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 :
24 : namespace mdns {
25 : namespace Minimal {
26 :
27 : /// Provides potentially verbose logging for DNSSD operations when using
28 : /// MinMdns.
29 : namespace Logging {
30 :
31 : #if CHIP_MINMDNS_HIGH_VERBOSITY
32 :
33 : void LogSendingQuery(const mdns::Minimal::Query & query);
34 : void LogReceivedResource(const mdns::Minimal::ResourceData & data);
35 : void LogFoundOperationalSrvRecord(const chip::PeerId & peerId, const mdns::Minimal::SerializedQNameIterator & targetHost);
36 : void LogFoundCommissionSrvRecord(const char * instance, const mdns::Minimal::SerializedQNameIterator & targetHost);
37 : void LogFoundIPAddress(const mdns::Minimal::SerializedQNameIterator & targetHost, const chip::Inet::IPAddress & addr);
38 :
39 : #else
40 :
41 0 : inline void LogSendingQuery(const mdns::Minimal::Query & query) {}
42 108 : inline void LogReceivedResource(const mdns::Minimal::ResourceData & data) {}
43 2 : inline void LogFoundOperationalSrvRecord(const chip::PeerId & peerId, const mdns::Minimal::SerializedQNameIterator & targetHost) {}
44 15 : inline void LogFoundCommissionSrvRecord(const char * instance, const mdns::Minimal::SerializedQNameIterator & targetHost) {}
45 27 : inline void LogFoundIPAddress(const mdns::Minimal::SerializedQNameIterator & targetHost, const chip::Inet::IPAddress & addr) {}
46 :
47 : #endif
48 :
49 : } // namespace Logging
50 : } // namespace Minimal
51 : } // namespace mdns
|