enum Flags { Optional = 0x80, Transitive = 0x40, Partial = 0x20, Extended = 0x10, ValidFlags = 0xf0, NoFlags = 0 } | Flags |
PathAttribute * create (const uint8_t* d, uint16_t max_len,
size_t& actual_length,
const BGPPeerData* peerdata)
throw(CorruptMessage) | create |
[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.
PathAttribute * clone ()
| 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.
~PathAttribute ()
| ~PathAttribute |
[virtual]
bool encode (uint8_t* buf, size_t &length, const BGPPeerData* peerdata)
| encode |
[const pure virtual]
size_t header_size ()
| header_size |
[const]
Returns: the size of the header.
PathAttType type ()
| type |
[const]
Returns: the type of the attribute
Flags flags ()
| flags |
[const]
Returns: the flags for the attribute
void set_partial ()
| set_partial |
bool operator< (const PathAttribute& him)
| operator< |
[const]
comparison operators are used to sort attributes. Right now the sort order is based on the type, size() and payload representation.
bool operator== (const PathAttribute& him)
| operator== |
[const]
void add_hash (MD5_CTX *context)
| add_hash |
[const]
compute the hash for this object.
string str ()
| str |
[const virtual]
void pretty_print ()
| pretty_print |
bool optional ()
| optional |
[const]
bool transitive ()
| transitive |
[const]
bool partial ()
| partial |
[const]
bool extended ()
| extended |
[const]
bool well_known ()
| well_known |
[const]
int sorttype ()
| sorttype |
[protected const]
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.
PathAttribute (Flags f, PathAttType t)
| PathAttribute |
[protected]
helper constructor used when creating an object from a derived class.
PathAttribute (const uint8_t *d)
| PathAttribute |
[protected]
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)
| set_header |
[protected const]
helper function to fill the header. Needs _flags and _type properly initialized. Writes into data buffer, and returns pointer to first byte of buffer after the header.
size_t length (const uint8_t* d)
| length |
[protected static]
fetch the length from the header. Assume the header is there.
size_t total_tlv_length (const uint8_t* d)
| total_tlv_length |
[protected static]
Total length including the header. Used to send the whole TLV back when an error has been detected.
const uint8_t * payload (const uint8_t *d)
| payload |
[protected]
size_t _size | _size |
[protected]
uint8_t * _data | _data |
[protected]
uint8_t _flags | _flags |
[protected]
uint8_t _type | _type |
[protected]