|
|
Parent class for ASPath elements, which can be either ASSet or ASSequence.
typedef vector <AsNum>::iterator iterator | iterator |
typedef vector <AsNum>::const_iterator const_iterator | const_iterator |
typedef vector <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]
vector <AsNum> _aslist | _aslist |
[protected]