PcapPlusPlus
20.08
|
#include <BgpLayer.h>
Classes | |
struct | path_attribute |
struct | prefix_and_ip |
Public Member Functions | |
BgpUpdateMessageLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
BgpUpdateMessageLayer (const std::vector< prefix_and_ip > &withdrawnRoutes=std::vector< prefix_and_ip >(), const std::vector< path_attribute > &pathAttributes=std::vector< path_attribute >(), const std::vector< prefix_and_ip > &nlri=std::vector< prefix_and_ip >()) | |
bgp_common_header * | getBasicMsgHeader () const |
size_t | getWithdrawnRoutesLength () const |
void | getWithdrawnRoutes (std::vector< prefix_and_ip > &withdrawnRoutes) |
bool | setWithdrawnRoutes (const std::vector< prefix_and_ip > &withdrawnRoutes) |
bool | clearWithdrawnRoutes () |
size_t | getPathAttributesLength () const |
void | getPathAttributes (std::vector< path_attribute > &pathAttributes) |
bool | setPathAttributes (const std::vector< path_attribute > &pathAttributes) |
bool | clearPathAttributes () |
size_t | getNetworkLayerReachabilityInfoLength () const |
void | getNetworkLayerReachabilityInfo (std::vector< prefix_and_ip > &nlri) |
bool | setNetworkLayerReachabilityInfo (const std::vector< prefix_and_ip > &nlri) |
bool | clearNetworkLayerReachabilityInfo () |
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 UPDATE 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::BgpUpdateMessageLayer::BgpUpdateMessageLayer | ( | const std::vector< prefix_and_ip > & | withdrawnRoutes = std::vector< prefix_and_ip >() , |
const std::vector< path_attribute > & | pathAttributes = std::vector< path_attribute >() , |
||
const std::vector< prefix_and_ip > & | nlri = std::vector< prefix_and_ip >() |
||
) |
A c'tor that creates a new BGP UPDATE message
[in] | withdrawnRoutes | A vector of withdrawn routes data. If left empty (which is the default value) no withdrawn route information will be written to the message |
[in] | pathAttributes | A vector of path attributes data. If left empty (which is the default value) no path attribute information will be written to the message |
[in] | nlri | A vector of network layer reachability data. If left empty (which is the default value) no reachability information will be written to the message |
bool pcpp::BgpUpdateMessageLayer::clearNetworkLayerReachabilityInfo | ( | ) |
Clear all NLRI data currently in the message. This is equivalent to calling setNetworkLayerReachabilityInfo() with an empty vector as a parameter
bool pcpp::BgpUpdateMessageLayer::clearPathAttributes | ( | ) |
Clear all Path Attributes data currently in the message. This is equivalent to calling setPathAttributes() with an empty vector as a parameter
bool pcpp::BgpUpdateMessageLayer::clearWithdrawnRoutes | ( | ) |
Clear all Withdrawn Routes data currently in the message. This is equivalent to calling setWithdrawnRoutes() with an empty vector as a parameter
|
inline |
Get a pointer to the basic BGP message data. Notice this points directly to the data, so any change will modify the actual packet data
|
inlinevirtual |
Implements pcpp::BgpLayer.
void pcpp::BgpUpdateMessageLayer::getNetworkLayerReachabilityInfo | ( | std::vector< prefix_and_ip > & | nlri | ) |
Get a vector of the Network Layer Reachability Info currently in the message
[out] | nlri | A reference to a vector the NLRI data will be written to |
size_t pcpp::BgpUpdateMessageLayer::getNetworkLayerReachabilityInfoLength | ( | ) | const |
void pcpp::BgpUpdateMessageLayer::getPathAttributes | ( | std::vector< path_attribute > & | pathAttributes | ) |
Get a vector of the Path Attributes currently in the message
[out] | pathAttributes | A reference to a vector the Path Attributes data will be written to |
size_t pcpp::BgpUpdateMessageLayer::getPathAttributesLength | ( | ) | const |
void pcpp::BgpUpdateMessageLayer::getWithdrawnRoutes | ( | std::vector< prefix_and_ip > & | withdrawnRoutes | ) |
Get a vector of the Withdrawn Routes currently in the message
[out] | withdrawnRoutes | A reference to a vector the Withdrawn Routes data will be written to |
size_t pcpp::BgpUpdateMessageLayer::getWithdrawnRoutesLength | ( | ) | const |
bool pcpp::BgpUpdateMessageLayer::setNetworkLayerReachabilityInfo | ( | const std::vector< prefix_and_ip > & | nlri | ) |
Set NLRI data in this message. This method will override any existing NLRI data in the message. If the input is an empty vector all NLRI data will be removed. This method autmatically sets the bgp_common_header::length field in the message
[in] | nlri | New NLRI data to set in the message |
bool pcpp::BgpUpdateMessageLayer::setPathAttributes | ( | const std::vector< path_attribute > & | pathAttributes | ) |
Set Path Attributes in this message. This method will override any existing Path Attributes in the message. If the input is an empty vector all Path Attributes will be removed. This method autmatically sets the bgp_common_header::length and the Path Attributes length fields in the message
[in] | pathAttributes | New Path Attributes to set in the message |
bool pcpp::BgpUpdateMessageLayer::setWithdrawnRoutes | ( | const std::vector< prefix_and_ip > & | withdrawnRoutes | ) |
Set Withdrawn Routes in this message. This method will override any existing Withdrawn Routes in the message. If the input is an empty vector all Withdrawn Routes will be removed. This method autmatically sets the bgp_common_header::length and the Withdrawn Routes length fields in the message
[in] | withdrawnRoutes | New Withdrawn Routes to set in the message |