DESERT 4.0.0
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_;
89 static int offset_;
94 inline static int &
96 {
97 return offset_;
98 }
99
105 int &
107 {
108 return (t_min_);
109 }
110
116 int &
118 {
119 return (t_max_);
120 }
121
127 int &
129 {
130 return (max_pck_want_rx_);
131 }
132
133 inline static hdr_TRIGGER_UFETCH *
134 access(const Packet *p)
135 {
136 return (hdr_TRIGGER_UFETCH *) p->access(offset_);
137 }
139
143typedef struct hdr_RTS_UFETCH {
149 static int offset_;
154 inline static int &
156 {
157 return offset_;
158 }
159
165 int &
167 {
168 return num_DATA_pcks_;
169 }
170
176 int &
178 {
179 return backoff_time_RTS_;
180 }
181
182 inline static hdr_RTS_UFETCH *
183 access(const Packet *p)
184 {
185 return (hdr_RTS_UFETCH *) p->access(offset_);
186 }
188
192typedef struct hdr_CTS_UFETCH {
197 static int offset_;
202 inline static int &
204 {
205 return offset_;
206 }
207
213 int &
218
224 int &
226 {
227 return mac_addr_HN_ctsed_;
228 }
229
230 inline static hdr_CTS_UFETCH *
231 access(const Packet *p)
232 {
233 return (hdr_CTS_UFETCH *) p->access(offset_);
234 }
236
240typedef struct hdr_BEACON_UFETCH {
247 static int offset_;
252 inline static int &
254 {
255 return offset_;
256 }
257
263 int &
265 {
266 return t_min_bc_;
267 }
268
274 int &
276 {
277 return t_max_bc_;
278 }
279
285 int &
290
291 inline static hdr_BEACON_UFETCH *
292 access(const Packet *p)
293 {
294 return (hdr_BEACON_UFETCH *) p->access(offset_);
295 }
297
301typedef struct hdr_PROBE_UFETCH {
306 static int offset_;
311 inline static int &
313 {
314 return offset_;
315 }
316
322 int &
324 {
326 }
327
333 int &
335 {
336 return backoff_time_PROBE_;
337 }
338
339 inline static hdr_PROBE_UFETCH *
340 access(const Packet *p)
341 {
342 return (hdr_PROBE_UFETCH *) p->access(offset_);
343 }
345
349typedef struct hdr_POLL_UFETCH {
356 static int offset_;
361 inline static int &
363 {
364 return offset_;
365 }
366
372 int &
377
383 int &
385 {
387 };
388
389 inline static struct hdr_POLL_UFETCH *
390 access(const Packet *p)
391 {
392 return (struct hdr_POLL_UFETCH *) p->access(offset_);
393 }
395
399typedef struct hdr_CBEACON_UFETCH {
406 static int offset_;
411 inline static int &
413 {
414 return offset_;
415 }
416
422 int &
424 {
425 return t_min_bc_;
426 }
427
433 int &
435 {
436 return t_max_bc_;
437 }
438
444 int &
449
450 inline static hdr_CBEACON_UFETCH *
451 access(const Packet *p)
452 {
453 return (hdr_CBEACON_UFETCH *) p->access(offset_);
454 }
456#endif
Definition uwUFetch_cmn_hdr.h:240
static int offset_
Definition uwUFetch_cmn_hdr.h:247
int t_max_bc_
Definition uwUFetch_cmn_hdr.h:243
static int & offset()
Definition uwUFetch_cmn_hdr.h:253
int & t_max_bc()
Definition uwUFetch_cmn_hdr.h:275
int & num_Max_CBEACON_tx_by_HN()
Definition uwUFetch_cmn_hdr.h:286
int num_Max_CBEACON_tx_by_HN_
Definition uwUFetch_cmn_hdr.h:245
int t_min_bc_
Definition uwUFetch_cmn_hdr.h:241
static hdr_BEACON_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:292
int & t_min_bc()
Definition uwUFetch_cmn_hdr.h:264
Definition uwUFetch_cmn_hdr.h:399
static hdr_CBEACON_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:451
static int offset_
Definition uwUFetch_cmn_hdr.h:406
int t_max_bc_
Definition uwUFetch_cmn_hdr.h:402
int num_Max_CBEACON_tx_by_HN_
Definition uwUFetch_cmn_hdr.h:404
static int & offset()
Definition uwUFetch_cmn_hdr.h:412
int & t_max_bc()
Definition uwUFetch_cmn_hdr.h:434
int & t_min_bc()
Definition uwUFetch_cmn_hdr.h:423
int & num_Max_CBEACON_tx_by_HN()
Definition uwUFetch_cmn_hdr.h:445
int t_min_bc_
Definition uwUFetch_cmn_hdr.h:400
Definition uwUFetch_cmn_hdr.h:192
int mac_addr_HN_ctsed_
Definition uwUFetch_cmn_hdr.h:195
static int & offset()
Definition uwUFetch_cmn_hdr.h:203
int & mac_addr_HN_ctsed()
Definition uwUFetch_cmn_hdr.h:225
static int offset_
Definition uwUFetch_cmn_hdr.h:197
int num_DATA_pcks_MAX_rx_
Definition uwUFetch_cmn_hdr.h:193
int & num_DATA_pcks_MAX_rx()
Definition uwUFetch_cmn_hdr.h:214
static hdr_CTS_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:231
Definition uwUFetch_cmn_hdr.h:349
static int & offset()
Definition uwUFetch_cmn_hdr.h:362
int num_DATA_pcks_MAX_rx_
Definition uwUFetch_cmn_hdr.h:350
static struct hdr_POLL_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:390
static int offset_
Definition uwUFetch_cmn_hdr.h:356
int & mac_addr_Node_polled()
Definition uwUFetch_cmn_hdr.h:384
int & num_DATA_pcks_MAX_rx()
Definition uwUFetch_cmn_hdr.h:373
int mac_addr_Node_polled_
Definition uwUFetch_cmn_hdr.h:353
Definition uwUFetch_cmn_hdr.h:301
int & n_DATA_pcks_Node_tx()
Definition uwUFetch_cmn_hdr.h:323
int backoff_time_PROBE_
Definition uwUFetch_cmn_hdr.h:304
static int offset_
Definition uwUFetch_cmn_hdr.h:306
int & backoff_time_PROBE()
Definition uwUFetch_cmn_hdr.h:334
int n_DATA_pcks_Node_tx_
Definition uwUFetch_cmn_hdr.h:302
static hdr_PROBE_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:340
static int & offset()
Definition uwUFetch_cmn_hdr.h:312
Definition uwUFetch_cmn_hdr.h:143
static int & offset()
Definition uwUFetch_cmn_hdr.h:155
static int offset_
Definition uwUFetch_cmn_hdr.h:149
int & backoff_time_RTS()
Definition uwUFetch_cmn_hdr.h:177
int num_DATA_pcks_
Definition uwUFetch_cmn_hdr.h:144
int & num_DATA_pcks()
Definition uwUFetch_cmn_hdr.h:166
int backoff_time_RTS_
Definition uwUFetch_cmn_hdr.h:146
static hdr_RTS_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:183
Definition uwUFetch_cmn_hdr.h:81
static int offset_
Definition uwUFetch_cmn_hdr.h:89
int & t_min()
Definition uwUFetch_cmn_hdr.h:106
int & t_max()
Definition uwUFetch_cmn_hdr.h:117
int t_max_
Definition uwUFetch_cmn_hdr.h:84
int & max_pck_want_rx()
Definition uwUFetch_cmn_hdr.h:128
static int & offset()
Definition uwUFetch_cmn_hdr.h:95
int t_min_
Definition uwUFetch_cmn_hdr.h:82
static hdr_TRIGGER_UFETCH * access(const Packet *p)
Definition uwUFetch_cmn_hdr.h:134
int max_pck_want_rx_
Definition uwUFetch_cmn_hdr.h:86
packet_t PT_POLL_UFETCH
Definition initlib.cpp:56
packet_t PT_CBEACON_UFETCH
Definition initlib.cpp:57
packet_t PT_CTS_UFETCH
Definition initlib.cpp:53
packet_t PT_TRIGGER_UFETCH
Definition initlib.cpp:51
packet_t PT_BEACON_UFETCH
Definition initlib.cpp:54
packet_t PT_PROBE_UFETCH
Definition initlib.cpp:55
packet_t PT_RTS_UFETCH
Definition initlib.cpp:52