DESERT 4.0.0
UwIcrpNode Class Reference

#include <uwicrp-module-node.h>

Inheritance diagram for UwIcrpNode:
Inheritance graph
Collaboration diagram for UwIcrpNode:
Collaboration graph

Public Member Functions

 UwIcrpNode ()
 
 ~UwIcrpNode ()
 

Protected Member Functions

virtual int recvSyncClMsg (ClMessage *)
 
virtual int recvAsyncClMsg (ClMessage *)
 
virtual int command (int, const char *const *)
 
virtual void recv (Packet *)
 
virtual void initialize ()
 
virtual void clearRouteTable (const int &)
 
virtual void clearAllRouteTable ()
 
virtual void initPkt (Packet *)
 
virtual void addRouteEntry (Packet *)
 
virtual int findInRouteTable (nsaddr_t)
 
virtual bool isIpInList (Packet *, nsaddr_t)
 
virtual bool addIpInList (Packet *, nsaddr_t)
 
virtual void printHopTable ()
 
virtual string printIP (const uint8_t)
 
nsaddr_t str2addr (const char *)
 
virtual void sendBackAck (const Packet *p)
 
virtual void initPktAck (Packet *p)
 
virtual void ackLost ()
 

Static Protected Member Functions

static const int getAckPktHeaderSize ()
 
static const int getDataPktHeaderSize ()
 
static const int getStatusPktHeaderSize ()
 

Protected Attributes

uint8_t ipAddr_
 
uint8_t ipSink_
 
routing_table_entry route_table [HOP_TABLE_LENGTH]
 
double max_validity_time_
 
int printDebug_
 
double timer_ack_waiting_
 
AckWaiting ackwaitingTmr_
 

Static Private Attributes

static long numberofstatuspkt_ = 0
 
static long numberofdatapkt_ = 0
 
static long numberofackpkt_ = 0
 

Friends

class AckWaiting
 

Detailed Description

UwIcrpNode class is used to represent the routing layer of a node.

Constructor & Destructor Documentation

◆ UwIcrpNode()

◆ ~UwIcrpNode()

UwIcrpNode::~UwIcrpNode ( )

Destructor of UwIcrpNode class.

Member Function Documentation

◆ ackLost()

void UwIcrpNode::ackLost ( )
protectedvirtual

Resets all the routing information because the lost of an ack.

References clearAllRouteTable().

Here is the call graph for this function:

◆ addIpInList()

bool UwIcrpNode::addIpInList ( Packet *  p,
nsaddr_t  ip_ 
)
protectedvirtual

Adds an IP passed as argument in the header of a Data packet passed as argument. The function returns true if it added the IP, false otherwise (not enough space in the header).

Parameters
Packet*Pointer to a Data packet in which to add an IP.
nsaddr_tAddress to add in the header.
Returns
true if the IP was added, false otherwise.

References hdr_uwicrp_data::list_of_hops(), hdr_uwicrp_data::list_of_hops_length(), and hdr_uwicrp_data::pointer_to_list_of_hops().

Referenced by recv().

Here is the call graph for this function:

◆ addRouteEntry()

void UwIcrpNode::addRouteEntry ( Packet *  p)
protectedvirtual

Adds the information received from a Status packet in the routing table of the node.

Parameters
Packet*Status packet received from a sink.

References routing_table_entry::creationtime, routing_table_entry::destination, routing_table_entry::hopcount, routing_table_entry::isValid, hdr_uwicrp_status::list_of_hops_length(), routing_table_entry::next_hop, hdr_uwicrp_status::pointer_to_list_of_hops(), route_table, and hdr_uwip::saddr().

Referenced by recv().

Here is the call graph for this function:

◆ clearAllRouteTable()

void UwIcrpNode::clearAllRouteTable ( )
protectedvirtual

◆ clearRouteTable()

void UwIcrpNode::clearRouteTable ( const int &  i)
protectedvirtual

Removes a specific entry in the routing table of the node.

Parameters
int&Index number of the entry to remove.

References routing_table_entry::creationtime, routing_table_entry::destination, routing_table_entry::hopcount, routing_table_entry::isValid, routing_table_entry::next_hop, and route_table.

Referenced by findInRouteTable().

◆ command()

int UwIcrpNode::command ( int  argc,
const char *const *  argv 
)
protectedvirtual

TCL command interpreter. It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

References clearAllRouteTable(), getAckPktHeaderSize(), getDataPktHeaderSize(), getStatusPktHeaderSize(), initialize(), ipAddr_, ipSink_, numberofackpkt_, numberofdatapkt_, numberofstatuspkt_, printDebug_, printHopTable(), and printIP().

Here is the call graph for this function:

◆ findInRouteTable()

int UwIcrpNode::findInRouteTable ( nsaddr_t  ip_)
protectedvirtual

Seeks for an entry in the routing table that contains information to a specific address passed as argument.

Parameters
nsaddr_tAddress of the destination to which search information.
Returns
Index value of the entry in the routing table that contains routing information to the destination.

References clearRouteTable(), routing_table_entry::creationtime, max_validity_time_, and route_table.

Referenced by recv().

Here is the call graph for this function:

◆ getAckPktHeaderSize()

static const int UwIcrpNode::getAckPktHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_uwicrp_ack packet header.

Returns
The size of a hdr_uwicrp_ack packet header.

Referenced by command().

◆ getDataPktHeaderSize()

static const int UwIcrpNode::getDataPktHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_uwicrp_data packet header.

Returns
The size of a hdr_uwicrp_data packet header.

Referenced by command().

◆ getStatusPktHeaderSize()

static const int UwIcrpNode::getStatusPktHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_uwicrp_status packet header.

Returns
The size of a hdr_uwicrp_status packet header.

Referenced by command().

◆ initialize()

void UwIcrpNode::initialize ( )
protectedvirtual

Initializes a UwIcrpNode node. It sends to the lower layers a Sync message asking for the IP of the node.

See also
UWIPClMsgReqAddr(int src)
sendSyncClMsgDown(ClMessage* m)

References ipAddr_.

Referenced by command().

◆ initPkt()

void UwIcrpNode::initPkt ( Packet *  p)
protectedvirtual

Initializes a Data packet (previously allocated).

Parameters
Packet*Pointer to a Data to initialize.

References hdr_uwip::daddr(), ipAddr_, ipSink_, hdr_uwicrp_data::list_of_hops(), hdr_uwicrp_data::list_of_hops_length(), and hdr_uwicrp_data::pointer_to_list_of_hops().

Referenced by recv().

Here is the call graph for this function:

◆ initPktAck()

void UwIcrpNode::initPktAck ( Packet *  p)
protectedvirtual

Initializes an Ack packet (previously allocated).

Parameters
Packet*Pointer to an Ack packet to initialize.

References hdr_uwip::daddr(), ipAddr_, and PT_UWICRP_ACK.

Referenced by sendBackAck().

Here is the call graph for this function:

◆ isIpInList()

bool UwIcrpNode::isIpInList ( Packet *  p,
nsaddr_t  ip_ 
)
protectedvirtual

Checks if a specific IP is in the header of the packet passed as argument. If yes it returns true, otherwise it return false.

Parameters
Packet*Pointer to a packet to analyze.
nsaddr_tAddress to search for.
Returns
true if the IP of the current node is in the header, otherwise false.

References hdr_uwicrp_data::list_of_hops(), and hdr_uwicrp_data::list_of_hops_length().

Referenced by recv().

Here is the call graph for this function:

◆ printHopTable()

void UwIcrpNode::printHopTable ( )
protectedvirtual

Prints in the stdout the routing table of the current node.

References routing_table_entry::hopcount, ipAddr_, printIP(), and route_table.

Referenced by command().

Here is the call graph for this function:

◆ printIP()

string UwIcrpNode::printIP ( const uint8_t  _ip)
protectedvirtual

Return a string with an IP in the classic form "x.x.x.x" converting an ns2 nsaddr_t address.

Parameters
nsaddr_t&ns2 address
Returns
String that contains a printable IP in the classic form "x.x.x.x"

Referenced by command(), printHopTable(), and recv().

◆ recv()

void UwIcrpNode::recv ( Packet *  p)
protectedvirtual

◆ recvAsyncClMsg()

int UwIcrpNode::recvAsyncClMsg ( ClMessage *  m)
protectedvirtual

Initializes a UwIcrpSink node. It sends to the lower layers a Sync message asking for the IP of the node.

See also
UWIPClMsgReqAddr(int src)
sendSyncClMsgDown(ClMessage* m)

References UWIPClMsgSendAddr::getAddr(), ipAddr_, and UWIP_CLMSG_SEND_ADDR.

Here is the call graph for this function:

◆ recvSyncClMsg()

int UwIcrpNode::recvSyncClMsg ( ClMessage *  m)
protectedvirtual

Cross-Layer messages synchronous interpreter.

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

◆ sendBackAck()

void UwIcrpNode::sendBackAck ( const Packet *  p)
protectedvirtual

Creates an ack packet after the reception a data packet received correctly

Parameters
p
See also
UwIcrpNode::initPktAck

References hdr_uwip::daddr(), initPktAck(), and numberofackpkt_.

Referenced by recv().

Here is the call graph for this function:

◆ str2addr()

nsaddr_t UwIcrpNode::str2addr ( const char *  str)
protected

Returns a nsaddr_t address from an IP written as a string in the form "x.x.x.x".

Parameters
char*IP in string form
Returns
nsaddr_t that contains the IP converter from the input string

Friends And Related Symbol Documentation

◆ AckWaiting

friend class AckWaiting
friend

Member Data Documentation

◆ ackwaitingTmr_

AckWaiting UwIcrpNode::ackwaitingTmr_
protected

AckWaiting object.

Referenced by recv().

◆ ipAddr_

uint8_t UwIcrpNode::ipAddr_
protected

IP of the current node.

Referenced by command(), initialize(), initPkt(), initPktAck(), printHopTable(), recv(), and recvAsyncClMsg().

◆ ipSink_

uint8_t UwIcrpNode::ipSink_
protected

IP of the sink associated.

Referenced by command(), initPkt(), and recv().

◆ max_validity_time_

double UwIcrpNode::max_validity_time_
protected

Maximum validity time of a route.

Referenced by findInRouteTable(), and UwIcrpNode().

◆ numberofackpkt_

long UwIcrpNode::numberofackpkt_ = 0
staticprivate

Comulative number of Ack packets processed by UwIcrpNode objects.

Referenced by command(), and sendBackAck().

◆ numberofdatapkt_

long UwIcrpNode::numberofdatapkt_ = 0
staticprivate

Comulative number of Data packets processed by UwIcrpNode objects.

Referenced by command(), and recv().

◆ numberofstatuspkt_

long UwIcrpNode::numberofstatuspkt_ = 0
staticprivate

Comulative number of Status packets processed by UwIcrpNode objects.

Referenced by command(), and recv().

◆ printDebug_

int UwIcrpNode::printDebug_
protected

Flag to enable or disable dirrefent levels of debug.

Referenced by command(), recv(), and UwIcrpNode().

◆ route_table

routing_table_entry UwIcrpNode::route_table[HOP_TABLE_LENGTH]
protected

◆ timer_ack_waiting_

double UwIcrpNode::timer_ack_waiting_
protected

Ack waiting timer.

Referenced by recv(), and UwIcrpNode().


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