diff --git a/build_overrides/pigweed_environment.gni b/build_overrides/pigweed_environment.gni index 16ace4c8ae862a..8ec6ff090c740f 100644 --- a/build_overrides/pigweed_environment.gni +++ b/build_overrides/pigweed_environment.gni @@ -1,13 +1,8 @@ -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# This file is automatically generated by Pigweed's environment setup. Do not +# edit it manually or check it in. +declare_args() { + dir_cipd_arm = "/usr/local/google/home/mboyington/IdeaProjects/connectedhomeip/.environment/cipd/packages/arm" + dir_cipd_pigweed = "/usr/local/google/home/mboyington/IdeaProjects/connectedhomeip/.environment/cipd/packages/pigweed" + dir_cipd_python = "/usr/local/google/home/mboyington/IdeaProjects/connectedhomeip/.environment/cipd/packages/python" + dir_virtual_env = "/usr/local/google/home/mboyington/IdeaProjects/connectedhomeip/.environment/pigweed-venv" +} diff --git a/src/lib/dnssd/minimal_mdns/Logging.cpp b/src/lib/dnssd/minimal_mdns/Logging.cpp index 355086c5b4b7a0..3a87f4f65e6166 100644 --- a/src/lib/dnssd/minimal_mdns/Logging.cpp +++ b/src/lib/dnssd/minimal_mdns/Logging.cpp @@ -15,13 +15,45 @@ * limitations under the License. */ #include -#include #include namespace mdns { namespace Minimal { namespace Logging { +QNameString::QNameString(const mdns::Minimal::FullQName & name) +{ + for (unsigned i = 0; i < name.nameCount; i++) + { + if (i != 0) + { + mBuffer.Add("."); + } + mBuffer.Add(name.names[i]); + } +} + +QNameString::QNameString(mdns::Minimal::SerializedQNameIterator name) +{ + bool first = true; + while (name.Next()) + { + if (first) + { + first = false; + } + else + { + mBuffer.Add("."); + } + mBuffer.Add(name.Value()); + } + if (!name.IsValid()) + { + mBuffer.Add("(!INVALID!)"); + } +} + namespace { #if CHIP_PROGRESS_LOGGING @@ -53,52 +85,6 @@ const char * QueryTypeToString(mdns::Minimal::QType type) } #endif // CHIP_PROGRESS_LOGGING - -class QNameString -{ -public: - QNameString(const mdns::Minimal::FullQName & name) - { - for (unsigned i = 0; i < name.nameCount; i++) - { - if (i != 0) - { - mBuffer.Add("."); - } - mBuffer.Add(name.names[i]); - } - } - - QNameString(mdns::Minimal::SerializedQNameIterator name) - { - bool first = true; - while (name.Next()) - { - if (first) - { - first = false; - } - else - { - mBuffer.Add("."); - } - mBuffer.Add(name.Value()); - } - if (!name.IsValid()) - { - mBuffer.Add("(!INVALID!)"); - } - } - - const char * c_str() const { return mBuffer.c_str(); } - - bool Fit() const { return mBuffer.Fit(); } - -private: - static constexpr size_t kMaxQNameLength = 128; - chip::StringBuilder mBuffer; -}; - } // namespace void LogSendingQuery(const mdns::Minimal::Query & query) diff --git a/src/lib/dnssd/minimal_mdns/Logging.h b/src/lib/dnssd/minimal_mdns/Logging.h index de00df4e2a7dca..235d0714fd1256 100644 --- a/src/lib/dnssd/minimal_mdns/Logging.h +++ b/src/lib/dnssd/minimal_mdns/Logging.h @@ -20,6 +20,7 @@ #include #include #include +#include namespace mdns { namespace Minimal { @@ -28,6 +29,23 @@ namespace Minimal { /// MinMdns. namespace Logging { +// Allows for a FullQName to be represented as a user-readable logging string +class QNameString +{ +public: + QNameString(const mdns::Minimal::FullQName & name); + + QNameString(mdns::Minimal::SerializedQNameIterator name); + + inline const char * c_str() const { return mBuffer.c_str(); } + + inline bool Fit() const { return mBuffer.Fit(); } + +private: + static constexpr size_t kMaxQNameLength = 128; + chip::StringBuilder mBuffer; +}; + #if CHIP_MINMDNS_HIGH_VERBOSITY void LogSendingQuery(const mdns::Minimal::Query & query); diff --git a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp index aa5e29c8ddeace..20beb48b49805d 100644 --- a/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp +++ b/src/lib/dnssd/minimal_mdns/responders/QueryResponder.cpp @@ -18,6 +18,7 @@ #include "QueryResponder.h" #include +#include #include @@ -56,7 +57,7 @@ QueryResponderSettings QueryResponderBase::AddResponder(RecordResponder * respon { return QueryResponderSettings(); } - ChipLogDetail(Discovery, "Responding with %s", responder->GetQName()); + ChipLogDetail(Discovery, "Responding with %s", Logging::QNameString(responder->GetQName()).c_str()); for (size_t i = 0; i < mResponderInfoSize; i++) {