OpenSDN source code
LargeCommunity Class Reference

This class represents an array of BGP Large Community values. A LargeCommunity consists of one or more 12-byte tuples. This class provides manipulation (append, remove, set), comparison, hashing, and conversion to/from human-readable formats. More...

#include <community.h>

Collaboration diagram for LargeCommunity:

Public Types

typedef boost::array< uint8_t, 12 > LargeCommunityValue
 A single Large Community value. More...
 
typedef std::vector< LargeCommunityValueLargeCommunityList
 A list (vector) of LargeCommunityValue items. More...
 

Public Member Functions

 LargeCommunity (LargeCommunityDB *largecomm_db)
 Constructs an instance of the class and links to the given LargeCommunityDB instance. More...
 
 LargeCommunity (const LargeCommunity &rhs)
 Copy constructor. More...
 
 LargeCommunity (LargeCommunityDB *largecomm_db, const LargeCommunitySpec spec)
 Constructs an instance of the class using the given LargeCommunitySpec and links to the given LargeCommunityDB instance. More...
 
virtual ~LargeCommunity ()
 Destroys an instance. More...
 
virtual void Remove ()
 Remove this community. More...
 
int CompareTo (const LargeCommunity &rhs) const
 Compare this LargeCommunity to another. More...
 
const LargeCommunityListcommunities () const
 Get the list of Large Community values. More...
 
std::vector< uint64_t > GetTagList (as_t asn=0) const
 Get the list of tags with the specified ASN. More...
 

Static Public Member Functions

static LargeCommunityList LargeCommunityFromString (const std::string &comm)
 Parse a string into a list of LargeCommunity values. More...
 
static LargeCommunityValue FromHexString (const std::string &comm, boost::system::error_code *errorp)
 Convert a hexadecimal string to a LargeCommunityValue. More...
 
static bool is_tag (const LargeCommunityValue &val)
 Check if the LargeCommunity value is tag. More...
 
static std::string ToString (const LargeCommunityValue &val)
 Convert a LargeCommunityValue to a human-readable string. More...
 
static std::string ToHexString (const LargeCommunityValue &val)
 Convert a LargeCommunityValue to a hexadecimal string. More...
 

Private Member Functions

void Append (const LargeCommunityValue &value)
 Append a single LargeCommunity value. More...
 
void Append (const LargeCommunityList &list)
 Append a list of LargeCommunity values. More...
 
void Remove (const LargeCommunityList &list)
 Remove specific LargeCommunity values. More...
 
void RemoveTag ()
 Remove all the tags. More...
 
void Set (const LargeCommunityList &list)
 Replace all existing values with the provided list. More...
 

Private Attributes

tbb::atomic< int > refcount_
 A reference counter, needed for memory management. More...
 
LargeCommunityDBlargecomm_db_
 A pointer to the managing LargeCommunityDB. More...
 
LargeCommunityList communities_
 A list of LargeCommunity storing BGP Large Community values. More...
 

Friends

class LargeCommunityDB
 Enables the access to private members for LargeCommunityDB. More...
 
class BgpAttrTest
 Enables the access to private members for BgpAttrTest. More...
 
std::size_t hash_value (LargeCommunity const &comm)
 Compute the hash value for a LargeCommunity object. More...
 
int intrusive_ptr_add_ref (const LargeCommunity *clargecomm)
 Increment reference count atomically. More...
 
int intrusive_ptr_del_ref (const LargeCommunity *clargecomm)
 Decrement reference count of an clargecomm. More...
 
void intrusive_ptr_release (const LargeCommunity *clargecomm)
 Release a LargeCommunity instance when the reference count reaches zero. More...
 

Detailed Description

This class represents an array of BGP Large Community values. A LargeCommunity consists of one or more 12-byte tuples. This class provides manipulation (append, remove, set), comparison, hashing, and conversion to/from human-readable formats.

Definition at line 548 of file community.h.

Member Typedef Documentation

◆ LargeCommunityList

A list (vector) of LargeCommunityValue items.

Definition at line 554 of file community.h.

◆ LargeCommunityValue

typedef boost::array<uint8_t, 12> LargeCommunity::LargeCommunityValue

A single Large Community value.

Definition at line 551 of file community.h.

Constructor & Destructor Documentation

◆ LargeCommunity() [1/3]

LargeCommunity::LargeCommunity ( LargeCommunityDB largecomm_db)
inlineexplicit

Constructs an instance of the class and links to the given LargeCommunityDB instance.

Definition at line 558 of file community.h.

◆ LargeCommunity() [2/3]

LargeCommunity::LargeCommunity ( const LargeCommunity rhs)
inlineexplicit

Copy constructor.

Definition at line 564 of file community.h.

◆ LargeCommunity() [3/3]

LargeCommunity::LargeCommunity ( LargeCommunityDB largecomm_db,
const LargeCommunitySpec  spec 
)
explicit

Constructs an instance of the class using the given LargeCommunitySpec and links to the given LargeCommunityDB instance.

Definition at line 1128 of file community.cc.

Here is the call graph for this function:

◆ ~LargeCommunity()

virtual LargeCommunity::~LargeCommunity ( )
inlinevirtual

Destroys an instance.

Definition at line 577 of file community.h.

Member Function Documentation

◆ Append() [1/2]

void LargeCommunity::Append ( const LargeCommunityList list)
private

Append a list of LargeCommunity values.

Definition at line 1017 of file community.cc.

◆ Append() [2/2]

void LargeCommunity::Append ( const LargeCommunityValue value)
private

Append a single LargeCommunity value.

Definition at line 1025 of file community.cc.

◆ communities()

const LargeCommunityList& LargeCommunity::communities ( ) const
inline

Get the list of Large Community values.

Definition at line 586 of file community.h.

◆ CompareTo()

int LargeCommunity::CompareTo ( const LargeCommunity rhs) const

Compare this LargeCommunity to another.

Definition at line 982 of file community.cc.

◆ FromHexString()

LargeCommunity::LargeCommunityValue LargeCommunity::FromHexString ( const std::string &  comm,
boost::system::error_code *  errorp 
)
static

Convert a hexadecimal string to a LargeCommunityValue.

Definition at line 1033 of file community.cc.

Here is the call graph for this function:

◆ GetTagList()

vector< uint64_t > LargeCommunity::GetTagList ( as_t  asn = 0) const

Get the list of tags with the specified ASN.

Definition at line 1109 of file community.cc.

Here is the call graph for this function:

◆ is_tag()

static bool LargeCommunity::is_tag ( const LargeCommunityValue val)
inlinestatic

Check if the LargeCommunity value is tag.

Definition at line 613 of file community.h.

◆ LargeCommunityFromString()

LargeCommunity::LargeCommunityList LargeCommunity::LargeCommunityFromString ( const std::string &  comm)
static

Parse a string into a list of LargeCommunity values.

Definition at line 1066 of file community.cc.

Here is the call graph for this function:

◆ Remove() [1/2]

void LargeCommunity::Remove ( )
virtual

Remove this community.

Definition at line 1005 of file community.cc.

Here is the call graph for this function:

◆ Remove() [2/2]

void LargeCommunity::Remove ( const LargeCommunityList list)
private

Remove specific LargeCommunity values.

Definition at line 998 of file community.cc.

◆ RemoveTag()

void LargeCommunity::RemoveTag ( )
private

Remove all the tags.

Definition at line 1098 of file community.cc.

Here is the call graph for this function:

◆ Set()

void LargeCommunity::Set ( const LargeCommunityList list)
private

Replace all existing values with the provided list.

Definition at line 1009 of file community.cc.

◆ ToHexString()

string LargeCommunity::ToHexString ( const LargeCommunityValue val)
static

Convert a LargeCommunityValue to a hexadecimal string.

Definition at line 1081 of file community.cc.

◆ ToString()

string LargeCommunity::ToString ( const LargeCommunityValue val)
static

Convert a LargeCommunityValue to a human-readable string.

Definition at line 1090 of file community.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ BgpAttrTest

friend class BgpAttrTest
friend

Enables the access to private members for BgpAttrTest.

Definition at line 634 of file community.h.

◆ hash_value

std::size_t hash_value ( LargeCommunity const &  comm)
friend

Compute the hash value for a LargeCommunity object.

Definition at line 602 of file community.h.

◆ intrusive_ptr_add_ref

int intrusive_ptr_add_ref ( const LargeCommunity clargecomm)
friend

Increment reference count atomically.

Definition at line 656 of file community.h.

◆ intrusive_ptr_del_ref

int intrusive_ptr_del_ref ( const LargeCommunity clargecomm)
friend

Decrement reference count of an clargecomm.

Definition at line 661 of file community.h.

◆ intrusive_ptr_release

void intrusive_ptr_release ( const LargeCommunity clargecomm)
friend

Release a LargeCommunity instance when the reference count reaches zero.

Definition at line 667 of file community.h.

◆ LargeCommunityDB

friend class LargeCommunityDB
friend

Enables the access to private members for LargeCommunityDB.

Definition at line 632 of file community.h.

Member Data Documentation

◆ communities_

LargeCommunityList LargeCommunity::communities_
private

A list of LargeCommunity storing BGP Large Community values.

Definition at line 652 of file community.h.

◆ largecomm_db_

LargeCommunityDB* LargeCommunity::largecomm_db_
private

A pointer to the managing LargeCommunityDB.

Definition at line 650 of file community.h.

◆ refcount_

tbb::atomic<int> LargeCommunity::refcount_
mutableprivate

A reference counter, needed for memory management.

Definition at line 648 of file community.h.


The documentation for this class was generated from the following files: