16 #if (BYTE_ORDER == LITTLE_ENDIAN)
43 #if (BYTE_ORDER == LITTLE_ENDIAN)
63 static_assert(
sizeof(
gre_basic_header) == 4,
"gre_basic_header size is not 4 bytes");
76 static_assert(
sizeof(
gre1_header) == 8,
"gre1_header size is not 8 bytes");
91 static_assert(
sizeof(
ppp_pptp_header) == 4,
"ppp_pptp_header size is not 4 bytes");
147 static std::vector<FieldDescriptor>
all()
150 std::initializer_list<FieldDescriptor> extra{
154 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
197 :
Layer(data, dataLen, prevLayer, packet, protocol)
205 GreChecksumOrRouting = 0,
211 uint8_t* getFieldValue(GreField field,
bool returnOffsetEvenIfFieldMissing)
const;
213 void computeCalculateFieldsInner();
301 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen)
321 static std::vector<FieldDescriptor>
all()
325 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
403 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen)
423 static std::vector<FieldDescriptor>
all()
428 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
487 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
506 return "PPP for PPTP Layer";
520 static std::vector<FieldDescriptor>
all()
524 std::copy(extra.begin(), extra.end(), std::back_inserter(result));
Definition: GreLayer.h:221
void serializeLayer(ObjectScope &serializer) const override
std::string toString() const override
bool getChecksum(uint16_t &checksum) const
GREv0Layer()
A constructor that creates a new GREv0 header and allocates the data.
bool setKey(uint32_t key)
gre_basic_header * getGreHeader() const
Definition: GreLayer.h:244
GREv0Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GreLayer.h:228
bool getKey(uint32_t &key) const
bool getOffset(uint16_t &offset) const
void computeCalculateFields() override
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: GreLayer.h:301
bool setChecksum(uint16_t checksum)
Definition: GreLayer.h:351
bool setAcknowledgmentNum(uint32_t ackNum)
void serializeLayer(ObjectScope &serializer) const override
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: GreLayer.h:403
bool getAcknowledgmentNum(uint32_t &ackNum) const
GREv1Layer(uint16_t callID)
void computeCalculateFields() override
bool unsetAcknowledgmentNum()
std::string toString() const override
gre1_header * getGreHeader() const
Definition: GreLayer.h:376
GREv1Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GreLayer.h:358
Definition: GreLayer.h:97
void serializeLayer(ObjectScope &serializer) const override
bool unsetSequenceNumber()
bool getSequenceNumber(uint32_t &seqNumber) const
void parseNextLayer() override
OsiModelLayer getOsiModelLayer() const override
Definition: GreLayer.h:136
bool setSequenceNumber(uint32_t seqNumber)
static ProtocolType getGREVersion(uint8_t *greData, size_t greDataLen)
size_t getHeaderLen() const override
Definition: Serializers.h:230
Definition: GreLayer.h:457
size_t getHeaderLen() const override
Definition: GreLayer.h:495
void computeCalculateFields() override
PPP_PPTPLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GreLayer.h:464
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: GreLayer.h:546
ppp_pptp_header * getPPP_PPTPHeader() const
Definition: GreLayer.h:478
OsiModelLayer getOsiModelLayer() const override
Definition: GreLayer.h:509
std::string toString() const override
Definition: GreLayer.h:504
PPP_PPTPLayer(uint8_t address, uint8_t control)
void parseNextLayer() override
Currently identifies the following next layers: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer.
void serializeLayer(ObjectScope &serializer) const override
uint8_t ProtocolType
Definition: ProtocolType.h:38
const ProtocolType GREv0
GRE version 0 protocol.
Definition: ProtocolType.h:99
const ProtocolType PPP_PPTP
PPP for PPTP protocol.
Definition: ProtocolType.h:108
const ProtocolType GREv1
GRE version 1 protocol.
Definition: ProtocolType.h:102
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:420
@ OsiModelNetworkLayer
Network layer (layer 3)
Definition: ProtocolType.h:426
@ OsiModelSessionLayer
Session layer (layer 5)
Definition: ProtocolType.h:430
Definition: Serializers.h:18
Definition: GreLayer.h:319
static const FieldDescriptor Offset
Routing offset, in host byte order, in bytes (written if routingBit is set)
Definition: GreLayer.h:334
static const FieldDescriptor Key
Key value, in host byte order (written if keyBit is set)
Definition: GreLayer.h:337
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: GreLayer.h:341
static const FieldDescriptor Checksum
Checksum value, in host byte order, written as a hexadecimal string (written if checksumBit is set)
Definition: GreLayer.h:331
static std::vector< FieldDescriptor > all()
Definition: GreLayer.h:321
Definition: GreLayer.h:421
static const FieldDescriptor AcknowledgmentNumber
Acknowledgment sequence number, in host byte order (written if ackSequenceNumBit is set)
Definition: GreLayer.h:442
static const FieldDescriptor AckSequenceNumBit
Acknowledgment number present bit (1 if set, 0 otherwise)
Definition: GreLayer.h:433
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: GreLayer.h:446
static const FieldDescriptor CallID
Peer Call ID for the PPTP session, in host byte order.
Definition: GreLayer.h:439
static std::vector< FieldDescriptor > all()
Definition: GreLayer.h:423
static const FieldDescriptor PayloadLength
Size of the payload not including the GRE header, in bytes and in host byte order.
Definition: GreLayer.h:436
Definition: GreLayer.h:145
static const FieldDescriptor Flags
Reserved flags (bits 8 to 12)
Definition: GreLayer.h:177
static const FieldDescriptor KeyBit
Key present bit (1 if set, 0 otherwise)
Definition: GreLayer.h:165
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: GreLayer.h:190
static const FieldDescriptor StrictSourceRouteBit
Strict source route bit (1 if set, 0 otherwise)
Definition: GreLayer.h:159
static const FieldDescriptor ChecksumBit
Checksum present bit (1 if set, 0 otherwise)
Definition: GreLayer.h:171
static const FieldDescriptor Protocol
Encapsulated protocol EtherType, in host byte order.
Definition: GreLayer.h:183
static const FieldDescriptor Version
GRE protocol version (3 bits: 0 for GREv0, 1 for GREv1)
Definition: GreLayer.h:180
static const FieldDescriptor RecursionControl
Number of additional encapsulations permitted (3-bit counter)
Definition: GreLayer.h:174
static const FieldDescriptor SequenceNumBit
Sequence number present bit (1 if set, 0 otherwise)
Definition: GreLayer.h:162
static std::vector< FieldDescriptor > all()
Definition: GreLayer.h:147
static const FieldDescriptor SequenceNumber
Sequence number, in host byte order (written if sequenceNumBit is set)
Definition: GreLayer.h:186
static const FieldDescriptor RoutingBit
Routing present bit (1 if set, 0 otherwise)
Definition: GreLayer.h:168
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214
static constexpr uint16_t MaxID
Maximum field ID used by the layer.
Definition: Layer.h:229
Definition: GreLayer.h:518
static constexpr uint16_t MaxID
Maximum field ID used by PPP_PPTPLayer.
Definition: GreLayer.h:539
static const FieldDescriptor Control
Control byte.
Definition: GreLayer.h:532
static const FieldDescriptor Address
Broadcast address byte.
Definition: GreLayer.h:529
static const FieldDescriptor Protocol
Protocol type of the next layer, in host byte order.
Definition: GreLayer.h:535
static std::vector< FieldDescriptor > all()
Definition: GreLayer.h:520