add printing support
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -40,6 +40,8 @@ private:
|
||||
uint16_t m_code;
|
||||
};
|
||||
|
||||
std::ostream &operator << (std::ostream &os, const StatusCode &code);
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* STATUS_CODE_H */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user