ITS
LSRequestPacket.cpp
Go to the documentation of this file.
1 #include "LSRequestPacket.h"
2 
4 {
5 }
6 
7 LSRequestPacket::LSRequestPacket(quint16 sequenceNumber, LongPositionVector lpv, GnAddr destination)
8 {
10  m_reserved = 0;
11  m_soPv = lpv;
13 }
14 
16 {
17  this->m_sequenceNumber = other.m_sequenceNumber;
18  this->m_reserved = other.m_reserved;
19  this->m_soPv = other.m_soPv;
20  this->m_destination = other.m_destination;
21 }
22 
24 {
25 }
26 
27 quint64 LSRequestPacket::extract(uchar* packet)
28 {
29  quint64 offset = 0;
30 
31  offset += get_UINT16(packet + offset, &m_sequenceNumber);
32  offset += get_UINT16(packet + offset, &m_reserved);
33  offset += m_soPv.extract(packet + offset);
34  offset += m_destination.extract(packet + offset);
35 
36  return offset;
37 }
38 
40 {
41  QByteArray hex;
42  QDataStream ds(&hex, QIODevice::WriteOnly);
43 
44  ds << m_sequenceNumber;
45  ds << m_reserved;
46  ds.writeRawData(m_soPv.toHex().data(), LongPositionVector::helper_size);
47  ds.writeRawData(m_destination.toHex().data(), GnAddr::helper_size);
48 
49  return hex;
50 }
LSRequestPacket()
LSRequestPacket LSRequestPacket constructor.
LongPositionVector m_soPv
Definition: TSBPacket.h:83
LSRequest Packet structure.
~LSRequestPacket()
~LSRequestPacket LSRequestPacket destructor.
quint64 extract(uchar *packet)
extract Fill the LongPositionVector with values contained in the packet
quint64 extract(uchar *packet)
extract Fill the GnAddr with values contained in the packet.
Definition: GnAddr.cpp:55
quint64 extract(uchar *packet)
extract Extract GBC from packet.
quint16 m_reserved
Definition: TSBPacket.h:82
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GnAddr.
Definition: GnAddr.cpp:69
quint16 sequenceNumber() const
sequenceNumber TSB sequence number getter.
Definition: TSBPacket.h:68
quint64 get_UINT16(u_char *field, quint16 *uint16)
get_INT64 Extract an integer encoded in 64 bits from a byte array.
Definition: apiNetwork.cpp:69
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the LongPositionVector.
Definition: GnAddr.h:28
quint16 m_sequenceNumber
Definition: TSBPacket.h:81
GnAddr destination()
destination Request GN_ADDR getter.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.