diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/map/map.ba.go')
-rw-r--r-- | internal/testbinapi/binapi2001/map/map.ba.go | 2164 |
1 files changed, 0 insertions, 2164 deletions
diff --git a/internal/testbinapi/binapi2001/map/map.ba.go b/internal/testbinapi/binapi2001/map/map.ba.go deleted file mode 100644 index b5dc558..0000000 --- a/internal/testbinapi/binapi2001/map/map.ba.go +++ /dev/null @@ -1,2164 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.5.0-dev -// VPP: 20.01 -// source: .vppapi/plugins/map.api.json - -// Package maps contains generated bindings for API file map.api. -// -// Contents: -// 6 aliases -// 10 enums -// 6 structs -// 1 union -// 30 messages -// -package maps - -import ( - "fmt" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 - -const ( - APIFile = "map" - APIVersion = "4.1.1" - VersionCrc = 0x42c84657 -) - -// 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 - -// Address defines type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func ParseAddress(s string) (Address, error) { - ip := net.ParseIP(s) - if ip == nil { - return Address{}, fmt.Errorf("invalid address: %s", s) - } - return AddressFromIP(ip), nil -} - -func AddressFromIP(ip net.IP) Address { - var addr Address - if ip.To4() == nil { - addr.Af = ADDRESS_IP6 - var ip6 IP6Address - copy(ip6[:], ip.To16()) - addr.Un.SetIP6(ip6) - } else { - addr.Af = ADDRESS_IP4 - var ip4 IP4Address - copy(ip4[:], ip.To4()) - addr.Un.SetIP4(ip4) - } - return addr -} - -func (x Address) ToIP() net.IP { - if x.Af == ADDRESS_IP6 { - ip6 := x.Un.GetIP6() - return net.IP(ip6[:]).To16() - } else { - ip4 := x.Un.GetIP4() - return net.IP(ip4[:]).To4() - } -} - -func (x Address) String() string { - return x.ToIP().String() -} - -func (x *Address) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *Address) UnmarshalText(text []byte) error { - addr, err := ParseAddress(string(text)) - if err != nil { - return err - } - *x = addr - return nil -} - -// IP4Prefix defines type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { - hasPrefix := strings.Contains(s, "/") - if hasPrefix { - ip, network, err := net.ParseCIDR(s) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseIP4Address(ip.String()) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } else { - ip := net.ParseIP(s) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if ip.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseIP4Address(ip.String()) - if err != nil { - return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } - return prefix, nil -} - -func (x IP4Prefix) ToIPNet() *net.IPNet { - mask := net.CIDRMask(int(x.Len), 32) - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x IP4Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *IP4Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP4Prefix) UnmarshalText(text []byte) error { - prefix, err := ParseIP4Prefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// IP6Prefix defines type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { - hasPrefix := strings.Contains(s, "/") - if hasPrefix { - ip, network, err := net.ParseCIDR(s) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseIP6Address(ip.String()) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } else { - ip := net.ParseIP(s) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if ip.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseIP6Address(ip.String()) - if err != nil { - return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) - } - } - return prefix, nil -} - -func (x IP6Prefix) ToIPNet() *net.IPNet { - mask := net.CIDRMask(int(x.Len), 128) - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x IP6Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *IP6Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *IP6Prefix) UnmarshalText(text []byte) error { - prefix, err := ParseIP6Prefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// Mprefix defines type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -// Prefix defines type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func ParsePrefix(ip string) (prefix Prefix, err error) { - hasPrefix := strings.Contains(ip, "/") - if hasPrefix { - netIP, network, err := net.ParseCIDR(ip) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - } else { - netIP := net.ParseIP(ip) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if netIP.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - } - } - return prefix, nil -} - -func (x Prefix) ToIPNet() *net.IPNet { - var mask net.IPMask - if x.Address.Af == ADDRESS_IP4 { - mask = net.CIDRMask(int(x.Len), 32) - } else { - mask = net.CIDRMask(int(x.Len), 128) - } - ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} - return ipnet -} - -func (x Prefix) String() string { - ip := x.Address.String() - return ip + "/" + strconv.Itoa(int(x.Len)) -} - -func (x *Prefix) MarshalText() ([]byte, error) { - return []byte(x.String()), nil -} - -func (x *Prefix) UnmarshalText(text []byte) error { - prefix, err := ParsePrefix(string(text)) - if err != nil { - return err - } - *x = prefix - return nil -} - -// PrefixMatcher defines type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -// AddressUnion defines union 'address_union'. -type AddressUnion struct { - // AddressUnion can be one of: - // - IP4 *IP4Address - // - IP6 *IP6Address - XXX_UnionData [16]byte -} - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - buf.EncodeBytes(a[:], 4) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - copy(a[:], buf.DecodeBytes(4)) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - buf.EncodeBytes(a[:], 16) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - buf := codec.NewBuffer(u.XXX_UnionData[:]) - copy(a[:], buf.DecodeBytes(16)) - return -} - -// MapAddDelRule defines message 'map_add_del_rule'. -type MapAddDelRule struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - IP6Dst IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"` - Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` -} - -func (m *MapAddDelRule) Reset() { *m = MapAddDelRule{} } -func (*MapAddDelRule) GetMessageName() string { return "map_add_del_rule" } -func (*MapAddDelRule) GetCrcString() string { return "c65b32f7" } -func (*MapAddDelRule) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapAddDelRule) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Index - size += 1 // m.IsAdd - size += 1 * 16 // m.IP6Dst - size += 2 // m.Psid - return size -} -func (m *MapAddDelRule) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Index) - buf.EncodeBool(m.IsAdd) - buf.EncodeBytes(m.IP6Dst[:], 16) - buf.EncodeUint16(m.Psid) - return buf.Bytes(), nil -} -func (m *MapAddDelRule) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Index = buf.DecodeUint32() - m.IsAdd = buf.DecodeBool() - copy(m.IP6Dst[:], buf.DecodeBytes(16)) - m.Psid = buf.DecodeUint16() - return nil -} - -// MapAddDelRuleReply defines message 'map_add_del_rule_reply'. -type MapAddDelRuleReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapAddDelRuleReply) Reset() { *m = MapAddDelRuleReply{} } -func (*MapAddDelRuleReply) GetMessageName() string { return "map_add_del_rule_reply" } -func (*MapAddDelRuleReply) GetCrcString() string { return "e8d4e804" } -func (*MapAddDelRuleReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapAddDelRuleReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapAddDelRuleReply) 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 *MapAddDelRuleReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapAddDomain defines message 'map_add_domain'. -type MapAddDomain struct { - IP6Prefix IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"` - IP4Prefix IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"` - IP6Src IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"` - EaBitsLen uint8 `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"` - PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` - PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` - Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` -} - -func (m *MapAddDomain) Reset() { *m = MapAddDomain{} } -func (*MapAddDomain) GetMessageName() string { return "map_add_domain" } -func (*MapAddDomain) GetCrcString() string { return "7a5a18c9" } -func (*MapAddDomain) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapAddDomain) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.IP6Prefix.Address - size += 1 // m.IP6Prefix.Len - size += 1 * 4 // m.IP4Prefix.Address - size += 1 // m.IP4Prefix.Len - size += 1 * 16 // m.IP6Src.Address - size += 1 // m.IP6Src.Len - size += 1 // m.EaBitsLen - size += 1 // m.PsidOffset - size += 1 // m.PsidLength - size += 2 // m.Mtu - size += 64 // m.Tag - return size -} -func (m *MapAddDomain) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IP6Prefix.Address[:], 16) - buf.EncodeUint8(m.IP6Prefix.Len) - buf.EncodeBytes(m.IP4Prefix.Address[:], 4) - buf.EncodeUint8(m.IP4Prefix.Len) - buf.EncodeBytes(m.IP6Src.Address[:], 16) - buf.EncodeUint8(m.IP6Src.Len) - buf.EncodeUint8(m.EaBitsLen) - buf.EncodeUint8(m.PsidOffset) - buf.EncodeUint8(m.PsidLength) - buf.EncodeUint16(m.Mtu) - buf.EncodeString(m.Tag, 64) - return buf.Bytes(), nil -} -func (m *MapAddDomain) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16)) - m.IP6Prefix.Len = buf.DecodeUint8() - copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4)) - m.IP4Prefix.Len = buf.DecodeUint8() - copy(m.IP6Src.Address[:], buf.DecodeBytes(16)) - m.IP6Src.Len = buf.DecodeUint8() - m.EaBitsLen = buf.DecodeUint8() - m.PsidOffset = buf.DecodeUint8() - m.PsidLength = buf.DecodeUint8() - m.Mtu = buf.DecodeUint16() - m.Tag = buf.DecodeString(64) - return nil -} - -// MapAddDomainReply defines message 'map_add_domain_reply'. -type MapAddDomainReply struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapAddDomainReply) Reset() { *m = MapAddDomainReply{} } -func (*MapAddDomainReply) GetMessageName() string { return "map_add_domain_reply" } -func (*MapAddDomainReply) GetCrcString() string { return "3e6d4e2c" } -func (*MapAddDomainReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapAddDomainReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Index - size += 4 // m.Retval - return size -} -func (m *MapAddDomainReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Index) - buf.EncodeInt32(m.Retval) - return buf.Bytes(), nil -} -func (m *MapAddDomainReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Index = buf.DecodeUint32() - m.Retval = buf.DecodeInt32() - return nil -} - -// MapDelDomain defines message 'map_del_domain'. -type MapDelDomain struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` -} - -func (m *MapDelDomain) Reset() { *m = MapDelDomain{} } -func (*MapDelDomain) GetMessageName() string { return "map_del_domain" } -func (*MapDelDomain) GetCrcString() string { return "8ac76db6" } -func (*MapDelDomain) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapDelDomain) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Index - return size -} -func (m *MapDelDomain) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Index) - return buf.Bytes(), nil -} -func (m *MapDelDomain) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Index = buf.DecodeUint32() - return nil -} - -// MapDelDomainReply defines message 'map_del_domain_reply'. -type MapDelDomainReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapDelDomainReply) Reset() { *m = MapDelDomainReply{} } -func (*MapDelDomainReply) GetMessageName() string { return "map_del_domain_reply" } -func (*MapDelDomainReply) GetCrcString() string { return "e8d4e804" } -func (*MapDelDomainReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapDelDomainReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapDelDomainReply) 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 *MapDelDomainReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapDomainDetails defines message 'map_domain_details'. -type MapDomainDetails struct { - DomainIndex uint32 `binapi:"u32,name=domain_index" json:"domain_index,omitempty"` - IP6Prefix IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"` - IP4Prefix IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"` - IP6Src IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"` - EaBitsLen uint8 `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"` - PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"` - PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"` - Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"` - Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` -} - -func (m *MapDomainDetails) Reset() { *m = MapDomainDetails{} } -func (*MapDomainDetails) GetMessageName() string { return "map_domain_details" } -func (*MapDomainDetails) GetCrcString() string { return "fc1859dd" } -func (*MapDomainDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapDomainDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.DomainIndex - size += 1 * 16 // m.IP6Prefix.Address - size += 1 // m.IP6Prefix.Len - size += 1 * 4 // m.IP4Prefix.Address - size += 1 // m.IP4Prefix.Len - size += 1 * 16 // m.IP6Src.Address - size += 1 // m.IP6Src.Len - size += 1 // m.EaBitsLen - size += 1 // m.PsidOffset - size += 1 // m.PsidLength - size += 1 // m.Flags - size += 2 // m.Mtu - size += 64 // m.Tag - return size -} -func (m *MapDomainDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.DomainIndex) - buf.EncodeBytes(m.IP6Prefix.Address[:], 16) - buf.EncodeUint8(m.IP6Prefix.Len) - buf.EncodeBytes(m.IP4Prefix.Address[:], 4) - buf.EncodeUint8(m.IP4Prefix.Len) - buf.EncodeBytes(m.IP6Src.Address[:], 16) - buf.EncodeUint8(m.IP6Src.Len) - buf.EncodeUint8(m.EaBitsLen) - buf.EncodeUint8(m.PsidOffset) - buf.EncodeUint8(m.PsidLength) - buf.EncodeUint8(m.Flags) - buf.EncodeUint16(m.Mtu) - buf.EncodeString(m.Tag, 64) - return buf.Bytes(), nil -} -func (m *MapDomainDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.DomainIndex = buf.DecodeUint32() - copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16)) - m.IP6Prefix.Len = buf.DecodeUint8() - copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4)) - m.IP4Prefix.Len = buf.DecodeUint8() - copy(m.IP6Src.Address[:], buf.DecodeBytes(16)) - m.IP6Src.Len = buf.DecodeUint8() - m.EaBitsLen = buf.DecodeUint8() - m.PsidOffset = buf.DecodeUint8() - m.PsidLength = buf.DecodeUint8() - m.Flags = buf.DecodeUint8() - m.Mtu = buf.DecodeUint16() - m.Tag = buf.DecodeString(64) - return nil -} - -// MapDomainDump defines message 'map_domain_dump'. -type MapDomainDump struct{} - -func (m *MapDomainDump) Reset() { *m = MapDomainDump{} } -func (*MapDomainDump) GetMessageName() string { return "map_domain_dump" } -func (*MapDomainDump) GetCrcString() string { return "51077d14" } -func (*MapDomainDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapDomainDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *MapDomainDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *MapDomainDump) Unmarshal(b []byte) error { - return nil -} - -// MapIfEnableDisable defines message 'map_if_enable_disable'. -type MapIfEnableDisable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsEnable bool `binapi:"bool,name=is_enable" json:"is_enable,omitempty"` - IsTranslation bool `binapi:"bool,name=is_translation" json:"is_translation,omitempty"` -} - -func (m *MapIfEnableDisable) Reset() { *m = MapIfEnableDisable{} } -func (*MapIfEnableDisable) GetMessageName() string { return "map_if_enable_disable" } -func (*MapIfEnableDisable) GetCrcString() string { return "59bb32f4" } -func (*MapIfEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapIfEnableDisable) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 1 // m.IsEnable - size += 1 // m.IsTranslation - return size -} -func (m *MapIfEnableDisable) 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.IsEnable) - buf.EncodeBool(m.IsTranslation) - return buf.Bytes(), nil -} -func (m *MapIfEnableDisable) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.IsEnable = buf.DecodeBool() - m.IsTranslation = buf.DecodeBool() - return nil -} - -// MapIfEnableDisableReply defines message 'map_if_enable_disable_reply'. -type MapIfEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapIfEnableDisableReply) Reset() { *m = MapIfEnableDisableReply{} } -func (*MapIfEnableDisableReply) GetMessageName() string { return "map_if_enable_disable_reply" } -func (*MapIfEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*MapIfEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapIfEnableDisableReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapIfEnableDisableReply) 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 *MapIfEnableDisableReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamAddDelPreResolve defines message 'map_param_add_del_pre_resolve'. -type MapParamAddDelPreResolve struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - IP4NhAddress IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"` - IP6NhAddress IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"` -} - -func (m *MapParamAddDelPreResolve) Reset() { *m = MapParamAddDelPreResolve{} } -func (*MapParamAddDelPreResolve) GetMessageName() string { return "map_param_add_del_pre_resolve" } -func (*MapParamAddDelPreResolve) GetCrcString() string { return "17008c66" } -func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamAddDelPreResolve) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 1 * 4 // m.IP4NhAddress - size += 1 * 16 // m.IP6NhAddress - return size -} -func (m *MapParamAddDelPreResolve) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsAdd) - buf.EncodeBytes(m.IP4NhAddress[:], 4) - buf.EncodeBytes(m.IP6NhAddress[:], 16) - return buf.Bytes(), nil -} -func (m *MapParamAddDelPreResolve) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - copy(m.IP4NhAddress[:], buf.DecodeBytes(4)) - copy(m.IP6NhAddress[:], buf.DecodeBytes(16)) - return nil -} - -// MapParamAddDelPreResolveReply defines message 'map_param_add_del_pre_resolve_reply'. -type MapParamAddDelPreResolveReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamAddDelPreResolveReply) Reset() { *m = MapParamAddDelPreResolveReply{} } -func (*MapParamAddDelPreResolveReply) GetMessageName() string { - return "map_param_add_del_pre_resolve_reply" -} -func (*MapParamAddDelPreResolveReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamAddDelPreResolveReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamAddDelPreResolveReply) 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 *MapParamAddDelPreResolveReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamGet defines message 'map_param_get'. -type MapParamGet struct{} - -func (m *MapParamGet) Reset() { *m = MapParamGet{} } -func (*MapParamGet) GetMessageName() string { return "map_param_get" } -func (*MapParamGet) GetCrcString() string { return "51077d14" } -func (*MapParamGet) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamGet) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *MapParamGet) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *MapParamGet) Unmarshal(b []byte) error { - return nil -} - -// MapParamGetReply defines message 'map_param_get_reply'. -type MapParamGetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - FragInner uint8 `binapi:"u8,name=frag_inner" json:"frag_inner,omitempty"` - FragIgnoreDf uint8 `binapi:"u8,name=frag_ignore_df" json:"frag_ignore_df,omitempty"` - ICMPIP4ErrRelaySrc IP4Address `binapi:"ip4_address,name=icmp_ip4_err_relay_src" json:"icmp_ip4_err_relay_src,omitempty"` - ICMP6EnableUnreachable bool `binapi:"bool,name=icmp6_enable_unreachable" json:"icmp6_enable_unreachable,omitempty"` - IP4NhAddress IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"` - IP6NhAddress IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"` - IP4LifetimeMs uint16 `binapi:"u16,name=ip4_lifetime_ms" json:"ip4_lifetime_ms,omitempty"` - IP4PoolSize uint16 `binapi:"u16,name=ip4_pool_size" json:"ip4_pool_size,omitempty"` - IP4Buffers uint32 `binapi:"u32,name=ip4_buffers" json:"ip4_buffers,omitempty"` - IP4HtRatio float64 `binapi:"f64,name=ip4_ht_ratio" json:"ip4_ht_ratio,omitempty"` - SecCheckEnable bool `binapi:"bool,name=sec_check_enable" json:"sec_check_enable,omitempty"` - SecCheckFragments bool `binapi:"bool,name=sec_check_fragments" json:"sec_check_fragments,omitempty"` - TcCopy bool `binapi:"bool,name=tc_copy" json:"tc_copy,omitempty"` - TcClass uint8 `binapi:"u8,name=tc_class" json:"tc_class,omitempty"` -} - -func (m *MapParamGetReply) Reset() { *m = MapParamGetReply{} } -func (*MapParamGetReply) GetMessageName() string { return "map_param_get_reply" } -func (*MapParamGetReply) GetCrcString() string { return "28092156" } -func (*MapParamGetReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamGetReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 1 // m.FragInner - size += 1 // m.FragIgnoreDf - size += 1 * 4 // m.ICMPIP4ErrRelaySrc - size += 1 // m.ICMP6EnableUnreachable - size += 1 * 4 // m.IP4NhAddress - size += 1 * 16 // m.IP6NhAddress - size += 2 // m.IP4LifetimeMs - size += 2 // m.IP4PoolSize - size += 4 // m.IP4Buffers - size += 8 // m.IP4HtRatio - size += 1 // m.SecCheckEnable - size += 1 // m.SecCheckFragments - size += 1 // m.TcCopy - size += 1 // m.TcClass - return size -} -func (m *MapParamGetReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint8(m.FragInner) - buf.EncodeUint8(m.FragIgnoreDf) - buf.EncodeBytes(m.ICMPIP4ErrRelaySrc[:], 4) - buf.EncodeBool(m.ICMP6EnableUnreachable) - buf.EncodeBytes(m.IP4NhAddress[:], 4) - buf.EncodeBytes(m.IP6NhAddress[:], 16) - buf.EncodeUint16(m.IP4LifetimeMs) - buf.EncodeUint16(m.IP4PoolSize) - buf.EncodeUint32(m.IP4Buffers) - buf.EncodeFloat64(m.IP4HtRatio) - buf.EncodeBool(m.SecCheckEnable) - buf.EncodeBool(m.SecCheckFragments) - buf.EncodeBool(m.TcCopy) - buf.EncodeUint8(m.TcClass) - return buf.Bytes(), nil -} -func (m *MapParamGetReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.FragInner = buf.DecodeUint8() - m.FragIgnoreDf = buf.DecodeUint8() - copy(m.ICMPIP4ErrRelaySrc[:], buf.DecodeBytes(4)) - m.ICMP6EnableUnreachable = buf.DecodeBool() - copy(m.IP4NhAddress[:], buf.DecodeBytes(4)) - copy(m.IP6NhAddress[:], buf.DecodeBytes(16)) - m.IP4LifetimeMs = buf.DecodeUint16() - m.IP4PoolSize = buf.DecodeUint16() - m.IP4Buffers = buf.DecodeUint32() - m.IP4HtRatio = buf.DecodeFloat64() - m.SecCheckEnable = buf.DecodeBool() - m.SecCheckFragments = buf.DecodeBool() - m.TcCopy = buf.DecodeBool() - m.TcClass = buf.DecodeUint8() - return nil -} - -// MapParamSetFragmentation defines message 'map_param_set_fragmentation'. -type MapParamSetFragmentation struct { - Inner bool `binapi:"bool,name=inner" json:"inner,omitempty"` - IgnoreDf bool `binapi:"bool,name=ignore_df" json:"ignore_df,omitempty"` -} - -func (m *MapParamSetFragmentation) Reset() { *m = MapParamSetFragmentation{} } -func (*MapParamSetFragmentation) GetMessageName() string { return "map_param_set_fragmentation" } -func (*MapParamSetFragmentation) GetCrcString() string { return "9ff54d90" } -func (*MapParamSetFragmentation) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetFragmentation) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Inner - size += 1 // m.IgnoreDf - return size -} -func (m *MapParamSetFragmentation) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.Inner) - buf.EncodeBool(m.IgnoreDf) - return buf.Bytes(), nil -} -func (m *MapParamSetFragmentation) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Inner = buf.DecodeBool() - m.IgnoreDf = buf.DecodeBool() - return nil -} - -// MapParamSetFragmentationReply defines message 'map_param_set_fragmentation_reply'. -type MapParamSetFragmentationReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetFragmentationReply) Reset() { *m = MapParamSetFragmentationReply{} } -func (*MapParamSetFragmentationReply) GetMessageName() string { - return "map_param_set_fragmentation_reply" -} -func (*MapParamSetFragmentationReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetFragmentationReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetFragmentationReply) 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 *MapParamSetFragmentationReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamSetICMP defines message 'map_param_set_icmp'. -type MapParamSetICMP struct { - IP4ErrRelaySrc IP4Address `binapi:"ip4_address,name=ip4_err_relay_src" json:"ip4_err_relay_src,omitempty"` -} - -func (m *MapParamSetICMP) Reset() { *m = MapParamSetICMP{} } -func (*MapParamSetICMP) GetMessageName() string { return "map_param_set_icmp" } -func (*MapParamSetICMP) GetCrcString() string { return "58210cbf" } -func (*MapParamSetICMP) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetICMP) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 4 // m.IP4ErrRelaySrc - return size -} -func (m *MapParamSetICMP) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IP4ErrRelaySrc[:], 4) - return buf.Bytes(), nil -} -func (m *MapParamSetICMP) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IP4ErrRelaySrc[:], buf.DecodeBytes(4)) - return nil -} - -// MapParamSetICMP6 defines message 'map_param_set_icmp6'. -type MapParamSetICMP6 struct { - EnableUnreachable bool `binapi:"bool,name=enable_unreachable" json:"enable_unreachable,omitempty"` -} - -func (m *MapParamSetICMP6) Reset() { *m = MapParamSetICMP6{} } -func (*MapParamSetICMP6) GetMessageName() string { return "map_param_set_icmp6" } -func (*MapParamSetICMP6) GetCrcString() string { return "5d01f8c1" } -func (*MapParamSetICMP6) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetICMP6) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.EnableUnreachable - return size -} -func (m *MapParamSetICMP6) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.EnableUnreachable) - return buf.Bytes(), nil -} -func (m *MapParamSetICMP6) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.EnableUnreachable = buf.DecodeBool() - return nil -} - -// MapParamSetICMP6Reply defines message 'map_param_set_icmp6_reply'. -type MapParamSetICMP6Reply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetICMP6Reply) Reset() { *m = MapParamSetICMP6Reply{} } -func (*MapParamSetICMP6Reply) GetMessageName() string { return "map_param_set_icmp6_reply" } -func (*MapParamSetICMP6Reply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetICMP6Reply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetICMP6Reply) 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 *MapParamSetICMP6Reply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamSetICMPReply defines message 'map_param_set_icmp_reply'. -type MapParamSetICMPReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetICMPReply) Reset() { *m = MapParamSetICMPReply{} } -func (*MapParamSetICMPReply) GetMessageName() string { return "map_param_set_icmp_reply" } -func (*MapParamSetICMPReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetICMPReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetICMPReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetICMPReply) 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 *MapParamSetICMPReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamSetSecurityCheck defines message 'map_param_set_security_check'. -type MapParamSetSecurityCheck struct { - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` - Fragments bool `binapi:"bool,name=fragments" json:"fragments,omitempty"` -} - -func (m *MapParamSetSecurityCheck) Reset() { *m = MapParamSetSecurityCheck{} } -func (*MapParamSetSecurityCheck) GetMessageName() string { return "map_param_set_security_check" } -func (*MapParamSetSecurityCheck) GetCrcString() string { return "6abe9836" } -func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetSecurityCheck) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Enable - size += 1 // m.Fragments - return size -} -func (m *MapParamSetSecurityCheck) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.Enable) - buf.EncodeBool(m.Fragments) - return buf.Bytes(), nil -} -func (m *MapParamSetSecurityCheck) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Enable = buf.DecodeBool() - m.Fragments = buf.DecodeBool() - return nil -} - -// MapParamSetSecurityCheckReply defines message 'map_param_set_security_check_reply'. -type MapParamSetSecurityCheckReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetSecurityCheckReply) Reset() { *m = MapParamSetSecurityCheckReply{} } -func (*MapParamSetSecurityCheckReply) GetMessageName() string { - return "map_param_set_security_check_reply" -} -func (*MapParamSetSecurityCheckReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetSecurityCheckReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetSecurityCheckReply) 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 *MapParamSetSecurityCheckReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamSetTCP defines message 'map_param_set_tcp'. -type MapParamSetTCP struct { - TCPMss uint16 `binapi:"u16,name=tcp_mss" json:"tcp_mss,omitempty"` -} - -func (m *MapParamSetTCP) Reset() { *m = MapParamSetTCP{} } -func (*MapParamSetTCP) GetMessageName() string { return "map_param_set_tcp" } -func (*MapParamSetTCP) GetCrcString() string { return "87a825d9" } -func (*MapParamSetTCP) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetTCP) Size() (size int) { - if m == nil { - return 0 - } - size += 2 // m.TCPMss - return size -} -func (m *MapParamSetTCP) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint16(m.TCPMss) - return buf.Bytes(), nil -} -func (m *MapParamSetTCP) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.TCPMss = buf.DecodeUint16() - return nil -} - -// MapParamSetTCPReply defines message 'map_param_set_tcp_reply'. -type MapParamSetTCPReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetTCPReply) Reset() { *m = MapParamSetTCPReply{} } -func (*MapParamSetTCPReply) GetMessageName() string { return "map_param_set_tcp_reply" } -func (*MapParamSetTCPReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetTCPReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetTCPReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetTCPReply) 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 *MapParamSetTCPReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapParamSetTrafficClass defines message 'map_param_set_traffic_class'. -type MapParamSetTrafficClass struct { - Copy bool `binapi:"bool,name=copy" json:"copy,omitempty"` - TcClass uint8 `binapi:"u8,name=tc_class" json:"tc_class,omitempty"` -} - -func (m *MapParamSetTrafficClass) Reset() { *m = MapParamSetTrafficClass{} } -func (*MapParamSetTrafficClass) GetMessageName() string { return "map_param_set_traffic_class" } -func (*MapParamSetTrafficClass) GetCrcString() string { return "9cac455c" } -func (*MapParamSetTrafficClass) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapParamSetTrafficClass) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Copy - size += 1 // m.TcClass - return size -} -func (m *MapParamSetTrafficClass) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.Copy) - buf.EncodeUint8(m.TcClass) - return buf.Bytes(), nil -} -func (m *MapParamSetTrafficClass) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Copy = buf.DecodeBool() - m.TcClass = buf.DecodeUint8() - return nil -} - -// MapParamSetTrafficClassReply defines message 'map_param_set_traffic_class_reply'. -type MapParamSetTrafficClassReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MapParamSetTrafficClassReply) Reset() { *m = MapParamSetTrafficClassReply{} } -func (*MapParamSetTrafficClassReply) GetMessageName() string { - return "map_param_set_traffic_class_reply" -} -func (*MapParamSetTrafficClassReply) GetCrcString() string { return "e8d4e804" } -func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapParamSetTrafficClassReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *MapParamSetTrafficClassReply) 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 *MapParamSetTrafficClassReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// MapRuleDetails defines message 'map_rule_details'. -type MapRuleDetails struct { - IP6Dst IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"` - Psid uint16 `binapi:"u16,name=psid" json:"psid,omitempty"` -} - -func (m *MapRuleDetails) Reset() { *m = MapRuleDetails{} } -func (*MapRuleDetails) GetMessageName() string { return "map_rule_details" } -func (*MapRuleDetails) GetCrcString() string { return "c7cbeea5" } -func (*MapRuleDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapRuleDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 16 // m.IP6Dst - size += 2 // m.Psid - return size -} -func (m *MapRuleDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.IP6Dst[:], 16) - buf.EncodeUint16(m.Psid) - return buf.Bytes(), nil -} -func (m *MapRuleDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - copy(m.IP6Dst[:], buf.DecodeBytes(16)) - m.Psid = buf.DecodeUint16() - return nil -} - -// MapRuleDump defines message 'map_rule_dump'. -type MapRuleDump struct { - DomainIndex uint32 `binapi:"u32,name=domain_index" json:"domain_index,omitempty"` -} - -func (m *MapRuleDump) Reset() { *m = MapRuleDump{} } -func (*MapRuleDump) GetMessageName() string { return "map_rule_dump" } -func (*MapRuleDump) GetCrcString() string { return "e43e6ff6" } -func (*MapRuleDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapRuleDump) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.DomainIndex - return size -} -func (m *MapRuleDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.DomainIndex) - return buf.Bytes(), nil -} -func (m *MapRuleDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.DomainIndex = buf.DecodeUint32() - return nil -} - -// MapSummaryStats defines message 'map_summary_stats'. -type MapSummaryStats struct{} - -func (m *MapSummaryStats) Reset() { *m = MapSummaryStats{} } -func (*MapSummaryStats) GetMessageName() string { return "map_summary_stats" } -func (*MapSummaryStats) GetCrcString() string { return "51077d14" } -func (*MapSummaryStats) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *MapSummaryStats) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *MapSummaryStats) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *MapSummaryStats) Unmarshal(b []byte) error { - return nil -} - -// MapSummaryStatsReply defines message 'map_summary_stats_reply'. -type MapSummaryStatsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - TotalBindings uint64 `binapi:"u64,name=total_bindings" json:"total_bindings,omitempty"` - TotalPkts []uint64 `binapi:"u64[2],name=total_pkts" json:"total_pkts,omitempty"` - TotalBytes []uint64 `binapi:"u64[2],name=total_bytes" json:"total_bytes,omitempty"` - TotalIP4Fragments uint64 `binapi:"u64,name=total_ip4_fragments" json:"total_ip4_fragments,omitempty"` - TotalSecurityCheck []uint64 `binapi:"u64[2],name=total_security_check" json:"total_security_check,omitempty"` -} - -func (m *MapSummaryStatsReply) Reset() { *m = MapSummaryStatsReply{} } -func (*MapSummaryStatsReply) GetMessageName() string { return "map_summary_stats_reply" } -func (*MapSummaryStatsReply) GetCrcString() string { return "0e4ace0e" } -func (*MapSummaryStatsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *MapSummaryStatsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 8 // m.TotalBindings - size += 8 * 2 // m.TotalPkts - size += 8 * 2 // m.TotalBytes - size += 8 // m.TotalIP4Fragments - size += 8 * 2 // m.TotalSecurityCheck - return size -} -func (m *MapSummaryStatsReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint64(m.TotalBindings) - for i := 0; i < 2; i++ { - var x uint64 - if i < len(m.TotalPkts) { - x = uint64(m.TotalPkts[i]) - } - buf.EncodeUint64(x) - } - for i := 0; i < 2; i++ { - var x uint64 - if i < len(m.TotalBytes) { - x = uint64(m.TotalBytes[i]) - } - buf.EncodeUint64(x) - } - buf.EncodeUint64(m.TotalIP4Fragments) - for i := 0; i < 2; i++ { - var x uint64 - if i < len(m.TotalSecurityCheck) { - x = uint64(m.TotalSecurityCheck[i]) - } - buf.EncodeUint64(x) - } - return buf.Bytes(), nil -} -func (m *MapSummaryStatsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.TotalBindings = buf.DecodeUint64() - m.TotalPkts = make([]uint64, 2) - for i := 0; i < len(m.TotalPkts); i++ { - m.TotalPkts[i] = buf.DecodeUint64() - } - m.TotalBytes = make([]uint64, 2) - for i := 0; i < len(m.TotalBytes); i++ { - m.TotalBytes[i] = buf.DecodeUint64() - } - m.TotalIP4Fragments = buf.DecodeUint64() - m.TotalSecurityCheck = make([]uint64, 2) - for i := 0; i < len(m.TotalSecurityCheck); i++ { - m.TotalSecurityCheck[i] = buf.DecodeUint64() - } - return nil -} - -func init() { file_maps_binapi_init() } -func file_maps_binapi_init() { - api.RegisterMessage((*MapAddDelRule)(nil), "map_add_del_rule_c65b32f7") - api.RegisterMessage((*MapAddDelRuleReply)(nil), "map_add_del_rule_reply_e8d4e804") - api.RegisterMessage((*MapAddDomain)(nil), "map_add_domain_7a5a18c9") - api.RegisterMessage((*MapAddDomainReply)(nil), "map_add_domain_reply_3e6d4e2c") - api.RegisterMessage((*MapDelDomain)(nil), "map_del_domain_8ac76db6") - api.RegisterMessage((*MapDelDomainReply)(nil), "map_del_domain_reply_e8d4e804") - api.RegisterMessage((*MapDomainDetails)(nil), "map_domain_details_fc1859dd") - api.RegisterMessage((*MapDomainDump)(nil), "map_domain_dump_51077d14") - api.RegisterMessage((*MapIfEnableDisable)(nil), "map_if_enable_disable_59bb32f4") - api.RegisterMessage((*MapIfEnableDisableReply)(nil), "map_if_enable_disable_reply_e8d4e804") - api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map_param_add_del_pre_resolve_17008c66") - api.RegisterMessage((*MapParamAddDelPreResolveReply)(nil), "map_param_add_del_pre_resolve_reply_e8d4e804") - api.RegisterMessage((*MapParamGet)(nil), "map_param_get_51077d14") - api.RegisterMessage((*MapParamGetReply)(nil), "map_param_get_reply_28092156") - api.RegisterMessage((*MapParamSetFragmentation)(nil), "map_param_set_fragmentation_9ff54d90") - api.RegisterMessage((*MapParamSetFragmentationReply)(nil), "map_param_set_fragmentation_reply_e8d4e804") - api.RegisterMessage((*MapParamSetICMP)(nil), "map_param_set_icmp_58210cbf") - api.RegisterMessage((*MapParamSetICMP6)(nil), "map_param_set_icmp6_5d01f8c1") - api.RegisterMessage((*MapParamSetICMP6Reply)(nil), "map_param_set_icmp6_reply_e8d4e804") - api.RegisterMessage((*MapParamSetICMPReply)(nil), "map_param_set_icmp_reply_e8d4e804") - api.RegisterMessage((*MapParamSetSecurityCheck)(nil), "map_param_set_security_check_6abe9836") - api.RegisterMessage((*MapParamSetSecurityCheckReply)(nil), "map_param_set_security_check_reply_e8d4e804") - api.RegisterMessage((*MapParamSetTCP)(nil), "map_param_set_tcp_87a825d9") - api.RegisterMessage((*MapParamSetTCPReply)(nil), "map_param_set_tcp_reply_e8d4e804") - api.RegisterMessage((*MapParamSetTrafficClass)(nil), "map_param_set_traffic_class_9cac455c") - api.RegisterMessage((*MapParamSetTrafficClassReply)(nil), "map_param_set_traffic_class_reply_e8d4e804") - api.RegisterMessage((*MapRuleDetails)(nil), "map_rule_details_c7cbeea5") - api.RegisterMessage((*MapRuleDump)(nil), "map_rule_dump_e43e6ff6") - api.RegisterMessage((*MapSummaryStats)(nil), "map_summary_stats_51077d14") - api.RegisterMessage((*MapSummaryStatsReply)(nil), "map_summary_stats_reply_0e4ace0e") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*MapAddDelRule)(nil), - (*MapAddDelRuleReply)(nil), - (*MapAddDomain)(nil), - (*MapAddDomainReply)(nil), - (*MapDelDomain)(nil), - (*MapDelDomainReply)(nil), - (*MapDomainDetails)(nil), - (*MapDomainDump)(nil), - (*MapIfEnableDisable)(nil), - (*MapIfEnableDisableReply)(nil), - (*MapParamAddDelPreResolve)(nil), - (*MapParamAddDelPreResolveReply)(nil), - (*MapParamGet)(nil), - (*MapParamGetReply)(nil), - (*MapParamSetFragmentation)(nil), - (*MapParamSetFragmentationReply)(nil), - (*MapParamSetICMP)(nil), - (*MapParamSetICMP6)(nil), - (*MapParamSetICMP6Reply)(nil), - (*MapParamSetICMPReply)(nil), - (*MapParamSetSecurityCheck)(nil), - (*MapParamSetSecurityCheckReply)(nil), - (*MapParamSetTCP)(nil), - (*MapParamSetTCPReply)(nil), - (*MapParamSetTrafficClass)(nil), - (*MapParamSetTrafficClassReply)(nil), - (*MapRuleDetails)(nil), - (*MapRuleDump)(nil), - (*MapSummaryStats)(nil), - (*MapSummaryStatsReply)(nil), - } -} |