57 std::cout <<
"> answerPath()" << std::endl;
68 std::cout <<
"[" <<
NOW
71 <<
"]::PATH_ANSWER_SENT::UID:" << ch_answer->uid()
73 <<
"::HOPCOUNT:" << (
hpest->list_of_hops_length() + 1)
95 std::cout <<
"> initPktPathEstAnswer()" << std::endl;
102 ch_new->direction() = hdr_cmn::DOWN;
133 for (
int i = 0;
i <
hpest_new->list_of_hops_length();
i++) {
151 ch_new->timestamp() = Scheduler::instance().clock();
165 std::cout <<
"> sendRouteBack()" << std::endl;
170 if (
hpest->ptype() ==
172 if (
hpest->list_of_hops_length() == 0) {
177 if (
hpest->list_of_hops()[
j_] ==
186 if (((
hpest->list_of_hops_length() -
hpest->pointer()) <=
187 this->getNumberOfHopToSink()) ||
188 (
this->getNumberOfHopToSink() ==
195 for (
int i = j_ + 1,
w = 0;
i <
hpest->list_of_hops_length();
i++,
w++) {
220 for (
int i = j_ + 1,
w = 0;
i <
hpest->list_of_hops_length();
i++,
w++) {
240 hpest->quality() /
hpest->list_of_hops_length();
248 for (
int i = j_ + 1,
w = 0;
249 i <
hpest->list_of_hops_length();
254 hpest->pointer() - 1;
266 if (
hpest->pointer() < 0) {
268 ch->next_hop() =
iph->daddr();
271 ch->next_hop() =
hpest->list_of_hops()[
hpest->pointer()];
275 std::cout <<
"[" <<
NOW
278 <<
"]::UID:" << ch->uid()
279 <<
"::SEND_ROUTE_BACK::NEXT_HOP:" <<
printIP(
ch->next_hop())
309 std::cout <<
"> evaluatePath()" << std::endl;
337 std::cout <<
"[" <<
NOW
340 <<
"]::UID:" << ch->uid()
342 <<
"::LAST_HOP:" <<
printIP(
iph->saddr()) <<
"::";
343 for (
int s = 0;
s <
hpest->list_of_hops_length();
s++)
344 std::cout <<
":" << (
int)
hpest->list_of_hops()[
s];
345 std::cout << std::endl;
365 if (
hpest->list_of_hops_length() >
383 std::cout <<
"[" <<
NOW
386 <<
"]::UID:" << ch->uid()
390 for (
int s = 0;
s <
hpest->list_of_hops_length();
s++)
391 std::cout <<
":" << (
int)
hpest->list_of_hops()[
s];
392 std::cout << std::endl;
412 if (
hpest->list_of_hops_length() >
431 std::cout <<
"[" <<
NOW
434 <<
"]::SN:" << ch->uid()
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.
double timer_route_validity_
Maximum validity time for a route entry.
ostringstream osstream_
Used to convert to string.
virtual void clearHops()
Clears all the route information of the current node.
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.
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,.
virtual const int & getNumberOfHopToSink() const
Returns the number of hops that separate the node to the sink.
virtual const int & evaluatePath(const Packet *)
Evaluates the route information contained in a Path Establishment packet, and according to different ...
int hop_table_length
Current length of the hop_table.
virtual void sendRouteBack(Packet *)
Forwards a Path Establishment Answer Packet.
static long number_of_pathestablishment_
Comulative number of Path Establishment packets processed by SunIPRoutingNode objects.
double period_status_
Period of the Poisson traffic for status and ack packets.
nsaddr_t sink_associated
IP of the sink associated to the node.
virtual const int & setNumberOfHopToSink(const int &)
Sets the number of hops that the current node needs to reach the sink.
bool ack_error_state
true if the node is not in an error state (that means that it discovered a broken link),...
const double getDelay(const double &period_) const
Returns a delay value to use in transmission.
double quality_link
Quality of the link from the node to the sink.
int ack_warnings_counter_
Number of acks lost since the last reset.
int printDebug_
Flag to enable or disable dirrefent levels of debug.
virtual void tracePacket(const Packet *const, const string &position="UNDEF___")
Traces a packet.
nsaddr_t ipAddr_
IP of the current node.
int metrics_
Metric used by the current node.
RemoveHopTableTimer rmhopTableTmr_
RemoveHopTableTimer object.
virtual void initPktPathEstAnswer(Packet *, const Packet *)
Initializes a Path Establishment Answer packet (previously allocated) retrieving the information from...
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.
hdr_sun_path_est describes path establishment packets used by UWSUN
uint8_t & sinkAssociated()
Reference to the sink_associated_ variable.
float & quality()
Reference to the quality_ variable.
u_int8_t & list_of_hops_length()
Reference to the list_of_hops_length_ variable.
hdr_uwip describes UWIP packets.
uint8_t & saddr()
Reference to the saddr_ variable.
#define HDR_SUN_PATH_EST(p)
Common structures and definition used by SUN.
#define STACK_TRACE
Used to keep track of methods call.
static int sunuid_
Unique identifier for UWSUN packets.
#define DROP_PATH_ESTABLISHMENT_ANSWER_PACKET_GARBAGE
Reason for a drop in a UWSUN module.
Dinamic source routing protocol, this file contains Nodes specifications.