DESERT 3.5.1
Loading...
Searching...
No Matches
uwUFetch_cmn_hdr.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 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
38#ifndef UWUFETCH_CMN_HDR_H
39#define UWUFETCH_CMN_HDR_H
40
41#include <mmac.h>
42#include <module.h>
43#include <packet.h>
44
45#define HDR_TRIGGER_UFETCH(p) \
46 (hdr_TRIGGER_UFETCH::access( \
47 p))
48#define HDR_RTS_UFETCH(p) \
49 (hdr_RTS_UFETCH::access(p))
50#define HDR_CTS_UFETCH(p) \
51 (hdr_CTS_UFETCH::access(p))
52#define HDR_BEACON_UFETCH(p) \
53 (hdr_BEACON_UFETCH::access( \
54 p))
55#define HDR_PROBE_UFETCH(p) \
56 (hdr_PROBE_UFETCH::access( \
57 p))
58#define HDR_POLL_UFETCH(p) \
59 (hdr_POLL_UFETCH::access(p))
61#define HDR_CBEACON_UFETCH(p) \
62 (hdr_CBEACON_UFETCH::access( \
63 p))
65extern packet_t PT_BEACON_UFETCH;
66extern packet_t PT_POLL_UFETCH;
67extern packet_t PT_CBEACON_UFETCH;
68extern packet_t PT_RTS_UFETCH;
69extern packet_t PT_PROBE_UFETCH;
70extern packet_t PT_TRIGGER_UFETCH;
71extern packet_t PT_CTS_UFETCH;
73static const int v_speed_sound =
74 1500;
75static const int BIT_RATE_SERVICE = 1000;
76static const int BIT_RATE_INSTANT = 10000;
77
81typedef struct hdr_TRIGGER_UFETCH {
82 int t_min_;
84 int t_max_;
86 int
90 static int offset_;
95 inline static int &
96 offset()
97 {
98 return offset_;
99 }
100
106 int &
108 {
109 return (t_min_);
110 }
111
117 int &
119 {
120 return (t_max_);
121 }
122
128 int &
130 {
131 return (max_pck_want_rx_);
132 }
133
134 inline static hdr_TRIGGER_UFETCH *
135 access(const Packet *p)
136 {
137 return (hdr_TRIGGER_UFETCH *) p->access(offset_);
138 }
144typedef struct hdr_RTS_UFETCH {
145 int num_DATA_pcks_;
147 int
151 static int offset_;
156 inline static int &
157 offset()
158 {
159 return offset_;
160 }
161
167 int &
169 {
170 return num_DATA_pcks_;
171 }
172
178 int &
180 {
181 return backoff_time_RTS_;
182 }
183
184 inline static hdr_RTS_UFETCH *
185 access(const Packet *p)
186 {
187 return (hdr_RTS_UFETCH *) p->access(offset_);
188 }
194typedef struct hdr_CTS_UFETCH {
199 static int offset_;
204 inline static int &
207 return offset_;
209
215 int &
220
226 int &
228 {
229 return mac_addr_HN_ctsed_;
230 }
231
232 inline static hdr_CTS_UFETCH *
233 access(const Packet *p)
234 {
235 return (hdr_CTS_UFETCH *) p->access(offset_);
236 }
242typedef struct hdr_BEACON_UFETCH {
243 int t_min_bc_;
245 int t_max_bc_;
249 static int offset_;
254 inline static int &
255 offset()
257 return offset_;
259
265 int &
267 {
268 return t_min_bc_;
269 }
270
276 int &
278 {
279 return t_max_bc_;
280 }
281
287 int &
292
293 inline static hdr_BEACON_UFETCH *
294 access(const Packet *p)
295 {
296 return (hdr_BEACON_UFETCH *) p->access(offset_);
297 }
303typedef struct hdr_PROBE_UFETCH {
304 int
310 static int offset_;
315 inline static int &
317 {
318 return offset_;
320
326 int &
328 {
330 }
331
337 int &
339 {
340 return backoff_time_PROBE_;
341 }
342
343 inline static hdr_PROBE_UFETCH *
344 access(const Packet *p)
345 {
346 return (hdr_PROBE_UFETCH *) p->access(offset_);
347 }
353typedef struct hdr_POLL_UFETCH {
360 static int offset_;
365 inline static int &
366 offset()
367 {
368 return offset_;
369 }
370
376 int &
381
387 int &
389 {
391 };
392
393 inline static struct hdr_POLL_UFETCH *
394 access(const Packet *p)
395 {
396 return (struct hdr_POLL_UFETCH *) p->access(offset_);
397 }
403typedef struct hdr_CBEACON_UFETCH {
404 int t_min_bc_;
406 int t_max_bc_;
410 static int offset_;
415 inline static int &
416 offset()
418 return offset_;
420
426 int &
428 {
429 return t_min_bc_;
430 }
431
437 int &
439 {
440 return t_max_bc_;
441 }
442
448 int &
453
454 inline static hdr_CBEACON_UFETCH *
455 access(const Packet *p)
456 {
457 return (hdr_CBEACON_UFETCH *) p->access(offset_);
458 }
460#endif
Content header of BEACON packet.
static int offset_
Required by the PacketHeaderManager.
int t_max_bc_
maximum value in which the Node can choose his backoff time
static int & offset()
Reference to the offset variable.
int & t_max_bc()
Reference to t_max_bc_ variable.
int & num_Max_CBEACON_tx_by_HN()
Reference to num_Max_CBEACON_tx_by_HN_ variable.
int num_Max_CBEACON_tx_by_HN_
Maximum number of CBEACON that the HN can transmit after the BEACON packet.
int t_min_bc_
minimum value in which the Node can choose his backoff time
static hdr_BEACON_UFETCH * access(const Packet *p)
int & t_min_bc()
Reference to t_min_bc_ variable.
Content header of CBEACON packet.
static hdr_CBEACON_UFETCH * access(const Packet *p)
static int offset_
Required by the PacketHeaderManager.
int t_max_bc_
maximum value in which the Node can choose his backoff time
int num_Max_CBEACON_tx_by_HN_
Maximum number of CBEACON that the HN can transmit after the BEACON packet.
static int & offset()
Reference to the offset variable.
int & t_max_bc()
Reference to t_max_bc_ variable.
int & t_min_bc()
Reference to t_min_bc_ variable.
int & num_Max_CBEACON_tx_by_HN()
Reference to num_Max_CBEACON_tx_by_HN_ variable.
int t_min_bc_
minimum value in which the Node can choose his backoff time
Content header of CTS packet.
int mac_addr_HN_ctsed_
Mac address of the HN from which the AUV want to receive the DATA packets
static int & offset()
Reference to the offset variable.
int & mac_addr_HN_ctsed()
Reference to the mac_addr_HN_ctsed_ variable.
static int offset_
Required by the PacketHeaderManager.
int num_DATA_pcks_MAX_rx_
maximum number of packets that AUV want receive from HN
int & num_DATA_pcks_MAX_rx()
Reference to the num_DATA_pcks_MAX_rx_ variable.
static hdr_CTS_UFETCH * access(const Packet *p)
Content header of POLL packet.
static int & offset()
Reference to the offset variable.
int num_DATA_pcks_MAX_rx_
Maximum number of DATA packet that HN want to receive from the specific node that is being to poll.
static struct hdr_POLL_UFETCH * access(const Packet *p)
static int offset_
Required by the PacketHeaderManager.
int & mac_addr_Node_polled()
Reference to mac_addr_Node_polled_ variable.
int & num_DATA_pcks_MAX_rx()
Reference to num_DATA_pcks_MAX_rx variable.
int mac_addr_Node_polled_
Mac address of the NODE that the HN has polled and from which it want to receive a data packet.
Content header of PROBE packet.
int & n_DATA_pcks_Node_tx()
Reference to n_DATA_pcks_Node_tx_ variable.
int backoff_time_PROBE_
Backoff time chosen by the NODE for collision free.
static int offset_
Required by the PacketHeaderManager.
int & backoff_time_PROBE()
Reference to backoff_time_PROBE_ variable.
int n_DATA_pcks_Node_tx_
number of packets that Node have to transmit at HN
static hdr_PROBE_UFETCH * access(const Packet *p)
static int & offset()
Reference to the offset variable.
Content header of RTS packet.
static int & offset()
Reference to the offset variable.
static int offset_
Required by the PacketHeaderManager.
int & backoff_time_RTS()
Reference to the backoff_Time_RTS_ variable.
int num_DATA_pcks_
Number of packets that the HN want to transmit to the AUV.
int & num_DATA_pcks()
Reference to the num_Data_pcks_ variable.
int backoff_time_RTS_
Backoff time chosen by the HN for collision free.
static hdr_RTS_UFETCH * access(const Packet *p)
Content header of TRIGGER packet.
static int offset_
Required by the PacketHeaderManager.
int & t_min()
Reference to the t_min variable.
int & t_max()
Reference to the t_max variable.
int t_max_
maximum value in which the HN can choose his backoff time
int & max_pck_want_rx()
Reference to the max_pck_want_rx variable.
static int & offset()
Reference to the offset variable.
int t_min_
minimum value in which the HN can choose his backoff time
static hdr_TRIGGER_UFETCH * access(const Packet *p)
int max_pck_want_rx_
Maximum number of pck that AUV want receive from sink.
packet_t PT_POLL_UFETCH
POLL packet type.
packet_t PT_CBEACON_UFETCH
CBEACON packet type.
packet_t PT_CTS_UFETCH
CTS packet type.
packet_t PT_TRIGGER_UFETCH
TRIGGER packet type.
packet_t PT_BEACON_UFETCH
BEACON packet type.
static const int BIT_RATE_INSTANT
packet_t PT_PROBE_UFETCH
PROBE packet type.
static const int v_speed_sound
Underwater sound propagation speed.
static const int BIT_RATE_SERVICE
packet_t PT_RTS_UFETCH
RTS packet type.