94 virtual void expire(Event *e);
122 virtual void expire(Event *e);
167 virtual void expire(Event *e);
190 virtual void expire(Event *e);
265 virtual int command(
int,
const char *
const *);
391 return std::fabs(
value) < std::numeric_limits<double>::epsilon();
655 virtual const double getLoad()
const;
673 static inline const int
684 static inline const int
695 static inline const int
817 const int &,
const int &,
const int &,
const int &,
const int &,
818 const int &,
const int &,
const double &,
const int &,
const int &);
AckWaiting class is used to handle the timer of acks.
BufferTimer(SunIPRoutingNode *m)
SunIPRoutingNode *virtual void expire(Event *e)
< Pointer to an objet of type SunIPRoutingNode.
RemoveHopTableTimer class is used to handle the validity time of hop tables.
RemoveHopTableTimer(SunIPRoutingNode *m)
SunIPRoutingNode *virtual void expire(Event *e)
< Pointer to an objet of type SunIPRoutingNode.
SearchPathTimer class is used to handle the timer of Search Path requests.
SunIPRoutingNode *virtual void expire(Event *e)
< Pointer to an objet of type SunIPRoutingNode.
SearchPathTimer(SunIPRoutingNode *m)
SinkProbeTimer class is used to handle the validity time of a probe message.
virtual void expire(Event *e)
Method invoked when the SinkProbeTimer timer expires.
SinkProbeTimer(SunIPRoutingNode *m)
SunIPRoutingNode class is used to represent the routing layer of a node.
long list_acks_max_time_
Clock of the last ack received by the node.
virtual void replyPathEstSearch(Packet *)
Replies to Path Establishment Search packets.
static string printIP(const nsaddr_t &)
Returns a string with an IP in the classic form "x.x.x.x" converting an ns2 nsaddr_t address.
int pointer_packets_
Pointer of the first avaiable space in list_packets list.
double timer_route_validity_
Maximum validity time for a route entry.
uint max_retx_
Maximum Number of transmissions performed: real retransmissions counter the counter is increased only...
const long & getPathEstablishmentCount() const
Returns the number of Path Establishment packets processed by the entire network.
virtual void writeInTrace(const string &)
Opens the trace file, writes the string passed as input and closes the file.
vector< buffer_element > buffer_data
Buffer used to store data packets.
virtual void printSelectedRoutes() const
Print the nodes that were chosen as relay nodes to rach the sink and how many times each node was cho...
double timer_sink_probe_validity_
Maximum validity time for a sink probe.
ostringstream osstream_
Used to convert to string.
const long & getNPathsEstablished()
Print how many times the node was established as relay node for other nodes of the netwok.
char trace_separator_
Used as separator among elements in an entr of the tracefile.
static const int LISTLENGTH
Used by the load metric to set the number of the acks tracked.
bool search_path_enable_
Flag to enable or disable the possibility to send search_path packets.
static long number_of_datapkt_
Comulative number of Data packets processed by SunIPRoutingNode objects.
virtual int command(int, const char *const *)
TCL command interpreter.
const long & getForwardedCount() const
Returns the number of Data packets forwarded by the entire network.
virtual void initPktDataPacket(Packet *)
Initializes a data packet passed as argument with the default values.
virtual void createRouteError(const Packet *, Packet *)
Used to create a route error packet.
virtual void clearHops()
Clears all the route information of the current node.
double probe_min_snr_
Value below which if a node receives a probe it discards it.
static const int getDataPktHeaderSize()
Returns the size in byte of a hdr_sun_data packet header.
nsaddr_t * hop_table
List of IPs to reach the sink.
long n_paths_established
Number of times the node is established as realy node by the other nodes of the network.
virtual void forwardDataPacket(Packet *)
Forwards a data packet to the next hop.
virtual const int getPacketsLastMinute() const
Returns the number of packets processed by the current node in the last interval of time (MINUTE).
long list_packets_max_time_
Clock of the last packet received by the node.
int disable_path_error_
Flag to enable or disable the possibility to send Path Error packets.
std::map< uint8_t, uint > paths_selected
Map containing the nodes selected as relay to the sink and the number of times each node was selected...
bool trace_
Flag used to enable or disable the trace file for nodes,.
static long number_of_ackpkt_
Comulative number of Ack packets processed by SunIPRoutingNode objects.
virtual const int & getNumberOfHopToSink() const
Returns the number of hops that separate the node to the sink.
static nsaddr_t str2addr(const char *)
Returns a nsaddr_t address from an IP written as a string in the form "x.x.x.x".
virtual void updatePacketsCount()
Updates the number of packets processed by the current node.
virtual const int & evaluatePath(const Packet *)
Evaluates the route information contained in a Path Establishment packet, and according to different ...
virtual void bufferManager()
Manage the buffer of the data packets.
const long & getDataDropsCountBuffer() const
Returns the number of packets dropped by the entire network for the reason: buffer is full.
int hop_table_length
Current length of the hop_table.
SinkProbeTimer sinkProbeTimer_
SinkProbeTimer object.
virtual const bool isMyIpInList(const Packet *) const
Checks if the IP of the current node is in the header of the packet passed as argument.
virtual void expTimerHopTable()
This function is invoked when the timer of the routing table expires.
int data_and_hops[MAX_HOP_NUMBER]
Structure that contains the number of data packets sent by the current node to the sink,...
virtual const int getAcksLastMinute() const
Returns the number of acks received by the current node in the last interval of time (MINUTE).
virtual void initPktPathEstSearch(Packet *) const
Initializes a Path Establishment Search packet (previously allocated).
SunIPRoutingNode(const SunIPRoutingNode &)
Copy constructor declared as private.
virtual void sendRouteBack(Packet *)
Forwards a Path Establishment Answer Packet.
ofstream trace_file_
Ofstream used to write the trace file in the disk.
char * trace_file_name_
Name of the trace file writter for the current node.
virtual string createTraceString(const string &, const double &, const int &, const int &, const int &, const int &, const int &, const int &, const int &, const double &, const int &, const int &)
Function that accepts a list of string and create an entry for the trace file.
int reset_buffer_if_error_
If == 1 when a node identify a broken link it will automatically free its buffer.
static long number_of_pathestablishment_
Comulative number of Path Establishment packets processed by SunIPRoutingNode objects.
static const int MINUTE
Used by the load metric to set the period to consider for the evaluation of the metric.
double snr_to_sink_
SNR between the sink and the current node.
static long number_of_pkt_forwarded_
Comulative number of Data packets forwarded by the network.
virtual void initPktAck(Packet *)
Initializes an ack packet passed as argument with the default values.
virtual void updateQuality(Packet *)
Updates the field quality in the packet passed as parameter.
double period_status_
Period of the Poisson traffic for status and ack packets.
BufferTimer bufferTmr_
BufferTimer object.
nsaddr_t sink_associated
IP of the sink associated to the node.
virtual void updateAcksCount()
Updates the number of acks received by the current node.
static const int getPathEstHeaderSize()
Returns the size in byte of a hdr_sun_path_est packet header.
double timer_buffer_
Timer for buffer management.
virtual void receiveProbe(const Packet *)
Invoked when the node receives a probe packet from a sink.
virtual const int & setNumberOfHopToSink(const int &)
Sets the number of hops that the current node needs to reach the sink.
double period_data_
Period of the Poisson traffic for data packets in the buffer.
virtual void sendBackAck(const Packet *)
Creates an ack packet and sends it to the previous hop using the information contained in the header ...
double list_acks[LISTLENGTH]
List of the last LISTLENGTH temporal instants in which the node received acks.
double alpha_
Parameters used by Load metric.
SearchPathTimer searchPathTmr_
SearchPathTimer object.
SunIPRoutingNode()
Constructor of SunIPRoutingNode class.
bool ack_error_state
true if the node is not in an error state (that means that it discovered a broken link),...
const long & getDataCount() const
Returns the number of Data packets processed by the entire network.
int PoissonTraffic_
Enable (1) or disable (0) the Poisson traffic for SUN packets.
const double getDelay(const double &period_) const
Returns a delay value to use in transmission.
static const int getAckHeaderSize()
Returns the size in byte of a hdr_sun_ack packet header.
const long & getAckCount() const
Returns the number of Ack packets processed by the entire network.
double quality_link
Quality of the link from the node to the sink.
virtual void lostSink()
This function removes all the information about routing information and sink association.
virtual void searchPath()
Sends a Path Establishment Packet with the option field sets to Search.
const long & getDataDropsCountMaxRetx() const
Returns the number of packets dropped by the entire network for the reason: maximum number of retrans...
uint32_t buffer_max_size_
Maximum length of the data buffer.
virtual void printHopTable() const
Prints in the stdout the routing table of the current node.
double list_packets[LISTLENGTH]
List of the last LISTLENGTH temporal instants in which the node received data packets.
virtual int recvSyncClMsg(ClMessage *)
Cross-Layer messages synchronous interpreter.
int ack_warnings_counter_
Number of acks lost since the last reset.
int max_ack_error_
Maximum number of Ack errors tollerated by the node.
virtual void searchPathExpire()
This function enable the possibility to send a new Seath Path packet.
int printDebug_
Flag to enable or disable dirrefent levels of debug.
virtual void sendRouteErrorBack(Packet *)
Send back an error packet to the previous hop.
virtual ~SunIPRoutingNode()
Destructor of SunIPRoutingNode class.
long pkt_stored_
Keep track of the total number of packet transmitted.
virtual void initialize()
Initializes a SunIPRoutingNode node.
static long number_of_drops_buffer_full_
Comulative number of packets dropped by SunIPRoutingNode objects, reason: the buffer is full.
virtual void tracePacket(const Packet *const, const string &position="UNDEF___")
Traces a packet.
virtual const double getLoad() const
Returns the load index of the current node combining the information from getPacketsLastMinute() and ...
nsaddr_t ipAddr_
IP of the current node.
int pointer_acks_
Pointer of the first avaiable space in list_acks list.
virtual const bool addMyIpInList(Packet *)
Adds the IP of the current node in the header of a Path Establishment packet passed as argument.
int metrics_
Metric used by the current node.
virtual int recvAsyncClMsg(ClMessage *)
Cross-Layer messages asynchronous interpreter.
RemoveHopTableTimer rmhopTableTmr_
RemoveHopTableTimer object.
long pkt_tx_
Keep track of the total number of packet retransmitted.
double timer_search_path_
Timer for the search path mechanism.
virtual void initPktPathEstAnswer(Packet *, const Packet *)
Initializes a Path Establishment Answer packet (previously allocated) retrieving the information from...
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
static long number_of_drops_maxretx_
Comulative number of packets dropped by SunIPRoutingNode objects, reason: max number of retransmissio...
virtual void answerPath(const Packet *)
Creates and sends an Path Establishment Answer packet.
const bool isZero(const double &value) const
Evaluates is the number passed as input is equal to zero.
int num_hop_to_sink
Number of hops needed to reach the sink using tha path saved tn the routing table.
int safe_timer_buffer_
Enables a mechanism used to modify the timer_buffer_ in case of the sending time is shorter than the ...
bool acks_array_full
true if list of acks is full, false otherwise.
bool packets_array_full
true if list of packets is full, false otherwise.
hdr_sun_ack describes acks packets used by UWSUN.
hdr_sun_data describes data packets used by UWSUN
hdr_sun_path_est describes path establishment packets used by UWSUN
Provides the Ack Messages header description.
Provides the Data Messages header description.
Provides the Path Establishment Messages header description.
Common structures and definition used by SUN.
Provides the UWCBR packets header description and the definition of the class UWCBR.
static const int MAX_HOP_NUMBER
Maximum number of hops contained in a SUN Path Establishment packet.
Cross layer messages definition for the UWIP Module.
Provides the UWIP packets header description. Definition of the class that define the network layer.