summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index b95d48f3..3ff5615e 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -3023,6 +3023,7 @@ func NewPathAttributeMpUnreachNLRI(nlri []AddrPrefixInterface) *PathAttributeMpU
type ExtendedCommunityInterface interface {
Serialize() ([]byte, error)
String() string
+ GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType)
ToApiStruct() *api.ExtendedCommunity
}
@@ -3050,6 +3051,14 @@ func (e *TwoOctetAsSpecificExtended) String() string {
return fmt.Sprintf("%d:%d", e.AS, e.LocalAdmin)
}
+func (e *TwoOctetAsSpecificExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType) {
+ t := EC_TYPE_TRANSITIVE_TWO_OCTET_AS_SPECIFIC
+ if !e.IsTransitive {
+ t = EC_TYPE_NON_TRANSITIVE_TWO_OCTET_AS_SPECIFIC
+ }
+ return t, e.SubType
+}
+
func (e *TwoOctetAsSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
return &api.ExtendedCommunity{
Type: api.EXTENDED_COMMUNITIE_TYPE_TWO_OCTET_AS_SPECIFIC,
@@ -3093,6 +3102,14 @@ func (e *IPv4AddressSpecificExtended) String() string {
return fmt.Sprintf("%s:%d", e.IPv4.String(), e.LocalAdmin)
}
+func (e *IPv4AddressSpecificExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType) {
+ t := EC_TYPE_TRANSITIVE_IP4_SPECIFIC
+ if !e.IsTransitive {
+ t = EC_TYPE_NON_TRANSITIVE_IP4_SPECIFIC
+ }
+ return t, e.SubType
+}
+
func (e *IPv4AddressSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
return &api.ExtendedCommunity{
Type: api.EXTENDED_COMMUNITIE_TYPE_IP4_SPECIFIC,
@@ -3131,6 +3148,14 @@ func (e *FourOctetAsSpecificExtended) String() string {
return fmt.Sprintf("%d.%d:%d", asUpper, asLower, e.LocalAdmin)
}
+func (e *FourOctetAsSpecificExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType) {
+ t := EC_TYPE_TRANSITIVE_FOUR_OCTET_AS_SPECIFIC
+ if !e.IsTransitive {
+ t = EC_TYPE_NON_TRANSITIVE_FOUR_OCTET_AS_SPECIFIC
+ }
+ return t, e.SubType
+}
+
func (e *FourOctetAsSpecificExtended) ToApiStruct() *api.ExtendedCommunity {
return &api.ExtendedCommunity{
Type: api.EXTENDED_COMMUNITIE_TYPE_FOUR_OCTET_AS_SPECIFIC,
@@ -3259,6 +3284,14 @@ func (e *OpaqueExtended) String() string {
return e.Value.String()
}
+func (e *OpaqueExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType) {
+ t := EC_TYPE_TRANSITIVE_OPAQUE
+ if !e.IsTransitive {
+ t = EC_TYPE_NON_TRANSITIVE_OPAQUE
+ }
+ return t, ExtendedCommunityAttrSubType(0xFF)
+}
+
func (e *OpaqueExtended) ToApiStruct() *api.ExtendedCommunity {
return &api.ExtendedCommunity{
Type: api.EXTENDED_COMMUNITIE_TYPE_OPAQUE,
@@ -3290,6 +3323,10 @@ func (e *UnknownExtended) String() string {
return fmt.Sprintf("%d", v)
}
+func (e *UnknownExtended) GetTypes() (ExtendedCommunityAttrType, ExtendedCommunityAttrSubType) {
+ return ExtendedCommunityAttrType(0xFF), ExtendedCommunityAttrSubType(0xFF)
+}
+
func (e *UnknownExtended) ToApiStruct() *api.ExtendedCommunity {
return &api.ExtendedCommunity{}
}