diff --git a/src/devices/wifi/ssid.cc b/src/devices/wifi/ssid.cc index a1a6d46eb..7aaae33d3 100644 --- a/src/devices/wifi/ssid.cc +++ b/src/devices/wifi/ssid.cc @@ -99,6 +99,14 @@ Ssid::GetLength (void) const return size; } +char * +Ssid::PeekString (void) const +{ + // it is safe to return a pointer to the buffer because it is + // guaranteed to be zero-terminated. + return (char *)m_ssid; +} + uint32_t Ssid::GetSerializedSize (void) const { @@ -122,5 +130,12 @@ Ssid::Deserialize (Buffer::Iterator i) return i; } +std::ostream & +operator << (std::ostream &os, const Ssid &ssid) +{ + os << ssid.PeekString (); + return os; +} + } // namespace ns3 diff --git a/src/devices/wifi/status-code.cc b/src/devices/wifi/status-code.cc index 27e722714..d594ae4dd 100644 --- a/src/devices/wifi/status-code.cc +++ b/src/devices/wifi/status-code.cc @@ -58,4 +58,18 @@ StatusCode::Deserialize (Buffer::Iterator start) return start; } +std::ostream & +operator << (std::ostream &os, const StatusCode &code) +{ + if (code.IsSuccess ()) + { + os << "success"; + } + else + { + os << "failure"; + } + return os; +} + } // namespace ns3 diff --git a/src/devices/wifi/status-code.h b/src/devices/wifi/status-code.h index 88248206b..e7daf9e26 100644 --- a/src/devices/wifi/status-code.h +++ b/src/devices/wifi/status-code.h @@ -40,6 +40,8 @@ private: uint16_t m_code; }; +std::ostream &operator << (std::ostream &os, const StatusCode &code); + } // namespace ns3 #endif /* STATUS_CODE_H */ diff --git a/src/devices/wifi/supported-rates.cc b/src/devices/wifi/supported-rates.cc index 1885ad368..4679e72db 100644 --- a/src/devices/wifi/supported-rates.cc +++ b/src/devices/wifi/supported-rates.cc @@ -82,6 +82,11 @@ SupportedRates::GetNRates (void) const return m_nRates; } uint32_t +SupportedRates::GetRate (uint8_t i) const +{ + return m_rates[i] * 500000; +} +uint32_t SupportedRates::GetSerializedSize (void) const { return m_nRates + 1 + 1; @@ -105,4 +110,18 @@ SupportedRates::Deserialize (Buffer::Iterator start) return start; } +std::ostream &operator << (std::ostream &os, const SupportedRates &rates) +{ + for (uint8_t i = 0; i < rates.GetNRates (); i++) + { + uint32_t rate = rates.GetRate (i); + os << rate << "mbs"; + if (i < rates.GetNRates () - 1) + { + os << " "; + } + } + return os; +} + } // namespace ns3 diff --git a/src/devices/wifi/supported-rates.h b/src/devices/wifi/supported-rates.h index 1dc0b12ce..417390f1a 100644 --- a/src/devices/wifi/supported-rates.h +++ b/src/devices/wifi/supported-rates.h @@ -36,6 +36,7 @@ public: bool IsBasicRate (uint32_t bs) const; uint8_t GetNRates (void) const; + uint32_t GetRate (uint8_t i) const; uint32_t GetSerializedSize (void) const; Buffer::Iterator Serialize (Buffer::Iterator start) const; @@ -45,6 +46,8 @@ private: uint8_t m_rates[8]; }; +std::ostream &operator << (std::ostream &os, const SupportedRates &rates); + } // namespace ns3 #endif /* SUPPORTED_RATES_H */