DESERT 4.0.0
UwIcrpSink Class Reference

#include <uwicrp-module-sink.h>

Inheritance diagram for UwIcrpSink:
Inheritance graph
Collaboration diagram for UwIcrpSink:
Collaboration graph

Public Member Functions

 UwIcrpSink ()
 
 ~UwIcrpSink ()
 

Protected Member Functions

virtual int recvSyncClMsg (ClMessage *)
 
virtual int recvAsyncClMsg (ClMessage *)
 
virtual int command (int, const char *const *)
 
virtual void recv (Packet *)
 
virtual void initStatusPkt (Packet *, Packet *)
 
virtual void initialize ()
 
virtual void sendBackAck (const Packet *p)
 
virtual string printIP (const uint8_t)
 

Static Protected Member Functions

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

Protected Attributes

uint8_t ipAddr_
 
int printDebug_
 

Static Private Attributes

static long numberofackpkt_ = 0
 
static long numberofstatuspkt_ = 0
 

Detailed Description

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

Constructor & Destructor Documentation

◆ UwIcrpSink()

UwIcrpSink::UwIcrpSink ( )

Constructor of UwIcrpSink class.

References printDebug_.

◆ ~UwIcrpSink()

UwIcrpSink::~UwIcrpSink ( )

Destructor of UwIcrpSink class.

Member Function Documentation

◆ command()

int UwIcrpSink::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 getAckPktHeaderSize(), getDataPktHeaderSize(), getStatusPktHeaderSize(), initialize(), ipAddr_, numberofackpkt_, and numberofstatuspkt_.

Here is the call graph for this function:

◆ getAckPktHeaderSize()

static const int UwIcrpSink::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 UwIcrpSink::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 UwIcrpSink::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 UwIcrpSink::initialize ( )
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 ipAddr_.

Referenced by command().

◆ initStatusPkt()

void UwIcrpSink::initStatusPkt ( Packet *  p_old,
Packet *  p_new 
)
protectedvirtual

Initializes a Status Packet previously allocated.

Parameters
Packet*Pointer to a PT_UWICRP_STATUS Packet to use to retrieve the information to initialize the new packet.
Packet*Pointer to a PT_UWICRP_STATUS Packet to initialize.

References hdr_uwicrp_status::creation_time(), hdr_uwip::daddr(), ipAddr_, hdr_uwicrp_data::list_of_hops(), hdr_uwicrp_status::list_of_hops(), hdr_uwicrp_data::list_of_hops_length(), hdr_uwicrp_status::list_of_hops_length(), hdr_uwicrp_data::pointer_to_list_of_hops(), hdr_uwicrp_status::pointer_to_list_of_hops(), PT_UWICRP_STATUS, and hdr_uwip::saddr().

Referenced by recv().

Here is the call graph for this function:

◆ printIP()

string UwIcrpSink::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 recv().

◆ recv()

void UwIcrpSink::recv ( Packet *  p)
protectedvirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.

References initStatusPkt(), ipAddr_, numberofstatuspkt_, printDebug_, printIP(), PT_UWICRP_ACK, PT_UWICRP_STATUS, and sendBackAck().

Here is the call graph for this function:

◆ recvAsyncClMsg()

int UwIcrpSink::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 UwIcrpSink::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 UwIcrpSink::sendBackAck ( const Packet *  p)
protectedvirtual

Creates an ack packet and sends it to the previous hop using the information contained in the header of the data packet passed as input parameter. It is an ack to the previous hop, and not to the source of the packet.

Parameters
Packet*Pointer to a Data packet to acknowledge.

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

Referenced by recv().

Here is the call graph for this function:

Member Data Documentation

◆ ipAddr_

uint8_t UwIcrpSink::ipAddr_
protected

IP of the current node.

Referenced by command(), initialize(), initStatusPkt(), recv(), recvAsyncClMsg(), and sendBackAck().

◆ numberofackpkt_

long UwIcrpSink::numberofackpkt_ = 0
staticprivate

Comulative number of Ack packets processed by UwIcrpSink objects.

Referenced by command(), and sendBackAck().

◆ numberofstatuspkt_

long UwIcrpSink::numberofstatuspkt_ = 0
staticprivate

Comulative number of Status packets processed by UwIcrpSink objects.

Referenced by command(), and recv().

◆ printDebug_

int UwIcrpSink::printDebug_
protected

Flag to enable or disable dirrefent levels of debug.

Referenced by recv(), and UwIcrpSink().


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