ns-3
|
Neighbor-index data structure for nix-vector routing. More...
#include <nix-vector.h>
Public Member Functions | |
Ptr< NixVector > | Copy (void) const |
NixVector (const NixVector &o) | |
NixVector & | operator= (const NixVector &o) |
void | AddNeighborIndex (uint32_t newBits, uint32_t numberOfBits) |
uint32_t | ExtractNeighborIndex (uint32_t numberOfBits) |
uint32_t | GetRemainingBits (void) |
uint32_t | GetSerializedSize (void) const |
uint32_t | Serialize (uint32_t *buffer, uint32_t maxSize) const |
uint32_t | Deserialize (const uint32_t *buffer, uint32_t size) |
uint32_t | BitCount (uint32_t numberOfNeighbors) const |
Friends | |
std::ostream & | operator<< (std::ostream &outs, const NixVector &nix) |
Neighbor-index data structure for nix-vector routing.
This data structure holds a vector of "neighbor-indexes" for a simulation specific routing protocol, nix-vector routing. Theses neighbor-indexes correspond to the net-device which a node should use to route a packet. A nix-vector is built (or fetched from a cache) on-demand. The nix-vector is transmitted with the packet, and along each hop of the route, the current node extracts the appropriate neighbor-index and routes the packet.
ns3::NixVector::NixVector | ( | const NixVector & | o | ) |
void ns3::NixVector::AddNeighborIndex | ( | uint32_t | newBits, |
uint32_t | numberOfBits | ||
) |
newBits | the neighbor-index to be added to the vector |
numberOfBits | the number of bits that newBits contains |
Adds the neighbor index to the vector using a fair amount of bit manipulation to pack everything in efficiently.
Note: This function assumes that the number of bits to be added is always less than or equal to 32, ie., you can only span one entry of a nix-vector at a time. This is reasonable, since 32 bits gives you 2^32 possible neighbors.
References NS_FATAL_ERROR, and NS_LOG_FUNCTION_NOARGS.
uint32_t ns3::NixVector::BitCount | ( | uint32_t | numberOfNeighbors | ) | const |
numberOfNeighbors | the total number of neighbors |
This function is used to determine the number of bits of numberOfNeighbors so that this value can be passed in to AddNeighborIndex or ExtractNeighborIndex.
References NS_LOG_FUNCTION_NOARGS.
Ptr< NixVector > ns3::NixVector::Copy | ( | void | ) | const |
uint32_t ns3::NixVector::Deserialize | ( | const uint32_t * | buffer, |
uint32_t | size | ||
) |
buffer | points to buffer for deserialization |
size | number of bytes to deserialize |
The raw character buffer containing all the nix-vector information is deserialized into this nix-vector.
References NS_ASSERT, and NS_LOG_FUNCTION.
uint32_t ns3::NixVector::ExtractNeighborIndex | ( | uint32_t | numberOfBits | ) |
numberOfBits | the number of bits to extract from the vector |
Extracts the number of bits specified from the vector and returns the value extracted
Note: This function assumes that the number of bits to be extracted is always less than or equal to 32, ie., you can only span one entry of a nix-vector at a time. This is reasonable, since 32 bits gives you 2^32 possible neighbors.
References GetRemainingBits(), NS_FATAL_ERROR, and NS_LOG_FUNCTION_NOARGS.
uint32_t ns3::NixVector::GetRemainingBits | ( | void | ) |
References NS_LOG_FUNCTION_NOARGS.
Referenced by ExtractNeighborIndex().
uint32_t ns3::NixVector::GetSerializedSize | ( | void | ) | const |
Referenced by ns3::Packet::GetSerializedSize().
uint32_t ns3::NixVector::Serialize | ( | uint32_t * | buffer, |
uint32_t | maxSize | ||
) | const |
buffer | points to serialization buffer |
maxSize | max number of bytes to write |
This nix-vector is serialized into the raw character buffer parameter.
References NS_LOG_FUNCTION.