Neighbor-index data structure for nix-vector routing. More...
#include <nix-vector.h>
Public Member Functions | |
NixVector () | |
typedef for the nixVector More... | |
NixVector (const NixVector &o) | |
~NixVector () | |
void | AddNeighborIndex (uint32_t newBits, uint32_t numberOfBits) |
uint32_t | BitCount (uint32_t numberOfNeighbors) const |
Ptr< NixVector > | Copy (void) const |
uint32_t | Deserialize (const uint32_t *buffer, uint32_t size) |
uint32_t | ExtractNeighborIndex (uint32_t numberOfBits) |
uint32_t | GetRemainingBits (void) |
uint32_t | GetSerializedSize (void) const |
NixVector & | operator= (const NixVector &o) |
uint32_t | Serialize (uint32_t *buffer, uint32_t maxSize) const |
Public Member Functions inherited from ns3::SimpleRefCount< NixVector > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Private Types | |
typedef std::vector< uint32_t > | NixBits_t |
Private Member Functions | |
void | DumpNixVector (std::ostream &os) const |
void | PrintDec2BinNix (uint32_t, uint32_t, std::ostream &os) const |
void | PrintDec2BinNixFill (uint32_t, uint32_t, std::ostream &os) const |
Private Attributes | |
uint32_t | m_currentVectorBitSize |
NixBits_t | m_nixVector |
uint32_t | m_totalBitSize |
uint32_t | m_used |
Friends | |
std::ostream & | operator<< (std::ostream &outs, const NixVector &nix) |
Additional Inherited Members | |
Static Public Member Functions inherited from ns3::SimpleRefCount< NixVector > | |
static void | Cleanup (void) |
Noop. More... | |
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.
As the nix-vector travels along the route, an internal private member variable keeps track of how many bits have been used. At a particular node, the nix-vector is used to return the next neighbor-index. This neighbor-index is used to determine which net-device to use. The number of bits used would then be incremented accordingly, and the packet would be routed.
Definition at line 63 of file nix-vector.h.
|
private |
Definition at line 155 of file nix-vector.h.
ns3::NixVector::NixVector | ( | ) |
typedef for the nixVector
Definition at line 32 of file nix-vector.cc.
References m_nixVector, and NS_LOG_FUNCTION.
Referenced by Copy().
ns3::NixVector::~NixVector | ( | ) |
Definition at line 43 of file nix-vector.cc.
References NS_LOG_FUNCTION.
ns3::NixVector::NixVector | ( | const NixVector & | o | ) |
Definition at line 48 of file nix-vector.cc.
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.
Definition at line 88 of file nix-vector.cc.
References m_currentVectorBitSize, m_nixVector, m_totalBitSize, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4NixVectorRouting::BuildNixVector(), and ns3::Ipv4NixVectorRouting::BuildNixVectorLocal().
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.
Definition at line 365 of file nix-vector.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::Ipv4NixVectorRouting::BuildNixVector(), ns3::Ipv4NixVectorRouting::BuildNixVectorLocal(), DumpNixVector(), and ns3::Ipv4NixVectorRouting::RouteInput().
Definition at line 71 of file nix-vector.cc.
References NixVector(), and NS_LOG_FUNCTION.
Referenced by ns3::Packet::operator=(), ns3::Packet::Packet(), and ns3::Ipv4NixVectorRouting::RouteOutput().
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.
Definition at line 282 of file nix-vector.cc.
References m_currentVectorBitSize, m_nixVector, m_totalBitSize, m_used, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ns3::Packet::Deserialize().
|
private |
Definition at line 319 of file nix-vector.cc.
References BitCount(), m_nixVector, m_totalBitSize, NS_LOG_FUNCTION, PrintDec2BinNix(), and PrintDec2BinNixFill().
Referenced by ns3::operator<<().
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.
Definition at line 160 of file nix-vector.cc.
References GetRemainingBits(), m_nixVector, m_used, NS_FATAL_ERROR, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4NixVectorRouting::RouteInput().
uint32_t ns3::NixVector::GetRemainingBits | ( | void | ) |
Definition at line 357 of file nix-vector.cc.
References m_totalBitSize, m_used, and NS_LOG_FUNCTION.
Referenced by ExtractNeighborIndex().
uint32_t ns3::NixVector::GetSerializedSize | ( | void | ) | const |
Definition at line 214 of file nix-vector.cc.
References m_currentVectorBitSize, m_nixVector, m_totalBitSize, m_used, and NS_LOG_FUNCTION.
Referenced by ns3::Packet::GetSerializedSize(), and ns3::Packet::Serialize().
Definition at line 57 of file nix-vector.cc.
References m_currentVectorBitSize, m_nixVector, m_totalBitSize, and m_used.
|
private |
Definition at line 388 of file nix-vector.cc.
References NS_LOG_FUNCTION.
Referenced by DumpNixVector().
|
private |
Definition at line 415 of file nix-vector.cc.
References NS_LOG_FUNCTION.
Referenced by DumpNixVector().
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.
Definition at line 225 of file nix-vector.cc.
References m_currentVectorBitSize, m_nixVector, m_totalBitSize, m_used, and NS_LOG_FUNCTION.
Referenced by ns3::Packet::Serialize().
|
friend |
Definition at line 81 of file nix-vector.cc.
|
private |
Definition at line 175 of file nix-vector.h.
Referenced by AddNeighborIndex(), Deserialize(), GetSerializedSize(), operator=(), and Serialize().
|
private |
Definition at line 163 of file nix-vector.h.
Referenced by AddNeighborIndex(), Deserialize(), DumpNixVector(), ExtractNeighborIndex(), GetSerializedSize(), NixVector(), operator=(), and Serialize().
|
private |
Definition at line 180 of file nix-vector.h.
Referenced by AddNeighborIndex(), Deserialize(), DumpNixVector(), GetRemainingBits(), GetSerializedSize(), operator=(), and Serialize().
|
private |
Definition at line 168 of file nix-vector.h.
Referenced by Deserialize(), ExtractNeighborIndex(), GetRemainingBits(), GetSerializedSize(), operator=(), and Serialize().