diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2020-07-22 04:40:55 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2020-07-22 04:40:55 +0200 |
commit | 58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch) | |
tree | a1bbda04c6d0621ce0fc20779276620f1820190b /internal/testbinapi/binapi2001/interface | |
parent | a155cd438c6558da266c1c5931361ea088b35653 (diff) |
Fix binapigen decoding and minor improvements
- fixed allocating byte slices before copying decoded data
- simplified encoding functions
- several minor improvements
Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'internal/testbinapi/binapi2001/interface')
-rw-r--r-- | internal/testbinapi/binapi2001/interface/interface.ba.go | 3083 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/interface/interface_rpc.ba.go | 343 |
2 files changed, 3426 insertions, 0 deletions
diff --git a/internal/testbinapi/binapi2001/interface/interface.ba.go b/internal/testbinapi/binapi2001/interface/interface.ba.go new file mode 100644 index 0000000..94a33b8 --- /dev/null +++ b/internal/testbinapi/binapi2001/interface/interface.ba.go @@ -0,0 +1,3083 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01 +// source: .vppapi/core/interface.api.json + +// Package interfaces contains generated bindings for API file interface.api. +// +// Contents: +// 7 aliases +// 10 enums +// 6 structs +// 1 union +// 53 messages +// +package interfaces + +import ( + "fmt" + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + "net" + "strconv" + "strings" +) + +// 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 = "interface" + APIVersion = "3.2.2" + VersionCrc = 0xfebc3ffa +) + +// 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)) + ")" +} + +// 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 + +// MacAddress defines alias 'mac_address'. +type MacAddress [6]uint8 + +func ParseMacAddress(s string) (MacAddress, error) { + var macaddr MacAddress + mac, err := net.ParseMAC(s) + if err != nil { + return macaddr, err + } + copy(macaddr[:], mac[:]) + return macaddr, nil +} +func (x MacAddress) ToMAC() net.HardwareAddr { + return net.HardwareAddr(x[:]) +} +func (x MacAddress) String() string { + return x.ToMAC().String() +} +func (x *MacAddress) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *MacAddress) UnmarshalText(text []byte) error { + mac, err := ParseMacAddress(string(text)) + if err != nil { + return err + } + *x = mac + return nil +} + +// 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) + } + 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, nil +} +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 { + // 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 +} + +// CollectDetailedInterfaceStats defines message 'collect_detailed_interface_stats'. +type CollectDetailedInterfaceStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } +func (*CollectDetailedInterfaceStats) GetMessageName() string { + return "collect_detailed_interface_stats" +} +func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } +func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CollectDetailedInterfaceStats) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CollectDetailedInterfaceStats) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CollectDetailedInterfaceStatsReply defines message 'collect_detailed_interface_stats_reply'. +type CollectDetailedInterfaceStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } +func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { + return "collect_detailed_interface_stats_reply" +} +func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } +func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CollectDetailedInterfaceStatsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *CollectDetailedInterfaceStatsReply) 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 *CollectDetailedInterfaceStatsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// CreateLoopback defines message 'create_loopback'. +type CreateLoopback struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } +func (*CreateLoopback) GetMessageName() string { return "create_loopback" } +func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } +func (*CreateLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateLoopback) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 6 // m.MacAddress + return size +} +func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *CreateLoopback) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// CreateLoopbackInstance defines message 'create_loopback_instance'. +type CreateLoopbackInstance struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` +} + +func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } +func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } +func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } +func (*CreateLoopbackInstance) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateLoopbackInstance) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 6 // m.MacAddress + size += 1 // m.IsSpecified + size += 4 // m.UserInstance + return size +} +func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeBool(m.IsSpecified) + buf.EncodeUint32(m.UserInstance) + return buf.Bytes(), nil +} +func (m *CreateLoopbackInstance) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.IsSpecified = buf.DecodeBool() + m.UserInstance = buf.DecodeUint32() + return nil +} + +// CreateLoopbackInstanceReply defines message 'create_loopback_instance_reply'. +type CreateLoopbackInstanceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } +func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } +func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateLoopbackInstanceReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateLoopbackInstanceReply) 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)) + return buf.Bytes(), nil +} +func (m *CreateLoopbackInstanceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateLoopbackReply defines message 'create_loopback_reply'. +type CreateLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } +func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } +func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateLoopbackReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateLoopbackReply) 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)) + return buf.Bytes(), nil +} +func (m *CreateLoopbackReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateSubif defines message 'create_subif'. +type CreateSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` +} + +func (m *CreateSubif) Reset() { *m = CreateSubif{} } +func (*CreateSubif) GetMessageName() string { return "create_subif" } +func (*CreateSubif) GetCrcString() string { return "cb371063" } +func (*CreateSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateSubif) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.SubID + size += 4 // m.SubIfFlags + size += 2 // m.OuterVlanID + size += 2 // m.InnerVlanID + return size +} +func (m *CreateSubif) 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.SubID) + buf.EncodeUint32(uint32(m.SubIfFlags)) + buf.EncodeUint16(m.OuterVlanID) + buf.EncodeUint16(m.InnerVlanID) + return buf.Bytes(), nil +} +func (m *CreateSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.SubID = buf.DecodeUint32() + m.SubIfFlags = SubIfFlags(buf.DecodeUint32()) + m.OuterVlanID = buf.DecodeUint16() + m.InnerVlanID = buf.DecodeUint16() + return nil +} + +// CreateSubifReply defines message 'create_subif_reply'. +type CreateSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } +func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } +func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateSubifReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateSubifReply) 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)) + return buf.Bytes(), nil +} +func (m *CreateSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// CreateVlanSubif defines message 'create_vlan_subif'. +type CreateVlanSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` +} + +func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } +func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } +func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } +func (*CreateVlanSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CreateVlanSubif) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.VlanID + return size +} +func (m *CreateVlanSubif) 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.VlanID) + return buf.Bytes(), nil +} +func (m *CreateVlanSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.VlanID = buf.DecodeUint32() + return nil +} + +// CreateVlanSubifReply defines message 'create_vlan_subif_reply'. +type CreateVlanSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } +func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } +func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateVlanSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CreateVlanSubifReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *CreateVlanSubifReply) 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)) + return buf.Bytes(), nil +} +func (m *CreateVlanSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteLoopback defines message 'delete_loopback'. +type DeleteLoopback struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } +func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } +func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } +func (*DeleteLoopback) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DeleteLoopback) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *DeleteLoopback) 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 *DeleteLoopback) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteLoopbackReply defines message 'delete_loopback_reply'. +type DeleteLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } +func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } +func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteLoopbackReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DeleteLoopbackReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *DeleteLoopbackReply) 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 *DeleteLoopbackReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// DeleteSubif defines message 'delete_subif'. +type DeleteSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } +func (*DeleteSubif) GetMessageName() string { return "delete_subif" } +func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } +func (*DeleteSubif) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DeleteSubif) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *DeleteSubif) 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 *DeleteSubif) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// DeleteSubifReply defines message 'delete_subif_reply'. +type DeleteSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } +func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } +func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteSubifReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DeleteSubifReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *DeleteSubifReply) 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 *DeleteSubifReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// HwInterfaceSetMtu defines message 'hw_interface_set_mtu'. +type HwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` +} + +func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } +func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } +func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } +func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *HwInterfaceSetMtu) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 2 // m.Mtu + return size +} +func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(m.Mtu) + return buf.Bytes(), nil +} +func (m *HwInterfaceSetMtu) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Mtu = buf.DecodeUint16() + return nil +} + +// HwInterfaceSetMtuReply defines message 'hw_interface_set_mtu_reply'. +type HwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } +func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } +func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *HwInterfaceSetMtuReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *HwInterfaceSetMtuReply) 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 *HwInterfaceSetMtuReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// InterfaceNameRenumber defines message 'interface_name_renumber'. +type InterfaceNameRenumber struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` +} + +func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } +func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } +func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } +func (*InterfaceNameRenumber) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *InterfaceNameRenumber) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.NewShowDevInstance + return size +} +func (m *InterfaceNameRenumber) 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.NewShowDevInstance) + return buf.Bytes(), nil +} +func (m *InterfaceNameRenumber) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.NewShowDevInstance = buf.DecodeUint32() + return nil +} + +// InterfaceNameRenumberReply defines message 'interface_name_renumber_reply'. +type InterfaceNameRenumberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } +func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } +func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } +func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *InterfaceNameRenumberReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *InterfaceNameRenumberReply) 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 *InterfaceNameRenumberReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceAddDelAddress defines message 'sw_interface_add_del_address'. +type SwInterfaceAddDelAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } +func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } +func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddDelAddress) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsAdd + size += 1 // m.DelAll + size += 4 // m.Prefix.Address.Af + size += 1 * 16 // m.Prefix.Address.Un + size += 1 // m.Prefix.Len + return size +} +func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.DelAll) + buf.EncodeUint32(uint32(m.Prefix.Address.Af)) + buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16) + buf.EncodeUint8(m.Prefix.Len) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + m.DelAll = buf.DecodeBool() + m.Prefix.Address.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Prefix.Len = buf.DecodeUint8() + return nil +} + +// SwInterfaceAddDelAddressReply defines message 'sw_interface_add_del_address_reply'. +type SwInterfaceAddDelAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddDelAddressReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddDelAddressReply) 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 *SwInterfaceAddDelAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceAddDelMacAddress defines message 'sw_interface_add_del_mac_address'. +type SwInterfaceAddDelMacAddress struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } +func (*SwInterfaceAddDelMacAddress) GetMessageName() string { + return "sw_interface_add_del_mac_address" +} +func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } +func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceAddDelMacAddress) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 * 6 // m.Addr + size += 1 // m.IsAdd + return size +} +func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeBytes(m.Addr[:], 6) + buf.EncodeUint8(m.IsAdd) + return buf.Bytes(), nil +} +func (m *SwInterfaceAddDelMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + copy(m.Addr[:], buf.DecodeBytes(6)) + m.IsAdd = buf.DecodeUint8() + return nil +} + +// SwInterfaceAddDelMacAddressReply defines message 'sw_interface_add_del_mac_address_reply'. +type SwInterfaceAddDelMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } +func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { + return "sw_interface_add_del_mac_address_reply" +} +func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceAddDelMacAddressReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceAddDelMacAddressReply) 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 *SwInterfaceAddDelMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceClearStats defines message 'sw_interface_clear_stats'. +type SwInterfaceClearStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } +func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } +func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceClearStats) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceClearStats) 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 *SwInterfaceClearStats) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceClearStatsReply defines message 'sw_interface_clear_stats_reply'. +type SwInterfaceClearStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } +func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } +func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceClearStatsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceClearStatsReply) 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 *SwInterfaceClearStatsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceDetails defines message 'sw_interface_details'. +type SwInterfaceDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } +func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } +func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } +func (*SwInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.SupSwIfIndex + size += 1 * 6 // m.L2Address + size += 4 // m.Flags + size += 4 // m.Type + size += 4 // m.LinkDuplex + size += 4 // m.LinkSpeed + size += 2 // m.LinkMtu + size += 4 * 4 // m.Mtu + size += 4 // m.SubID + size += 1 // m.SubNumberOfTags + size += 2 // m.SubOuterVlanID + size += 2 // m.SubInnerVlanID + size += 4 // m.SubIfFlags + size += 4 // m.VtrOp + size += 4 // m.VtrPushDot1q + size += 4 // m.VtrTag1 + size += 4 // m.VtrTag2 + size += 2 // m.OuterTag + size += 1 * 6 // m.BDmac + size += 1 * 6 // m.BSmac + size += 2 // m.BVlanid + size += 4 // m.ISid + size += 64 // m.InterfaceName + size += 64 // m.InterfaceDevType + size += 64 // m.Tag + return size +} +func (m *SwInterfaceDetails) 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.SupSwIfIndex) + buf.EncodeBytes(m.L2Address[:], 6) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeUint32(uint32(m.Type)) + buf.EncodeUint32(uint32(m.LinkDuplex)) + buf.EncodeUint32(m.LinkSpeed) + buf.EncodeUint16(m.LinkMtu) + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + buf.EncodeUint32(x) + } + buf.EncodeUint32(m.SubID) + buf.EncodeUint8(m.SubNumberOfTags) + buf.EncodeUint16(m.SubOuterVlanID) + buf.EncodeUint16(m.SubInnerVlanID) + buf.EncodeUint32(uint32(m.SubIfFlags)) + buf.EncodeUint32(m.VtrOp) + buf.EncodeUint32(m.VtrPushDot1q) + buf.EncodeUint32(m.VtrTag1) + buf.EncodeUint32(m.VtrTag2) + buf.EncodeUint16(m.OuterTag) + buf.EncodeBytes(m.BDmac[:], 6) + buf.EncodeBytes(m.BSmac[:], 6) + buf.EncodeUint16(m.BVlanid) + buf.EncodeUint32(m.ISid) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeString(m.InterfaceDevType, 64) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.SupSwIfIndex = buf.DecodeUint32() + copy(m.L2Address[:], buf.DecodeBytes(6)) + m.Flags = IfStatusFlags(buf.DecodeUint32()) + m.Type = IfType(buf.DecodeUint32()) + m.LinkDuplex = LinkDuplex(buf.DecodeUint32()) + m.LinkSpeed = buf.DecodeUint32() + m.LinkMtu = buf.DecodeUint16() + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = buf.DecodeUint32() + } + m.SubID = buf.DecodeUint32() + m.SubNumberOfTags = buf.DecodeUint8() + m.SubOuterVlanID = buf.DecodeUint16() + m.SubInnerVlanID = buf.DecodeUint16() + m.SubIfFlags = SubIfFlags(buf.DecodeUint32()) + m.VtrOp = buf.DecodeUint32() + m.VtrPushDot1q = buf.DecodeUint32() + m.VtrTag1 = buf.DecodeUint32() + m.VtrTag2 = buf.DecodeUint32() + m.OuterTag = buf.DecodeUint16() + copy(m.BDmac[:], buf.DecodeBytes(6)) + copy(m.BSmac[:], buf.DecodeBytes(6)) + m.BVlanid = buf.DecodeUint16() + m.ISid = buf.DecodeUint32() + m.InterfaceName = buf.DecodeString(64) + m.InterfaceDevType = buf.DecodeString(64) + m.Tag = buf.DecodeString(64) + return nil +} + +// SwInterfaceDump defines message 'sw_interface_dump'. +type SwInterfaceDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + NameFilter string `binapi:"string[],name=name_filter" json:"name_filter,omitempty"` +} + +func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } +func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } +func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } +func (*SwInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.NameFilterValid + size += 4 + len(m.NameFilter) // m.NameFilter + return size +} +func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.NameFilterValid) + buf.EncodeString(m.NameFilter, 0) + return buf.Bytes(), nil +} +func (m *SwInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.NameFilterValid = buf.DecodeBool() + m.NameFilter = buf.DecodeString(0) + return nil +} + +// SwInterfaceEvent defines message 'sw_interface_event'. +type SwInterfaceEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` +} + +func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } +func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } +func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } +func (*SwInterfaceEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *SwInterfaceEvent) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.Flags + size += 1 // m.Deleted + return size +} +func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.PID) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Flags)) + buf.EncodeBool(m.Deleted) + return buf.Bytes(), nil +} +func (m *SwInterfaceEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Flags = IfStatusFlags(buf.DecodeUint32()) + m.Deleted = buf.DecodeBool() + return nil +} + +// SwInterfaceGetMacAddress defines message 'sw_interface_get_mac_address'. +type SwInterfaceGetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } +func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } +func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceGetMacAddress) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceGetMacAddress) 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 *SwInterfaceGetMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceGetMacAddressReply defines message 'sw_interface_get_mac_address_reply'. +type SwInterfaceGetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } +func (*SwInterfaceGetMacAddressReply) GetMessageName() string { + return "sw_interface_get_mac_address_reply" +} +func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } +func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceGetMacAddressReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 1 * 6 // m.MacAddress + return size +} +func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// SwInterfaceGetTable defines message 'sw_interface_get_table'. +type SwInterfaceGetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } +func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } +func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceGetTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + return size +} +func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + return nil +} + +// SwInterfaceGetTableReply defines message 'sw_interface_get_table_reply'. +type SwInterfaceGetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } +func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } +func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceGetTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.VrfID + return size +} +func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *SwInterfaceGetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.VrfID = buf.DecodeUint32() + return nil +} + +// SwInterfaceRxPlacementDetails defines message 'sw_interface_rx_placement_details'. +type SwInterfaceRxPlacementDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } +func (*SwInterfaceRxPlacementDetails) GetMessageName() string { + return "sw_interface_rx_placement_details" +} +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } +func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceRxPlacementDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 4 // m.WorkerID + size += 4 // m.Mode + return size +} +func (m *SwInterfaceRxPlacementDetails) 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.QueueID) + buf.EncodeUint32(m.WorkerID) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *SwInterfaceRxPlacementDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.WorkerID = buf.DecodeUint32() + m.Mode = RxMode(buf.DecodeUint32()) + return nil +} + +// SwInterfaceRxPlacementDump defines message 'sw_interface_rx_placement_dump'. +type SwInterfaceRxPlacementDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } +func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } +func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceRxPlacementDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceRxPlacementDump) 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 *SwInterfaceRxPlacementDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetFlags defines message 'sw_interface_set_flags'. +type SwInterfaceSetFlags struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } +func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } +func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetFlags) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.Flags + return size +} +func (m *SwInterfaceSetFlags) 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.Flags)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetFlags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Flags = IfStatusFlags(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetFlagsReply defines message 'sw_interface_set_flags_reply'. +type SwInterfaceSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } +func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } +func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetFlagsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetFlagsReply) 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 *SwInterfaceSetFlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetIPDirectedBroadcast defines message 'sw_interface_set_ip_directed_broadcast'. +type SwInterfaceSetIPDirectedBroadcast struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// SwInterfaceSetIPDirectedBroadcastReply defines message 'sw_interface_set_ip_directed_broadcast_reply'. +type SwInterfaceSetIPDirectedBroadcastReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { + *m = SwInterfaceSetIPDirectedBroadcastReply{} +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast_reply" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) 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 *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetMacAddress defines message 'sw_interface_set_mac_address'. +type SwInterfaceSetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } +func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } +func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetMacAddress) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 * 6 // m.MacAddress + return size +} +func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.MacAddress[:], 6) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMacAddress) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + copy(m.MacAddress[:], buf.DecodeBytes(6)) + return nil +} + +// SwInterfaceSetMacAddressReply defines message 'sw_interface_set_mac_address_reply'. +type SwInterfaceSetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetMacAddressReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetMacAddressReply) 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 *SwInterfaceSetMacAddressReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetMtu defines message 'sw_interface_set_mtu'. +type SwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty"` +} + +func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } +func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } +func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetMtu) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 * 4 // m.Mtu + return size +} +func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceSetMtu) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = buf.DecodeUint32() + } + return nil +} + +// SwInterfaceSetMtuReply defines message 'sw_interface_set_mtu_reply'. +type SwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } +func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } +func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetMtuReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetMtuReply) 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 *SwInterfaceSetMtuReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetRxMode defines message 'sw_interface_set_rx_mode'. +type SwInterfaceSetRxMode struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } +func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } +func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } +func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetRxMode) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.QueueIDValid + size += 4 // m.QueueID + size += 4 // m.Mode + return size +} +func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.QueueIDValid) + buf.EncodeUint32(m.QueueID) + buf.EncodeUint32(uint32(m.Mode)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxMode) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.QueueIDValid = buf.DecodeBool() + m.QueueID = buf.DecodeUint32() + m.Mode = RxMode(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSetRxModeReply defines message 'sw_interface_set_rx_mode_reply'. +type SwInterfaceSetRxModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } +func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } +func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetRxModeReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetRxModeReply) 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 *SwInterfaceSetRxModeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetRxPlacement defines message 'sw_interface_set_rx_placement'. +type SwInterfaceSetRxPlacement struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` +} + +func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } +func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } +func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } +func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetRxPlacement) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.QueueID + size += 4 // m.WorkerID + size += 1 // m.IsMain + return size +} +func (m *SwInterfaceSetRxPlacement) 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.QueueID) + buf.EncodeUint32(m.WorkerID) + buf.EncodeBool(m.IsMain) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetRxPlacement) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.QueueID = buf.DecodeUint32() + m.WorkerID = buf.DecodeUint32() + m.IsMain = buf.DecodeBool() + return nil +} + +// SwInterfaceSetRxPlacementReply defines message 'sw_interface_set_rx_placement_reply'. +type SwInterfaceSetRxPlacementReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } +func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { + return "sw_interface_set_rx_placement_reply" +} +func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetRxPlacementReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetRxPlacementReply) 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 *SwInterfaceSetRxPlacementReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetTable defines message 'sw_interface_set_table'. +type SwInterfaceSetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } +func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } +func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetTable) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 1 // m.IsIPv6 + size += 4 // m.VrfID + return size +} +func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeUint32(m.VrfID) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.VrfID = buf.DecodeUint32() + return nil +} + +// SwInterfaceSetTableReply defines message 'sw_interface_set_table_reply'. +type SwInterfaceSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } +func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } +func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetTableReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetTableReply) 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 *SwInterfaceSetTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceSetUnnumbered defines message 'sw_interface_set_unnumbered'. +type SwInterfaceSetUnnumbered struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } +func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } +func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetUnnumbered) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.UnnumberedSwIfIndex + size += 1 // m.IsAdd + return size +} +func (m *SwInterfaceSetUnnumbered) 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.UnnumberedSwIfIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetUnnumbered) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.UnnumberedSwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.IsAdd = buf.DecodeBool() + return nil +} + +// SwInterfaceSetUnnumberedReply defines message 'sw_interface_set_unnumbered_reply'. +type SwInterfaceSetUnnumberedReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetUnnumberedReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetUnnumberedReply) 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 *SwInterfaceSetUnnumberedReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// SwInterfaceTagAddDel defines message 'sw_interface_tag_add_del'. +type SwInterfaceTagAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` +} + +func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } +func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } +func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceTagAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 64 // m.Tag + return size +} +func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.Tag, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceTagAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Tag = buf.DecodeString(64) + return nil +} + +// SwInterfaceTagAddDelReply defines message 'sw_interface_tag_add_del_reply'. +type SwInterfaceTagAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } +func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } +func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceTagAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *SwInterfaceTagAddDelReply) 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 *SwInterfaceTagAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// WantInterfaceEvents defines message 'want_interface_events'. +type WantInterfaceEvents struct { + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } +func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } +func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } +func (*WantInterfaceEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantInterfaceEvents) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.EnableDisable) + buf.EncodeUint32(m.PID) + return buf.Bytes(), nil +} +func (m *WantInterfaceEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeUint32() + m.PID = buf.DecodeUint32() + return nil +} + +// WantInterfaceEventsReply defines message 'want_interface_events_reply'. +type WantInterfaceEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } +func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } +func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantInterfaceEventsReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *WantInterfaceEventsReply) 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 *WantInterfaceEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_interfaces_binapi_init() } +func file_interfaces_binapi_init() { + api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "collect_detailed_interface_stats_5501adee") + api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "collect_detailed_interface_stats_reply_e8d4e804") + api.RegisterMessage((*CreateLoopback)(nil), "create_loopback_42bb5d22") + api.RegisterMessage((*CreateLoopbackInstance)(nil), "create_loopback_instance_d36a3ee2") + api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "create_loopback_instance_reply_5383d31f") + api.RegisterMessage((*CreateLoopbackReply)(nil), "create_loopback_reply_5383d31f") + api.RegisterMessage((*CreateSubif)(nil), "create_subif_cb371063") + api.RegisterMessage((*CreateSubifReply)(nil), "create_subif_reply_5383d31f") + api.RegisterMessage((*CreateVlanSubif)(nil), "create_vlan_subif_af34ac8b") + api.RegisterMessage((*CreateVlanSubifReply)(nil), "create_vlan_subif_reply_5383d31f") + api.RegisterMessage((*DeleteLoopback)(nil), "delete_loopback_f9e6675e") + api.RegisterMessage((*DeleteLoopbackReply)(nil), "delete_loopback_reply_e8d4e804") + api.RegisterMessage((*DeleteSubif)(nil), "delete_subif_f9e6675e") + api.RegisterMessage((*DeleteSubifReply)(nil), "delete_subif_reply_e8d4e804") + api.RegisterMessage((*HwInterfaceSetMtu)(nil), "hw_interface_set_mtu_e6746899") + api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "hw_interface_set_mtu_reply_e8d4e804") + api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface_name_renumber_2b8858b8") + api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface_name_renumber_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "sw_interface_add_del_address_5803d5c4") + api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "sw_interface_add_del_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "sw_interface_add_del_mac_address_638bb9f4") + api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "sw_interface_add_del_mac_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceClearStats)(nil), "sw_interface_clear_stats_f9e6675e") + api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "sw_interface_clear_stats_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceDetails)(nil), "sw_interface_details_17b69fa2") + api.RegisterMessage((*SwInterfaceDump)(nil), "sw_interface_dump_aa610c27") + api.RegisterMessage((*SwInterfaceEvent)(nil), "sw_interface_event_f709f78d") + api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "sw_interface_get_mac_address_f9e6675e") + api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "sw_interface_get_mac_address_reply_40ef2c08") + api.RegisterMessage((*SwInterfaceGetTable)(nil), "sw_interface_get_table_2d033de4") + api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "sw_interface_get_table_reply_a6eb0109") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "sw_interface_rx_placement_details_f6d7d024") + api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "sw_interface_rx_placement_dump_f9e6675e") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "sw_interface_set_flags_6a2b491a") + api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "sw_interface_set_flags_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "sw_interface_set_ip_directed_broadcast_ae6cfcfb") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "sw_interface_set_ip_directed_broadcast_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "sw_interface_set_mac_address_6aca746a") + api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "sw_interface_set_mac_address_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetMtu)(nil), "sw_interface_set_mtu_5cbe85e5") + api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "sw_interface_set_mtu_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "sw_interface_set_rx_mode_780f5cee") + api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "sw_interface_set_rx_mode_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "sw_interface_set_rx_placement_db65f3c9") + api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "sw_interface_set_rx_placement_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetTable)(nil), "sw_interface_set_table_df42a577") + api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "sw_interface_set_table_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "sw_interface_set_unnumbered_938ef33b") + api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "sw_interface_set_unnumbered_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "sw_interface_tag_add_del_426f8bc1") + api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "sw_interface_tag_add_del_reply_e8d4e804") + api.RegisterMessage((*WantInterfaceEvents)(nil), "want_interface_events_476f5a08") + api.RegisterMessage((*WantInterfaceEventsReply)(nil), "want_interface_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceAddDelMacAddress)(nil), + (*SwInterfaceAddDelMacAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} diff --git a/internal/testbinapi/binapi2001/interface/interface_rpc.ba.go b/internal/testbinapi/binapi2001/interface/interface_rpc.ba.go new file mode 100644 index 0000000..f12e6eb --- /dev/null +++ b/internal/testbinapi/binapi2001/interface/interface_rpc.ba.go @@ -0,0 +1,343 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" + "io" +) + +// RPCService defines RPC service interface. +type RPCService interface { + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { + out := new(SwInterfaceAddDelMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceDump(ctx context.Context, in *SwInterfaceDump) (RPCService_SwInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceDumpClient{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_SwInterfaceDumpClient interface { + Recv() (*SwInterfaceDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceDumpClient) Recv() (*SwInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceRxPlacementDump(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_SwInterfaceRxPlacementDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceRxPlacementDumpClient{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_SwInterfaceRxPlacementDumpClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceRxPlacementDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceRxPlacementDumpClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceRxPlacementDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} |