DESERT 3.5.1
Loading...
Searching...
No Matches
UwIcrpNode Class Reference

#include <uwicrp-module-node.h>

Inheritance diagram for UwIcrpNode:
Collaboration diagram for UwIcrpNode:

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.

Definition at line 87 of file uwicrp-module-node.h.

Constructor & Destructor Documentation

◆ UwIcrpNode()

UwIcrpNode::UwIcrpNode ( )

Constructor of UwIcrpNode class.

Definition at line 74 of file uwicrp-module-node.cpp.

◆ ~UwIcrpNode()

UwIcrpNode::~UwIcrpNode ( )

Destructor of UwIcrpNode class.

Definition at line 95 of file uwicrp-module-node.cpp.

Member Function Documentation

◆ ackLost()

void UwIcrpNode::ackLost ( )
protectedvirtual

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

Definition at line 580 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 481 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 414 of file uwicrp-module-node.cpp.

◆ clearAllRouteTable()

void UwIcrpNode::clearAllRouteTable ( )
protectedvirtual

Clears completely the routing table of the node.

Definition at line 137 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 125 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 149 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 449 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 260 of file uwicrp-module-node.h.

◆ 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.

Definition at line 271 of file uwicrp-module-node.h.

◆ 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.

Definition at line 282 of file uwicrp-module-node.h.

◆ 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)

Definition at line 116 of file uwicrp-module-node.cpp.

◆ initPkt()

void UwIcrpNode::initPkt ( Packet *  p)
protectedvirtual

Initializes a Data packet (previously allocated).

Parameters
Packet*Pointer to a Data to initialize.

Definition at line 383 of file uwicrp-module-node.cpp.

◆ initPktAck()

void UwIcrpNode::initPktAck ( Packet *  p)
protectedvirtual

Initializes an Ack packet (previously allocated).

Parameters
Packet*Pointer to an Ack packet to initialize.

Definition at line 558 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 467 of file uwicrp-module-node.cpp.

◆ printHopTable()

void UwIcrpNode::printHopTable ( )
protectedvirtual

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

Definition at line 496 of file uwicrp-module-node.cpp.

◆ 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"

Definition at line 510 of file uwicrp-module-node.cpp.

◆ recv()

void UwIcrpNode::recv ( Packet *  p)
protectedvirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.

Definition at line 207 of file uwicrp-module-node.cpp.

◆ 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)

Definition at line 106 of file uwicrp-module-node.cpp.

◆ 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.

Definition at line 100 of file uwicrp-module-node.cpp.

◆ 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

Definition at line 540 of file uwicrp-module-node.cpp.

◆ 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

Definition at line 518 of file uwicrp-module-node.cpp.

Friends And Related Symbol Documentation

◆ AckWaiting

friend class AckWaiting
friend

Definition at line 89 of file uwicrp-module-node.h.

Member Data Documentation

◆ ackwaitingTmr_

AckWaiting UwIcrpNode::ackwaitingTmr_
protected

AckWaiting object.

Definition at line 295 of file uwicrp-module-node.h.

◆ ipAddr_

uint8_t UwIcrpNode::ipAddr_
protected

IP of the current node.

Definition at line 287 of file uwicrp-module-node.h.

◆ ipSink_

uint8_t UwIcrpNode::ipSink_
protected

IP of the sink associated.

Definition at line 288 of file uwicrp-module-node.h.

◆ max_validity_time_

double UwIcrpNode::max_validity_time_
protected

Maximum validity time of a route.

Definition at line 291 of file uwicrp-module-node.h.

◆ numberofackpkt_

long UwIcrpNode::numberofackpkt_ = 0
staticprivate

Comulative number of Ack packets processed by UwIcrpNode objects.

Definition at line 303 of file uwicrp-module-node.h.

◆ numberofdatapkt_

long UwIcrpNode::numberofdatapkt_ = 0
staticprivate

Comulative number of Data packets processed by UwIcrpNode objects.

Definition at line 300 of file uwicrp-module-node.h.

◆ numberofstatuspkt_

long UwIcrpNode::numberofstatuspkt_ = 0
staticprivate

Comulative number of Status packets processed by UwIcrpNode objects.

Definition at line 298 of file uwicrp-module-node.h.

◆ printDebug_

int UwIcrpNode::printDebug_
protected

Flag to enable or disable dirrefent levels of debug.

Definition at line 292 of file uwicrp-module-node.h.

◆ route_table

routing_table_entry UwIcrpNode::route_table[HOP_TABLE_LENGTH]
protected

Node routing table.

Definition at line 290 of file uwicrp-module-node.h.

◆ timer_ack_waiting_

double UwIcrpNode::timer_ack_waiting_
protected

Ack waiting timer.

Definition at line 294 of file uwicrp-module-node.h.


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