class AsNum

A class for storing an AS number used by protocols such as BGP. More...

Definition#include <asnum.hh>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members


Detailed Description

This class can be used to store an AS number that can be either 16 or 32 bits. Originally, the AS numbers were defined as 16-bit unsigned numbers. Later the "extended" AS numbers were introduced, which are unsigned 32-bit numbers.

16-bit numbers are expanded to 32-bit by extending them with 0's in front. 32-bit numbers are represented in a 16-bit path, by a special 16-bit value, AS_TRAN, which will be allocated by IANA. Together with any AsPath containing AS_TRAN, we will always see a NEW_AS_PATH attribute which contains the full 32-bit representation of the path. So there is no loss of information.

The internal representation of an AsNum is 32-bit in host order.

An AsNum must always be initialized, so the default constructor is never called.

static const uint16_t AS_INVALID

AS_INVALID

static const uint16_t AS_TRAN

AS_TRAN

explicit  AsNum (const uint32_t value)

AsNum

Constructor.

Parameters:
valuethe value to assign to this AS number.

explicit  AsNum (const uint16_t value)

AsNum

explicit  AsNum (int value)

AsNum

explicit  AsNum (const uint8_t *d)

AsNum

construct from a 2-byte buffer in memory

uint16_t  as ()

as

[const]

Get the non-extended AS number value.

Returns: the non-extended AS number value.

uint32_t  as32 ()

as32

[const]

Get the extended AS number value.

Returns: the extended AS number value.

void  copy_out (uint8_t *d)

copy_out

[const]

copy the 16-bit value into a 2-byte memory buffer

bool  extended ()

extended

[const]

Test if this is an extended AS number.

Returns: true if this is an extended AS number.

bool  operator== (const AsNum& x)

operator==

[const]

Equality Operator

Parameters:
otherthe right-hand operand to compare against.

Returns: true if the left-hand operand is numerically same as the right-hand operand.

bool  operator< (const AsNum& x)

operator<

[const]

Less-Than Operator

Returns: true if the left-hand operand is numerically smaller than the right-hand operand.

string  str ()

str

[const]

Convert this AS number from binary form to presentation format.

Returns: C++ string with the human-readable ASCII representation of the AS number.

string  short_str ()

short_str

[const]


Generated by: pavlin on possum.icir.org on Mon Mar 10 19:34:43 2003, using kdoc 2.0a54+XORP.