|
xorp
|
Public Types | |
| enum | Flags { Optional = 0x80, Transitive = 0x40, Partial = 0x20, Extended = 0x10, ValidFlags = 0xf0, NoFlags = 0 } |
Public Member Functions | |
| virtual PathAttribute * | clone () const =0 |
| Make a copy of the current attribute. | |
| virtual bool | encode (uint8_t *buf, size_t &length, const BGPPeerData *peerdata) const =0 |
| encode a path attribute. | |
| size_t | header_size () const |
| PathAttType | type () const |
| Flags | flags () const |
| void | set_partial () |
| Set the partial flag. | |
| bool | operator< (const PathAttribute &him) const |
| comparison operators are used to sort attributes. | |
| bool | operator== (const PathAttribute &him) const |
| void | add_hash (MD5_CTX *context) const |
| compute the hash for this object. | |
| virtual string | str () const |
| We need to encode an attribute to send to a peer. | |
| void | pretty_print () |
| bool | optional () const |
| bool | transitive () const |
| bool | partial () const |
| bool | extended () const |
| bool | well_known () const |
Static Public Member Functions | |
| static PathAttribute * | create (const uint8_t *d, uint16_t max_len, size_t &actual_length, const BGPPeerData *peerdata, uint32_t ip_version) throw (CorruptMessage) |
| main routine to create a PathAttribute from incoming data. | |
Protected Member Functions | |
| int | sorttype () const |
| sorttype() is only used in sorting a path attribute list. | |
| PathAttribute (Flags f, PathAttType t) | |
| helper constructor used when creating an object from a derived class. | |
| PathAttribute (const uint8_t *d) | |
| basic constructor from data, assumes that the block has at least the required size. | |
| uint8_t * | set_header (uint8_t *data, size_t payload_size, size_t &wire_size) const |
| helper function to fill the header. | |
| const uint8_t * | payload (const uint8_t *d) |
Static Protected Member Functions | |
| static size_t | length (const uint8_t *d) |
| fetch the length from the header. | |
| static size_t | total_tlv_length (const uint8_t *d) |
| Total length including the header. | |
Protected Attributes | |
| uint8_t | _flags |
| uint8_t | _type |
| virtual PathAttribute* PathAttribute::clone | ( | ) | const [pure virtual] |
Make a copy of the current attribute.
The derived class should use new to generate a copy of itself. The wire format representation will not be used by the caller.
Implemented in AnyAttribute, OriginAttribute, ASPathAttribute, AS4PathAttribute, NextHopAttribute< A >, MEDAttribute, LocalPrefAttribute, AtomicAggAttribute, AggregatorAttribute, AS4AggregatorAttribute, CommunityAttribute, OriginatorIDAttribute, ClusterListAttribute, MPReachNLRIAttribute< A >, MPUNReachNLRIAttribute< A >, and UnknownAttribute.
| PathAttribute * PathAttribute::create | ( | const uint8_t * | d, |
| uint16_t | max_len, | ||
| size_t & | actual_length, | ||
| const BGPPeerData * | peerdata, | ||
| uint32_t | ip_version | ||
| ) | throw (CorruptMessage) [static] |
main routine to create a PathAttribute from incoming data.
Takes a chunk of memory of size l, returns an object of the appropriate type and actual_length is the number of bytes used from the packet. Throws an exception on error.
| bool PathAttribute::encode | ( | uint8_t * | buf, |
| size_t & | wire_size, | ||
| const BGPPeerData * | peerdata | ||
| ) | const [pure virtual] |
encode a path attribute.
In a sane world, we'd use a virtual function for this. But we store so many path attributes that we can't afford the overhead of a virtual function table for them, so we have to do this the hard way
XXX THE ABOVE IS NO LONGER THE CASE. WE SHOULD REWRITE THIS TO USE VIRTUAL FUNCTIONS
Implemented in AnyAttribute, OriginAttribute, ASPathAttribute, AS4PathAttribute, NextHopAttribute< A >, MEDAttribute, LocalPrefAttribute, AtomicAggAttribute, AggregatorAttribute, AS4AggregatorAttribute, CommunityAttribute, OriginatorIDAttribute, ClusterListAttribute, MPReachNLRIAttribute< A >, MPUNReachNLRIAttribute< A >, UnknownAttribute, MPReachNLRIAttribute< A >, MPReachNLRIAttribute< A >, MPUNReachNLRIAttribute< A >, and MPUNReachNLRIAttribute< A >.
| static size_t PathAttribute::length | ( | const uint8_t * | d | ) | [inline, static, protected] |
| bool PathAttribute::operator< | ( | const PathAttribute & | him | ) | const |
| uint8_t * PathAttribute::set_header | ( | uint8_t * | data, |
| size_t | payload_size, | ||
| size_t & | wire_size | ||
| ) | const [protected] |
| int PathAttribute::sorttype | ( | ) | const [inline, protected] |
sorttype() is only used in sorting a path attribute list.
It is different from PathAttType because we want to sort the path attribute list on NextHop for less expensive processing when the IGP information for a nexthop changes. So we give priority to NEXT_HOP and keep other values unchanged.
| string PathAttribute::str | ( | ) | const [virtual] |
We need to encode an attribute to send to a peer.
However we only have the canonically encoded byte stream data for it. Sometimes that is fine, and we should just send that; sometimes we need to decode and re-encode for this specific peer.
Reimplemented in OriginAttribute, ASPathAttribute, AS4PathAttribute, NextHopAttribute< A >, MEDAttribute, LocalPrefAttribute, AtomicAggAttribute, AggregatorAttribute, AS4AggregatorAttribute, CommunityAttribute, OriginatorIDAttribute, ClusterListAttribute, MPReachNLRIAttribute< A >, MPUNReachNLRIAttribute< A >, and UnknownAttribute.
| static size_t PathAttribute::total_tlv_length | ( | const uint8_t * | d | ) | [inline, static, protected] |