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.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/packet/bgp/bgp.go b/packet/bgp/bgp.go
index 2fea8b44..ef2e3e20 100644
--- a/packet/bgp/bgp.go
+++ b/packet/bgp/bgp.go
@@ -5213,6 +5213,8 @@ var asPathParamFormatMap = map[uint8]*AsPathParamFormat{
}
type AsPathParamInterface interface {
+ GetType() uint8
+ GetAS() []uint32
Serialize() ([]byte, error)
DecodeFromBytes([]byte) error
Len() int
@@ -5227,6 +5229,18 @@ type AsPathParam struct {
AS []uint16
}
+func (a *AsPathParam) GetType() uint8 {
+ return a.Type
+}
+
+func (a *AsPathParam) GetAS() []uint32 {
+ nums := make([]uint32, 0, len(a.AS))
+ for _, as := range a.AS {
+ nums = append(nums, uint32(as))
+ }
+ return nums
+}
+
func (a *AsPathParam) Serialize() ([]byte, error) {
buf := make([]byte, 2+len(a.AS)*2)
buf[0] = uint8(a.Type)
@@ -5314,6 +5328,14 @@ type As4PathParam struct {
AS []uint32
}
+func (a *As4PathParam) GetType() uint8 {
+ return a.Type
+}
+
+func (a *As4PathParam) GetAS() []uint32 {
+ return a.AS
+}
+
func (a *As4PathParam) Serialize() ([]byte, error) {
buf := make([]byte, 2+len(a.AS)*4)
buf[0] = a.Type