OpenSDN source code
LargeCommunitySpec Class Reference

This class encapsulates the wire-format representation of a BGP Large Community attribute and provides encoding, comparison, and canonicalization functions for Large Community attributes. More...

#include <community.h>

Inheritance diagram for LargeCommunitySpec:
Collaboration diagram for LargeCommunitySpec:

Public Member Functions

 LargeCommunitySpec ()
 Constructs a new instance using the attribute type and flags. More...
 
 LargeCommunitySpec (const BgpAttribute &rhs)
 Construct from an existing BgpAttribute. More...
 
virtual size_t EncodeLength () const
 Compute the encoded length of the attribute. More...
 
virtual int CompareTo (const BgpAttribute &rhs_attr) const
 Compare the attribute with another BgpAttribute. More...
 
virtual void ToCanonical (BgpAttr *attr)
 Convert the attribute to its canonical form. More...
 
virtual std::string ToString () const
 Generate a human-readable string representation. More...
 
- Public Member Functions inherited from BgpAttribute
 BgpAttribute ()
 
 BgpAttribute (uint8_t code, uint8_t flags)
 
 BgpAttribute (uint8_t code, uint8_t subcode, uint8_t flags)
 
uint8_t GetEncodeFlags () const
 
- Public Member Functions inherited from ParseObject
virtual ~ParseObject ()
 

Public Attributes

std::vector< uint32_t > communities
 Vector of community values. Each Large Community value consists of three 4-byte fields (12 bytes total). More...
 
- Public Attributes inherited from BgpAttribute
uint8_t code
 
uint8_t subcode
 
uint8_t flags
 

Static Public Attributes

static const int kSize = -1
 
static const uint8_t kFlags = Optional | Transitive
 
- Static Public Attributes inherited from BgpAttribute
static const uint8_t FLAG_MASK = Optional|Transitive
 

Additional Inherited Members

- Public Types inherited from BgpAttribute
enum  Flag { Optional = 1 << 7 , Transitive = 1 << 6 , Partial = 1 << 5 , ExtendedLength = 1 << 4 }
 
enum  Code {
  Reserved = 0 , Origin = 1 , AsPath = 2 , NextHop = 3 ,
  MultiExitDisc = 4 , LocalPref = 5 , AtomicAggregate = 6 , Aggregator = 7 ,
  Communities = 8 , OriginatorId = 9 , ClusterList = 10 , MPReachNlri = 14 ,
  MPUnreachNlri = 15 , ExtendedCommunities = 16 , As4Path = 17 , As4Aggregator = 18 ,
  PmsiTunnel = 22 , LargeCommunities = 32 , McastEdgeDiscovery = 241 , McastEdgeForwarding = 242 ,
  OriginVnPath = 243
}
 
enum  Subcode {
  OList = 1 , LabelBlock = 2 , SourceRd = 3 , Esi = 4 ,
  Params = 5 , LeafOList = 6 , SubProtocol = 7
}
 

Detailed Description

This class encapsulates the wire-format representation of a BGP Large Community attribute and provides encoding, comparison, and canonicalization functions for Large Community attributes.

Definition at line 507 of file community.h.

Constructor & Destructor Documentation

◆ LargeCommunitySpec() [1/2]

LargeCommunitySpec::LargeCommunitySpec ( )
inline

Constructs a new instance using the attribute type and flags.

Definition at line 520 of file community.h.

◆ LargeCommunitySpec() [2/2]

LargeCommunitySpec::LargeCommunitySpec ( const BgpAttribute rhs)
inlineexplicit

Construct from an existing BgpAttribute.

Definition at line 523 of file community.h.

Member Function Documentation

◆ CompareTo()

int LargeCommunitySpec::CompareTo ( const BgpAttribute rhs_attr) const
virtual

Compare the attribute with another BgpAttribute.

Reimplemented from BgpAttribute.

Definition at line 968 of file community.cc.

Here is the call graph for this function:

◆ EncodeLength()

size_t LargeCommunitySpec::EncodeLength ( ) const
virtual

Compute the encoded length of the attribute.

Reimplemented from BgpAttribute.

Definition at line 964 of file community.cc.

◆ ToCanonical()

void LargeCommunitySpec::ToCanonical ( BgpAttr attr)
virtual

Convert the attribute to its canonical form.

Reimplemented from BgpAttribute.

Definition at line 976 of file community.cc.

Here is the call graph for this function:

◆ ToString()

string LargeCommunitySpec::ToString ( ) const
virtual

Generate a human-readable string representation.

Reimplemented from BgpAttribute.

Definition at line 957 of file community.cc.

Member Data Documentation

◆ communities

std::vector<uint32_t> LargeCommunitySpec::communities

Vector of community values. Each Large Community value consists of three 4-byte fields (12 bytes total).

Definition at line 531 of file community.h.

◆ kFlags

const uint8_t LargeCommunitySpec::kFlags = Optional | Transitive
static

Flags indicating whether the attribute is Optional and Transitive per BGP standards.

Definition at line 516 of file community.h.

◆ kSize

const int LargeCommunitySpec::kSize = -1
static

Indicates variable size of BGP attribute in encoded form (used internally by encoding functions). -1 means the total size depends on how many communities are present.

Definition at line 512 of file community.h.


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