ITS
CommonHeader.h
Go to the documentation of this file.
1 
18 #ifndef COMMONHEADER_H
19 #define COMMONHEADER_H
20 
21 #include <api.h>
22 #include <QByteArray>
23 #include <QDataStream>
24 #include <TrafficClass.h>
25 
29 typedef struct sniff_commonHeader_s
30 {
31  quint8 nextHeader;
34  quint8 flags;
35  quint16 payloadLength;
37  quint8 reserved;
39 
41 {
42 public:
46  enum e_helper
47  {
49  };
50 
55  {
60  };
61 
66  {
74  };
79  {
81  };
86  {
88  };
93  {
95  };
100  {
104  };
109  {
113  };
118  {
121  };
126  {
129  };
130 
131  /* Constructors */
135  CommonHeader();
162  CommonHeader(const CommonHeader& other);
163 
169 
170  /* API */
175  QByteArray toHex();
176 
177  /* Getters */
182  quint8 nextHeader() const {return m_nextHeader;}
188 
193  quint8 headerType() const {return (m_headerType_HeaderSubType & 0xF0) >> 4;}
198  quint8 headerSubType() const {return (m_headerType_HeaderSubType & 0xF);}
208  quint8 flags() const {return m_flags;}
213  quint8 itsGnIsMobile() const {return m_flags >> 7;}
218  quint16 payloadLength() const {return m_payloadLength;}
223  quint8 maximumHopLimit() const {return m_maximumHopLimit;}
224 
225 private:
226  quint8 m_nextHeader;
229  quint8 m_flags;
232  quint8 m_reserved;
233 };
234 
235 #endif // COMMONHEADER_H
Usefull functions and declarations.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the CommonHeader.
TrafficClass m_trafficClass
Definition: CommonHeader.h:228
quint8 m_nextHeader
Definition: CommonHeader.h:226
e_headerSubTypeAny
The e_headerSubTypeAny enum defines the Header sub-type values of ANY type.
Definition: CommonHeader.h:78
quint8 m_flags
Definition: CommonHeader.h:229
quint8 m_headerType_HeaderSubType
Definition: CommonHeader.h:227
quint8 itsGnIsMobile() const
itsGnIsMobile First bit of flags field getter.
Definition: CommonHeader.h:213
quint8 m_maximumHopLimit
Definition: CommonHeader.h:231
quint16 payloadLength() const
payloadLength Payload length field getter.
Definition: CommonHeader.h:218
quint8 headerType_HeaderSubType
Definition: CommonHeader.h:32
The sniff_trafficClass_t structure is a C style version of the TrafficClass.
Definition: TrafficClass.h:23
e_headerType
The e_headerType enum defines the Header type values.
Definition: CommonHeader.h:65
e_headerSubTypeGeoUnicast
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:92
quint8 headerType() const
headerType Header field getter.
Definition: CommonHeader.h:193
e_headerSubTypeBeacon
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:85
TrafficClass definition.
quint8 m_reserved
Definition: CommonHeader.h:232
e_upperProtocolEntity
The e_upperProtocolEntity enum defines the Next header values.
Definition: CommonHeader.h:54
TrafficClass trafficClass() const
trafficClass Traffic class field getter.
Definition: CommonHeader.h:203
quint8 flags() const
flags Flags field getter.
Definition: CommonHeader.h:208
quint16 m_payloadLength
Definition: CommonHeader.h:230
e_headerSubTypeGeoBroadcast
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:108
sniff_trafficClass_t trafficClass
Definition: CommonHeader.h:33
CommonHeader()
CommonHeader Default constructor.
Definition: CommonHeader.cpp:3
quint8 headerSubType() const
headerSubType Header sub-type field getter.
Definition: CommonHeader.h:198
e_headerSubTypeLocationService
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:125
e_helper
The e_helper enum is used to help to have sizes.
Definition: CommonHeader.h:46
quint8 nextHeader() const
nextHeader Next header field getter.
Definition: CommonHeader.h:182
The sniff_commonHeader_t is a C version of the class.
Definition: CommonHeader.h:29
quint8 maximumHopLimit() const
maximumHopLimit Maximum hop limit field getter.
Definition: CommonHeader.h:223
e_headerSubTypeTopologicallyScopedBroadcast
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:117
quint8 headerType_HeaderSubType() const
headerType_HeaderSubType Header type + header sub-type fields getter.
Definition: CommonHeader.h:187
e_headerSubTypeGeoAnycast
The e_headerSubTypeAny enum defines the Header sub-type values of Beacon type.
Definition: CommonHeader.h:99
struct sniff_commonHeader_s sniff_commonHeader_t
The sniff_commonHeader_t is a C version of the class.