Neighbor-index data structure for nix-vector routing. More...
#include <nix-vector.h>
Public Member Functions | |
NixVector (const NixVector &o) | |
Ptr< NixVector > | Copy (void) const |
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 (uint32_t *buffer, uint32_t size) |
uint32_t | BitCount (uint32_t numberOfNeighbors) const |
void | DumpNixVector (std::ostream &os) const |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::NixVector. | |
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.
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.
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.
uint32_t ns3::NixVector::Deserialize | ( | 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.
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.
uint32_t ns3::NixVector::GetRemainingBits | ( | void | ) |
uint32_t ns3::NixVector::GetSerializedSize | ( | void | ) | const |
static TypeId ns3::NixVector::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::NixVector.
This object is accessible through the following paths with Config::Set and Config::Connect:
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Object.
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.