|
DESERT 4.0.0
|
#include <uwicrp-module-node.h>


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 |
UwIcrpNode class is used to represent the routing layer of a node.
| UwIcrpNode::UwIcrpNode | ( | ) |
Constructor of UwIcrpNode class.
References clearAllRouteTable(), routing_table_entry::creationtime, routing_table_entry::destination, routing_table_entry::hopcount, routing_table_entry::isValid, max_validity_time_, routing_table_entry::next_hop, printDebug_, route_table, and timer_ack_waiting_.

| UwIcrpNode::~UwIcrpNode | ( | ) |
Destructor of UwIcrpNode class.
|
protectedvirtual |
Resets all the routing information because the lost of an ack.
References clearAllRouteTable().

|
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).
| Packet* | Pointer to a Data packet in which to add an IP. |
| nsaddr_t | Address to add in the header. |
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().

|
protectedvirtual |
Adds the information received from a Status packet in the routing table of the node.
| 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().

|
protectedvirtual |
Clears completely the routing table of the node.
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 ackLost(), command(), and UwIcrpNode().
|
protectedvirtual |
Removes a specific entry in the routing table of the node.
| 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().
|
protectedvirtual |
TCL command interpreter. It implements the following OTcl methods:
| argc | Number of arguments in argv. |
| argv | Array of strings which are the command parameters (Note that argv[0] is the name of the object). |
References clearAllRouteTable(), getAckPktHeaderSize(), getDataPktHeaderSize(), getStatusPktHeaderSize(), initialize(), ipAddr_, ipSink_, numberofackpkt_, numberofdatapkt_, numberofstatuspkt_, printDebug_, printHopTable(), and printIP().

|
protectedvirtual |
Seeks for an entry in the routing table that contains information to a specific address passed as argument.
| nsaddr_t | Address of the destination to which search information. |
References clearRouteTable(), routing_table_entry::creationtime, max_validity_time_, and route_table.
Referenced by recv().

|
inlinestaticprotected |
Returns the size in byte of a hdr_uwicrp_ack packet header.
Referenced by command().
|
inlinestaticprotected |
Returns the size in byte of a hdr_uwicrp_data packet header.
Referenced by command().
|
inlinestaticprotected |
Returns the size in byte of a hdr_uwicrp_status packet header.
Referenced by command().
|
protectedvirtual |
Initializes a UwIcrpNode node. It sends to the lower layers a Sync message asking for the IP of the node.
References ipAddr_.
Referenced by command().
|
protectedvirtual |
Initializes a Data packet (previously allocated).
| 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().

|
protectedvirtual |
Initializes an Ack packet (previously allocated).
| Packet* | Pointer to an Ack packet to initialize. |
References hdr_uwip::daddr(), ipAddr_, and PT_UWICRP_ACK.
Referenced by sendBackAck().

|
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.
| Packet* | Pointer to a packet to analyze. |
| nsaddr_t | Address to search for. |
References hdr_uwicrp_data::list_of_hops(), and hdr_uwicrp_data::list_of_hops_length().
Referenced by recv().

|
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().

|
protectedvirtual |
Return a string with an IP in the classic form "x.x.x.x" converting an ns2 nsaddr_t address.
| nsaddr_t& | ns2 address |
Referenced by command(), printHopTable(), and recv().
|
protectedvirtual |
Performs the reception of packets from upper and lower layers.
| Packet* | Pointer to the packet will be received. |
References ackwaitingTmr_, addIpInList(), addRouteEntry(), hdr_uwip::daddr(), findInRouteTable(), initPkt(), ipAddr_, ipSink_, isIpInList(), hdr_uwicrp_status::list_of_hops(), routing_table_entry::next_hop, numberofdatapkt_, numberofstatuspkt_, hdr_uwicrp_status::pointer_to_list_of_hops(), printDebug_, printIP(), PT_UWICRP_ACK, PT_UWICRP_STATUS, route_table, sendBackAck(), and timer_ack_waiting_.

|
protectedvirtual |
Initializes a UwIcrpSink node. It sends to the lower layers a Sync message asking for the IP of the node.
References UWIPClMsgSendAddr::getAddr(), ipAddr_, and UWIP_CLMSG_SEND_ADDR.

|
protectedvirtual |
Cross-Layer messages synchronous interpreter.
| ClMessage* | an instance of ClMessage that represent the message received |
|
protectedvirtual |
Creates an ack packet after the reception a data packet received correctly
| p |
References hdr_uwip::daddr(), initPktAck(), and numberofackpkt_.
Referenced by recv().

|
protected |
Returns a nsaddr_t address from an IP written as a string in the form "x.x.x.x".
| char* | IP in string form |
|
friend |
|
protected |
AckWaiting object.
Referenced by recv().
|
protected |
IP of the current node.
Referenced by command(), initialize(), initPkt(), initPktAck(), printHopTable(), recv(), and recvAsyncClMsg().
|
protected |
|
protected |
Maximum validity time of a route.
Referenced by findInRouteTable(), and UwIcrpNode().
|
staticprivate |
Comulative number of Ack packets processed by UwIcrpNode objects.
Referenced by command(), and sendBackAck().
|
staticprivate |
Comulative number of Data packets processed by UwIcrpNode objects.
|
staticprivate |
Comulative number of Status packets processed by UwIcrpNode objects.
|
protected |
Flag to enable or disable dirrefent levels of debug.
Referenced by command(), recv(), and UwIcrpNode().
|
protected |
Node routing table.
Referenced by addRouteEntry(), clearAllRouteTable(), clearRouteTable(), findInRouteTable(), printHopTable(), recv(), and UwIcrpNode().
|
protected |
Ack waiting timer.
Referenced by recv(), and UwIcrpNode().