DESERT 4.0.0
UwFlooding Class Reference

#include <uwflooding.h>

Inheritance diagram for UwFlooding:
Inheritance graph
Collaboration diagram for UwFlooding:
Collaboration graph

Public Member Functions

 UwFlooding ()
 
virtual ~UwFlooding ()
 

Protected Member Functions

virtual int command (int, const char *const *)
 
virtual void recv (Packet *)
 
virtual int recvSyncClMsg (ClMessage *)
 
virtual int recvAsyncClMsg (ClMessage *)
 
virtual void writePathInTrace (const Packet *, const string &)
 

Static Protected Member Functions

static nsaddr_t str2addr (const char *)
 
static string printIP (const nsaddr_t &)
 

Private Types

typedef std::map< uint16_t, double > map_packets
 
typedef std::map< uint8_t, map_packetsmap_forwarded_packets
 

Private Member Functions

 UwFlooding (const UwFlooding &)
 
uint8_t getTTL (Packet *p) const
 

Private Attributes

uint8_t ipAddr_
 
int ttl_
 
double maximum_cache_time_
 
int optimize_
 
long packets_forwarded_
 
bool trace_path_
 
char * trace_file_path_name_
 
ofstream trace_file_path_
 
ostringstream osstream_
 
map_forwarded_packets my_forwarded_packets_
 
std::map< uint16_t, uint8_t > ttl_traffic_map
 

Detailed Description

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

Member Typedef Documentation

◆ map_forwarded_packets

typedef std::map<uint8_t, map_packets> UwFlooding::map_forwarded_packets
private

Typedef for a map of the packet forwarded (saddr, map_packets).

◆ map_packets

typedef std::map<uint16_t, double> UwFlooding::map_packets
private

Typedef for a packet id: (serial_number, timestamp).

Constructor & Destructor Documentation

◆ UwFlooding() [1/2]

UwFlooding::UwFlooding ( )

Constructor of UwFlooding class.

References maximum_cache_time_, optimize_, and ttl_.

◆ ~UwFlooding()

UwFlooding::~UwFlooding ( )
virtual

Destructor of UwFlooding class.

◆ UwFlooding() [2/2]

UwFlooding::UwFlooding ( const UwFlooding )
private

Copy constructor declared as private. It is not possible to create a new UwFlooding object passing to its constructor another UwFlooding object.

Parameters
UwFlooding&UwFlooding object.

Member Function Documentation

◆ command()

int UwFlooding::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 ipAddr_, packets_forwarded_, trace_file_path_, trace_file_path_name_, trace_path_, and ttl_traffic_map.

◆ getTTL()

uint8_t UwFlooding::getTTL ( Packet *  p) const
private

Get the value of the TTL

Parameters
ppointer to the packet for which the ttl has to be computed.
Returns
the ttl for that packet

References hdr_uwcbr::traffic_type(), ttl_, and ttl_traffic_map.

Referenced by recv().

Here is the call graph for this function:

◆ printIP()

string UwFlooding::printIP ( const nsaddr_t &  ip_)
staticprotected

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"

◆ recv()

void UwFlooding::recv ( Packet *  p)
protectedvirtual

Performs the reception of packets from upper and lower layers.

Parameters
Packet*Pointer to the packet will be received.

References hdr_uwip::daddr(), getTTL(), ipAddr_, maximum_cache_time_, my_forwarded_packets_, optimize_, packets_forwarded_, hdr_uwip::saddr(), trace_path_, hdr_uwflooding::ttl(), and writePathInTrace().

Here is the call graph for this function:

◆ recvAsyncClMsg()

int UwFlooding::recvAsyncClMsg ( ClMessage *  m)
protectedvirtual

Cross-Layer messages asynchronous interpreter. Used to retrive the IP od the current node from the IP module.

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

◆ recvSyncClMsg()

int UwFlooding::recvSyncClMsg ( ClMessage *  m)
protectedvirtual

Cross-Layer messages synchronous interpreter.

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

◆ str2addr()

static nsaddr_t UwFlooding::str2addr ( const char *  )
staticprotected

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

◆ writePathInTrace()

void UwFlooding::writePathInTrace ( const Packet *  p,
const string &  _info 
)
protectedvirtual

Writes in the Path Trace file the path contained in the Packet

Parameters
Packetto analyze.

References hdr_uwip::daddr(), osstream_, hdr_uwip::saddr(), trace_file_path_, trace_file_path_name_, and hdr_uwflooding::ttl().

Referenced by recv().

Here is the call graph for this function:

Member Data Documentation

◆ ipAddr_

uint8_t UwFlooding::ipAddr_
private

Referenced by command(), and recv().

◆ maximum_cache_time_

double UwFlooding::maximum_cache_time_
private

Validity time of a packet entry.

Referenced by recv(), and UwFlooding().

◆ my_forwarded_packets_

map_forwarded_packets UwFlooding::my_forwarded_packets_
private

Map of the packet forwarded.

Referenced by recv().

◆ optimize_

int UwFlooding::optimize_
private

Flag used to enable the mechanism to drop packets processed twice.

Referenced by recv(), and UwFlooding().

◆ osstream_

ostringstream UwFlooding::osstream_
private

Used to convert to string.

Referenced by writePathInTrace().

◆ packets_forwarded_

long UwFlooding::packets_forwarded_
private

Number of packets forwarded by this module.

Referenced by command(), and recv().

◆ trace_file_path_

ofstream UwFlooding::trace_file_path_
private

Ofstream used to write the path trace file in the disk.

Referenced by command(), and writePathInTrace().

◆ trace_file_path_name_

char* UwFlooding::trace_file_path_name_
private

Name of the trace file that contains the list of paths of the data packets received.

Referenced by command(), and writePathInTrace().

◆ trace_path_

bool UwFlooding::trace_path_
private

Flag used to enable or disable the path trace file for nodes,

Referenced by command(), and recv().

◆ ttl_

int UwFlooding::ttl_
private

Time to leave of the UWFLOODING packets.

Referenced by getTTL(), and UwFlooding().

◆ ttl_traffic_map

std::map<uint16_t, uint8_t> UwFlooding::ttl_traffic_map
private

Map with ttl per traffic.

Referenced by command(), and getTTL().


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