|
|
Parent class for AsPath elements, which can be either AsSet or AsSequence.
typedef list <AsNum>::iterator iterator | iterator |
typedef list <AsNum>::const_iterator const_iterator | const_iterator |
typedef list <AsNum>::const_reverse_iterator const_reverse_iterator | const_reverse_iterator |
AsSegment (ASPathSegType t = AS_NONE)
| AsSegment |
Constructor of an empty AsSegment
AsSegment (const uint8_t* d)
throw(CorruptMessage) | AsSegment |
constructor from external representation will just decode the chunk of data received, and convert to internal representation. In fact, the external representation is quite simple and effective.
_type is d[0], l is d[1], entries follow.
AsSegment (const AsSegment& a)
| AsSegment |
~AsSegment ()
| ~AsSegment |
The destructor has nothing to do, the underlying container will take care of the thing.
void clear ()
| clear |
reset whatever is currently contained in the object.
size_t path_length ()
| path_length |
[const]
Returns: the path length, which is 1 for an AS_SET, and the length of the sequence for an AS_SEQUENCE
size_t as_size ()
| as_size |
[const]
void add_as (const AsNum& n)
| add_as |
Add AsNum at the end of the segment (order is irrelevant for AS_SET but important for AS_SEQUENCE) This is used when initializing from a string.
void prepend_as (const AsNum& n)
| prepend_as |
Add AsNum at the beginning of the segment (order is irrelevant for AS_SET but important for AS_SEQUENCE). This is used e.g. when a node is adding its AsNum to the sequence.
bool contains (const AsNum& as_num)
| contains |
[const]
Check if a given AsNum is contained in the segment.
const AsNum& first_asnum ()
| first_asnum |
[const]
const AsNum& as_num (int n)
| as_num |
[const]
find the n'th AS number in the segment
void decode (const uint8_t *d)
throw(CorruptMessage) | decode |
Convert the external representation into the internal one. _type is d[0], _entries is d[1], entries follow.
const uint8_t * encode (size_t &len, uint8_t *buf)
| encode |
[const]
Convert from internal to external representation. If we do not pass a buffer (buf = 0), then the routine will allocate a new one; otherwise, len indicates the size of the input buffer, which must be large enough to store the encoding.
Returns: the pointer to the buffer, len is the actual size.
size_t wire_size ()
| wire_size |
[const]
Returns: the size of the list on the wire.
string str ()
| str |
[const]
Returns: fancy string representation of the segment
string short_str ()
| short_str |
[const]
Returns: compact string representation of the segment
bool operator== (const AsSegment& him)
| operator== |
[const]
compares internal representations for equality.
bool operator< (const AsSegment& him)
| operator< |
[const]
Compares internal representations for <.
ASPathSegType type ()
| type |
[const]
void set_type (ASPathSegType t)
| set_type |
size_t encode_for_mib (uint8_t* buf, size_t buf_size)
| encode_for_mib |
[const]
bool two_byte_compatible ()
| two_byte_compatible |
[const]
returns true if the AS segment does not lose information when represented entirely as two-byte AS numbers
ASPathSegType _type | _type |
[protected]
size_t _entries | _entries |
[protected]
list <AsNum> _aslist | _aslist |
[protected]