summaryrefslogtreecommitdiffhomepage
path: root/packet/bgp/bgp.go
diff options
context:
space:
mode:
Diffstat (limited to 'packet/bgp/bgp.go')
-rw-r--r--packet/bgp/bgp.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go
index c45ccc81..916a5f69 100644
--- a/packet/bgp/bgp.go
+++ b/packet/bgp/bgp.go
@@ -216,6 +216,25 @@ const (
BGP_CAP_LONG_LIVED_GRACEFUL_RESTART BGPCapabilityCode = 129
)
+var CapNameMap = map[BGPCapabilityCode]string{
+ BGP_CAP_MULTIPROTOCOL: "multiprotocol",
+ BGP_CAP_ROUTE_REFRESH: "route-refresh",
+ BGP_CAP_CARRYING_LABEL_INFO: "carrying-label-info",
+ BGP_CAP_GRACEFUL_RESTART: "graceful-restart",
+ BGP_CAP_FOUR_OCTET_AS_NUMBER: "4-octet-as",
+ BGP_CAP_ADD_PATH: "add-path",
+ BGP_CAP_ENHANCED_ROUTE_REFRESH: "enhanced-route-refresh",
+ BGP_CAP_ROUTE_REFRESH_CISCO: "cisco-route-refresh",
+ BGP_CAP_LONG_LIVED_GRACEFUL_RESTART: "long-lived-graceful-restart",
+}
+
+func (c BGPCapabilityCode) String() string {
+ if n, y := CapNameMap[c]; y {
+ return n
+ }
+ return fmt.Sprintf("UnknownCapability(%d)", c)
+}
+
type ParameterCapabilityInterface interface {
DecodeFromBytes([]byte) error
Serialize() ([]byte, error)