xorp

ASPath Class Reference

An ASPath is a list of ASSegments, each of which can be an AS_SET, AS_CONFED_SET, AS_SEQUENCE, or an AS_CONFED_SEQUENCE. More...

#include <aspath.hh>

Inheritance diagram for ASPath:
AS4Path

List of all members.

Public Types

typedef list< ASSegment >
::const_iterator 
const_iterator
typedef list< ASSegment >::iterator iterator

Public Member Functions

 ASPath (const char *as_path) throw (InvalidString)
 Initialize from a string in the format 1,2,(3,4,5),6,7,8,(9,10,11),12,13.
 ASPath (const uint8_t *d, size_t len) throw (CorruptMessage)
 construct from received data
 ASPath (const ASPath &asp1, const ASPath &asp2)
 construct an aggregate from two ASPaths
 ASPath (const ASPath &a)
 Copy constructor.
void add_segment (const ASSegment &s)
void prepend_segment (const ASSegment &s)
size_t path_length () const
bool contains (const AsNum &as_num) const
const AsNumfirst_asnum () const
string str () const
string short_str () const
const ASSegmentsegment (size_t n) const
size_t num_segments () const
const uint8_t * encode (size_t &len, uint8_t *buf) const
 Convert from internal to external representation, with the correct representation for the original AS_PATH attribute.
size_t wire_size () const
void prepend_as (const AsNum &asn)
 Add the As number to the begining of the AS_SEQUENCE that starts the As path, or if the ASPath starts with an AS_SET, then add a new AS_SEQUENCE with the new AsNum to the start of the ASPath.
void prepend_confed_as (const AsNum &asn)
 Add the As number to the begining of the AS_CONFED_SEQUENCE that starts the As path, or if the ASPath does not start with an AS_CONFED_SEQUENCE, then add a new AS_CONFED_SEQUENCE with the new AsNum to the start of the ASPath.
void remove_confed_segments ()
 remove all confederation segments from aspath
bool contains_confed_segments () const
ASPathoperator= (const ASPath &him)
bool operator== (const ASPath &him) const
bool operator< (const ASPath &him) const
void encode_for_mib (vector< uint8_t > &aspath) const
bool two_byte_compatible () const
 returns true if the AS path does not lose information when represented entirely as two-byte AS numbers
void merge_as4_path (AS4Path &as4_path)
 Merge an AS4Path into a 2-byte AS Path.

Protected Attributes

list< ASSegment_segments
 internal representation
size_t _num_segments
size_t _path_len

Private Member Functions

void decode (const uint8_t *d, size_t len) throw (CorruptMessage)
 populate an ASPath from received data.

Detailed Description

An ASPath is a list of ASSegments, each of which can be an AS_SET, AS_CONFED_SET, AS_SEQUENCE, or an AS_CONFED_SEQUENCE.


Constructor & Destructor Documentation

ASPath::ASPath ( const char *  as_path) throw (InvalidString)

Initialize from a string in the format 1,2,(3,4,5),6,7,8,(9,10,11),12,13.

ASPath constructor by parsing strings.

Input strings should have the form

"segment, segment, segment, ... ,segment"

where segments are parsed as

AS_SEQUENCE: [comma-separated-asn-list] or comma-separated-asn-list AS_SET: {comma-separated-asn-list} AS_CONFED_SEQUENCE: (comma-separated-asn-list) AS_CONFED_SET: <comma-separated-asn-list>

blank spaces " " can appear at any point in the string.

ASPath::ASPath ( const ASPath asp1,
const ASPath asp2 
)

construct an aggregate from two ASPaths

construct a new aggregate ASPath from two ASPaths


Member Function Documentation

bool ASPath::contains_confed_segments ( ) const
Returns:
true if the AS_PATH Contains confederation segments.
void ASPath::decode ( const uint8_t *  d,
size_t  len 
) throw (CorruptMessage) [private]

populate an ASPath from received data.

populate an ASPath from the received data representation

Only used in the constructor.

Reimplemented in AS4Path.

const uint8_t * ASPath::encode ( size_t &  len,
uint8_t *  buf 
) const

Convert from internal to external representation, with the correct representation for the original AS_PATH attribute.

If there are any 4-byte AS numbers, they will be encoded as AS_TRAN.

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.

Reimplemented in AS4Path.

void ASPath::merge_as4_path ( AS4Path as4_path)

Merge an AS4Path into a 2-byte AS Path.

Both paths will end up containing the same data

param as4path the AS4_PATH to be merged.

size_t ASPath::wire_size ( ) const
Returns:
the size of the list on the wire. XXX this should be made more efficient.

Reimplemented in AS4Path.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations