From 92814f7b85c01ffc7eca750cfec3b7bbc200a2d3 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Wed, 20 Jun 2018 16:46:52 +0900 Subject: packet/bgp: Missing New func for BGP Capabilities Signed-off-by: IWASE Yusuke --- packet/bgp/bgp.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'packet/bgp') diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go index 13320e54..ae62d3bf 100644 --- a/packet/bgp/bgp.go +++ b/packet/bgp/bgp.go @@ -433,6 +433,14 @@ type CapCarryingLabelInfo struct { DefaultParameterCapability } +func NewCapCarryingLabelInfo() *CapCarryingLabelInfo { + return &CapCarryingLabelInfo{ + DefaultParameterCapability{ + CapCode: BGP_CAP_CARRYING_LABEL_INFO, + }, + } +} + type CapExtendedNexthopTuple struct { NLRIAFI uint16 NLRISAFI uint16 @@ -881,6 +889,15 @@ type CapUnknown struct { DefaultParameterCapability } +func NewCapUnknown(code BGPCapabilityCode, value []byte) *CapUnknown { + return &CapUnknown{ + DefaultParameterCapability{ + CapCode: code, + CapValue: value, + }, + } +} + func DecodeCapability(data []byte) (ParameterCapabilityInterface, error) { if len(data) < 2 { return nil, NewMessageError(BGP_ERROR_OPEN_MESSAGE_ERROR, BGP_ERROR_SUB_UNSUPPORTED_CAPABILITY, nil, "Not all ParameterCapability bytes available") -- cgit v1.2.3