PcapPlusPlus
20.08
|
#include <BgpLayer.h>
Classes | |
struct | bgp_notification_message |
Public Member Functions | |
BgpNotificationMessageLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
BgpNotificationMessageLayer (uint8_t errorCode, uint8_t errorSubCode) | |
BgpNotificationMessageLayer (uint8_t errorCode, uint8_t errorSubCode, const uint8_t *notificationData, size_t notificationDataLen) | |
BgpNotificationMessageLayer (uint8_t errorCode, uint8_t errorSubCode, const std::string ¬ificationData) | |
bgp_notification_message * | getNotificationMsgHeader () const |
size_t | getNotificationDataLen () const |
uint8_t * | getNotificationData () const |
std::string | getNotificationDataAsHexString () const |
bool | setNotificationData (const uint8_t *newNotificationData, size_t newNotificationDataLen) |
bool | setNotificationData (const std::string &newNotificationDataAsHexString) |
BgpMessageType | getBgpMessageType () const |
Public Member Functions inherited from pcpp::BgpLayer | |
std::string | getMessageTypeAsString () const |
size_t | getHeaderLen () const |
void | parseNextLayer () |
std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
void | computeCalculateFields () |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
Additional Inherited Members | |
Public Types inherited from pcpp::BgpLayer | |
enum | BgpMessageType { Open = 1, Update = 2, Notification = 3, Keepalive = 4, RouteRefresh = 5 } |
Static Public Member Functions inherited from pcpp::BgpLayer | |
static bool | isBgpPort (uint16_t portSrc, uint16_t portDst) |
static BgpLayer * | parseBgpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) |
Represents a BGP v4 NOTIFICATION message
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[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 |
pcpp::BgpNotificationMessageLayer::BgpNotificationMessageLayer | ( | uint8_t | errorCode, |
uint8_t | errorSubCode | ||
) |
A c'tor that creates a new BGP NOTIFICATION message
[in] | errorCode | BGP notification error code |
[in] | errorSubCode | BGP notification error sub code |
pcpp::BgpNotificationMessageLayer::BgpNotificationMessageLayer | ( | uint8_t | errorCode, |
uint8_t | errorSubCode, | ||
const uint8_t * | notificationData, | ||
size_t | notificationDataLen | ||
) |
A c'tor that creates a new BGP Notification message
[in] | errorCode | BGP notification error code |
[in] | errorSubCode | BGP notification error sub code |
[in] | notificationData | A byte array that contains the notification data |
[in] | notificationDataLen | The size of the byte array that contains the notification data |
pcpp::BgpNotificationMessageLayer::BgpNotificationMessageLayer | ( | uint8_t | errorCode, |
uint8_t | errorSubCode, | ||
const std::string & | notificationData | ||
) |
A c'tor that creates a new BGP Notification message
[in] | errorCode | BGP notification error code |
[in] | errorSubCode | BGP notification error sub code |
[in] | notificationData | A hex string that contains the notification data. This string will be converted to a byte array that will be added to the message. If the input isn't a valid hex string notification data will remain empty and an error will be printed to log |
|
inlinevirtual |
Implements pcpp::BgpLayer.
uint8_t* pcpp::BgpNotificationMessageLayer::getNotificationData | ( | ) | const |
std::string pcpp::BgpNotificationMessageLayer::getNotificationDataAsHexString | ( | ) | const |
size_t pcpp::BgpNotificationMessageLayer::getNotificationDataLen | ( | ) | const |
|
inline |
Get a pointer to the notification message data. Notice this points directly to the data, so any change will modify the actual packet data
bool pcpp::BgpNotificationMessageLayer::setNotificationData | ( | const std::string & | newNotificationDataAsHexString | ) |
Set the notification data. This method will extend or shorten the existing layer to include the new notification data. If newNotificationDataAsHexString is an empty string then notification data will be set to none.
[in] | newNotificationDataAsHexString | A hex string representing the new notification data. If the string is not a valid hex string no data will be changed and an error will be returned |
bool pcpp::BgpNotificationMessageLayer::setNotificationData | ( | const uint8_t * | newNotificationData, |
size_t | newNotificationDataLen | ||
) |
Set the notification data. This method will extend or shorten the existing layer to include the new notification data. If newNotificationData is NULL or newNotificationDataLen is zero then notification data will be set to none.
[in] | newNotificationData | A byte array containing the new notification data |
[in] | newNotificationDataLen | The size of the byte array |