ITS
GnAddr.h
Go to the documentation of this file.
1 
12 #ifndef GNADDR_H
13 #define GNADDR_H
14 
15 #include <QByteArray>
16 #include <QDataStream>
17 #include <apiNetwork.h>
18 
22 typedef struct sniff_gnAddr_s
23 {
25  quint8 mid[6];
27 
28 class GnAddr
29 {
30 public:
34  enum e_helper
35  {
37  };
38 
39  /* Constructors */
43  GnAddr();
52  GnAddr(quint8 manually, quint8 stationType, quint16 stationCountryCode, quint8 *mid);
58  GnAddr(quint16 mStationTypeStationCountryCode, quint8 *mid);
63  GnAddr(sniff_gnAddr_t gnAddr);
68  GnAddr(QByteArray gnAddr);
73  GnAddr(const GnAddr &other);
74 
79  quint64 extract(uchar* packet);
80 
87  bool operator==(const GnAddr &g2) const;
88 
89  /* API */
94  QByteArray toHex();
95 
96  /* Getters */
101  quint8 manually() const{return (m_StationType_StationCountryCode & 0x8000) >> 15;}
106  quint8 stationType() const{return (m_StationType_StationCountryCode & 0x7C00) >> 10;}
111  quint16 stationCountryCode() const{return m_StationType_StationCountryCode & 0x3FF;}
121  quint8 *mid() {return m_mid;}
126  quint8 mid(int i) const {if(i < 0 || i > 6)return m_mid[0];return m_mid[i];}
127 
128 
129 // /* Setters */
130 // /**
131 // * @brief setMID
132 // * @param m
133 // */
134 // void setMID(quint64 m){for(int i = 5 ; i > -1 ; i--){m_mid[i] = m % 0x100;m >>= 8;}}
135 // void setMID(uchar *m){for(int i = 0 ; i < 6 ; i++)m_mid[i] = m[i];}
136 private:
138  quint8 m_mid[6];
140 };
141 
142 #endif // GNADDR_H
struct sniff_gnAddr_s sniff_gnAddr_t
The sniff_gnAddr_t structure is the C style of the class.
quint8 mid(int i) const
mid MID specific value field getter.
Definition: GnAddr.h:126
quint8 manually() const
manually Manually field getter (1 bit).
Definition: GnAddr.h:101
quint8 m_mid[6]
Definition: GnAddr.h:138
quint16 m_StationType_StationCountryCode
setMID
Definition: GnAddr.h:137
quint8 * mid()
mid MID field getter.
Definition: GnAddr.h:121
e_helper
The e_helper enum is used to help to have sizes.
Definition: GnAddr.h:34
quint16 MStationTypeCountryCode() const
MStationTypeCountryCode Manually StationType CountryCode field getter.
Definition: GnAddr.h:116
quint64 extract(uchar *packet)
extract Fill the GnAddr with values contained in the packet.
Definition: GnAddr.cpp:55
quint16 stationType_StationCountryCode
Definition: GnAddr.h:24
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GnAddr.
Definition: GnAddr.cpp:69
quint16 stationCountryCode() const
stationCountryCode Station Country Code field getter (10 bits).
Definition: GnAddr.h:111
quint8 stationType() const
stationType Station Type field getter (5 bits).
Definition: GnAddr.h:106
Definition: GnAddr.h:28
GnAddr()
GnAddr Default constructor.
Definition: GnAddr.cpp:3
The sniff_gnAddr_t structure is the C style of the class.
Definition: GnAddr.h:22
bool operator==(const GnAddr &g2) const
operator == Overload of the == operator.
Definition: GnAddr.cpp:45
quint8 mid[6]
Definition: GnAddr.h:25