23 #include "ns3/assert.h"    28 #define IPV4_ADDRESS_SIZE 4    29 #define OLSR_MSG_HEADER_SIZE 12    30 #define OLSR_PKT_HEADER_SIZE 4    53   NS_ASSERT_MSG (seconds >= 
OLSR_C, 
"SecondsToEmf - Can not convert a value less than OLSR_C");
    56   for (b = 1; (seconds / 
OLSR_C) >= (1 << b); ++b)
    64   double tmp = 16 * (seconds / (
OLSR_C * (1 << b)) - 1);
    67   a = (int) std::ceil (tmp - 0.5);
    81   return (uint8_t)((a << 4) | b);
    93   int a = (olsrFormat >> 4);
    94   int b = (olsrFormat & 0xf);
    96   return OLSR_C * (1 + a / 16.0) * (1 << b);
   118     .SetGroupName (
"Olsr")
   177     .SetGroupName (
"Olsr")
   195       size += 
m_message.mid.GetSerializedSize ();
   199       size += 
m_message.hello.GetSerializedSize ();
   202       size += 
m_message.tc.GetSerializedSize ();
   205       size += 
m_message.hna.GetSerializedSize ();
   305   for (std::vector<Ipv4Address>::const_iterator iter = this->interfaceAddresses.begin ();
   306        iter != this->interfaceAddresses.end (); iter++)
   317   this->interfaceAddresses.clear ();
   321   this->interfaceAddresses.erase (this->interfaceAddresses.begin (),
   322                                   this->interfaceAddresses.end ());
   323   for (
int n = 0; 
n < numAddresses; ++
n)
   338   for (std::vector<LinkMessage>::const_iterator iter = this->linkMessages.begin ();
   339        iter != this->linkMessages.end (); iter++)
   363   for (std::vector<LinkMessage>::const_iterator iter = this->linkMessages.begin ();
   364        iter != this->linkMessages.end (); iter++)
   392   this->linkMessages.clear ();
   394   uint16_t helloSizeLeft = messageSize;
   397   this->hTime = i.
ReadU8 ();
   398   this->willingness = i.
ReadU8 ();
   402   while (helloSizeLeft)
   414       helloSizeLeft -= lmSize;
   415       this->linkMessages.push_back (lm);
   445   for (std::vector<Ipv4Address>::const_iterator iter = this->neighborAddresses.begin ();
   446        iter != this->neighborAddresses.end (); iter++)
   457   this->neighborAddresses.clear ();
   465   this->neighborAddresses.clear ();
   466   for (
int n = 0; 
n < numAddresses; ++
n)
   494   for (
size_t n = 0; 
n < this->associations.size (); ++
n)
   508   this->associations.clear ();
   509   for (
int n = 0; 
n < numAddresses; ++
n)
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
a class to represent an Ipv4 address mask 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
uint32_t ReadNtohU32(void)
iterator in a Buffer instance 
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
void WriteHtonU32(uint32_t data)
Ipv4 addresses are stored in host order in this class. 
void WriteU8(uint8_t data)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
uint8_t SecondsToEmf(double seconds)
Converts a decimal number of seconds to the mantissa/exponent format. 
uint32_t Get(void) const
Get the host-order 32-bit IP address. 
double EmfToSeconds(uint8_t olsrFormat)
Converts a number of seconds in the mantissa/exponent format to a decimal number. ...
uint16_t ReadNtohU16(void)
a unique identifier for an interface. 
TypeId SetParent(TypeId tid)
Set the parent TypeId.