diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/bfd')
-rw-r--r-- | internal/testbinapi/binapi2001/bfd/bfd.ba.go | 2111 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/bfd/bfd_rpc.ba.go | 232 |
2 files changed, 0 insertions, 2343 deletions
diff --git a/internal/testbinapi/binapi2001/bfd/bfd.ba.go b/internal/testbinapi/binapi2001/bfd/bfd.ba.go deleted file mode 100644 index f83cc33..0000000 --- a/internal/testbinapi/binapi2001/bfd/bfd.ba.go +++ /dev/null @@ -1,2111 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.5.0-dev -// VPP: 20.01 -// source: .vppapi/core/bfd.api.json - -// Package bfd contains generated bindings for API file bfd.api. -// -// Contents: -// 6 aliases -// 11 enums -// 6 structs -// 1 union -// 28 messages -// -package bfd - -import ( - "fmt" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "bfd" - APIVersion = "2.0.0" - VersionCrc = 0xfd792c8c -) - -// AddressFamily defines enum 'address_family'. -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) - -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} - -// BfdState defines enum 'bfd_state'. -type BfdState uint32 - -const ( - BFD_STATE_API_ADMIN_DOWN BfdState = 0 - BFD_STATE_API_DOWN BfdState = 1 - BFD_STATE_API_INIT BfdState = 2 - BFD_STATE_API_UP BfdState = 3 -) - -var ( - BfdState_name = map[uint32]string{ - 0: "BFD_STATE_API_ADMIN_DOWN", - 1: "BFD_STATE_API_DOWN", - 2: "BFD_STATE_API_INIT", - 3: "BFD_STATE_API_UP", - } - BfdState_value = map[string]uint32{ - "BFD_STATE_API_ADMIN_DOWN": 0, - "BFD_STATE_API_DOWN": 1, - "BFD_STATE_API_INIT": 2, - "BFD_STATE_API_UP": 3, - } -) - -func (x BfdState) String() string { - s, ok := BfdState_name[uint32(x)] - if ok { - return s - } - return "BfdState(" + strconv.Itoa(int(x)) + ")" -} - -// IfStatusFlags defines enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - str := func(n uint32) string { - s, ok := IfStatusFlags_name[uint32(n)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")" - } - for i := uint32(0); i <= 32; i++ { - val := uint32(x) - if val&(1<<i) != 0 { - if s != "" { - s += "|" - } - s += str(1 << i) - } - } - if s == "" { - return str(uint32(x)) - } - return s -} - -// IfType defines enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// IPDscp defines enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) - -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) - -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} - -// IPEcn defines enum 'ip_ecn'. -type IPEcn uint8 - -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) - -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) - -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} - -// IPProto defines enum 'ip_proto'. -type IPProto uint32 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex defines enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto defines enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode defines enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags defines enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - str := func(n uint32) string { - s, ok := SubIfFlags_name[uint32(n)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(n)) + ")" - } - for i := uint32(0); i <= 32; i++ { - val := uint32(x) - if val&(1<<i) != 0 { - if s != "" { - s += "|" - } - s += str(1 << i) - } - } - if s == "" { - return str(uint32(x)) - } - return s -} - -// AddressWithPrefix defines alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) { - prefix, err := ParsePrefix(s) - if err != nil { - return AddressWithPrefix{}, err - } - return AddressWithPrefix(prefix), nil -} - -func (x AddressWithPrefix) String() string { - return Prefix(x).String() -} - -func (x *AddressWithPrefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *AddressWithPrefix) UnmarshalText(text []byte) error { - prefix, err := ParseAddressWithPrefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// InterfaceIndex defines alias 'interface_index'. -type InterfaceIndex uint32 - -// IP4Address defines alias 'ip4_address'. -type IP4Address [4]uint8 - -func ParseIP4Address(s string) (IP4Address, error) { - ip := net.ParseIP(s).To4() - if ip == nil { - return IP4Address{}, fmt.Errorf("invalid IP address: %s", s) - } - var ipaddr IP4Address - copy(ipaddr[:], ip.To4()) - return ipaddr, nil -} - -func (x IP4Address) ToIP() net.IP { - return net.IP(x[:]).To4() -} - -func (x IP4Address) String() string { - return x.ToIP().String() -} - -func (x *IP4Address) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP4Address) UnmarshalText(text []byte) error { - ipaddr, err := ParseIP4Address(string(text)) - if err != nil { - return err - } - *x = ipaddr - return nil -} - -// IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address defines alias 'ip6_address'. -type IP6Address [16]uint8 - -func ParseIP6Address(s string) (IP6Address, error) { - ip := net.ParseIP(s).To16() - if ip == nil { - return IP6Address{}, fmt.Errorf("invalid IP address: %s", s) - } - var ipaddr IP6Address - copy(ipaddr[:], ip.To16()) - return ipaddr, nil -} - -func (x IP6Address) ToIP() net.IP { - return net.IP(x[:]).To16() -} - -func (x IP6Address) String() string { - return x.ToIP().String() -} - -func (x *IP6Address) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP6Address) UnmarshalText(text []byte) error { - ipaddr, err := ParseIP6Address(string(text)) - if err != nil { - return err - } - *x = ipaddr - return nil -} - -// IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix - -// Address defines type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func ParseAddress(s string) (Address, error) { - ip := net.ParseIP(s) - if ip == nil { - return Address{}, fmt.Errorf("invalid address: %s", s) - } - return AddressFromIP(ip), nil -} - -func AddressFromIP(ip net.IP) Address { - var addr Address - if ip.To4() == nil { - addr.Af = ADDRESS_IP6 - var ip6 IP6Address - copy(ip6[:], ip.To16()) - addr.Un.SetIP6(ip6) - } else { - addr.Af = ADDRESS_IP4 - var ip4 IP4Address - copy(ip4[:], ip.To4()) - addr.Un.SetIP4(ip4) - } - return addr -} - -func (x Address) ToIP() net.IP { - if x.Af == ADDRESS_IP6 { - ip6 := x.Un.GetIP6() - return net.IP(ip6[:]).To16() - } else { - ip4 := x.Un.GetIP4() - return net.IP(ip4[:]).To4() - } -} - -func (x Address) String() string { - return x.ToIP().String() -} - -func (x *Address) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *Address) UnmarshalText(text []byte) error { - addr, err := ParseAddress(string(text)) - if err != nil { - return err - } - *x = addr - return nil -} - -// IP4Prefix defines type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { - hasPrefix := strings.Contains(s, "/") - if hasPrefix { - ip, network, err := net.ParseCIDR(s) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseIP4Address(ip.String()) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } else { - ip := net.ParseIP(s) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if ip.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseIP4Address(ip.String()) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } - return prefix, nil -} - -func (x IP4Prefix) ToIPNet() *net.IPNet { - mask := net.CIDRMask(int(x.Len), 32) - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x IP4Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *IP4Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP4Prefix) UnmarshalText(text []byte) error { - prefix, err := ParseIP4Prefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// IP6Prefix defines type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { - hasPrefix := strings.Contains(s, "/") - if hasPrefix { - ip, network, err := net.ParseCIDR(s) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseIP6Address(ip.String()) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } else { - ip := net.ParseIP(s) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if ip.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseIP6Address(ip.String()) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } - return prefix, nil -} - -func (x IP6Prefix) ToIPNet() *net.IPNet { - mask := net.CIDRMask(int(x.Len), 128) - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x IP6Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *IP6Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP6Prefix) UnmarshalText(text []byte) error { - prefix, err := ParseIP6Prefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// Mprefix defines type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -// Prefix defines type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParsePrefix(ip string) (prefix Prefix, err error) { - hasPrefix := strings.Contains(ip, "/") - if hasPrefix { - netIP, network, err := net.ParseCIDR(ip) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - } else { - netIP := net.ParseIP(ip) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if netIP.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - } - return prefix, nil -} - -func (x Prefix) ToIPNet() *net.IPNet { - var mask net.IPMask - if x.Address.Af == ADDRESS_IP4 { - mask = net.CIDRMask(int(x.Len), 32) - } else { - mask = net.CIDRMask(int(x.Len), 128) - } - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *Prefix) UnmarshalText(text []byte) error { - prefix, err := ParsePrefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// PrefixMatcher defines type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -// AddressUnion defines union 'address_union'. -type AddressUnion struct { - // AddressUnion can be one of: - // - IP4 *IP4Address - // - IP6 *IP6Address - XXX_UnionData [16]byte -} - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - buf.EncodeBytes(a[:], 4) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - copy(a[:], buf.DecodeBytes(4)) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - buf.EncodeBytes(a[:], 16) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - copy(a[:], buf.DecodeBytes(16)) - return -} - -// BfdAuthDelKey defines message 'bfd_auth_del_key'. -type BfdAuthDelKey struct { - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` -} - -func (m *BfdAuthDelKey) Reset() { *m = BfdAuthDelKey{} } -func (*BfdAuthDelKey) GetMessageName() string { return "bfd_auth_del_key" } -func (*BfdAuthDelKey) GetCrcString() string { return "65310b22" } -func (*BfdAuthDelKey) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdAuthDelKey) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.ConfKeyID - return size -} -func (m *BfdAuthDelKey) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.ConfKeyID) - return buf.Bytes(), nil -} -func (m *BfdAuthDelKey) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.ConfKeyID = buf.DecodeUint32() - return nil -} - -// BfdAuthDelKeyReply defines message 'bfd_auth_del_key_reply'. -type BfdAuthDelKeyReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdAuthDelKeyReply) Reset() { *m = BfdAuthDelKeyReply{} } -func (*BfdAuthDelKeyReply) GetMessageName() string { return "bfd_auth_del_key_reply" } -func (*BfdAuthDelKeyReply) GetCrcString() string { return "e8d4e804" } -func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdAuthDelKeyReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdAuthDelKeyReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdAuthDelKeyReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdAuthKeysDetails defines message 'bfd_auth_keys_details'. -type BfdAuthKeysDetails struct { - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` - UseCount uint32 `binapi:"u32,name=use_count" json:"use_count,omitempty"` - AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` -} - -func (m *BfdAuthKeysDetails) Reset() { *m = BfdAuthKeysDetails{} } -func (*BfdAuthKeysDetails) GetMessageName() string { return "bfd_auth_keys_details" } -func (*BfdAuthKeysDetails) GetCrcString() string { return "84130e9f" } -func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdAuthKeysDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.ConfKeyID - size += 4 // m.UseCount - size += 1 // m.AuthType - return size -} -func (m *BfdAuthKeysDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.ConfKeyID) - buf.EncodeUint32(m.UseCount) - buf.EncodeUint8(m.AuthType) - return buf.Bytes(), nil -} -func (m *BfdAuthKeysDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.ConfKeyID = buf.DecodeUint32() - m.UseCount = buf.DecodeUint32() - m.AuthType = buf.DecodeUint8() - return nil -} - -// BfdAuthKeysDump defines message 'bfd_auth_keys_dump'. -type BfdAuthKeysDump struct{} - -func (m *BfdAuthKeysDump) Reset() { *m = BfdAuthKeysDump{} } -func (*BfdAuthKeysDump) GetMessageName() string { return "bfd_auth_keys_dump" } -func (*BfdAuthKeysDump) GetCrcString() string { return "51077d14" } -func (*BfdAuthKeysDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdAuthKeysDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *BfdAuthKeysDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *BfdAuthKeysDump) Unmarshal(b []byte) error { - return nil -} - -// BfdAuthSetKey defines message 'bfd_auth_set_key'. -type BfdAuthSetKey struct { - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` - KeyLen uint8 `binapi:"u8,name=key_len" json:"key_len,omitempty"` - AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` - Key []byte `binapi:"u8[20],name=key" json:"key,omitempty"` -} - -func (m *BfdAuthSetKey) Reset() { *m = BfdAuthSetKey{} } -func (*BfdAuthSetKey) GetMessageName() string { return "bfd_auth_set_key" } -func (*BfdAuthSetKey) GetCrcString() string { return "690b8877" } -func (*BfdAuthSetKey) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdAuthSetKey) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.ConfKeyID - size += 1 // m.KeyLen - size += 1 // m.AuthType - size += 1 * 20 // m.Key - return size -} -func (m *BfdAuthSetKey) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.ConfKeyID) - buf.EncodeUint8(m.KeyLen) - buf.EncodeUint8(m.AuthType) - buf.EncodeBytes(m.Key, 20) - return buf.Bytes(), nil -} -func (m *BfdAuthSetKey) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.ConfKeyID = buf.DecodeUint32() - m.KeyLen = buf.DecodeUint8() - m.AuthType = buf.DecodeUint8() - m.Key = make([]byte, 20) - copy(m.Key, buf.DecodeBytes(len(m.Key))) - return nil -} - -// BfdAuthSetKeyReply defines message 'bfd_auth_set_key_reply'. -type BfdAuthSetKeyReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdAuthSetKeyReply) Reset() { *m = BfdAuthSetKeyReply{} } -func (*BfdAuthSetKeyReply) GetMessageName() string { return "bfd_auth_set_key_reply" } -func (*BfdAuthSetKeyReply) GetCrcString() string { return "e8d4e804" } -func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdAuthSetKeyReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdAuthSetKeyReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdAuthSetKeyReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPAdd defines message 'bfd_udp_add'. -type BfdUDPAdd struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` - RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` - IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` - BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` -} - -func (m *BfdUDPAdd) Reset() { *m = BfdUDPAdd{} } -func (*BfdUDPAdd) GetMessageName() string { return "bfd_udp_add" } -func (*BfdUDPAdd) GetCrcString() string { return "7a6d1185" } -func (*BfdUDPAdd) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPAdd) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.DesiredMinTx - size += 4 // m.RequiredMinRx - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 1 // m.DetectMult - size += 1 // m.IsAuthenticated - size += 1 // m.BfdKeyID - size += 4 // m.ConfKeyID - return size -} -func (m *BfdUDPAdd) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(m.DesiredMinTx) - buf.EncodeUint32(m.RequiredMinRx) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(m.DetectMult) - buf.EncodeBool(m.IsAuthenticated) - buf.EncodeUint8(m.BfdKeyID) - buf.EncodeUint32(m.ConfKeyID) - return buf.Bytes(), nil -} -func (m *BfdUDPAdd) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.DesiredMinTx = buf.DecodeUint32() - m.RequiredMinRx = buf.DecodeUint32() - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.DetectMult = buf.DecodeUint8() - m.IsAuthenticated = buf.DecodeBool() - m.BfdKeyID = buf.DecodeUint8() - m.ConfKeyID = buf.DecodeUint32() - return nil -} - -// BfdUDPAddReply defines message 'bfd_udp_add_reply'. -type BfdUDPAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPAddReply) Reset() { *m = BfdUDPAddReply{} } -func (*BfdUDPAddReply) GetMessageName() string { return "bfd_udp_add_reply" } -func (*BfdUDPAddReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPAddReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPAddReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPAddReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPAuthActivate defines message 'bfd_udp_auth_activate'. -type BfdUDPAuthActivate struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` - BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` -} - -func (m *BfdUDPAuthActivate) Reset() { *m = BfdUDPAuthActivate{} } -func (*BfdUDPAuthActivate) GetMessageName() string { return "bfd_udp_auth_activate" } -func (*BfdUDPAuthActivate) GetCrcString() string { return "493ee0ec" } -func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPAuthActivate) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 1 // m.IsDelayed - size += 1 // m.BfdKeyID - size += 4 // m.ConfKeyID - return size -} -func (m *BfdUDPAuthActivate) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeBool(m.IsDelayed) - buf.EncodeUint8(m.BfdKeyID) - buf.EncodeUint32(m.ConfKeyID) - return buf.Bytes(), nil -} -func (m *BfdUDPAuthActivate) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.IsDelayed = buf.DecodeBool() - m.BfdKeyID = buf.DecodeUint8() - m.ConfKeyID = buf.DecodeUint32() - return nil -} - -// BfdUDPAuthActivateReply defines message 'bfd_udp_auth_activate_reply'. -type BfdUDPAuthActivateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPAuthActivateReply) Reset() { *m = BfdUDPAuthActivateReply{} } -func (*BfdUDPAuthActivateReply) GetMessageName() string { return "bfd_udp_auth_activate_reply" } -func (*BfdUDPAuthActivateReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPAuthActivateReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPAuthActivateReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPAuthActivateReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPAuthDeactivate defines message 'bfd_udp_auth_deactivate'. -type BfdUDPAuthDeactivate struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` -} - -func (m *BfdUDPAuthDeactivate) Reset() { *m = BfdUDPAuthDeactivate{} } -func (*BfdUDPAuthDeactivate) GetMessageName() string { return "bfd_udp_auth_deactivate" } -func (*BfdUDPAuthDeactivate) GetCrcString() string { return "99978c32" } -func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPAuthDeactivate) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 1 // m.IsDelayed - return size -} -func (m *BfdUDPAuthDeactivate) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeBool(m.IsDelayed) - return buf.Bytes(), nil -} -func (m *BfdUDPAuthDeactivate) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.IsDelayed = buf.DecodeBool() - return nil -} - -// BfdUDPAuthDeactivateReply defines message 'bfd_udp_auth_deactivate_reply'. -type BfdUDPAuthDeactivateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPAuthDeactivateReply) Reset() { *m = BfdUDPAuthDeactivateReply{} } -func (*BfdUDPAuthDeactivateReply) GetMessageName() string { return "bfd_udp_auth_deactivate_reply" } -func (*BfdUDPAuthDeactivateReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPAuthDeactivateReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPAuthDeactivateReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPAuthDeactivateReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPDel defines message 'bfd_udp_del'. -type BfdUDPDel struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` -} - -func (m *BfdUDPDel) Reset() { *m = BfdUDPDel{} } -func (*BfdUDPDel) GetMessageName() string { return "bfd_udp_del" } -func (*BfdUDPDel) GetCrcString() string { return "8096514d" } -func (*BfdUDPDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPDel) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - return size -} -func (m *BfdUDPDel) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - return buf.Bytes(), nil -} -func (m *BfdUDPDel) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - return nil -} - -// BfdUDPDelEchoSource defines message 'bfd_udp_del_echo_source'. -type BfdUDPDelEchoSource struct{} - -func (m *BfdUDPDelEchoSource) Reset() { *m = BfdUDPDelEchoSource{} } -func (*BfdUDPDelEchoSource) GetMessageName() string { return "bfd_udp_del_echo_source" } -func (*BfdUDPDelEchoSource) GetCrcString() string { return "51077d14" } -func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPDelEchoSource) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *BfdUDPDelEchoSource) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *BfdUDPDelEchoSource) Unmarshal(b []byte) error { - return nil -} - -// BfdUDPDelEchoSourceReply defines message 'bfd_udp_del_echo_source_reply'. -type BfdUDPDelEchoSourceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPDelEchoSourceReply) Reset() { *m = BfdUDPDelEchoSourceReply{} } -func (*BfdUDPDelEchoSourceReply) GetMessageName() string { return "bfd_udp_del_echo_source_reply" } -func (*BfdUDPDelEchoSourceReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPDelEchoSourceReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPDelEchoSourceReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPDelEchoSourceReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPDelReply defines message 'bfd_udp_del_reply'. -type BfdUDPDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPDelReply) Reset() { *m = BfdUDPDelReply{} } -func (*BfdUDPDelReply) GetMessageName() string { return "bfd_udp_del_reply" } -func (*BfdUDPDelReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPDelReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPDelReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPDelReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPGetEchoSource defines message 'bfd_udp_get_echo_source'. -type BfdUDPGetEchoSource struct{} - -func (m *BfdUDPGetEchoSource) Reset() { *m = BfdUDPGetEchoSource{} } -func (*BfdUDPGetEchoSource) GetMessageName() string { return "bfd_udp_get_echo_source" } -func (*BfdUDPGetEchoSource) GetCrcString() string { return "51077d14" } -func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPGetEchoSource) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *BfdUDPGetEchoSource) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *BfdUDPGetEchoSource) Unmarshal(b []byte) error { - return nil -} - -// BfdUDPGetEchoSourceReply defines message 'bfd_udp_get_echo_source_reply'. -type BfdUDPGetEchoSourceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` - HaveUsableIP4 bool `binapi:"bool,name=have_usable_ip4" json:"have_usable_ip4,omitempty"` - IP4Addr IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` - HaveUsableIP6 bool `binapi:"bool,name=have_usable_ip6" json:"have_usable_ip6,omitempty"` - IP6Addr IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` -} - -func (m *BfdUDPGetEchoSourceReply) Reset() { *m = BfdUDPGetEchoSourceReply{} } -func (*BfdUDPGetEchoSourceReply) GetMessageName() string { return "bfd_udp_get_echo_source_reply" } -func (*BfdUDPGetEchoSourceReply) GetCrcString() string { return "1e00cfce" } -func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPGetEchoSourceReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.SwIfIndex - size += 1 // m.IsSet - size += 1 // m.HaveUsableIP4 - size += 1 * 4 // m.IP4Addr - size += 1 // m.HaveUsableIP6 - size += 1 * 16 // m.IP6Addr - return size -} -func (m *BfdUDPGetEchoSourceReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeBool(m.IsSet) - buf.EncodeBool(m.HaveUsableIP4) - buf.EncodeBytes(m.IP4Addr[:], 4) - buf.EncodeBool(m.HaveUsableIP6) - buf.EncodeBytes(m.IP6Addr[:], 16) - return buf.Bytes(), nil -} -func (m *BfdUDPGetEchoSourceReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.IsSet = buf.DecodeBool() - m.HaveUsableIP4 = buf.DecodeBool() - copy(m.IP4Addr[:], buf.DecodeBytes(4)) - m.HaveUsableIP6 = buf.DecodeBool() - copy(m.IP6Addr[:], buf.DecodeBytes(16)) - return nil -} - -// BfdUDPMod defines message 'bfd_udp_mod'. -type BfdUDPMod struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` - RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` -} - -func (m *BfdUDPMod) Reset() { *m = BfdUDPMod{} } -func (*BfdUDPMod) GetMessageName() string { return "bfd_udp_mod" } -func (*BfdUDPMod) GetCrcString() string { return "783a3ff6" } -func (*BfdUDPMod) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPMod) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.DesiredMinTx - size += 4 // m.RequiredMinRx - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 1 // m.DetectMult - return size -} -func (m *BfdUDPMod) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(m.DesiredMinTx) - buf.EncodeUint32(m.RequiredMinRx) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(m.DetectMult) - return buf.Bytes(), nil -} -func (m *BfdUDPMod) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.DesiredMinTx = buf.DecodeUint32() - m.RequiredMinRx = buf.DecodeUint32() - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.DetectMult = buf.DecodeUint8() - return nil -} - -// BfdUDPModReply defines message 'bfd_udp_mod_reply'. -type BfdUDPModReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPModReply) Reset() { *m = BfdUDPModReply{} } -func (*BfdUDPModReply) GetMessageName() string { return "bfd_udp_mod_reply" } -func (*BfdUDPModReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPModReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPModReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPModReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPModReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPSessionDetails defines message 'bfd_udp_session_details'. -type BfdUDPSessionDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - State BfdState `binapi:"bfd_state,name=state" json:"state,omitempty"` - IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` - BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` - ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` - RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` - DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` - DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` -} - -func (m *BfdUDPSessionDetails) Reset() { *m = BfdUDPSessionDetails{} } -func (*BfdUDPSessionDetails) GetMessageName() string { return "bfd_udp_session_details" } -func (*BfdUDPSessionDetails) GetCrcString() string { return "60653c02" } -func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPSessionDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 4 // m.State - size += 1 // m.IsAuthenticated - size += 1 // m.BfdKeyID - size += 4 // m.ConfKeyID - size += 4 // m.RequiredMinRx - size += 4 // m.DesiredMinTx - size += 1 // m.DetectMult - return size -} -func (m *BfdUDPSessionDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.State)) - buf.EncodeBool(m.IsAuthenticated) - buf.EncodeUint8(m.BfdKeyID) - buf.EncodeUint32(m.ConfKeyID) - buf.EncodeUint32(m.RequiredMinRx) - buf.EncodeUint32(m.DesiredMinTx) - buf.EncodeUint8(m.DetectMult) - return buf.Bytes(), nil -} -func (m *BfdUDPSessionDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.State = BfdState(buf.DecodeUint32()) - m.IsAuthenticated = buf.DecodeBool() - m.BfdKeyID = buf.DecodeUint8() - m.ConfKeyID = buf.DecodeUint32() - m.RequiredMinRx = buf.DecodeUint32() - m.DesiredMinTx = buf.DecodeUint32() - m.DetectMult = buf.DecodeUint8() - return nil -} - -// BfdUDPSessionDump defines message 'bfd_udp_session_dump'. -type BfdUDPSessionDump struct{} - -func (m *BfdUDPSessionDump) Reset() { *m = BfdUDPSessionDump{} } -func (*BfdUDPSessionDump) GetMessageName() string { return "bfd_udp_session_dump" } -func (*BfdUDPSessionDump) GetCrcString() string { return "51077d14" } -func (*BfdUDPSessionDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPSessionDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *BfdUDPSessionDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *BfdUDPSessionDump) Unmarshal(b []byte) error { - return nil -} - -// BfdUDPSessionSetFlags defines message 'bfd_udp_session_set_flags'. -type BfdUDPSessionSetFlags struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - LocalAddr Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` - PeerAddr Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` -} - -func (m *BfdUDPSessionSetFlags) Reset() { *m = BfdUDPSessionSetFlags{} } -func (*BfdUDPSessionSetFlags) GetMessageName() string { return "bfd_udp_session_set_flags" } -func (*BfdUDPSessionSetFlags) GetCrcString() string { return "cf313851" } -func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPSessionSetFlags) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.LocalAddr.Af - size += 1 * 16 // m.LocalAddr.Un - size += 4 // m.PeerAddr.Af - size += 1 * 16 // m.PeerAddr.Un - size += 4 // m.Flags - return size -} -func (m *BfdUDPSessionSetFlags) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - buf.EncodeUint32(uint32(m.LocalAddr.Af)) - buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.PeerAddr.Af)) - buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Flags)) - return buf.Bytes(), nil -} -func (m *BfdUDPSessionSetFlags) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.LocalAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.PeerAddr.Af = AddressFamily(buf.DecodeUint32()) - copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Flags = IfStatusFlags(buf.DecodeUint32()) - return nil -} - -// BfdUDPSessionSetFlagsReply defines message 'bfd_udp_session_set_flags_reply'. -type BfdUDPSessionSetFlagsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPSessionSetFlagsReply) Reset() { *m = BfdUDPSessionSetFlagsReply{} } -func (*BfdUDPSessionSetFlagsReply) GetMessageName() string { return "bfd_udp_session_set_flags_reply" } -func (*BfdUDPSessionSetFlagsReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPSessionSetFlagsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPSessionSetFlagsReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPSessionSetFlagsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// BfdUDPSetEchoSource defines message 'bfd_udp_set_echo_source'. -type BfdUDPSetEchoSource struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *BfdUDPSetEchoSource) Reset() { *m = BfdUDPSetEchoSource{} } -func (*BfdUDPSetEchoSource) GetMessageName() string { return "bfd_udp_set_echo_source" } -func (*BfdUDPSetEchoSource) GetCrcString() string { return "f9e6675e" } -func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *BfdUDPSetEchoSource) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - return size -} -func (m *BfdUDPSetEchoSource) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.SwIfIndex)) - return buf.Bytes(), nil -} -func (m *BfdUDPSetEchoSource) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - return nil -} - -// BfdUDPSetEchoSourceReply defines message 'bfd_udp_set_echo_source_reply'. -type BfdUDPSetEchoSourceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *BfdUDPSetEchoSourceReply) Reset() { *m = BfdUDPSetEchoSourceReply{} } -func (*BfdUDPSetEchoSourceReply) GetMessageName() string { return "bfd_udp_set_echo_source_reply" } -func (*BfdUDPSetEchoSourceReply) GetCrcString() string { return "e8d4e804" } -func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *BfdUDPSetEchoSourceReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *BfdUDPSetEchoSourceReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *BfdUDPSetEchoSourceReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// WantBfdEvents defines message 'want_bfd_events'. -type WantBfdEvents struct { - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -func (m *WantBfdEvents) Reset() { *m = WantBfdEvents{} } -func (*WantBfdEvents) GetMessageName() string { return "want_bfd_events" } -func (*WantBfdEvents) GetCrcString() string { return "c5e2af94" } -func (*WantBfdEvents) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *WantBfdEvents) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.EnableDisable - size += 4 // m.PID - return size -} -func (m *WantBfdEvents) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.EnableDisable) - buf.EncodeUint32(m.PID) - return buf.Bytes(), nil -} -func (m *WantBfdEvents) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.EnableDisable = buf.DecodeBool() - m.PID = buf.DecodeUint32() - return nil -} - -// WantBfdEventsReply defines message 'want_bfd_events_reply'. -type WantBfdEventsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *WantBfdEventsReply) Reset() { *m = WantBfdEventsReply{} } -func (*WantBfdEventsReply) GetMessageName() string { return "want_bfd_events_reply" } -func (*WantBfdEventsReply) GetCrcString() string { return "e8d4e804" } -func (*WantBfdEventsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *WantBfdEventsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *WantBfdEventsReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *WantBfdEventsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -func init() { file_bfd_binapi_init() } -func file_bfd_binapi_init() { - api.RegisterMessage((*BfdAuthDelKey)(nil), "bfd_auth_del_key_65310b22") - api.RegisterMessage((*BfdAuthDelKeyReply)(nil), "bfd_auth_del_key_reply_e8d4e804") - api.RegisterMessage((*BfdAuthKeysDetails)(nil), "bfd_auth_keys_details_84130e9f") - api.RegisterMessage((*BfdAuthKeysDump)(nil), "bfd_auth_keys_dump_51077d14") - api.RegisterMessage((*BfdAuthSetKey)(nil), "bfd_auth_set_key_690b8877") - api.RegisterMessage((*BfdAuthSetKeyReply)(nil), "bfd_auth_set_key_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAdd)(nil), "bfd_udp_add_7a6d1185") - api.RegisterMessage((*BfdUDPAddReply)(nil), "bfd_udp_add_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd_udp_auth_activate_493ee0ec") - api.RegisterMessage((*BfdUDPAuthActivateReply)(nil), "bfd_udp_auth_activate_reply_e8d4e804") - api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd_udp_auth_deactivate_99978c32") - api.RegisterMessage((*BfdUDPAuthDeactivateReply)(nil), "bfd_udp_auth_deactivate_reply_e8d4e804") - api.RegisterMessage((*BfdUDPDel)(nil), "bfd_udp_del_8096514d") - api.RegisterMessage((*BfdUDPDelEchoSource)(nil), "bfd_udp_del_echo_source_51077d14") - api.RegisterMessage((*BfdUDPDelEchoSourceReply)(nil), "bfd_udp_del_echo_source_reply_e8d4e804") - api.RegisterMessage((*BfdUDPDelReply)(nil), "bfd_udp_del_reply_e8d4e804") - api.RegisterMessage((*BfdUDPGetEchoSource)(nil), "bfd_udp_get_echo_source_51077d14") - api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd_udp_get_echo_source_reply_1e00cfce") - api.RegisterMessage((*BfdUDPMod)(nil), "bfd_udp_mod_783a3ff6") - api.RegisterMessage((*BfdUDPModReply)(nil), "bfd_udp_mod_reply_e8d4e804") - api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd_udp_session_details_60653c02") - api.RegisterMessage((*BfdUDPSessionDump)(nil), "bfd_udp_session_dump_51077d14") - api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd_udp_session_set_flags_cf313851") - api.RegisterMessage((*BfdUDPSessionSetFlagsReply)(nil), "bfd_udp_session_set_flags_reply_e8d4e804") - api.RegisterMessage((*BfdUDPSetEchoSource)(nil), "bfd_udp_set_echo_source_f9e6675e") - api.RegisterMessage((*BfdUDPSetEchoSourceReply)(nil), "bfd_udp_set_echo_source_reply_e8d4e804") - api.RegisterMessage((*WantBfdEvents)(nil), "want_bfd_events_c5e2af94") - api.RegisterMessage((*WantBfdEventsReply)(nil), "want_bfd_events_reply_e8d4e804") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*BfdAuthDelKey)(nil), - (*BfdAuthDelKeyReply)(nil), - (*BfdAuthKeysDetails)(nil), - (*BfdAuthKeysDump)(nil), - (*BfdAuthSetKey)(nil), - (*BfdAuthSetKeyReply)(nil), - (*BfdUDPAdd)(nil), - (*BfdUDPAddReply)(nil), - (*BfdUDPAuthActivate)(nil), - (*BfdUDPAuthActivateReply)(nil), - (*BfdUDPAuthDeactivate)(nil), - (*BfdUDPAuthDeactivateReply)(nil), - (*BfdUDPDel)(nil), - (*BfdUDPDelEchoSource)(nil), - (*BfdUDPDelEchoSourceReply)(nil), - (*BfdUDPDelReply)(nil), - (*BfdUDPGetEchoSource)(nil), - (*BfdUDPGetEchoSourceReply)(nil), - (*BfdUDPMod)(nil), - (*BfdUDPModReply)(nil), - (*BfdUDPSessionDetails)(nil), - (*BfdUDPSessionDump)(nil), - (*BfdUDPSessionSetFlags)(nil), - (*BfdUDPSessionSetFlagsReply)(nil), - (*BfdUDPSetEchoSource)(nil), - (*BfdUDPSetEchoSourceReply)(nil), - (*WantBfdEvents)(nil), - (*WantBfdEventsReply)(nil), - } -} diff --git a/internal/testbinapi/binapi2001/bfd/bfd_rpc.ba.go b/internal/testbinapi/binapi2001/bfd/bfd_rpc.ba.go deleted file mode 100644 index a9a9472..0000000 --- a/internal/testbinapi/binapi2001/bfd/bfd_rpc.ba.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package bfd - -import ( - "context" - "fmt" - "io" - - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" -) - -// RPCService defines RPC service bfd. -type RPCService interface { - BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) - BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) - BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) - BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) - BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) - BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) - BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) - BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) - BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) - BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) - BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) - BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) - BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) - WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { - out := new(BfdAuthDelKeyReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_BfdAuthKeysDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_BfdAuthKeysDumpClient interface { - Recv() (*BfdAuthKeysDetails, error) - api.Stream -} - -type serviceClient_BfdAuthKeysDumpClient struct { - api.Stream -} - -func (c *serviceClient_BfdAuthKeysDumpClient) Recv() (*BfdAuthKeysDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *BfdAuthKeysDetails: - return m, nil - case *vpe.ControlPingReply: - err = c.Stream.Close() - if err != nil { - return nil, err - } - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { - out := new(BfdAuthSetKeyReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { - out := new(BfdUDPAddReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { - out := new(BfdUDPAuthActivateReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { - out := new(BfdUDPAuthDeactivateReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { - out := new(BfdUDPDelReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { - out := new(BfdUDPDelEchoSourceReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { - out := new(BfdUDPGetEchoSourceReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { - out := new(BfdUDPModReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_BfdUDPSessionDumpClient{stream} - if err := x.Stream.SendMsg(in); err != nil { - return nil, err - } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { - return nil, err - } - return x, nil -} - -type RPCService_BfdUDPSessionDumpClient interface { - Recv() (*BfdUDPSessionDetails, error) - api.Stream -} - -type serviceClient_BfdUDPSessionDumpClient struct { - api.Stream -} - -func (c *serviceClient_BfdUDPSessionDumpClient) Recv() (*BfdUDPSessionDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *BfdUDPSessionDetails: - return m, nil - case *vpe.ControlPingReply: - err = c.Stream.Close() - if err != nil { - return nil, err - } - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { - out := new(BfdUDPSessionSetFlagsReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { - out := new(BfdUDPSetEchoSourceReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { - out := new(WantBfdEventsReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} |