diff --git a/Packet++/header/Layer.h b/Packet++/header/Layer.h index 828cb5c84..f2e1755e1 100644 --- a/Packet++/header/Layer.h +++ b/Packet++/header/Layer.h @@ -232,10 +232,9 @@ namespace pcpp virtual bool shortenLayer(int offsetInLayer, size_t numOfBytesToShorten); }; + inline std::ostream& operator<<(std::ostream& os, const pcpp::Layer& layer) + { + os << layer.toString(); + return os; + } } // namespace pcpp - -inline std::ostream& operator<<(std::ostream& os, const pcpp::Layer& layer) -{ - os << layer.toString(); - return os; -} diff --git a/Packet++/header/LdapLayer.h b/Packet++/header/LdapLayer.h index 09e82c9ba..9ab9b888d 100644 --- a/Packet++/header/LdapLayer.h +++ b/Packet++/header/LdapLayer.h @@ -1320,47 +1320,47 @@ namespace pcpp : LdapResponseLayer(std::move(asn1Record), data, dataLen, prevLayer, packet) {} }; -} // namespace pcpp - -inline std::ostream& operator<<(std::ostream& os, const pcpp::LdapControl& control) -{ - os << "{" << control.controlType << ", " << control.controlValue << "}"; - return os; -} -inline std::ostream& operator<<(std::ostream& os, const pcpp::LdapAttribute& attr) -{ - os << "{" << attr.type << ", {"; + inline std::ostream& operator<<(std::ostream& os, const pcpp::LdapControl& control) + { + os << "{" << control.controlType << ", " << control.controlValue << "}"; + return os; + } - std::string separator; - for (const auto& value : attr.values) + inline std::ostream& operator<<(std::ostream& os, const pcpp::LdapAttribute& attr) { - os << separator << value; - if (separator.empty()) + os << "{" << attr.type << ", {"; + + std::string separator; + for (const auto& value : attr.values) { - separator = ", "; + os << separator << value; + if (separator.empty()) + { + separator = ", "; + } } - } - os << "}}"; - return os; -} - -inline std::ostream& operator<<(std::ostream& os, - const pcpp::LdapBindRequestLayer::SaslAuthentication& saslAuthentication) -{ - os << "{" << saslAuthentication.mechanism << ", {"; + os << "}}"; + return os; + } - std::string separator; - for (const auto& value : saslAuthentication.credentials) + inline std::ostream& operator<<(std::ostream& os, + const pcpp::LdapBindRequestLayer::SaslAuthentication& saslAuthentication) { - os << separator << "0x" << std::hex << static_cast(value) << std::dec; - if (separator.empty()) + os << "{" << saslAuthentication.mechanism << ", {"; + + std::string separator; + for (const auto& value : saslAuthentication.credentials) { - separator = ", "; + os << separator << "0x" << std::hex << static_cast(value) << std::dec; + if (separator.empty()) + { + separator = ", "; + } } - } - os << "}}"; - return os; -} + os << "}}"; + return os; + } +} // namespace pcpp diff --git a/Packet++/header/Packet.h b/Packet++/header/Packet.h index 4e7760f67..65324f6f2 100644 --- a/Packet++/header/Packet.h +++ b/Packet++/header/Packet.h @@ -445,10 +445,9 @@ namespace pcpp return dynamic_cast(curLayer); } + inline std::ostream& operator<<(std::ostream& os, const pcpp::Packet& packet) + { + os << packet.toString(); + return os; + } } // namespace pcpp - -inline std::ostream& operator<<(std::ostream& os, const pcpp::Packet& packet) -{ - os << packet.toString(); - return os; -}