PcapPlusPlus
|
#include <PPPoELayer.h>
Classes | |
struct | PPPoETag |
Public Types | |
enum | PPPoETagTypes { PPPOE_TAG_EOL = 0x0000, PPPOE_TAG_SVC_NAME = 0x0101, PPPOE_TAG_AC_NAME = 0x0102, PPPOE_TAG_HOST_UNIQ = 0x0103, PPPOE_TAG_AC_COOKIE = 0x0104, PPPOE_TAG_VENDOR = 0x0105, PPPOE_TAG_CREDITS = 0x0106, PPPOE_TAG_METRICS = 0x0107, PPPOE_TAG_SEQ_NUM = 0x0108, PPPOE_TAG_CRED_SCALE = 0x0109, PPPOE_TAG_RELAY_ID = 0x0110, PPPOE_TAG_HURL = 0x0111, PPPOE_TAG_MOTM = 0x0112, PPPOE_TAG_MAX_PAYLD = 0x0120, PPPOE_TAG_IP_RT_ADD = 0x0121, PPPOE_TAG_SVC_ERR = 0x0201, PPPOE_TAG_AC_ERR = 0x0202, PPPOE_TAG_GENERIC_ERR = 0x0203 } |
Public Types inherited from pcpp::PPPoELayer | |
enum | PPPoECode { PPPOE_CODE_SESSION = 0x00, PPPOE_CODE_PADO = 0x07, PPPOE_CODE_PADI = 0x09, PPPOE_CODE_PADG = 0x0a, PPPOE_CODE_PADC = 0x0b, PPPOE_CODE_PADQ = 0x0c, PPPOE_CODE_PADR = 0x19, PPPOE_CODE_PADS = 0x65, PPPOE_CODE_PADT = 0xa7, PPPOE_CODE_PADM = 0xd3, PPPOE_CODE_PADN = 0xd4 } |
Public Member Functions | |
PPPoEDiscoveryLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
PPPoEDiscoveryLayer (uint8_t version, uint8_t type, PPPoELayer::PPPoECode code, uint16_t sessionId) | |
PPPoEDiscoveryLayer (const PPPoEDiscoveryLayer &other) | |
PPPoETag * | getTag (PPPoEDiscoveryLayer::PPPoETagTypes tagType) |
PPPoETag * | getFirstTag () |
PPPoETag * | getNextTag (PPPoETag *tag) |
int | getTagCount () |
PPPoETag * | addTag (PPPoETagTypes tagType, uint16_t tagLength, const uint8_t *tagData) |
PPPoETag * | addTagAfter (PPPoETagTypes tagType, uint16_t tagLength, const uint8_t *tagData, PPPoETag *prevTag) |
bool | removeTag (PPPoEDiscoveryLayer::PPPoETagTypes tagType) |
bool | removeAllTags () |
virtual void | parseNextLayer () |
virtual size_t | getHeaderLen () |
virtual std::string | toString () |
Public Member Functions inherited from pcpp::PPPoELayer | |
pppoe_header * | getPPPoEHeader () |
virtual void | computeCalculateFields () |
OsiModelLayer | getOsiModelLayer () |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () |
Layer * | getPrevLayer () |
ProtocolType | getProtocol () |
uint8_t * | getData () |
size_t | getDataLen () |
uint8_t * | getLayerPayload () |
size_t | getLayerPayloadSize () |
bool | isAllocatedToPacket () |
void | copyData (uint8_t *toArr) |
uint8_t * | getDataPtr (size_t offset=0) |
Describes the PPPoE discovery protocol
PPPoE tag types
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data (will be casted to pppoe_header) |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
|
inline |
A constructor that allocates a new PPPoE Discovery header with version, type, PPPoE code and session ID
[in] | version | PPPoE version |
[in] | type | PPPoE type |
[in] | code | PPPoE code enum |
[in] | sessionId | PPPoE session ID |
|
inline |
A copy constructor that copies the entire header from the other PPPoEDiscoveryLayer
PPPoETag* pcpp::PPPoEDiscoveryLayer::addTag | ( | PPPoETagTypes | tagType, |
uint16_t | tagLength, | ||
const uint8_t * | tagData | ||
) |
Add a new tag at the end of the layer (after the last tag)
[in] | tagType | The type of the added tag |
[in] | tagLength | The length of the tag data |
[in] | tagData | A pointer to the tag data. This data will be copied to added tag data. Notice the length of tagData must be tagLength |
PPPoETag* pcpp::PPPoEDiscoveryLayer::addTagAfter | ( | PPPoETagTypes | tagType, |
uint16_t | tagLength, | ||
const uint8_t * | tagData, | ||
PPPoETag * | prevTag | ||
) |
Add a new tag after an existing tag
[in] | tagType | The type of the added tag |
[in] | tagLength | The length of the tag data |
[in] | tagData | A pointer to the tag data. This data will be copied to added tag data. Notice the length of tagData must be tagLength |
[in] | prevTag | The tag which the new added tag will come after |
PPPoETag* pcpp::PPPoEDiscoveryLayer::getFirstTag | ( | ) |
|
virtual |
Implements pcpp::Layer.
Get the tag which come next to "tag" parameter. If "tag" is NULL or then NULL will be returned. If "tag" is the last tag NULL will be returned. Notice the return value is a pointer to the real data casted to PPPoETag type (as opposed to a copy of the tag data). So changes in the return value will affect the packet data
[in] | tag | The tag to start search |
PPPoETag* pcpp::PPPoEDiscoveryLayer::getTag | ( | PPPoEDiscoveryLayer::PPPoETagTypes | tagType | ) |
Retrieve a PPPoE tag by tag type. If packet consists of multiple tags of the same type, the first tag will be returned. If packet contains no tags of the tag type NULL will be returned. Notice the return value is a pointer to the real data casted to PPPoETag type (as opposed to a copy of the tag data). So changes in the return value will affect the packet data
[in] | tagType | The type of the tag to search |
int pcpp::PPPoEDiscoveryLayer::getTagCount | ( | ) |
|
inlinevirtual |
Does nothing for this layer (PPPoE discovery is always the last layer)
Implements pcpp::Layer.
bool pcpp::PPPoEDiscoveryLayer::removeAllTags | ( | ) |
Remove all tags in this layer
bool pcpp::PPPoEDiscoveryLayer::removeTag | ( | PPPoEDiscoveryLayer::PPPoETagTypes | tagType | ) |
Remove an existing tag. Tag will be found by the tag type
[in] | tagType | The tag type to remove |
|
inlinevirtual |
Implements pcpp::Layer.