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

#include <uwflooding-sec.h>

Inheritance diagram for UwFloodingSec:
Collaboration diagram for UwFloodingSec:

Public Member Functions

 UwFloodingSec ()
 
virtual ~UwFloodingSec ()
 

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 &)
 
void addToNeighbor (uint8_t neighbor_addr)
 
void printNeighbor ()
 
bool checkUnconfirmedPkt (uint8_t neighbor_addr, int uid)
 
void sendDown (Packet *p, double delay=0)
 
virtual void sendStatsClMsg (int neighbor_addr)
 
void retrieveInstantNoise (int neighbor_addr)
 

Static Protected Member Functions

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

Private Types

typedef std::map< uint16_t, doublemap_packets
 
typedef std::map< uint8_t, map_packetsmap_forwarded_packets
 
typedef std::map< uint8_t, uintneighbor_map
 
typedef std::map< uint8_t, NeighborReputationHandlerneighbor_timer_map
 

Private Member Functions

 UwFloodingSec (const UwFloodingSec &)
 
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_
 
chartrace_file_path_name_
 
ofstream trace_file_path_
 
ostringstream osstream_
 
map_forwarded_packets my_forwarded_packets_
 
std::map< uint16_t, uint8_tttl_traffic_map
 
bool use_reputation
 
neighbor_map neighbor
 
neighbor_timer_map neighbor_tmr
 
double fwd_to
 
uint8_t prev_hop_temp
 
UwReputationInterfacereputation
 
double alpha_snr
 
bool valid_phy_id
 
int stats_phy_id
 

Friends

class NeighborReputationHandler
 

Detailed Description

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

Definition at line 168 of file uwflooding-sec.h.

Member Typedef Documentation

◆ map_forwarded_packets

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

Definition at line 316 of file uwflooding-sec.h.

◆ map_packets

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

Definition at line 312 of file uwflooding-sec.h.

◆ neighbor_map

Typdef for a map of the neighbor with the number of packets received from him.

Definition at line 325 of file uwflooding-sec.h.

◆ neighbor_timer_map

Typedef for the forwardig timer of the neigbors.

Definition at line 329 of file uwflooding-sec.h.

Constructor & Destructor Documentation

◆ UwFloodingSec() [1/2]

UwFloodingSec::UwFloodingSec ( )

Constructor of UwFloodingSec class.

Definition at line 290 of file uwflooding-sec.cpp.

◆ ~UwFloodingSec()

UwFloodingSec::~UwFloodingSec ( )
virtual

Destructor of UwFloodingSec class.

Definition at line 315 of file uwflooding-sec.cpp.

◆ UwFloodingSec() [2/2]

UwFloodingSec::UwFloodingSec ( const UwFloodingSec )
private

Copy constructor declared as private.

It is not possible to create a new UwFloodingSec object passing to its constructor another UwFloodingSec object.

Parameters
UwFloodingSec&UwFloodingSec object.

Member Function Documentation

◆ addToNeighbor()

void UwFloodingSec::addToNeighbor ( uint8_t  neighbor_addr)
protected

Adds a node in the neighbor map, updating the number of packets received from that node.

Parameters
neighbor_addrIP address of the neighbor

Definition at line 753 of file uwflooding-sec.cpp.

◆ checkUnconfirmedPkt()

bool UwFloodingSec::checkUnconfirmedPkt ( uint8_t  neighbor_addr,
int  uid 
)
protected

Check if the received packets is an unconfirmed one.

Parameters
neighbor_addrIP address of the neighbor
uiduinique id of the received packet
Returns
true if the packets was between the unchecked, false otherwise

Definition at line 807 of file uwflooding-sec.cpp.

◆ command()

int UwFloodingSec::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 400 of file uwflooding-sec.cpp.

◆ getTTL()

uint8_t UwFloodingSec::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

Definition at line 694 of file uwflooding-sec.cpp.

◆ printIP()

string UwFloodingSec::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"

Definition at line 738 of file uwflooding-sec.cpp.

◆ printNeighbor()

void UwFloodingSec::printNeighbor ( )
protected

Prints the neighbor list togheter with the number of packets received from the neighbor.

Definition at line 770 of file uwflooding-sec.cpp.

◆ recv()

void UwFloodingSec::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 466 of file uwflooding-sec.cpp.

◆ recvAsyncClMsg()

int UwFloodingSec::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.

Definition at line 394 of file uwflooding-sec.cpp.

◆ recvSyncClMsg()

int UwFloodingSec::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 320 of file uwflooding-sec.cpp.

◆ retrieveInstantNoise()

void UwFloodingSec::retrieveInstantNoise ( int  neighbor_addr)
protected

Send ClMsgStats to retreive instantaneous noise.

The ClMsg is sent in unicast only to the module which sent the trigger message

Parameters
neighbor_addrIP address of the neighbor

Definition at line 373 of file uwflooding-sec.cpp.

◆ sendDown()

void UwFloodingSec::sendDown ( Packet p,
double  delay = 0 
)
protected

Send down packets and start forwarding timer.

Parameters
ppointer to the packet
delay(optional) delay introduced before transmission [sec.]

Definition at line 789 of file uwflooding-sec.cpp.

◆ sendStatsClMsg()

void UwFloodingSec::sendStatsClMsg ( int  neighbor_addr)
protectedvirtual

Send ClMsgStats message when triggered by the reception of an overherd packets.

The ClMsg is sent in unicast only to the module which sent the trigger message

Parameters
neighbor_addrIP address of the neighbor

Definition at line 338 of file uwflooding-sec.cpp.

◆ str2addr()

static nsaddr_t UwFloodingSec::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 UwFloodingSec::writePathInTrace ( const Packet p,
const string _info 
)
protectedvirtual

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

Parameters
Packetto analyze.

Definition at line 705 of file uwflooding-sec.cpp.

Friends And Related Symbol Documentation

◆ NeighborReputationHandler

Definition at line 170 of file uwflooding-sec.h.

Member Data Documentation

◆ alpha_snr

double UwFloodingSec::alpha_snr
private

Value to be used by the NeighborReputationHandler object to combine new snr values and average snr.

Definition at line 340 of file uwflooding-sec.h.

◆ fwd_to

double UwFloodingSec::fwd_to
private

Time out within which the forwarding is expected.

Definition at line 333 of file uwflooding-sec.h.

◆ ipAddr_

uint8_t UwFloodingSec::ipAddr_
private

Definition at line 296 of file uwflooding-sec.h.

◆ maximum_cache_time_

double UwFloodingSec::maximum_cache_time_
private

Validity time of a packet entry.

Definition at line 298 of file uwflooding-sec.h.

◆ my_forwarded_packets_

map_forwarded_packets UwFloodingSec::my_forwarded_packets_
private

Map of the packet forwarded.

Definition at line 319 of file uwflooding-sec.h.

◆ neighbor

neighbor_map UwFloodingSec::neighbor
private

Map with the neighbor.

Definition at line 327 of file uwflooding-sec.h.

◆ neighbor_tmr

neighbor_timer_map UwFloodingSec::neighbor_tmr
private

Map with the neighbor timer.

Definition at line 331 of file uwflooding-sec.h.

◆ optimize_

int UwFloodingSec::optimize_
private

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

Definition at line 299 of file uwflooding-sec.h.

◆ osstream_

ostringstream UwFloodingSec::osstream_
private

Used to convert to string.

Definition at line 310 of file uwflooding-sec.h.

◆ packets_forwarded_

long UwFloodingSec::packets_forwarded_
private

Number of packets forwarded by this module.

Definition at line 301 of file uwflooding-sec.h.

◆ prev_hop_temp

uint8_t UwFloodingSec::prev_hop_temp
private

Previous hop IP address of the last received packet.

Definition at line 335 of file uwflooding-sec.h.

◆ reputation

UwReputationInterface* UwFloodingSec::reputation
private

Reputation of the neighbor.

Definition at line 338 of file uwflooding-sec.h.

◆ stats_phy_id

int UwFloodingSec::stats_phy_id
private

id of the physical layer from which collect the statistics.

Definition at line 345 of file uwflooding-sec.h.

◆ trace_file_path_

ofstream UwFloodingSec::trace_file_path_
private

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

Definition at line 308 of file uwflooding-sec.h.

◆ trace_file_path_name_

char* UwFloodingSec::trace_file_path_name_
private

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

Definition at line 305 of file uwflooding-sec.h.

◆ trace_path_

bool UwFloodingSec::trace_path_
private

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

Definition at line 302 of file uwflooding-sec.h.

◆ ttl_

int UwFloodingSec::ttl_
private

Time to leave of the UWFLOODING packets.

Definition at line 297 of file uwflooding-sec.h.

◆ ttl_traffic_map

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

Map with ttl per traffic.

Definition at line 321 of file uwflooding-sec.h.

◆ use_reputation

bool UwFloodingSec::use_reputation
private

True if the reputation system is used.

Definition at line 323 of file uwflooding-sec.h.

◆ valid_phy_id

bool UwFloodingSec::valid_phy_id
private

True if the id of the phy layer from which obtain the statistics is a valid one.

Definition at line 343 of file uwflooding-sec.h.


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