DESERT 4.0.0
packer-common.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 PACKER_COMMON_H
39#define PACKER_COMMON_H
40
41#include "packer.h"
42
43#include <packet.h>
44
45#include <iostream>
46
47#define NUM_FIELDS 22
48
52class packerCOMMON : public packer
53{
54public:
60
66
67private:
95 void init();
103 size_t packMyHdr(Packet *, unsigned char *, size_t);
112 size_t unpackMyHdr(unsigned char *, size_t, Packet *);
117 void printMyHdrMap();
123 void printMyHdrFields(Packet *);
124
125 // Common header fields useful for DESERT
126 size_t PTYPE_Bits;
128 size_t SIZE_Bits;
130 size_t UID_Bits;
132 size_t ERROR_Bits;
138 size_t
141 size_t
146 size_t
149 size_t TXTIME_Bits;
152 // Other common header fields (maybe useful for future usage)
157 size_t iface_Bits;
161 size_t ts_arr_Bits;
177};
178
179#endif
Definition packer-common.h:53
size_t aomdv_salvage_count_Bits
Definition packer-common.h:163
size_t TIMESTAMP_Bits
Definition packer-common.h:134
size_t PREV_HOP_Bits
Definition packer-common.h:139
size_t TXTIME_Bits
Definition packer-common.h:149
size_t xmit_failure_data_Bits
Definition packer-common.h:168
size_t unpackMyHdr(unsigned char *, size_t, Packet *)
Definition packer-common.cpp:251
void printMyHdrFields(Packet *)
Definition packer-common.cpp:454
size_t SIZE_Bits
Definition packer-common.h:128
size_t src_rt_valid_Bits
Definition packer-common.h:159
size_t DIRECTION_Bits
Definition packer-common.h:136
size_t xmit_failure_Bits
Definition packer-common.h:166
size_t ADDR_TYPE_Bits
Definition packer-common.h:144
packerCOMMON()
Definition packer-common.cpp:60
size_t num_forwards_Bits
Definition packer-common.h:173
void printMyHdrMap()
Definition packer-common.cpp:375
size_t ERROR_Bits
Definition packer-common.h:132
~packerCOMMON()
Definition packer-common.cpp:145
size_t xmit_reason_Bits
Definition packer-common.h:171
size_t fecsize_Bits
Definition packer-common.h:155
nbits_index
Definition packer-common.h:68
@ PTYPE
Definition packer-common.h:69
@ DIRECTION
Definition packer-common.h:74
@ PREV_HOP
Definition packer-common.h:75
@ opt_num_forwards_
Definition packer-common.h:90
@ ts_arr_
Definition packer-common.h:84
@ ERROR
Definition packer-common.h:72
@ errbitcnt_
Definition packer-common.h:80
@ UID
Definition packer-common.h:71
@ TXTIME
Definition packer-common.h:79
@ TIMESTAMP
Definition packer-common.h:73
@ num_forwards_
Definition packer-common.h:89
@ src_rt_valid
Definition packer-common.h:83
@ ADDR_TYPE
Definition packer-common.h:77
@ xmit_failure_
Definition packer-common.h:86
@ LAST_HOP
Definition packer-common.h:78
@ iface_
Definition packer-common.h:82
@ xmit_failure_data_
Definition packer-common.h:87
@ xmit_reason_
Definition packer-common.h:88
@ NEXT_HOP
Definition packer-common.h:76
@ SIZE
Definition packer-common.h:70
@ fecsize_
Definition packer-common.h:81
@ aomdv_salvage_count_
Definition packer-common.h:85
size_t packMyHdr(Packet *, unsigned char *, size_t)
Definition packer-common.cpp:185
size_t NEXT_HOP_Bits
Definition packer-common.h:142
size_t UID_Bits
Definition packer-common.h:130
size_t ts_arr_Bits
Definition packer-common.h:161
void init()
Definition packer-common.cpp:150
size_t LAST_HOP_Bits
Definition packer-common.h:147
size_t PTYPE_Bits
Definition packer-common.h:126
size_t iface_Bits
Definition packer-common.h:157
size_t opt_num_forwards_Bits
Definition packer-common.h:175
size_t errbitcnt_Bits
Definition packer-common.h:153
Definition packer.h:57
Header of the class responsible to map an NS-Miracle packet into a bit stream, and vice-versa.