11 #ifndef BGP_UPDATE_MSG_H_ 12 #define BGP_UPDATE_MSG_H_ 30 std::vector<Prefix4> withdrawn_routes;
31 std::vector<std::shared_ptr<BgpPathAttrib>> path_attribute;
32 std::vector<Prefix4> nlri;
51 bool setAttribs(
const std::vector<std::shared_ptr<BgpPathAttrib>> &attrs);
92 bool setNlri4(
const std::vector<Prefix4> &routes);
95 bool addNlri4(uint32_t prefix, uint8_t length);
101 bool setWithdrawn6(
const std::vector<Prefix6> &routes);
104 bool setNlri6(
const std::vector<Prefix6> &routes,
const uint8_t nexthop_global[16],
const uint8_t nexthop_linklocal[16]);
106 ssize_t
doPrint(
size_t indent, uint8_t **to,
size_t *buf_sz)
const;
107 ssize_t
parse(
const uint8_t *from,
size_t msg_sz);
108 ssize_t
write(uint8_t *to,
size_t buf_sz)
const;
113 bool validateAttribs();
119 #endif // BGP_UPDATE_MSG_H_ bool setNextHop(uint32_t nexthop)
Set/Create nexthop attribtue.
bool restoreAsPath()
Restore the AS_PATH attribute to four octets ASN flavor.
bool updateAttribute(const BgpPathAttrib &attrib)
Add/Update an attribute.
virtual ssize_t length() const
Get size in bytes required to serialize the object.
bool setWithdrawn4(const std::vector< Prefix4 > &routes)
Set withdrawn routes.
BgpPathAttrib & getAttrib(uint8_t type)
Get mutable reference to attribute by typecode.
ssize_t doPrint(size_t indent, uint8_t **to, size_t *buf_sz) const
Print implementation.
bool setNlri4(const std::vector< Prefix4 > &routes)
Set NLRIs.
bool addWithdrawn4(uint32_t prefix, uint8_t length)
Add withdrawn route.
bool downgradeAggregator()
Downgrade aggregator to two octets.
ssize_t parse(const uint8_t *from, size_t msg_sz)
Deserialize a BGP message body.
bool restoreAggregator()
Restore aggregator attribute from as4_aggregator.
bool prepend(uint32_t asn)
Prepend ASN to AS_PATH and AS4_PATH (if in 2b-mode ans AS4_PATH exists)
The BgpMessage base class.
IPv4 Route/Prefix related utilities.
IPv4 Route/Prefix related utilities.
ssize_t write(uint8_t *to, size_t buf_sz) const
Serialize a BGP message body.
bool dropNonTransitive()
Drop all non-transitive attributes from the update message.
bool dropAttrib(uint8_t type)
Drop (remove) an attribute from the update message.
bool addNlri4(uint32_t prefix, uint8_t length)
Add NLRI route.
bool hasAttrib(uint8_t type) const
Test if update message has an attribute.
BgpUpdateMessage(BgpLogHandler *logger, bool use_4b_asn)
Construct a new Bgp Update Message:: Bgp Update Message object.
bool setAttribs(const std::vector< std::shared_ptr< BgpPathAttrib >> &attrs)
Replace the attributes list with another attribute list.
bool addAttrib(const BgpPathAttrib &attrib)
Add an attribute to the update message.
bool downgradeAsPath()
Downgrade the AS_PATH to two octets flavor.
The BgpUpdateMessage class.