DESERT 4.0.0
sun-ipr-common-structures.h
Go to the documentation of this file.
1//
2// Copyright (c) 2021 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
40#ifndef SUN_COMMON_STRUCTURES_H
41#define SUN_COMMON_STRUCTURES_H
42
43#define STACK_TRACE 0
44#define MIN_SNR -9999.9
45// From ip-routing.h
46#define DROP_DEST_UNREACHABLE_REASON \
47 "DUR"
49#define DROP_PATH_ALREADY_PROCESSED \
50 "PAP"
51#define DROP_MAX_NUMBER_OF_HOP_IN_LIST_REACHED \
52 "MHR"
53#define DROP_WRONG_NODE_PATH_EST \
54 "WNP"
56// Drop reasons for Data packets.
57#define DROP_DATA_HOPS_LENGTH_EQUALS_ZERO \
58 "DHZ"
60// Drops reasons for Path Establishment Search packets
61#define DROP_PATH_ESTABLISHMENT_SEARCH_PACKET_HOP_LIST_FULL \
62 "PSF"
63#define DROP_PATH_ESTABLISHMENT_SEARCH_PACKET_ALREADY_PROCESSED \
64 "PSA"
65#define DROP_PATH_ESTABLISHMENT_SEARCH_PACKET_WRONG_CHECKSUM \
66 "PWC"
67#define DROP_PATH_ESTABLISHMENT_SEARCH_PACKET_NO_ROUTE_TO_DESTINATION \
68 "PNR"
70// Drops reasons for Path Establishment answer packets
71#define DROP_PATH_ESTABLISHMENT_ANSWER_PACKET_GARBAGE \
72 "PAG"
73#define DROP_PATH_ESTABLISHMENT_ANSWER_NODE_ROUTING_TABLE_FULL \
74 "PAF"
76// Drop reasons for Sink Node
77#define DROP_SINK_PACKET_TYPE_UNSOPPORTED \
78 "SPU"
80// Others
81#define DROP_PACKET_NOT_FOR_ME \
82 "PNM"
83#define DROP_PACKET_WITHOUT_DIRECTION \
84 "PWD"
85#define DROP_BROKEN_LINK_DROP \
86 "BLD"
87#define DROP_BUFFER_IS_FULL \
88 "BIF"
90#include "packet.h"
91
92#include <iostream>
93#include <sstream>
94
95static const int MAX_HOP_NUMBER = 5;
97static int sunuid_ = 0;
102typedef struct buffer_element {
103
104 Packet *p_;
107 double t_last_tx_;
112 unsigned int retx_;
113
115 {
116 }
117 buffer_element(Packet *_p, int _id_pkt_ = 0,
118 double _t_reception_ = Scheduler::instance().clock(),
119 double _t_last_tx_ = 0, int _num_retx_ = 0)
120 : p_(_p)
121 , id_pkt_(_id_pkt_)
122 , t_reception_(_t_reception_)
123 , t_last_tx_(_t_last_tx_)
124 , num_attempts_(_num_retx_)
125 , retx_(0)
126 {
127 }
130
131#endif // SUN_COMMON_STRUCTURES_H
Definition sun-ipr-common-structures.h:102
buffer_element(Packet *_p, int _id_pkt_=0, double _t_reception_=Scheduler::instance().clock(), double _t_last_tx_=0, int _num_retx_=0)
Definition sun-ipr-common-structures.h:117
unsigned int retx_
Definition sun-ipr-common-structures.h:112
Packet * p_
Definition sun-ipr-common-structures.h:104
double t_last_tx_
Definition sun-ipr-common-structures.h:107
int id_pkt_
Definition sun-ipr-common-structures.h:105
double t_reception_
Definition sun-ipr-common-structures.h:106
int num_attempts_
Definition sun-ipr-common-structures.h:108
buffer_element()
Definition sun-ipr-common-structures.h:114