Public Member Functions | Friends

ns3::NixVector Class Reference
[Packet]

Neighbor-index data structure for nix-vector routing. More...

#include <nix-vector.h>

Inheritance diagram for ns3::NixVector:
Inheritance graph
[legend]
Collaboration diagram for ns3::NixVector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Ptr< NixVectorCopy (void) const
 NixVector (const NixVector &o)
NixVectoroperator= (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)

Detailed Description

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.


Constructor & Destructor Documentation

ns3::NixVector::NixVector ( const NixVector o )
Parameters:
othe NixVector to copy to a new NixVector using a constructor

Member Function Documentation

void ns3::NixVector::AddNeighborIndex ( uint32_t  newBits,
uint32_t  numberOfBits 
)
Parameters:
newBitsthe neighbor-index to be added to the vector
numberOfBitsthe 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
Returns:
number of bits of numberOfNeighbors
Parameters:
numberOfNeighborsthe 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.

Ptr<NixVector> ns3::NixVector::Copy ( void   ) const
Returns:
a copy of this nix-vector
uint32_t ns3::NixVector::Deserialize ( const uint32_t *  buffer,
uint32_t  size 
)
Returns:
zero if a complete nix-vector is not deserialized
Parameters:
bufferpoints to buffer for deserialization
sizenumber 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 )
Returns:
the neighbor index
Parameters:
numberOfBitsthe 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   )
Returns:
number of bits remaining in the nix-vector (ie m_total - m_used)
uint32_t ns3::NixVector::GetSerializedSize ( void   ) const
Returns:
the number of bytes required for serialization
NixVector& ns3::NixVector::operator= ( const NixVector o )
Parameters:
othe NixVector to copy to a new NixVector using the equals operator
uint32_t ns3::NixVector::Serialize ( uint32_t *  buffer,
uint32_t  maxSize 
) const
Returns:
zero if buffer not large enough
Parameters:
bufferpoints to serialization buffer
maxSizemax number of bytes to write

This nix-vector is serialized into the raw character buffer parameter.


The documentation for this class was generated from the following file: