Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2022 Project CHIP Authors
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 : #pragma once
18 :
19 : #include <inet/IPAddress.h>
20 : #include <lib/core/PeerId.h>
21 : #include <lib/dnssd/minimal_mdns/Parser.h>
22 : #include <lib/dnssd/minimal_mdns/Query.h>
23 : #include <minmdns/MinMdnsConfig.h>
24 :
25 : namespace mdns {
26 : namespace Minimal {
27 :
28 : /// Provides potentially verbose logging for DNSSD operations when using
29 : /// MinMdns.
30 : namespace Logging {
31 :
32 : #if CHIP_MINMDNS_HIGH_VERBOSITY
33 :
34 : void LogSendingQuery(const mdns::Minimal::Query & query);
35 : void LogReceivedResource(const mdns::Minimal::ResourceData & data);
36 : void LogFoundOperationalSrvRecord(const chip::PeerId & peerId, const mdns::Minimal::SerializedQNameIterator & targetHost);
37 : void LogFoundCommissionSrvRecord(const char * instance, const mdns::Minimal::SerializedQNameIterator & targetHost);
38 : void LogFoundIPAddress(const mdns::Minimal::SerializedQNameIterator & targetHost, const chip::Inet::IPAddress & addr);
39 :
40 : #else
41 :
42 0 : inline void LogSendingQuery(const mdns::Minimal::Query & query) {}
43 80 : inline void LogReceivedResource(const mdns::Minimal::ResourceData & data) {}
44 2 : inline void LogFoundOperationalSrvRecord(const chip::PeerId & peerId, const mdns::Minimal::SerializedQNameIterator & targetHost) {}
45 13 : inline void LogFoundCommissionSrvRecord(const char * instance, const mdns::Minimal::SerializedQNameIterator & targetHost) {}
46 13 : inline void LogFoundIPAddress(const mdns::Minimal::SerializedQNameIterator & targetHost, const chip::Inet::IPAddress & addr) {}
47 :
48 : #endif
49 :
50 : } // namespace Logging
51 : } // namespace Minimal
52 : } // namespace mdns
|