DESERT 4.0.0
UwUdp Class Reference

#include <uwudp-module.h>

Inheritance diagram for UwUdp:
Inheritance graph
Collaboration diagram for UwUdp:
Collaboration graph

Public Member Functions

 UwUdp ()
 
virtual ~UwUdp ()=default
 
virtual void recv (Packet *) override
 
virtual void recv (Packet *, int) override
 
virtual int command (int, const char *const *) override
 
virtual int assignPort (Module *)
 
void printIdsPkts () const
 

Static Protected Member Functions

static int getUdpHeaderSize ()
 

Protected Attributes

uint16_t portcounter
 
int drop_duplicated_packets_
 
int debug_
 
std::map< int, int > port_map
 
std::map< int, int > id_map
 
std::map< uint16_t, map_packets_elmap_packets
 

Detailed Description

UwUdp class is used to manage UWUDP packets, and flows to and from upper modules.

Constructor & Destructor Documentation

◆ UwUdp()

UwUdp::UwUdp ( )

Constructor of UwUdp class.

References debug_, and drop_duplicated_packets_.

◆ ~UwUdp()

virtual UwUdp::~UwUdp ( )
virtualdefault

Destructor of UwUdp class.

Member Function Documentation

◆ assignPort()

int UwUdp::assignPort ( Module *  m)
virtual

Associates a module with a port.

Parameters
Module*Module to which associate a port.
Returns
Id of the port associated to the module.

References id_map, port_map, and portcounter.

Referenced by command().

◆ command()

int UwUdp::command ( int  argc,
const char *const *  argv 
)
overridevirtual

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 assignPort(), getUdpHeaderSize(), and printIdsPkts().

Here is the call graph for this function:

◆ getUdpHeaderSize()

static int UwUdp::getUdpHeaderSize ( )
inlinestaticprotected

Returns the size in byte of a hdr_uwudp packet header.

Returns
The size of a hdr_uwudp packet header.

Referenced by command().

◆ printIdsPkts()

void UwUdp::printIdsPkts ( ) const
inline

Prints the IDs of the packet's headers defined by UWUDP.

References PT_UWUDP.

Referenced by command().

◆ recv() [1/2]

void UwUdp::recv ( Packet *  p)
overridevirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.

◆ recv() [2/2]

void UwUdp::recv ( Packet *  p,
int  idSrc 
)
overridevirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.
Handler*Handler.

References hdr_uwudp::dport(), drop_duplicated_packets_, id_map, map_packets, port_map, portcounter, hdr_uwip::saddr(), and hdr_uwudp::sport().

Here is the call graph for this function:

Member Data Documentation

◆ debug_

int UwUdp::debug_
protected

Flag to enable or disable debug.

Referenced by UwUdp().

◆ drop_duplicated_packets_

int UwUdp::drop_duplicated_packets_
protected

Flag to enable or disable the drop of duplicated packets.

Referenced by recv(), and UwUdp().

◆ id_map

std::map<int, int> UwUdp::id_map
protected

Map port number to application module id (port_number, id).

Referenced by assignPort(), and recv().

◆ map_packets

std::map<uint16_t, map_packets_el> UwUdp::map_packets
protected

Map used to keep track of the packets received by each port. The key is the port number. The second element contains the saddr IP and a vector used as bucketlist.

Referenced by recv().

◆ port_map

std::map<int, int> UwUdp::port_map
protected

Map application module id to port number (id, port_number).

Referenced by assignPort(), and recv().

◆ portcounter

uint16_t UwUdp::portcounter
protected

Counter used to generate new port numbers.

Referenced by assignPort(), and recv().


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