PcapPlusPlus
22.05
|
#include <BgpLayer.h>
Classes | |
struct | bgp_open_message |
struct | optional_parameter |
Public Member Functions | |
BgpOpenMessageLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
BgpOpenMessageLayer (uint16_t myAutonomousSystem, uint16_t holdTime, const IPv4Address &bgpId, const std::vector< optional_parameter > &optionalParams=std::vector< optional_parameter >()) | |
bgp_open_message * | getOpenMsgHeader () const |
IPv4Address | getBgpId () const |
void | setBgpId (const IPv4Address &newBgpId) |
void | getOptionalParameters (std::vector< optional_parameter > &optionalParameters) |
size_t | getOptionalParametersLength () |
bool | setOptionalParameters (const std::vector< optional_parameter > &optionalParameters) |
bool | clearOptionalParameters () |
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 OPEN 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::BgpOpenMessageLayer::BgpOpenMessageLayer | ( | uint16_t | myAutonomousSystem, |
uint16_t | holdTime, | ||
const IPv4Address & | bgpId, | ||
const std::vector< optional_parameter > & | optionalParams = std::vector< optional_parameter >() |
||
) |
A c'tor that creates a new BGP OPEN message
[in] | myAutonomousSystem | The Autonomous System number of the sender |
[in] | holdTime | The number of seconds the sender proposes for the value of the Hold Timer |
[in] | bgpId | The BGP Identifier of the sender |
[in] | optionalParams | A vector of optional parameters. This parameter is optional and if not provided no parameters will be set on the message |
bool pcpp::BgpOpenMessageLayer::clearOptionalParameters | ( | ) |
Clear all optional parameters currently in the message. This is equivalent to calling setOptionalParameters() with an empty vector as a parameter
|
inline |
|
inlinevirtual |
Implements pcpp::BgpLayer.
|
inline |
Get a pointer to the open message data. Notice this points directly to the data, so any change will modify the actual packet data
void pcpp::BgpOpenMessageLayer::getOptionalParameters | ( | std::vector< optional_parameter > & | optionalParameters | ) |
Get a vector of the optional parameters in the message
[out] | optionalParameters | The vector where the optional parameters will be written to. This method doesn't remove any existing data on this vector before pushing data to it |
size_t pcpp::BgpOpenMessageLayer::getOptionalParametersLength | ( | ) |
void pcpp::BgpOpenMessageLayer::setBgpId | ( | const IPv4Address & | newBgpId | ) |
Set the BGP identifier
[in] | newBgpId | BGP identifier to set. If value is not a valid IPv4 address it won't be set |
bool pcpp::BgpOpenMessageLayer::setOptionalParameters | ( | const std::vector< optional_parameter > & | optionalParameters | ) |
Set optional parameters in the message. This method will override all existing optional parameters currently in the message. If the input is an empty vector all optional parameters will be cleared. This method automatically sets the bgp_common_header::length and the bgp_open_message::optionalParameterLength fields on the message
[in] | optionalParameters | A vector of new optional parameters to set in the message |