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...
 

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 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 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 547 of file community.h.

Member Typedef Documentation

◆ LargeCommunityList

A list (vector) of LargeCommunityValue items.

Definition at line 553 of file community.h.

◆ LargeCommunityValue

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

A single Large Community value.

Definition at line 550 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 557 of file community.h.

◆ LargeCommunity() [2/3]

LargeCommunity::LargeCommunity ( const LargeCommunity rhs)
inlineexplicit

Copy constructor.

Definition at line 563 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 1093 of file community.cc.

Here is the call graph for this function:

◆ ~LargeCommunity()

virtual LargeCommunity::~LargeCommunity ( )
inlinevirtual

Destroys an instance.

Definition at line 576 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 1016 of file community.cc.

◆ Append() [2/2]

void LargeCommunity::Append ( const LargeCommunityValue value)
private

Append a single LargeCommunity value.

Definition at line 1024 of file community.cc.

◆ communities()

const LargeCommunityList& LargeCommunity::communities ( ) const
inline

Get the list of Large Community values.

Definition at line 585 of file community.h.

◆ CompareTo()

int LargeCommunity::CompareTo ( const LargeCommunity rhs) const

Compare this LargeCommunity to another.

Definition at line 981 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 1032 of file community.cc.

Here is the call graph for this function:

◆ LargeCommunityFromString()

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

Parse a string into a list of LargeCommunity values.

Definition at line 1065 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 1004 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 997 of file community.cc.

◆ Set()

void LargeCommunity::Set ( const LargeCommunityList list)
private

Replace all existing values with the provided list.

Definition at line 1008 of file community.cc.

◆ ToHexString()

string LargeCommunity::ToHexString ( const LargeCommunityValue val)
static

Convert a LargeCommunityValue to a hexadecimal string.

Definition at line 1080 of file community.cc.

◆ ToString()

string LargeCommunity::ToString ( const LargeCommunityValue val)
static

Convert a LargeCommunityValue to a human-readable string.

Definition at line 1089 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 625 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 598 of file community.h.

◆ intrusive_ptr_add_ref

int intrusive_ptr_add_ref ( const LargeCommunity clargecomm)
friend

Increment reference count atomically.

Definition at line 645 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 650 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 656 of file community.h.

◆ LargeCommunityDB

friend class LargeCommunityDB
friend

Enables the access to private members for LargeCommunityDB.

Definition at line 623 of file community.h.

Member Data Documentation

◆ communities_

LargeCommunityList LargeCommunity::communities_
private

A list of LargeCommunity storing BGP Large Community values.

Definition at line 641 of file community.h.

◆ largecomm_db_

LargeCommunityDB* LargeCommunity::largecomm_db_
private

A pointer to the managing LargeCommunityDB.

Definition at line 639 of file community.h.

◆ refcount_

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

A reference counter, needed for memory management.

Definition at line 637 of file community.h.


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