diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/dhcp')
-rw-r--r-- | internal/testbinapi/binapi2001/dhcp/dhcp.ba.go | 2641 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go | 222 |
2 files changed, 0 insertions, 2863 deletions
diff --git a/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go b/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go deleted file mode 100644 index a84d4da..0000000 --- a/internal/testbinapi/binapi2001/dhcp/dhcp.ba.go +++ /dev/null @@ -1,2641 +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/dhcp.api.json - -// Package dhcp contains generated bindings for API file dhcp.api. -// -// Contents: -// 7 aliases -// 13 enums -// 12 structs -// 1 union -// 29 messages -// -package dhcp - -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 = "dhcp" - APIVersion = "3.0.1" - VersionCrc = 0x96a5f046 -) - -// 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)) + ")" -} - -// DHCPClientState defines enum 'dhcp_client_state'. -type DHCPClientState uint32 - -const ( - DHCP_CLIENT_STATE_API_DISCOVER DHCPClientState = 1 - DHCP_CLIENT_STATE_API_REQUEST DHCPClientState = 2 - DHCP_CLIENT_STATE_API_BOUND DHCPClientState = 3 -) - -var ( - DHCPClientState_name = map[uint32]string{ - 1: "DHCP_CLIENT_STATE_API_DISCOVER", - 2: "DHCP_CLIENT_STATE_API_REQUEST", - 3: "DHCP_CLIENT_STATE_API_BOUND", - } - DHCPClientState_value = map[string]uint32{ - "DHCP_CLIENT_STATE_API_DISCOVER": 1, - "DHCP_CLIENT_STATE_API_REQUEST": 2, - "DHCP_CLIENT_STATE_API_BOUND": 3, - } -) - -func (x DHCPClientState) String() string { - s, ok := DHCPClientState_name[uint32(x)] - if ok { - return s - } - return "DHCPClientState(" + strconv.Itoa(int(x)) + ")" -} - -// Dhcpv6MsgType defines enum 'dhcpv6_msg_type'. -type Dhcpv6MsgType uint32 - -const ( - DHCPV6_MSG_API_SOLICIT Dhcpv6MsgType = 1 - DHCPV6_MSG_API_ADVERTISE Dhcpv6MsgType = 2 - DHCPV6_MSG_API_REQUEST Dhcpv6MsgType = 3 - DHCPV6_MSG_API_CONFIRM Dhcpv6MsgType = 4 - DHCPV6_MSG_API_RENEW Dhcpv6MsgType = 5 - DHCPV6_MSG_API_REBIND Dhcpv6MsgType = 6 - DHCPV6_MSG_API_REPLY Dhcpv6MsgType = 7 - DHCPV6_MSG_API_RELEASE Dhcpv6MsgType = 8 - DHCPV6_MSG_API_DECLINE Dhcpv6MsgType = 9 - DHCPV6_MSG_API_RECONFIGURE Dhcpv6MsgType = 10 - DHCPV6_MSG_API_INFORMATION_REQUEST Dhcpv6MsgType = 11 - DHCPV6_MSG_API_RELAY_FORW Dhcpv6MsgType = 12 - DHCPV6_MSG_API_RELAY_REPL Dhcpv6MsgType = 13 -) - -var ( - Dhcpv6MsgType_name = map[uint32]string{ - 1: "DHCPV6_MSG_API_SOLICIT", - 2: "DHCPV6_MSG_API_ADVERTISE", - 3: "DHCPV6_MSG_API_REQUEST", - 4: "DHCPV6_MSG_API_CONFIRM", - 5: "DHCPV6_MSG_API_RENEW", - 6: "DHCPV6_MSG_API_REBIND", - 7: "DHCPV6_MSG_API_REPLY", - 8: "DHCPV6_MSG_API_RELEASE", - 9: "DHCPV6_MSG_API_DECLINE", - 10: "DHCPV6_MSG_API_RECONFIGURE", - 11: "DHCPV6_MSG_API_INFORMATION_REQUEST", - 12: "DHCPV6_MSG_API_RELAY_FORW", - 13: "DHCPV6_MSG_API_RELAY_REPL", - } - Dhcpv6MsgType_value = map[string]uint32{ - "DHCPV6_MSG_API_SOLICIT": 1, - "DHCPV6_MSG_API_ADVERTISE": 2, - "DHCPV6_MSG_API_REQUEST": 3, - "DHCPV6_MSG_API_CONFIRM": 4, - "DHCPV6_MSG_API_RENEW": 5, - "DHCPV6_MSG_API_REBIND": 6, - "DHCPV6_MSG_API_REPLY": 7, - "DHCPV6_MSG_API_RELEASE": 8, - "DHCPV6_MSG_API_DECLINE": 9, - "DHCPV6_MSG_API_RECONFIGURE": 10, - "DHCPV6_MSG_API_INFORMATION_REQUEST": 11, - "DHCPV6_MSG_API_RELAY_FORW": 12, - "DHCPV6_MSG_API_RELAY_REPL": 13, - } -) - -func (x Dhcpv6MsgType) String() string { - s, ok := Dhcpv6MsgType_name[uint32(x)] - if ok { - return s - } - return "Dhcpv6MsgType(" + 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 -} - -// VssType defines enum 'vss_type'. -type VssType uint32 - -const ( - VSS_TYPE_API_ASCII VssType = 0 - VSS_TYPE_API_VPN_ID VssType = 1 - VSS_TYPE_API_INVALID VssType = 123 - VSS_TYPE_API_DEFAULT VssType = 255 -) - -var ( - VssType_name = map[uint32]string{ - 0: "VSS_TYPE_API_ASCII", - 1: "VSS_TYPE_API_VPN_ID", - 123: "VSS_TYPE_API_INVALID", - 255: "VSS_TYPE_API_DEFAULT", - } - VssType_value = map[string]uint32{ - "VSS_TYPE_API_ASCII": 0, - "VSS_TYPE_API_VPN_ID": 1, - "VSS_TYPE_API_INVALID": 123, - "VSS_TYPE_API_DEFAULT": 255, - } -) - -func (x VssType) String() string { - s, ok := VssType_name[uint32(x)] - if ok { - return s - } - return "VssType(" + strconv.Itoa(int(x)) + ")" -} - -// 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) - } - 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 -} - -// DHCP6AddressInfo defines type 'dhcp6_address_info'. -type DHCP6AddressInfo struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` - PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` -} - -// DHCP6PdPrefixInfo defines type 'dhcp6_pd_prefix_info'. -type DHCP6PdPrefixInfo struct { - Prefix IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` - ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` - PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` -} - -// DHCPClient defines type 'dhcp_client'. -type DHCPClient struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` - ID []byte `binapi:"u8[64],name=id" json:"id,omitempty"` - WantDHCPEvent bool `binapi:"bool,name=want_dhcp_event" json:"want_dhcp_event,omitempty"` - SetBroadcastFlag bool `binapi:"bool,name=set_broadcast_flag" json:"set_broadcast_flag,omitempty"` - Dscp IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -// DHCPLease defines type 'dhcp_lease'. -type DHCPLease struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - State DHCPClientState `binapi:"dhcp_client_state,name=state" json:"state,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` - MaskWidth uint8 `binapi:"u8,name=mask_width" json:"mask_width,omitempty"` - HostAddress Address `binapi:"address,name=host_address" json:"host_address,omitempty"` - RouterAddress Address `binapi:"address,name=router_address" json:"router_address,omitempty"` - HostMac MacAddress `binapi:"mac_address,name=host_mac" json:"host_mac,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"-"` - DomainServer []DomainServer `binapi:"domain_server[count],name=domain_server" json:"domain_server,omitempty"` -} - -// DHCPServer defines type 'dhcp_server'. -type DHCPServer struct { - ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` - DHCPServer Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` -} - -// DomainServer defines type 'domain_server'. -type DomainServer struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` -} - -// 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 -} - -// DHCP6ClientsEnableDisable defines message 'dhcp6_clients_enable_disable'. -type DHCP6ClientsEnableDisable struct { - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *DHCP6ClientsEnableDisable) Reset() { *m = DHCP6ClientsEnableDisable{} } -func (*DHCP6ClientsEnableDisable) GetMessageName() string { return "dhcp6_clients_enable_disable" } -func (*DHCP6ClientsEnableDisable) GetCrcString() string { return "b3e225d2" } -func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCP6ClientsEnableDisable) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.Enable - return size -} -func (m *DHCP6ClientsEnableDisable) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.Enable) - return buf.Bytes(), nil -} -func (m *DHCP6ClientsEnableDisable) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Enable = buf.DecodeBool() - return nil -} - -// DHCP6ClientsEnableDisableReply defines message 'dhcp6_clients_enable_disable_reply'. -type DHCP6ClientsEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCP6ClientsEnableDisableReply) Reset() { *m = DHCP6ClientsEnableDisableReply{} } -func (*DHCP6ClientsEnableDisableReply) GetMessageName() string { - return "dhcp6_clients_enable_disable_reply" -} -func (*DHCP6ClientsEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCP6ClientsEnableDisableReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCP6ClientsEnableDisableReply) 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 *DHCP6ClientsEnableDisableReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCP6DuidLlSet defines message 'dhcp6_duid_ll_set'. -type DHCP6DuidLlSet struct { - DuidLl []byte `binapi:"u8[10],name=duid_ll" json:"duid_ll,omitempty"` -} - -func (m *DHCP6DuidLlSet) Reset() { *m = DHCP6DuidLlSet{} } -func (*DHCP6DuidLlSet) GetMessageName() string { return "dhcp6_duid_ll_set" } -func (*DHCP6DuidLlSet) GetCrcString() string { return "0f6ca323" } -func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCP6DuidLlSet) Size() (size int) { - if m == nil { - return 0 - } - size += 1 * 10 // m.DuidLl - return size -} -func (m *DHCP6DuidLlSet) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBytes(m.DuidLl, 10) - return buf.Bytes(), nil -} -func (m *DHCP6DuidLlSet) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.DuidLl = make([]byte, 10) - copy(m.DuidLl, buf.DecodeBytes(len(m.DuidLl))) - return nil -} - -// DHCP6DuidLlSetReply defines message 'dhcp6_duid_ll_set_reply'. -type DHCP6DuidLlSetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCP6DuidLlSetReply) Reset() { *m = DHCP6DuidLlSetReply{} } -func (*DHCP6DuidLlSetReply) GetMessageName() string { return "dhcp6_duid_ll_set_reply" } -func (*DHCP6DuidLlSetReply) GetCrcString() string { return "e8d4e804" } -func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCP6DuidLlSetReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCP6DuidLlSetReply) 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 *DHCP6DuidLlSetReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCP6PdReplyEvent defines message 'dhcp6_pd_reply_event'. -type DHCP6PdReplyEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` - MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` - T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` - T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` - InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` - StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` - Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` -} - -func (m *DHCP6PdReplyEvent) Reset() { *m = DHCP6PdReplyEvent{} } -func (*DHCP6PdReplyEvent) GetMessageName() string { return "dhcp6_pd_reply_event" } -func (*DHCP6PdReplyEvent) GetCrcString() string { return "cb3e462b" } -func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { - return api.EventMessage -} - -func (m *DHCP6PdReplyEvent) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.PID - size += 4 // m.SwIfIndex - size += 4 // m.ServerIndex - size += 4 // m.MsgType - size += 4 // m.T1 - size += 4 // m.T2 - size += 2 // m.InnerStatusCode - size += 2 // m.StatusCode - size += 1 // m.Preference - size += 4 // m.NPrefixes - for j1 := 0; j1 < len(m.Prefixes); j1++ { - var s1 DHCP6PdPrefixInfo - _ = s1 - if j1 < len(m.Prefixes) { - s1 = m.Prefixes[j1] - } - size += 1 * 16 // s1.Prefix.Address - size += 1 // s1.Prefix.Len - size += 4 // s1.ValidTime - size += 4 // s1.PreferredTime - } - return size -} -func (m *DHCP6PdReplyEvent) 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(m.ServerIndex) - buf.EncodeUint32(uint32(m.MsgType)) - buf.EncodeUint32(m.T1) - buf.EncodeUint32(m.T2) - buf.EncodeUint16(m.InnerStatusCode) - buf.EncodeUint16(m.StatusCode) - buf.EncodeUint8(m.Preference) - buf.EncodeUint32(uint32(len(m.Prefixes))) - for j0 := 0; j0 < len(m.Prefixes); j0++ { - var v0 DHCP6PdPrefixInfo // Prefixes - if j0 < len(m.Prefixes) { - v0 = m.Prefixes[j0] - } - buf.EncodeBytes(v0.Prefix.Address[:], 16) - buf.EncodeUint8(v0.Prefix.Len) - buf.EncodeUint32(v0.ValidTime) - buf.EncodeUint32(v0.PreferredTime) - } - return buf.Bytes(), nil -} -func (m *DHCP6PdReplyEvent) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.PID = buf.DecodeUint32() - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.ServerIndex = buf.DecodeUint32() - m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) - m.T1 = buf.DecodeUint32() - m.T2 = buf.DecodeUint32() - m.InnerStatusCode = buf.DecodeUint16() - m.StatusCode = buf.DecodeUint16() - m.Preference = buf.DecodeUint8() - m.NPrefixes = buf.DecodeUint32() - m.Prefixes = make([]DHCP6PdPrefixInfo, m.NPrefixes) - for j0 := 0; j0 < len(m.Prefixes); j0++ { - copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) - m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() - m.Prefixes[j0].ValidTime = buf.DecodeUint32() - m.Prefixes[j0].PreferredTime = buf.DecodeUint32() - } - return nil -} - -// DHCP6PdSendClientMessage defines message 'dhcp6_pd_send_client_message'. -type DHCP6PdSendClientMessage struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` - Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` - Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` - Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` - Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` - Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` - MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` - T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` - T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` - NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` - Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` -} - -func (m *DHCP6PdSendClientMessage) Reset() { *m = DHCP6PdSendClientMessage{} } -func (*DHCP6PdSendClientMessage) GetMessageName() string { return "dhcp6_pd_send_client_message" } -func (*DHCP6PdSendClientMessage) GetCrcString() string { return "064badb8" } -func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCP6PdSendClientMessage) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.ServerIndex - size += 4 // m.Irt - size += 4 // m.Mrt - size += 4 // m.Mrc - size += 4 // m.Mrd - size += 1 // m.Stop - size += 4 // m.MsgType - size += 4 // m.T1 - size += 4 // m.T2 - size += 4 // m.NPrefixes - for j1 := 0; j1 < len(m.Prefixes); j1++ { - var s1 DHCP6PdPrefixInfo - _ = s1 - if j1 < len(m.Prefixes) { - s1 = m.Prefixes[j1] - } - size += 1 * 16 // s1.Prefix.Address - size += 1 // s1.Prefix.Len - size += 4 // s1.ValidTime - size += 4 // s1.PreferredTime - } - return size -} -func (m *DHCP6PdSendClientMessage) 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.ServerIndex) - buf.EncodeUint32(m.Irt) - buf.EncodeUint32(m.Mrt) - buf.EncodeUint32(m.Mrc) - buf.EncodeUint32(m.Mrd) - buf.EncodeBool(m.Stop) - buf.EncodeUint32(uint32(m.MsgType)) - buf.EncodeUint32(m.T1) - buf.EncodeUint32(m.T2) - buf.EncodeUint32(uint32(len(m.Prefixes))) - for j0 := 0; j0 < len(m.Prefixes); j0++ { - var v0 DHCP6PdPrefixInfo // Prefixes - if j0 < len(m.Prefixes) { - v0 = m.Prefixes[j0] - } - buf.EncodeBytes(v0.Prefix.Address[:], 16) - buf.EncodeUint8(v0.Prefix.Len) - buf.EncodeUint32(v0.ValidTime) - buf.EncodeUint32(v0.PreferredTime) - } - return buf.Bytes(), nil -} -func (m *DHCP6PdSendClientMessage) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.ServerIndex = buf.DecodeUint32() - m.Irt = buf.DecodeUint32() - m.Mrt = buf.DecodeUint32() - m.Mrc = buf.DecodeUint32() - m.Mrd = buf.DecodeUint32() - m.Stop = buf.DecodeBool() - m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) - m.T1 = buf.DecodeUint32() - m.T2 = buf.DecodeUint32() - m.NPrefixes = buf.DecodeUint32() - m.Prefixes = make([]DHCP6PdPrefixInfo, m.NPrefixes) - for j0 := 0; j0 < len(m.Prefixes); j0++ { - copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) - m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() - m.Prefixes[j0].ValidTime = buf.DecodeUint32() - m.Prefixes[j0].PreferredTime = buf.DecodeUint32() - } - return nil -} - -// DHCP6PdSendClientMessageReply defines message 'dhcp6_pd_send_client_message_reply'. -type DHCP6PdSendClientMessageReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCP6PdSendClientMessageReply) Reset() { *m = DHCP6PdSendClientMessageReply{} } -func (*DHCP6PdSendClientMessageReply) GetMessageName() string { - return "dhcp6_pd_send_client_message_reply" -} -func (*DHCP6PdSendClientMessageReply) GetCrcString() string { return "e8d4e804" } -func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCP6PdSendClientMessageReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCP6PdSendClientMessageReply) 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 *DHCP6PdSendClientMessageReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCP6ReplyEvent defines message 'dhcp6_reply_event'. -type DHCP6ReplyEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` - MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` - T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` - T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` - InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` - StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` - Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` -} - -func (m *DHCP6ReplyEvent) Reset() { *m = DHCP6ReplyEvent{} } -func (*DHCP6ReplyEvent) GetMessageName() string { return "dhcp6_reply_event" } -func (*DHCP6ReplyEvent) GetCrcString() string { return "9f3af9e5" } -func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { - return api.EventMessage -} - -func (m *DHCP6ReplyEvent) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.PID - size += 4 // m.SwIfIndex - size += 4 // m.ServerIndex - size += 4 // m.MsgType - size += 4 // m.T1 - size += 4 // m.T2 - size += 2 // m.InnerStatusCode - size += 2 // m.StatusCode - size += 1 // m.Preference - size += 4 // m.NAddresses - for j1 := 0; j1 < len(m.Addresses); j1++ { - var s1 DHCP6AddressInfo - _ = s1 - if j1 < len(m.Addresses) { - s1 = m.Addresses[j1] - } - size += 1 * 16 // s1.Address - size += 4 // s1.ValidTime - size += 4 // s1.PreferredTime - } - return size -} -func (m *DHCP6ReplyEvent) 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(m.ServerIndex) - buf.EncodeUint32(uint32(m.MsgType)) - buf.EncodeUint32(m.T1) - buf.EncodeUint32(m.T2) - buf.EncodeUint16(m.InnerStatusCode) - buf.EncodeUint16(m.StatusCode) - buf.EncodeUint8(m.Preference) - buf.EncodeUint32(uint32(len(m.Addresses))) - for j0 := 0; j0 < len(m.Addresses); j0++ { - var v0 DHCP6AddressInfo // Addresses - if j0 < len(m.Addresses) { - v0 = m.Addresses[j0] - } - buf.EncodeBytes(v0.Address[:], 16) - buf.EncodeUint32(v0.ValidTime) - buf.EncodeUint32(v0.PreferredTime) - } - return buf.Bytes(), nil -} -func (m *DHCP6ReplyEvent) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.PID = buf.DecodeUint32() - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.ServerIndex = buf.DecodeUint32() - m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) - m.T1 = buf.DecodeUint32() - m.T2 = buf.DecodeUint32() - m.InnerStatusCode = buf.DecodeUint16() - m.StatusCode = buf.DecodeUint16() - m.Preference = buf.DecodeUint8() - m.NAddresses = buf.DecodeUint32() - m.Addresses = make([]DHCP6AddressInfo, m.NAddresses) - for j0 := 0; j0 < len(m.Addresses); j0++ { - copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) - m.Addresses[j0].ValidTime = buf.DecodeUint32() - m.Addresses[j0].PreferredTime = buf.DecodeUint32() - } - return nil -} - -// DHCP6SendClientMessage defines message 'dhcp6_send_client_message'. -type DHCP6SendClientMessage struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` - Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` - Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` - Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` - Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` - Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` - MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` - T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` - T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` - NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` - Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` -} - -func (m *DHCP6SendClientMessage) Reset() { *m = DHCP6SendClientMessage{} } -func (*DHCP6SendClientMessage) GetMessageName() string { return "dhcp6_send_client_message" } -func (*DHCP6SendClientMessage) GetCrcString() string { return "f6f14ef0" } -func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCP6SendClientMessage) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.SwIfIndex - size += 4 // m.ServerIndex - size += 4 // m.Irt - size += 4 // m.Mrt - size += 4 // m.Mrc - size += 4 // m.Mrd - size += 1 // m.Stop - size += 4 // m.MsgType - size += 4 // m.T1 - size += 4 // m.T2 - size += 4 // m.NAddresses - for j1 := 0; j1 < len(m.Addresses); j1++ { - var s1 DHCP6AddressInfo - _ = s1 - if j1 < len(m.Addresses) { - s1 = m.Addresses[j1] - } - size += 1 * 16 // s1.Address - size += 4 // s1.ValidTime - size += 4 // s1.PreferredTime - } - return size -} -func (m *DHCP6SendClientMessage) 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.ServerIndex) - buf.EncodeUint32(m.Irt) - buf.EncodeUint32(m.Mrt) - buf.EncodeUint32(m.Mrc) - buf.EncodeUint32(m.Mrd) - buf.EncodeBool(m.Stop) - buf.EncodeUint32(uint32(m.MsgType)) - buf.EncodeUint32(m.T1) - buf.EncodeUint32(m.T2) - buf.EncodeUint32(uint32(len(m.Addresses))) - for j0 := 0; j0 < len(m.Addresses); j0++ { - var v0 DHCP6AddressInfo // Addresses - if j0 < len(m.Addresses) { - v0 = m.Addresses[j0] - } - buf.EncodeBytes(v0.Address[:], 16) - buf.EncodeUint32(v0.ValidTime) - buf.EncodeUint32(v0.PreferredTime) - } - return buf.Bytes(), nil -} -func (m *DHCP6SendClientMessage) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.ServerIndex = buf.DecodeUint32() - m.Irt = buf.DecodeUint32() - m.Mrt = buf.DecodeUint32() - m.Mrc = buf.DecodeUint32() - m.Mrd = buf.DecodeUint32() - m.Stop = buf.DecodeBool() - m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) - m.T1 = buf.DecodeUint32() - m.T2 = buf.DecodeUint32() - m.NAddresses = buf.DecodeUint32() - m.Addresses = make([]DHCP6AddressInfo, m.NAddresses) - for j0 := 0; j0 < len(m.Addresses); j0++ { - copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) - m.Addresses[j0].ValidTime = buf.DecodeUint32() - m.Addresses[j0].PreferredTime = buf.DecodeUint32() - } - return nil -} - -// DHCP6SendClientMessageReply defines message 'dhcp6_send_client_message_reply'. -type DHCP6SendClientMessageReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCP6SendClientMessageReply) Reset() { *m = DHCP6SendClientMessageReply{} } -func (*DHCP6SendClientMessageReply) GetMessageName() string { return "dhcp6_send_client_message_reply" } -func (*DHCP6SendClientMessageReply) GetCrcString() string { return "e8d4e804" } -func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCP6SendClientMessageReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCP6SendClientMessageReply) 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 *DHCP6SendClientMessageReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCPClientConfig defines message 'dhcp_client_config'. -type DHCPClientConfig struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` -} - -func (m *DHCPClientConfig) Reset() { *m = DHCPClientConfig{} } -func (*DHCPClientConfig) GetMessageName() string { return "dhcp_client_config" } -func (*DHCPClientConfig) GetCrcString() string { return "959b80a3" } -func (*DHCPClientConfig) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPClientConfig) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsAdd - size += 4 // m.Client.SwIfIndex - size += 64 // m.Client.Hostname - size += 1 * 64 // m.Client.ID - size += 1 // m.Client.WantDHCPEvent - size += 1 // m.Client.SetBroadcastFlag - size += 1 // m.Client.Dscp - size += 4 // m.Client.PID - return size -} -func (m *DHCPClientConfig) 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.Client.SwIfIndex)) - buf.EncodeString(m.Client.Hostname, 64) - buf.EncodeBytes(m.Client.ID, 64) - buf.EncodeBool(m.Client.WantDHCPEvent) - buf.EncodeBool(m.Client.SetBroadcastFlag) - buf.EncodeUint8(uint8(m.Client.Dscp)) - buf.EncodeUint32(m.Client.PID) - return buf.Bytes(), nil -} -func (m *DHCPClientConfig) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsAdd = buf.DecodeBool() - m.Client.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.Client.Hostname = buf.DecodeString(64) - m.Client.ID = make([]byte, 64) - copy(m.Client.ID, buf.DecodeBytes(len(m.Client.ID))) - m.Client.WantDHCPEvent = buf.DecodeBool() - m.Client.SetBroadcastFlag = buf.DecodeBool() - m.Client.Dscp = IPDscp(buf.DecodeUint8()) - m.Client.PID = buf.DecodeUint32() - return nil -} - -// DHCPClientConfigReply defines message 'dhcp_client_config_reply'. -type DHCPClientConfigReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCPClientConfigReply) Reset() { *m = DHCPClientConfigReply{} } -func (*DHCPClientConfigReply) GetMessageName() string { return "dhcp_client_config_reply" } -func (*DHCPClientConfigReply) GetCrcString() string { return "e8d4e804" } -func (*DHCPClientConfigReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPClientConfigReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCPClientConfigReply) 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 *DHCPClientConfigReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCPClientDetails defines message 'dhcp_client_details'. -type DHCPClientDetails struct { - Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` - Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` -} - -func (m *DHCPClientDetails) Reset() { *m = DHCPClientDetails{} } -func (*DHCPClientDetails) GetMessageName() string { return "dhcp_client_details" } -func (*DHCPClientDetails) GetCrcString() string { return "acd82f5a" } -func (*DHCPClientDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPClientDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Client.SwIfIndex - size += 64 // m.Client.Hostname - size += 1 * 64 // m.Client.ID - size += 1 // m.Client.WantDHCPEvent - size += 1 // m.Client.SetBroadcastFlag - size += 1 // m.Client.Dscp - size += 4 // m.Client.PID - size += 4 // m.Lease.SwIfIndex - size += 4 // m.Lease.State - size += 1 // m.Lease.IsIPv6 - size += 64 // m.Lease.Hostname - size += 1 // m.Lease.MaskWidth - size += 4 // m.Lease.HostAddress.Af - size += 1 * 16 // m.Lease.HostAddress.Un - size += 4 // m.Lease.RouterAddress.Af - size += 1 * 16 // m.Lease.RouterAddress.Un - size += 1 * 6 // m.Lease.HostMac - size += 1 // m.Lease.Count - for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { - var s2 DomainServer - _ = s2 - if j2 < len(m.Lease.DomainServer) { - s2 = m.Lease.DomainServer[j2] - } - size += 4 // s2.Address.Af - size += 1 * 16 // s2.Address.Un - } - return size -} -func (m *DHCPClientDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(uint32(m.Client.SwIfIndex)) - buf.EncodeString(m.Client.Hostname, 64) - buf.EncodeBytes(m.Client.ID, 64) - buf.EncodeBool(m.Client.WantDHCPEvent) - buf.EncodeBool(m.Client.SetBroadcastFlag) - buf.EncodeUint8(uint8(m.Client.Dscp)) - buf.EncodeUint32(m.Client.PID) - buf.EncodeUint32(uint32(m.Lease.SwIfIndex)) - buf.EncodeUint32(uint32(m.Lease.State)) - buf.EncodeBool(m.Lease.IsIPv6) - buf.EncodeString(m.Lease.Hostname, 64) - buf.EncodeUint8(m.Lease.MaskWidth) - buf.EncodeUint32(uint32(m.Lease.HostAddress.Af)) - buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Lease.RouterAddress.Af)) - buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 16) - buf.EncodeBytes(m.Lease.HostMac[:], 6) - buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) - for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { - var v1 DomainServer // DomainServer - if j1 < len(m.Lease.DomainServer) { - v1 = m.Lease.DomainServer[j1] - } - buf.EncodeUint32(uint32(v1.Address.Af)) - buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16) - } - return buf.Bytes(), nil -} -func (m *DHCPClientDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Client.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.Client.Hostname = buf.DecodeString(64) - m.Client.ID = make([]byte, 64) - copy(m.Client.ID, buf.DecodeBytes(len(m.Client.ID))) - m.Client.WantDHCPEvent = buf.DecodeBool() - m.Client.SetBroadcastFlag = buf.DecodeBool() - m.Client.Dscp = IPDscp(buf.DecodeUint8()) - m.Client.PID = buf.DecodeUint32() - m.Lease.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.Lease.State = DHCPClientState(buf.DecodeUint32()) - m.Lease.IsIPv6 = buf.DecodeBool() - m.Lease.Hostname = buf.DecodeString(64) - m.Lease.MaskWidth = buf.DecodeUint8() - m.Lease.HostAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Lease.RouterAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) - m.Lease.Count = buf.DecodeUint8() - m.Lease.DomainServer = make([]DomainServer, m.Lease.Count) - for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { - m.Lease.DomainServer[j1].Address.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - } - return nil -} - -// DHCPClientDump defines message 'dhcp_client_dump'. -type DHCPClientDump struct{} - -func (m *DHCPClientDump) Reset() { *m = DHCPClientDump{} } -func (*DHCPClientDump) GetMessageName() string { return "dhcp_client_dump" } -func (*DHCPClientDump) GetCrcString() string { return "51077d14" } -func (*DHCPClientDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPClientDump) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *DHCPClientDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *DHCPClientDump) Unmarshal(b []byte) error { - return nil -} - -// DHCPComplEvent defines message 'dhcp_compl_event'. -type DHCPComplEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` -} - -func (m *DHCPComplEvent) Reset() { *m = DHCPComplEvent{} } -func (*DHCPComplEvent) GetMessageName() string { return "dhcp_compl_event" } -func (*DHCPComplEvent) GetCrcString() string { return "e908fd1d" } -func (*DHCPComplEvent) GetMessageType() api.MessageType { - return api.EventMessage -} - -func (m *DHCPComplEvent) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.PID - size += 4 // m.Lease.SwIfIndex - size += 4 // m.Lease.State - size += 1 // m.Lease.IsIPv6 - size += 64 // m.Lease.Hostname - size += 1 // m.Lease.MaskWidth - size += 4 // m.Lease.HostAddress.Af - size += 1 * 16 // m.Lease.HostAddress.Un - size += 4 // m.Lease.RouterAddress.Af - size += 1 * 16 // m.Lease.RouterAddress.Un - size += 1 * 6 // m.Lease.HostMac - size += 1 // m.Lease.Count - for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { - var s2 DomainServer - _ = s2 - if j2 < len(m.Lease.DomainServer) { - s2 = m.Lease.DomainServer[j2] - } - size += 4 // s2.Address.Af - size += 1 * 16 // s2.Address.Un - } - return size -} -func (m *DHCPComplEvent) 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.Lease.SwIfIndex)) - buf.EncodeUint32(uint32(m.Lease.State)) - buf.EncodeBool(m.Lease.IsIPv6) - buf.EncodeString(m.Lease.Hostname, 64) - buf.EncodeUint8(m.Lease.MaskWidth) - buf.EncodeUint32(uint32(m.Lease.HostAddress.Af)) - buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.Lease.RouterAddress.Af)) - buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 16) - buf.EncodeBytes(m.Lease.HostMac[:], 6) - buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) - for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { - var v1 DomainServer // DomainServer - if j1 < len(m.Lease.DomainServer) { - v1 = m.Lease.DomainServer[j1] - } - buf.EncodeUint32(uint32(v1.Address.Af)) - buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16) - } - return buf.Bytes(), nil -} -func (m *DHCPComplEvent) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.PID = buf.DecodeUint32() - m.Lease.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) - m.Lease.State = DHCPClientState(buf.DecodeUint32()) - m.Lease.IsIPv6 = buf.DecodeBool() - m.Lease.Hostname = buf.DecodeString(64) - m.Lease.MaskWidth = buf.DecodeUint8() - m.Lease.HostAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Lease.RouterAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) - m.Lease.Count = buf.DecodeUint8() - m.Lease.DomainServer = make([]DomainServer, m.Lease.Count) - for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { - m.Lease.DomainServer[j1].Address.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - } - return nil -} - -// DHCPPluginControlPing defines message 'dhcp_plugin_control_ping'. -type DHCPPluginControlPing struct{} - -func (m *DHCPPluginControlPing) Reset() { *m = DHCPPluginControlPing{} } -func (*DHCPPluginControlPing) GetMessageName() string { return "dhcp_plugin_control_ping" } -func (*DHCPPluginControlPing) GetCrcString() string { return "51077d14" } -func (*DHCPPluginControlPing) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPPluginControlPing) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *DHCPPluginControlPing) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *DHCPPluginControlPing) Unmarshal(b []byte) error { - return nil -} - -// DHCPPluginControlPingReply defines message 'dhcp_plugin_control_ping_reply'. -type DHCPPluginControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *DHCPPluginControlPingReply) Reset() { *m = DHCPPluginControlPingReply{} } -func (*DHCPPluginControlPingReply) GetMessageName() string { return "dhcp_plugin_control_ping_reply" } -func (*DHCPPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*DHCPPluginControlPingReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPPluginControlPingReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - size += 4 // m.ClientIndex - size += 4 // m.VpePID - return size -} -func (m *DHCPPluginControlPingReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeInt32(m.Retval) - buf.EncodeUint32(m.ClientIndex) - buf.EncodeUint32(m.VpePID) - return buf.Bytes(), nil -} -func (m *DHCPPluginControlPingReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - m.ClientIndex = buf.DecodeUint32() - m.VpePID = buf.DecodeUint32() - return nil -} - -// DHCPPluginGetVersion defines message 'dhcp_plugin_get_version'. -type DHCPPluginGetVersion struct{} - -func (m *DHCPPluginGetVersion) Reset() { *m = DHCPPluginGetVersion{} } -func (*DHCPPluginGetVersion) GetMessageName() string { return "dhcp_plugin_get_version" } -func (*DHCPPluginGetVersion) GetCrcString() string { return "51077d14" } -func (*DHCPPluginGetVersion) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPPluginGetVersion) Size() (size int) { - if m == nil { - return 0 - } - return size -} -func (m *DHCPPluginGetVersion) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - return buf.Bytes(), nil -} -func (m *DHCPPluginGetVersion) Unmarshal(b []byte) error { - return nil -} - -// DHCPPluginGetVersionReply defines message 'dhcp_plugin_get_version_reply'. -type DHCPPluginGetVersionReply struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` -} - -func (m *DHCPPluginGetVersionReply) Reset() { *m = DHCPPluginGetVersionReply{} } -func (*DHCPPluginGetVersionReply) GetMessageName() string { return "dhcp_plugin_get_version_reply" } -func (*DHCPPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } -func (*DHCPPluginGetVersionReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPPluginGetVersionReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Major - size += 4 // m.Minor - return size -} -func (m *DHCPPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.Major) - buf.EncodeUint32(m.Minor) - return buf.Bytes(), nil -} -func (m *DHCPPluginGetVersionReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Major = buf.DecodeUint32() - m.Minor = buf.DecodeUint32() - return nil -} - -// DHCPProxyConfig defines message 'dhcp_proxy_config'. -type DHCPProxyConfig struct { - RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` - ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - DHCPServer Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` - DHCPSrcAddress Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` -} - -func (m *DHCPProxyConfig) Reset() { *m = DHCPProxyConfig{} } -func (*DHCPProxyConfig) GetMessageName() string { return "dhcp_proxy_config" } -func (*DHCPProxyConfig) GetCrcString() string { return "6767230e" } -func (*DHCPProxyConfig) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPProxyConfig) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.RxVrfID - size += 4 // m.ServerVrfID - size += 1 // m.IsAdd - size += 4 // m.DHCPServer.Af - size += 1 * 16 // m.DHCPServer.Un - size += 4 // m.DHCPSrcAddress.Af - size += 1 * 16 // m.DHCPSrcAddress.Un - return size -} -func (m *DHCPProxyConfig) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.RxVrfID) - buf.EncodeUint32(m.ServerVrfID) - buf.EncodeBool(m.IsAdd) - buf.EncodeUint32(uint32(m.DHCPServer.Af)) - buf.EncodeBytes(m.DHCPServer.Un.XXX_UnionData[:], 16) - buf.EncodeUint32(uint32(m.DHCPSrcAddress.Af)) - buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 16) - return buf.Bytes(), nil -} -func (m *DHCPProxyConfig) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.RxVrfID = buf.DecodeUint32() - m.ServerVrfID = buf.DecodeUint32() - m.IsAdd = buf.DecodeBool() - m.DHCPServer.Af = AddressFamily(buf.DecodeUint32()) - copy(m.DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.DHCPSrcAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - return nil -} - -// DHCPProxyConfigReply defines message 'dhcp_proxy_config_reply'. -type DHCPProxyConfigReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCPProxyConfigReply) Reset() { *m = DHCPProxyConfigReply{} } -func (*DHCPProxyConfigReply) GetMessageName() string { return "dhcp_proxy_config_reply" } -func (*DHCPProxyConfigReply) GetCrcString() string { return "e8d4e804" } -func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPProxyConfigReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCPProxyConfigReply) 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 *DHCPProxyConfigReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// DHCPProxyDetails defines message 'dhcp_proxy_details'. -type DHCPProxyDetails struct { - RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` - VssOui uint32 `binapi:"u32,name=vss_oui" json:"vss_oui,omitempty"` - VssFibID uint32 `binapi:"u32,name=vss_fib_id" json:"vss_fib_id,omitempty"` - VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - VssVPNAsciiID string `binapi:"string[129],name=vss_vpn_ascii_id" json:"vss_vpn_ascii_id,omitempty"` - DHCPSrcAddress Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"-"` - Servers []DHCPServer `binapi:"dhcp_server[count],name=servers" json:"servers,omitempty"` -} - -func (m *DHCPProxyDetails) Reset() { *m = DHCPProxyDetails{} } -func (*DHCPProxyDetails) GetMessageName() string { return "dhcp_proxy_details" } -func (*DHCPProxyDetails) GetCrcString() string { return "ce16f044" } -func (*DHCPProxyDetails) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPProxyDetails) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.RxVrfID - size += 4 // m.VssOui - size += 4 // m.VssFibID - size += 4 // m.VssType - size += 1 // m.IsIPv6 - size += 129 // m.VssVPNAsciiID - size += 4 // m.DHCPSrcAddress.Af - size += 1 * 16 // m.DHCPSrcAddress.Un - size += 1 // m.Count - for j1 := 0; j1 < len(m.Servers); j1++ { - var s1 DHCPServer - _ = s1 - if j1 < len(m.Servers) { - s1 = m.Servers[j1] - } - size += 4 // s1.ServerVrfID - size += 4 // s1.DHCPServer.Af - size += 1 * 16 // s1.DHCPServer.Un - } - return size -} -func (m *DHCPProxyDetails) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.RxVrfID) - buf.EncodeUint32(m.VssOui) - buf.EncodeUint32(m.VssFibID) - buf.EncodeUint32(uint32(m.VssType)) - buf.EncodeBool(m.IsIPv6) - buf.EncodeString(m.VssVPNAsciiID, 129) - buf.EncodeUint32(uint32(m.DHCPSrcAddress.Af)) - buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 16) - buf.EncodeUint8(uint8(len(m.Servers))) - for j0 := 0; j0 < len(m.Servers); j0++ { - var v0 DHCPServer // Servers - if j0 < len(m.Servers) { - v0 = m.Servers[j0] - } - buf.EncodeUint32(v0.ServerVrfID) - buf.EncodeUint32(uint32(v0.DHCPServer.Af)) - buf.EncodeBytes(v0.DHCPServer.Un.XXX_UnionData[:], 16) - } - return buf.Bytes(), nil -} -func (m *DHCPProxyDetails) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.RxVrfID = buf.DecodeUint32() - m.VssOui = buf.DecodeUint32() - m.VssFibID = buf.DecodeUint32() - m.VssType = VssType(buf.DecodeUint32()) - m.IsIPv6 = buf.DecodeBool() - m.VssVPNAsciiID = buf.DecodeString(129) - m.DHCPSrcAddress.Af = AddressFamily(buf.DecodeUint32()) - copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - m.Count = buf.DecodeUint8() - m.Servers = make([]DHCPServer, m.Count) - for j0 := 0; j0 < len(m.Servers); j0++ { - m.Servers[j0].ServerVrfID = buf.DecodeUint32() - m.Servers[j0].DHCPServer.Af = AddressFamily(buf.DecodeUint32()) - copy(m.Servers[j0].DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) - } - return nil -} - -// DHCPProxyDump defines message 'dhcp_proxy_dump'. -type DHCPProxyDump struct { - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` -} - -func (m *DHCPProxyDump) Reset() { *m = DHCPProxyDump{} } -func (*DHCPProxyDump) GetMessageName() string { return "dhcp_proxy_dump" } -func (*DHCPProxyDump) GetCrcString() string { return "5c5b063f" } -func (*DHCPProxyDump) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPProxyDump) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.IsIP6 - return size -} -func (m *DHCPProxyDump) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.IsIP6) - return buf.Bytes(), nil -} -func (m *DHCPProxyDump) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.IsIP6 = buf.DecodeBool() - return nil -} - -// DHCPProxySetVss defines message 'dhcp_proxy_set_vss'. -type DHCPProxySetVss struct { - TblID uint32 `binapi:"u32,name=tbl_id" json:"tbl_id,omitempty"` - VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` - VPNAsciiID string `binapi:"string[129],name=vpn_ascii_id" json:"vpn_ascii_id,omitempty"` - Oui uint32 `binapi:"u32,name=oui" json:"oui,omitempty"` - VPNIndex uint32 `binapi:"u32,name=vpn_index" json:"vpn_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *DHCPProxySetVss) Reset() { *m = DHCPProxySetVss{} } -func (*DHCPProxySetVss) GetMessageName() string { return "dhcp_proxy_set_vss" } -func (*DHCPProxySetVss) GetCrcString() string { return "50537301" } -func (*DHCPProxySetVss) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *DHCPProxySetVss) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.TblID - size += 4 // m.VssType - size += 129 // m.VPNAsciiID - size += 4 // m.Oui - size += 4 // m.VPNIndex - size += 1 // m.IsIPv6 - size += 1 // m.IsAdd - return size -} -func (m *DHCPProxySetVss) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint32(m.TblID) - buf.EncodeUint32(uint32(m.VssType)) - buf.EncodeString(m.VPNAsciiID, 129) - buf.EncodeUint32(m.Oui) - buf.EncodeUint32(m.VPNIndex) - buf.EncodeBool(m.IsIPv6) - buf.EncodeBool(m.IsAdd) - return buf.Bytes(), nil -} -func (m *DHCPProxySetVss) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.TblID = buf.DecodeUint32() - m.VssType = VssType(buf.DecodeUint32()) - m.VPNAsciiID = buf.DecodeString(129) - m.Oui = buf.DecodeUint32() - m.VPNIndex = buf.DecodeUint32() - m.IsIPv6 = buf.DecodeBool() - m.IsAdd = buf.DecodeBool() - return nil -} - -// DHCPProxySetVssReply defines message 'dhcp_proxy_set_vss_reply'. -type DHCPProxySetVssReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DHCPProxySetVssReply) Reset() { *m = DHCPProxySetVssReply{} } -func (*DHCPProxySetVssReply) GetMessageName() string { return "dhcp_proxy_set_vss_reply" } -func (*DHCPProxySetVssReply) GetCrcString() string { return "e8d4e804" } -func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *DHCPProxySetVssReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *DHCPProxySetVssReply) 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 *DHCPProxySetVssReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// WantDHCP6PdReplyEvents defines message 'want_dhcp6_pd_reply_events'. -type WantDHCP6PdReplyEvents struct { - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -func (m *WantDHCP6PdReplyEvents) Reset() { *m = WantDHCP6PdReplyEvents{} } -func (*WantDHCP6PdReplyEvents) GetMessageName() string { return "want_dhcp6_pd_reply_events" } -func (*WantDHCP6PdReplyEvents) GetCrcString() string { return "c5e2af94" } -func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *WantDHCP6PdReplyEvents) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.EnableDisable - size += 4 // m.PID - return size -} -func (m *WantDHCP6PdReplyEvents) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeBool(m.EnableDisable) - buf.EncodeUint32(m.PID) - return buf.Bytes(), nil -} -func (m *WantDHCP6PdReplyEvents) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.EnableDisable = buf.DecodeBool() - m.PID = buf.DecodeUint32() - return nil -} - -// WantDHCP6PdReplyEventsReply defines message 'want_dhcp6_pd_reply_events_reply'. -type WantDHCP6PdReplyEventsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *WantDHCP6PdReplyEventsReply) Reset() { *m = WantDHCP6PdReplyEventsReply{} } -func (*WantDHCP6PdReplyEventsReply) GetMessageName() string { - return "want_dhcp6_pd_reply_events_reply" -} -func (*WantDHCP6PdReplyEventsReply) GetCrcString() string { return "e8d4e804" } -func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *WantDHCP6PdReplyEventsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *WantDHCP6PdReplyEventsReply) 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 *WantDHCP6PdReplyEventsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -// WantDHCP6ReplyEvents defines message 'want_dhcp6_reply_events'. -type WantDHCP6ReplyEvents struct { - EnableDisable uint8 `binapi:"u8,name=enable_disable" json:"enable_disable,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -func (m *WantDHCP6ReplyEvents) Reset() { *m = WantDHCP6ReplyEvents{} } -func (*WantDHCP6ReplyEvents) GetMessageName() string { return "want_dhcp6_reply_events" } -func (*WantDHCP6ReplyEvents) GetCrcString() string { return "05b454b5" } -func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *WantDHCP6ReplyEvents) Size() (size int) { - if m == nil { - return 0 - } - size += 1 // m.EnableDisable - size += 4 // m.PID - return size -} -func (m *WantDHCP6ReplyEvents) Marshal(b []byte) ([]byte, error) { - if b == nil { - b = make([]byte, m.Size()) - } - buf := codec.NewBuffer(b) - buf.EncodeUint8(m.EnableDisable) - buf.EncodeUint32(m.PID) - return buf.Bytes(), nil -} -func (m *WantDHCP6ReplyEvents) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.EnableDisable = buf.DecodeUint8() - m.PID = buf.DecodeUint32() - return nil -} - -// WantDHCP6ReplyEventsReply defines message 'want_dhcp6_reply_events_reply'. -type WantDHCP6ReplyEventsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *WantDHCP6ReplyEventsReply) Reset() { *m = WantDHCP6ReplyEventsReply{} } -func (*WantDHCP6ReplyEventsReply) GetMessageName() string { return "want_dhcp6_reply_events_reply" } -func (*WantDHCP6ReplyEventsReply) GetCrcString() string { return "e8d4e804" } -func (*WantDHCP6ReplyEventsReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *WantDHCP6ReplyEventsReply) Size() (size int) { - if m == nil { - return 0 - } - size += 4 // m.Retval - return size -} -func (m *WantDHCP6ReplyEventsReply) 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 *WantDHCP6ReplyEventsReply) Unmarshal(b []byte) error { - buf := codec.NewBuffer(b) - m.Retval = buf.DecodeInt32() - return nil -} - -func init() { file_dhcp_binapi_init() } -func file_dhcp_binapi_init() { - api.RegisterMessage((*DHCP6ClientsEnableDisable)(nil), "dhcp6_clients_enable_disable_b3e225d2") - api.RegisterMessage((*DHCP6ClientsEnableDisableReply)(nil), "dhcp6_clients_enable_disable_reply_e8d4e804") - api.RegisterMessage((*DHCP6DuidLlSet)(nil), "dhcp6_duid_ll_set_0f6ca323") - api.RegisterMessage((*DHCP6DuidLlSetReply)(nil), "dhcp6_duid_ll_set_reply_e8d4e804") - api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp6_pd_reply_event_cb3e462b") - api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp6_pd_send_client_message_064badb8") - api.RegisterMessage((*DHCP6PdSendClientMessageReply)(nil), "dhcp6_pd_send_client_message_reply_e8d4e804") - api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp6_reply_event_9f3af9e5") - api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp6_send_client_message_f6f14ef0") - api.RegisterMessage((*DHCP6SendClientMessageReply)(nil), "dhcp6_send_client_message_reply_e8d4e804") - api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp_client_config_959b80a3") - api.RegisterMessage((*DHCPClientConfigReply)(nil), "dhcp_client_config_reply_e8d4e804") - api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp_client_details_acd82f5a") - api.RegisterMessage((*DHCPClientDump)(nil), "dhcp_client_dump_51077d14") - api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp_compl_event_e908fd1d") - api.RegisterMessage((*DHCPPluginControlPing)(nil), "dhcp_plugin_control_ping_51077d14") - api.RegisterMessage((*DHCPPluginControlPingReply)(nil), "dhcp_plugin_control_ping_reply_f6b0b8ca") - api.RegisterMessage((*DHCPPluginGetVersion)(nil), "dhcp_plugin_get_version_51077d14") - api.RegisterMessage((*DHCPPluginGetVersionReply)(nil), "dhcp_plugin_get_version_reply_9b32cf86") - api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp_proxy_config_6767230e") - api.RegisterMessage((*DHCPProxyConfigReply)(nil), "dhcp_proxy_config_reply_e8d4e804") - api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp_proxy_details_ce16f044") - api.RegisterMessage((*DHCPProxyDump)(nil), "dhcp_proxy_dump_5c5b063f") - api.RegisterMessage((*DHCPProxySetVss)(nil), "dhcp_proxy_set_vss_50537301") - api.RegisterMessage((*DHCPProxySetVssReply)(nil), "dhcp_proxy_set_vss_reply_e8d4e804") - api.RegisterMessage((*WantDHCP6PdReplyEvents)(nil), "want_dhcp6_pd_reply_events_c5e2af94") - api.RegisterMessage((*WantDHCP6PdReplyEventsReply)(nil), "want_dhcp6_pd_reply_events_reply_e8d4e804") - api.RegisterMessage((*WantDHCP6ReplyEvents)(nil), "want_dhcp6_reply_events_05b454b5") - api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "want_dhcp6_reply_events_reply_e8d4e804") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*DHCP6ClientsEnableDisable)(nil), - (*DHCP6ClientsEnableDisableReply)(nil), - (*DHCP6DuidLlSet)(nil), - (*DHCP6DuidLlSetReply)(nil), - (*DHCP6PdReplyEvent)(nil), - (*DHCP6PdSendClientMessage)(nil), - (*DHCP6PdSendClientMessageReply)(nil), - (*DHCP6ReplyEvent)(nil), - (*DHCP6SendClientMessage)(nil), - (*DHCP6SendClientMessageReply)(nil), - (*DHCPClientConfig)(nil), - (*DHCPClientConfigReply)(nil), - (*DHCPClientDetails)(nil), - (*DHCPClientDump)(nil), - (*DHCPComplEvent)(nil), - (*DHCPPluginControlPing)(nil), - (*DHCPPluginControlPingReply)(nil), - (*DHCPPluginGetVersion)(nil), - (*DHCPPluginGetVersionReply)(nil), - (*DHCPProxyConfig)(nil), - (*DHCPProxyConfigReply)(nil), - (*DHCPProxyDetails)(nil), - (*DHCPProxyDump)(nil), - (*DHCPProxySetVss)(nil), - (*DHCPProxySetVssReply)(nil), - (*WantDHCP6PdReplyEvents)(nil), - (*WantDHCP6PdReplyEventsReply)(nil), - (*WantDHCP6ReplyEvents)(nil), - (*WantDHCP6ReplyEventsReply)(nil), - } -} diff --git a/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go b/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go deleted file mode 100644 index 25918a0..0000000 --- a/internal/testbinapi/binapi2001/dhcp/dhcp_rpc.ba.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package dhcp - -import ( - "context" - "fmt" - "io" - - api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" -) - -// RPCService defines RPC service dhcp. -type RPCService interface { - DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) - DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) - DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) - DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) - DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) - DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) - DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) - DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) - DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) - DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) - DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) - WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) - WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) -} - -type serviceClient struct { - conn api.Connection -} - -func NewServiceClient(conn api.Connection) RPCService { - return &serviceClient{conn} -} - -func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { - out := new(DHCP6ClientsEnableDisableReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { - out := new(DHCP6DuidLlSetReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { - out := new(DHCP6PdSendClientMessageReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { - out := new(DHCP6SendClientMessageReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { - out := new(DHCPClientConfigReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_DHCPClientDumpClient{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_DHCPClientDumpClient interface { - Recv() (*DHCPClientDetails, error) - api.Stream -} - -type serviceClient_DHCPClientDumpClient struct { - api.Stream -} - -func (c *serviceClient_DHCPClientDumpClient) Recv() (*DHCPClientDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *DHCPClientDetails: - return m, nil - case *vpe.ControlPingReply: - err = c.Stream.Close() - if err != nil { - return nil, err - } - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) { - out := new(DHCPPluginControlPingReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) { - out := new(DHCPPluginGetVersionReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { - out := new(DHCPProxyConfigReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) { - stream, err := c.conn.NewStream(ctx) - if err != nil { - return nil, err - } - x := &serviceClient_DHCPProxyDumpClient{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_DHCPProxyDumpClient interface { - Recv() (*DHCPProxyDetails, error) - api.Stream -} - -type serviceClient_DHCPProxyDumpClient struct { - api.Stream -} - -func (c *serviceClient_DHCPProxyDumpClient) Recv() (*DHCPProxyDetails, error) { - msg, err := c.Stream.RecvMsg() - if err != nil { - return nil, err - } - switch m := msg.(type) { - case *DHCPProxyDetails: - return m, nil - case *vpe.ControlPingReply: - err = c.Stream.Close() - if err != nil { - return nil, err - } - return nil, io.EOF - default: - return nil, fmt.Errorf("unexpected message: %T %v", m, m) - } -} - -func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { - out := new(DHCPProxySetVssReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { - out := new(WantDHCP6PdReplyEventsReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} - -func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { - out := new(WantDHCP6ReplyEventsReply) - err := c.conn.Invoke(ctx, in, out) - if err != nil { - return nil, err - } - return out, api.RetvalToVPPApiError(out.Retval) -} |