diff options
author | 2020-07-22 04:40:55 +0200 | |
---|---|---|
committer | 2020-07-22 04:40:55 +0200 | |
commit | 58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch) | |
tree | a1bbda04c6d0621ce0fc20779276620f1820190b /internal/testbinapi/binapi2001/ipsec | |
parent | a155cd438c6558da266c1c5931361ea088b35653 (diff) |
Fix binapigen decoding and minor improvements
- fixed allocating byte slices before copying decoded data
- simplified encoding functions
- several minor improvements
Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'internal/testbinapi/binapi2001/ipsec')
-rw-r--r-- | internal/testbinapi/binapi2001/ipsec/ipsec.ba.go | 2590 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/ipsec/ipsec_rpc.ba.go | 353 |
2 files changed, 2943 insertions, 0 deletions
diff --git a/internal/testbinapi/binapi2001/ipsec/ipsec.ba.go b/internal/testbinapi/binapi2001/ipsec/ipsec.ba.go new file mode 100644 index 0000000..b1c0079 --- /dev/null +++ b/internal/testbinapi/binapi2001/ipsec/ipsec.ba.go @@ -0,0 +1,2590 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01 +// source: .vppapi/core/ipsec.api.json + +// Package ipsec contains generated bindings for API file ipsec.api. +// +// Contents: +// 6 aliases +// 15 enums +// 10 structs +// 1 union +// 30 messages +// +package ipsec + +import ( + "fmt" + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + "net" + "strconv" + "strings" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ipsec" + APIVersion = "3.0.0" + VersionCrc = 0x5a59fef9 +) + +// 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)) + ")" +} + +// IpsecCryptoAlg defines enum 'ipsec_crypto_alg'. +type IpsecCryptoAlg uint32 + +const ( + IPSEC_API_CRYPTO_ALG_NONE IpsecCryptoAlg = 0 + IPSEC_API_CRYPTO_ALG_AES_CBC_128 IpsecCryptoAlg = 1 + IPSEC_API_CRYPTO_ALG_AES_CBC_192 IpsecCryptoAlg = 2 + IPSEC_API_CRYPTO_ALG_AES_CBC_256 IpsecCryptoAlg = 3 + IPSEC_API_CRYPTO_ALG_AES_CTR_128 IpsecCryptoAlg = 4 + IPSEC_API_CRYPTO_ALG_AES_CTR_192 IpsecCryptoAlg = 5 + IPSEC_API_CRYPTO_ALG_AES_CTR_256 IpsecCryptoAlg = 6 + IPSEC_API_CRYPTO_ALG_AES_GCM_128 IpsecCryptoAlg = 7 + IPSEC_API_CRYPTO_ALG_AES_GCM_192 IpsecCryptoAlg = 8 + IPSEC_API_CRYPTO_ALG_AES_GCM_256 IpsecCryptoAlg = 9 + IPSEC_API_CRYPTO_ALG_DES_CBC IpsecCryptoAlg = 10 + IPSEC_API_CRYPTO_ALG_3DES_CBC IpsecCryptoAlg = 11 +) + +var ( + IpsecCryptoAlg_name = map[uint32]string{ + 0: "IPSEC_API_CRYPTO_ALG_NONE", + 1: "IPSEC_API_CRYPTO_ALG_AES_CBC_128", + 2: "IPSEC_API_CRYPTO_ALG_AES_CBC_192", + 3: "IPSEC_API_CRYPTO_ALG_AES_CBC_256", + 4: "IPSEC_API_CRYPTO_ALG_AES_CTR_128", + 5: "IPSEC_API_CRYPTO_ALG_AES_CTR_192", + 6: "IPSEC_API_CRYPTO_ALG_AES_CTR_256", + 7: "IPSEC_API_CRYPTO_ALG_AES_GCM_128", + 8: "IPSEC_API_CRYPTO_ALG_AES_GCM_192", + 9: "IPSEC_API_CRYPTO_ALG_AES_GCM_256", + 10: "IPSEC_API_CRYPTO_ALG_DES_CBC", + 11: "IPSEC_API_CRYPTO_ALG_3DES_CBC", + } + IpsecCryptoAlg_value = map[string]uint32{ + "IPSEC_API_CRYPTO_ALG_NONE": 0, + "IPSEC_API_CRYPTO_ALG_AES_CBC_128": 1, + "IPSEC_API_CRYPTO_ALG_AES_CBC_192": 2, + "IPSEC_API_CRYPTO_ALG_AES_CBC_256": 3, + "IPSEC_API_CRYPTO_ALG_AES_CTR_128": 4, + "IPSEC_API_CRYPTO_ALG_AES_CTR_192": 5, + "IPSEC_API_CRYPTO_ALG_AES_CTR_256": 6, + "IPSEC_API_CRYPTO_ALG_AES_GCM_128": 7, + "IPSEC_API_CRYPTO_ALG_AES_GCM_192": 8, + "IPSEC_API_CRYPTO_ALG_AES_GCM_256": 9, + "IPSEC_API_CRYPTO_ALG_DES_CBC": 10, + "IPSEC_API_CRYPTO_ALG_3DES_CBC": 11, + } +) + +func (x IpsecCryptoAlg) String() string { + s, ok := IpsecCryptoAlg_name[uint32(x)] + if ok { + return s + } + return "IpsecCryptoAlg(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecIntegAlg defines enum 'ipsec_integ_alg'. +type IpsecIntegAlg uint32 + +const ( + IPSEC_API_INTEG_ALG_NONE IpsecIntegAlg = 0 + IPSEC_API_INTEG_ALG_MD5_96 IpsecIntegAlg = 1 + IPSEC_API_INTEG_ALG_SHA1_96 IpsecIntegAlg = 2 + IPSEC_API_INTEG_ALG_SHA_256_96 IpsecIntegAlg = 3 + IPSEC_API_INTEG_ALG_SHA_256_128 IpsecIntegAlg = 4 + IPSEC_API_INTEG_ALG_SHA_384_192 IpsecIntegAlg = 5 + IPSEC_API_INTEG_ALG_SHA_512_256 IpsecIntegAlg = 6 +) + +var ( + IpsecIntegAlg_name = map[uint32]string{ + 0: "IPSEC_API_INTEG_ALG_NONE", + 1: "IPSEC_API_INTEG_ALG_MD5_96", + 2: "IPSEC_API_INTEG_ALG_SHA1_96", + 3: "IPSEC_API_INTEG_ALG_SHA_256_96", + 4: "IPSEC_API_INTEG_ALG_SHA_256_128", + 5: "IPSEC_API_INTEG_ALG_SHA_384_192", + 6: "IPSEC_API_INTEG_ALG_SHA_512_256", + } + IpsecIntegAlg_value = map[string]uint32{ + "IPSEC_API_INTEG_ALG_NONE": 0, + "IPSEC_API_INTEG_ALG_MD5_96": 1, + "IPSEC_API_INTEG_ALG_SHA1_96": 2, + "IPSEC_API_INTEG_ALG_SHA_256_96": 3, + "IPSEC_API_INTEG_ALG_SHA_256_128": 4, + "IPSEC_API_INTEG_ALG_SHA_384_192": 5, + "IPSEC_API_INTEG_ALG_SHA_512_256": 6, + } +) + +func (x IpsecIntegAlg) String() string { + s, ok := IpsecIntegAlg_name[uint32(x)] + if ok { + return s + } + return "IpsecIntegAlg(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecProto defines enum 'ipsec_proto'. +type IpsecProto uint32 + +const ( + IPSEC_API_PROTO_ESP IpsecProto = 1 + IPSEC_API_PROTO_AH IpsecProto = 2 +) + +var ( + IpsecProto_name = map[uint32]string{ + 1: "IPSEC_API_PROTO_ESP", + 2: "IPSEC_API_PROTO_AH", + } + IpsecProto_value = map[string]uint32{ + "IPSEC_API_PROTO_ESP": 1, + "IPSEC_API_PROTO_AH": 2, + } +) + +func (x IpsecProto) String() string { + s, ok := IpsecProto_name[uint32(x)] + if ok { + return s + } + return "IpsecProto(" + strconv.Itoa(int(x)) + ")" +} + +// IpsecSadFlags defines enum 'ipsec_sad_flags'. +type IpsecSadFlags uint32 + +const ( + IPSEC_API_SAD_FLAG_NONE IpsecSadFlags = 0 + IPSEC_API_SAD_FLAG_USE_ESN IpsecSadFlags = 1 + IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY IpsecSadFlags = 2 + IPSEC_API_SAD_FLAG_IS_TUNNEL IpsecSadFlags = 4 + IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 IpsecSadFlags = 8 + IPSEC_API_SAD_FLAG_UDP_ENCAP IpsecSadFlags = 16 +) + +var ( + IpsecSadFlags_name = map[uint32]string{ + 0: "IPSEC_API_SAD_FLAG_NONE", + 1: "IPSEC_API_SAD_FLAG_USE_ESN", + 2: "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY", + 4: "IPSEC_API_SAD_FLAG_IS_TUNNEL", + 8: "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6", + 16: "IPSEC_API_SAD_FLAG_UDP_ENCAP", + } + IpsecSadFlags_value = map[string]uint32{ + "IPSEC_API_SAD_FLAG_NONE": 0, + "IPSEC_API_SAD_FLAG_USE_ESN": 1, + "IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY": 2, + "IPSEC_API_SAD_FLAG_IS_TUNNEL": 4, + "IPSEC_API_SAD_FLAG_IS_TUNNEL_V6": 8, + "IPSEC_API_SAD_FLAG_UDP_ENCAP": 16, + } +) + +func (x IpsecSadFlags) String() string { + s, ok := IpsecSadFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := IpsecSadFlags_name[uint32(n)] + if ok { + return s + } + return "IpsecSadFlags(" + 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 +} + +// IpsecSpdAction defines enum 'ipsec_spd_action'. +type IpsecSpdAction uint32 + +const ( + IPSEC_API_SPD_ACTION_BYPASS IpsecSpdAction = 0 + IPSEC_API_SPD_ACTION_DISCARD IpsecSpdAction = 1 + IPSEC_API_SPD_ACTION_RESOLVE IpsecSpdAction = 2 + IPSEC_API_SPD_ACTION_PROTECT IpsecSpdAction = 3 +) + +var ( + IpsecSpdAction_name = map[uint32]string{ + 0: "IPSEC_API_SPD_ACTION_BYPASS", + 1: "IPSEC_API_SPD_ACTION_DISCARD", + 2: "IPSEC_API_SPD_ACTION_RESOLVE", + 3: "IPSEC_API_SPD_ACTION_PROTECT", + } + IpsecSpdAction_value = map[string]uint32{ + "IPSEC_API_SPD_ACTION_BYPASS": 0, + "IPSEC_API_SPD_ACTION_DISCARD": 1, + "IPSEC_API_SPD_ACTION_RESOLVE": 2, + "IPSEC_API_SPD_ACTION_PROTECT": 3, + } +) + +func (x IpsecSpdAction) String() string { + s, ok := IpsecSpdAction_name[uint32(x)] + if ok { + return s + } + return "IpsecSpdAction(" + 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) + } + var addr Address + if ip.To4() == nil { + addr.Af = ADDRESS_IP6 + var ip6 IP6Address + copy(ip6[:], ip.To16()) + addr.Un.SetIP6(ip6) + } else { + addr.Af = ADDRESS_IP4 + var ip4 IP4Address + copy(ip4[:], ip.To4()) + addr.Un.SetIP4(ip4) + } + return addr, nil +} +func (x Address) ToIP() net.IP { + if x.Af == ADDRESS_IP6 { + ip6 := x.Un.GetIP6() + return net.IP(ip6[:]).To16() + } else { + ip4 := x.Un.GetIP4() + return net.IP(ip4[:]).To4() + } +} +func (x Address) String() string { + return x.ToIP().String() +} +func (x *Address) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *Address) UnmarshalText(text []byte) error { + addr, err := ParseAddress(string(text)) + if err != nil { + return err + } + *x = addr + return nil +} + +// IP4Prefix defines type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) { + hasPrefix := strings.Contains(s, "/") + if hasPrefix { + ip, network, err := net.ParseCIDR(s) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseIP4Address(ip.String()) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } else { + ip := net.ParseIP(s) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if ip.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseIP4Address(ip.String()) + if err != nil { + return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } + return prefix, nil +} +func (x IP4Prefix) ToIPNet() *net.IPNet { + mask := net.CIDRMask(int(x.Len), 32) + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x IP4Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *IP4Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP4Prefix) UnmarshalText(text []byte) error { + prefix, err := ParseIP4Prefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// IP6Prefix defines type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) { + hasPrefix := strings.Contains(s, "/") + if hasPrefix { + ip, network, err := net.ParseCIDR(s) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseIP6Address(ip.String()) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } else { + ip := net.ParseIP(s) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if ip.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseIP6Address(ip.String()) + if err != nil { + return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err) + } + } + return prefix, nil +} +func (x IP6Prefix) ToIPNet() *net.IPNet { + mask := net.CIDRMask(int(x.Len), 128) + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x IP6Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *IP6Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *IP6Prefix) UnmarshalText(text []byte) error { + prefix, err := ParseIP6Prefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// IpsecSadEntry defines type 'ipsec_sad_entry'. +type IpsecSadEntry struct { + SadID uint32 `binapi:"u32,name=sad_id" json:"sad_id,omitempty"` + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + CryptoAlgorithm IpsecCryptoAlg `binapi:"ipsec_crypto_alg,name=crypto_algorithm" json:"crypto_algorithm,omitempty"` + CryptoKey Key `binapi:"key,name=crypto_key" json:"crypto_key,omitempty"` + IntegrityAlgorithm IpsecIntegAlg `binapi:"ipsec_integ_alg,name=integrity_algorithm" json:"integrity_algorithm,omitempty"` + IntegrityKey Key `binapi:"key,name=integrity_key" json:"integrity_key,omitempty"` + Flags IpsecSadFlags `binapi:"ipsec_sad_flags,name=flags" json:"flags,omitempty"` + TunnelSrc Address `binapi:"address,name=tunnel_src" json:"tunnel_src,omitempty"` + TunnelDst Address `binapi:"address,name=tunnel_dst" json:"tunnel_dst,omitempty"` + TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` +} + +// IpsecSpdEntry defines type 'ipsec_spd_entry'. +type IpsecSpdEntry struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + Priority int32 `binapi:"i32,name=priority" json:"priority,omitempty"` + IsOutbound uint8 `binapi:"u8,name=is_outbound" json:"is_outbound,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` + Policy IpsecSpdAction `binapi:"ipsec_spd_action,name=policy" json:"policy,omitempty"` + Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"` + RemoteAddressStart Address `binapi:"address,name=remote_address_start" json:"remote_address_start,omitempty"` + RemoteAddressStop Address `binapi:"address,name=remote_address_stop" json:"remote_address_stop,omitempty"` + LocalAddressStart Address `binapi:"address,name=local_address_start" json:"local_address_start,omitempty"` + LocalAddressStop Address `binapi:"address,name=local_address_stop" json:"local_address_stop,omitempty"` + RemotePortStart uint16 `binapi:"u16,name=remote_port_start" json:"remote_port_start,omitempty"` + RemotePortStop uint16 `binapi:"u16,name=remote_port_stop" json:"remote_port_stop,omitempty"` + LocalPortStart uint16 `binapi:"u16,name=local_port_start" json:"local_port_start,omitempty"` + LocalPortStop uint16 `binapi:"u16,name=local_port_stop" json:"local_port_stop,omitempty"` +} + +// IpsecTunnelProtect defines type 'ipsec_tunnel_protect'. +type IpsecTunnelProtect struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SaOut uint32 `binapi:"u32,name=sa_out" json:"sa_out,omitempty"` + NSaIn uint8 `binapi:"u8,name=n_sa_in" json:"-"` + SaIn []uint32 `binapi:"u32[n_sa_in],name=sa_in" json:"sa_in,omitempty"` +} + +// Key defines type 'key'. +type Key struct { + Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` + Data []byte `binapi:"u8[128],name=data" json:"data,omitempty"` +} + +// Mprefix defines type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +// Prefix defines type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func ParsePrefix(ip string) (prefix Prefix, err error) { + hasPrefix := strings.Contains(ip, "/") + if hasPrefix { + netIP, network, err := net.ParseCIDR(ip) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + maskSize, _ := network.Mask.Size() + prefix.Len = byte(maskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + } else { + netIP := net.ParseIP(ip) + defaultMaskSize, _ := net.CIDRMask(32, 32).Size() + if netIP.To4() == nil { + defaultMaskSize, _ = net.CIDRMask(128, 128).Size() + } + prefix.Len = byte(defaultMaskSize) + prefix.Address, err = ParseAddress(netIP.String()) + if err != nil { + return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) + } + } + return prefix, nil +} +func (x Prefix) ToIPNet() *net.IPNet { + var mask net.IPMask + if x.Address.Af == ADDRESS_IP4 { + mask = net.CIDRMask(int(x.Len), 32) + } else { + mask = net.CIDRMask(int(x.Len), 128) + } + ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask} + return ipnet +} +func (x Prefix) String() string { + ip := x.Address.String() + return ip + "/" + strconv.Itoa(int(x.Len)) +} +func (x *Prefix) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *Prefix) UnmarshalText(text []byte) error { + prefix, err := ParsePrefix(string(text)) + if err != nil { + return err + } + *x = prefix + return nil +} + +// PrefixMatcher defines type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +// AddressUnion defines union 'address_union'. +type AddressUnion struct { + // IP4 *IP4Address + // IP6 *IP6Address + XXX_UnionData [16]byte +} + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 4) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(4)) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 16) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + buf := codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(16)) + return +} + +// IpsecBackendDetails defines message 'ipsec_backend_details'. +type IpsecBackendDetails struct { + Name []byte `binapi:"u8[128],name=name" json:"name,omitempty"` + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + Index uint8 `binapi:"u8,name=index" json:"index,omitempty"` + Active uint8 `binapi:"u8,name=active" json:"active,omitempty"` +} + +func (m *IpsecBackendDetails) Reset() { *m = IpsecBackendDetails{} } +func (*IpsecBackendDetails) GetMessageName() string { return "ipsec_backend_details" } +func (*IpsecBackendDetails) GetCrcString() string { return "7700751c" } +func (*IpsecBackendDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecBackendDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 128 // m.Name + size += 4 // m.Protocol + size += 1 // m.Index + size += 1 // m.Active + return size +} +func (m *IpsecBackendDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Name, 128) + buf.EncodeUint32(uint32(m.Protocol)) + buf.EncodeUint8(m.Index) + buf.EncodeUint8(m.Active) + return buf.Bytes(), nil +} +func (m *IpsecBackendDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Name = make([]byte, 128) + copy(m.Name, buf.DecodeBytes(len(m.Name))) + m.Protocol = IpsecProto(buf.DecodeUint32()) + m.Index = buf.DecodeUint8() + m.Active = buf.DecodeUint8() + return nil +} + +// IpsecBackendDump defines message 'ipsec_backend_dump'. +type IpsecBackendDump struct{} + +func (m *IpsecBackendDump) Reset() { *m = IpsecBackendDump{} } +func (*IpsecBackendDump) GetMessageName() string { return "ipsec_backend_dump" } +func (*IpsecBackendDump) GetCrcString() string { return "51077d14" } +func (*IpsecBackendDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecBackendDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *IpsecBackendDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *IpsecBackendDump) Unmarshal(b []byte) error { + return nil +} + +// IpsecInterfaceAddDelSpd defines message 'ipsec_interface_add_del_spd'. +type IpsecInterfaceAddDelSpd struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` +} + +func (m *IpsecInterfaceAddDelSpd) Reset() { *m = IpsecInterfaceAddDelSpd{} } +func (*IpsecInterfaceAddDelSpd) GetMessageName() string { return "ipsec_interface_add_del_spd" } +func (*IpsecInterfaceAddDelSpd) GetCrcString() string { return "1e3b8286" } +func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecInterfaceAddDelSpd) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.SpdID + return size +} +func (m *IpsecInterfaceAddDelSpd) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeUint32(m.SpdID) + return buf.Bytes(), nil +} +func (m *IpsecInterfaceAddDelSpd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.SwIfIndex = buf.DecodeUint32() + m.SpdID = buf.DecodeUint32() + return nil +} + +// IpsecInterfaceAddDelSpdReply defines message 'ipsec_interface_add_del_spd_reply'. +type IpsecInterfaceAddDelSpdReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecInterfaceAddDelSpdReply) Reset() { *m = IpsecInterfaceAddDelSpdReply{} } +func (*IpsecInterfaceAddDelSpdReply) GetMessageName() string { + return "ipsec_interface_add_del_spd_reply" +} +func (*IpsecInterfaceAddDelSpdReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecInterfaceAddDelSpdReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecInterfaceAddDelSpdReply) 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 *IpsecInterfaceAddDelSpdReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecSaDetails defines message 'ipsec_sa_details'. +type IpsecSaDetails struct { + Entry IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` + SeqOutbound uint64 `binapi:"u64,name=seq_outbound" json:"seq_outbound,omitempty"` + LastSeqInbound uint64 `binapi:"u64,name=last_seq_inbound" json:"last_seq_inbound,omitempty"` + ReplayWindow uint64 `binapi:"u64,name=replay_window" json:"replay_window,omitempty"` + TotalDataSize uint64 `binapi:"u64,name=total_data_size" json:"total_data_size,omitempty"` +} + +func (m *IpsecSaDetails) Reset() { *m = IpsecSaDetails{} } +func (*IpsecSaDetails) GetMessageName() string { return "ipsec_sa_details" } +func (*IpsecSaDetails) GetCrcString() string { return "9c8d829a" } +func (*IpsecSaDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSaDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 4 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 4 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + size += 4 // m.SwIfIndex + size += 4 // m.Salt + size += 8 // m.SeqOutbound + size += 8 // m.LastSeqInbound + size += 8 // m.ReplayWindow + size += 8 // m.TotalDataSize + return size +} +func (m *IpsecSaDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint32(uint32(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.Entry.TxTableID) + buf.EncodeUint32(m.Entry.Salt) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeUint32(m.Salt) + buf.EncodeUint64(m.SeqOutbound) + buf.EncodeUint64(m.LastSeqInbound) + buf.EncodeUint64(m.ReplayWindow) + buf.EncodeUint64(m.TotalDataSize) + return buf.Bytes(), nil +} +func (m *IpsecSaDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + m.SwIfIndex = buf.DecodeUint32() + m.Salt = buf.DecodeUint32() + m.SeqOutbound = buf.DecodeUint64() + m.LastSeqInbound = buf.DecodeUint64() + m.ReplayWindow = buf.DecodeUint64() + m.TotalDataSize = buf.DecodeUint64() + return nil +} + +// IpsecSaDump defines message 'ipsec_sa_dump'. +type IpsecSaDump struct { + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSaDump) Reset() { *m = IpsecSaDump{} } +func (*IpsecSaDump) GetMessageName() string { return "ipsec_sa_dump" } +func (*IpsecSaDump) GetCrcString() string { return "2076c2f4" } +func (*IpsecSaDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSaDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SaID + return size +} +func (m *IpsecSaDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SaID) + return buf.Bytes(), nil +} +func (m *IpsecSaDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAddDel defines message 'ipsec_sad_entry_add_del'. +type IpsecSadEntryAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Entry IpsecSadEntry `binapi:"ipsec_sad_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSadEntryAddDel) Reset() { *m = IpsecSadEntryAddDel{} } +func (*IpsecSadEntryAddDel) GetMessageName() string { return "ipsec_sad_entry_add_del" } +func (*IpsecSadEntryAddDel) GetCrcString() string { return "a25ab61e" } +func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSadEntryAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Entry.SadID + size += 4 // m.Entry.Spi + size += 4 // m.Entry.Protocol + size += 4 // m.Entry.CryptoAlgorithm + size += 1 // m.Entry.CryptoKey.Length + size += 1 * 128 // m.Entry.CryptoKey.Data + size += 4 // m.Entry.IntegrityAlgorithm + size += 1 // m.Entry.IntegrityKey.Length + size += 1 * 128 // m.Entry.IntegrityKey.Data + size += 4 // m.Entry.Flags + size += 4 // m.Entry.TunnelSrc.Af + size += 1 * 16 // m.Entry.TunnelSrc.Un + size += 4 // m.Entry.TunnelDst.Af + size += 1 * 16 // m.Entry.TunnelDst.Un + size += 4 // m.Entry.TxTableID + size += 4 // m.Entry.Salt + return size +} +func (m *IpsecSadEntryAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint32(m.Entry.SadID) + buf.EncodeUint32(m.Entry.Spi) + buf.EncodeUint32(uint32(m.Entry.Protocol)) + buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm)) + buf.EncodeUint8(m.Entry.CryptoKey.Length) + buf.EncodeBytes(m.Entry.CryptoKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm)) + buf.EncodeUint8(m.Entry.IntegrityKey.Length) + buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128) + buf.EncodeUint32(uint32(m.Entry.Flags)) + buf.EncodeUint32(uint32(m.Entry.TunnelSrc.Af)) + buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.TunnelDst.Af)) + buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.Entry.TxTableID) + buf.EncodeUint32(m.Entry.Salt) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Entry.SadID = buf.DecodeUint32() + m.Entry.Spi = buf.DecodeUint32() + m.Entry.Protocol = IpsecProto(buf.DecodeUint32()) + m.Entry.CryptoAlgorithm = IpsecCryptoAlg(buf.DecodeUint32()) + m.Entry.CryptoKey.Length = buf.DecodeUint8() + m.Entry.CryptoKey.Data = make([]byte, 128) + copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data))) + m.Entry.IntegrityAlgorithm = IpsecIntegAlg(buf.DecodeUint32()) + m.Entry.IntegrityKey.Length = buf.DecodeUint8() + m.Entry.IntegrityKey.Data = make([]byte, 128) + copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data))) + m.Entry.Flags = IpsecSadFlags(buf.DecodeUint32()) + m.Entry.TunnelSrc.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TunnelDst.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.TunnelDst.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.TxTableID = buf.DecodeUint32() + m.Entry.Salt = buf.DecodeUint32() + return nil +} + +// IpsecSadEntryAddDelReply defines message 'ipsec_sad_entry_add_del_reply'. +type IpsecSadEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSadEntryAddDelReply) Reset() { *m = IpsecSadEntryAddDelReply{} } +func (*IpsecSadEntryAddDelReply) GetMessageName() string { return "ipsec_sad_entry_add_del_reply" } +func (*IpsecSadEntryAddDelReply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSadEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSadEntryAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSadEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSadEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSelectBackend defines message 'ipsec_select_backend'. +type IpsecSelectBackend struct { + Protocol IpsecProto `binapi:"ipsec_proto,name=protocol" json:"protocol,omitempty"` + Index uint8 `binapi:"u8,name=index" json:"index,omitempty"` +} + +func (m *IpsecSelectBackend) Reset() { *m = IpsecSelectBackend{} } +func (*IpsecSelectBackend) GetMessageName() string { return "ipsec_select_backend" } +func (*IpsecSelectBackend) GetCrcString() string { return "4fd24836" } +func (*IpsecSelectBackend) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSelectBackend) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Protocol + size += 1 // m.Index + return size +} +func (m *IpsecSelectBackend) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Protocol)) + buf.EncodeUint8(m.Index) + return buf.Bytes(), nil +} +func (m *IpsecSelectBackend) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Protocol = IpsecProto(buf.DecodeUint32()) + m.Index = buf.DecodeUint8() + return nil +} + +// IpsecSelectBackendReply defines message 'ipsec_select_backend_reply'. +type IpsecSelectBackendReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSelectBackendReply) Reset() { *m = IpsecSelectBackendReply{} } +func (*IpsecSelectBackendReply) GetMessageName() string { return "ipsec_select_backend_reply" } +func (*IpsecSelectBackendReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSelectBackendReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSelectBackendReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecSelectBackendReply) 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 *IpsecSelectBackendReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecSpdAddDel defines message 'ipsec_spd_add_del'. +type IpsecSpdAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` +} + +func (m *IpsecSpdAddDel) Reset() { *m = IpsecSpdAddDel{} } +func (*IpsecSpdAddDel) GetMessageName() string { return "ipsec_spd_add_del" } +func (*IpsecSpdAddDel) GetCrcString() string { return "9ffdf5da" } +func (*IpsecSpdAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.SpdID + return size +} +func (m *IpsecSpdAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint32(m.SpdID) + return buf.Bytes(), nil +} +func (m *IpsecSpdAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.SpdID = buf.DecodeUint32() + return nil +} + +// IpsecSpdAddDelReply defines message 'ipsec_spd_add_del_reply'. +type IpsecSpdAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecSpdAddDelReply) Reset() { *m = IpsecSpdAddDelReply{} } +func (*IpsecSpdAddDelReply) GetMessageName() string { return "ipsec_spd_add_del_reply" } +func (*IpsecSpdAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecSpdAddDelReply) 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 *IpsecSpdAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecSpdDetails defines message 'ipsec_spd_details'. +type IpsecSpdDetails struct { + Entry IpsecSpdEntry `binapi:"ipsec_spd_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSpdDetails) Reset() { *m = IpsecSpdDetails{} } +func (*IpsecSpdDetails) GetMessageName() string { return "ipsec_spd_details" } +func (*IpsecSpdDetails) GetCrcString() string { return "021e2c20" } +func (*IpsecSpdDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Entry.SpdID + size += 4 // m.Entry.Priority + size += 1 // m.Entry.IsOutbound + size += 4 // m.Entry.SaID + size += 4 // m.Entry.Policy + size += 1 // m.Entry.Protocol + size += 4 // m.Entry.RemoteAddressStart.Af + size += 1 * 16 // m.Entry.RemoteAddressStart.Un + size += 4 // m.Entry.RemoteAddressStop.Af + size += 1 * 16 // m.Entry.RemoteAddressStop.Un + size += 4 // m.Entry.LocalAddressStart.Af + size += 1 * 16 // m.Entry.LocalAddressStart.Un + size += 4 // m.Entry.LocalAddressStop.Af + size += 1 * 16 // m.Entry.LocalAddressStop.Un + size += 2 // m.Entry.RemotePortStart + size += 2 // m.Entry.RemotePortStop + size += 2 // m.Entry.LocalPortStart + size += 2 // m.Entry.LocalPortStop + return size +} +func (m *IpsecSpdDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.Entry.SpdID) + buf.EncodeInt32(m.Entry.Priority) + buf.EncodeUint8(m.Entry.IsOutbound) + buf.EncodeUint32(m.Entry.SaID) + buf.EncodeUint32(uint32(m.Entry.Policy)) + buf.EncodeUint8(m.Entry.Protocol) + buf.EncodeUint32(uint32(m.Entry.RemoteAddressStart.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.RemoteAddressStop.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.LocalAddressStart.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.LocalAddressStop.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.Entry.RemotePortStart) + buf.EncodeUint16(m.Entry.RemotePortStop) + buf.EncodeUint16(m.Entry.LocalPortStart) + buf.EncodeUint16(m.Entry.LocalPortStop) + return buf.Bytes(), nil +} +func (m *IpsecSpdDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Entry.SpdID = buf.DecodeUint32() + m.Entry.Priority = buf.DecodeInt32() + m.Entry.IsOutbound = buf.DecodeUint8() + m.Entry.SaID = buf.DecodeUint32() + m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32()) + m.Entry.Protocol = buf.DecodeUint8() + m.Entry.RemoteAddressStart.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemoteAddressStop.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStart.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStop.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemotePortStart = buf.DecodeUint16() + m.Entry.RemotePortStop = buf.DecodeUint16() + m.Entry.LocalPortStart = buf.DecodeUint16() + m.Entry.LocalPortStop = buf.DecodeUint16() + return nil +} + +// IpsecSpdDump defines message 'ipsec_spd_dump'. +type IpsecSpdDump struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` +} + +func (m *IpsecSpdDump) Reset() { *m = IpsecSpdDump{} } +func (*IpsecSpdDump) GetMessageName() string { return "ipsec_spd_dump" } +func (*IpsecSpdDump) GetCrcString() string { return "afefbf7d" } +func (*IpsecSpdDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SpdID + size += 4 // m.SaID + return size +} +func (m *IpsecSpdDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SpdID) + buf.EncodeUint32(m.SaID) + return buf.Bytes(), nil +} +func (m *IpsecSpdDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdID = buf.DecodeUint32() + m.SaID = buf.DecodeUint32() + return nil +} + +// IpsecSpdEntryAddDel defines message 'ipsec_spd_entry_add_del'. +type IpsecSpdEntryAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Entry IpsecSpdEntry `binapi:"ipsec_spd_entry,name=entry" json:"entry,omitempty"` +} + +func (m *IpsecSpdEntryAddDel) Reset() { *m = IpsecSpdEntryAddDel{} } +func (*IpsecSpdEntryAddDel) GetMessageName() string { return "ipsec_spd_entry_add_del" } +func (*IpsecSpdEntryAddDel) GetCrcString() string { return "db217840" } +func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdEntryAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 4 // m.Entry.SpdID + size += 4 // m.Entry.Priority + size += 1 // m.Entry.IsOutbound + size += 4 // m.Entry.SaID + size += 4 // m.Entry.Policy + size += 1 // m.Entry.Protocol + size += 4 // m.Entry.RemoteAddressStart.Af + size += 1 * 16 // m.Entry.RemoteAddressStart.Un + size += 4 // m.Entry.RemoteAddressStop.Af + size += 1 * 16 // m.Entry.RemoteAddressStop.Un + size += 4 // m.Entry.LocalAddressStart.Af + size += 1 * 16 // m.Entry.LocalAddressStart.Un + size += 4 // m.Entry.LocalAddressStop.Af + size += 1 * 16 // m.Entry.LocalAddressStop.Un + size += 2 // m.Entry.RemotePortStart + size += 2 // m.Entry.RemotePortStop + size += 2 // m.Entry.LocalPortStart + size += 2 // m.Entry.LocalPortStop + return size +} +func (m *IpsecSpdEntryAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint32(m.Entry.SpdID) + buf.EncodeInt32(m.Entry.Priority) + buf.EncodeUint8(m.Entry.IsOutbound) + buf.EncodeUint32(m.Entry.SaID) + buf.EncodeUint32(uint32(m.Entry.Policy)) + buf.EncodeUint8(m.Entry.Protocol) + buf.EncodeUint32(uint32(m.Entry.RemoteAddressStart.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.RemoteAddressStop.Af)) + buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.LocalAddressStart.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.Entry.LocalAddressStop.Af)) + buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 16) + buf.EncodeUint16(m.Entry.RemotePortStart) + buf.EncodeUint16(m.Entry.RemotePortStop) + buf.EncodeUint16(m.Entry.LocalPortStart) + buf.EncodeUint16(m.Entry.LocalPortStop) + return buf.Bytes(), nil +} +func (m *IpsecSpdEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Entry.SpdID = buf.DecodeUint32() + m.Entry.Priority = buf.DecodeInt32() + m.Entry.IsOutbound = buf.DecodeUint8() + m.Entry.SaID = buf.DecodeUint32() + m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32()) + m.Entry.Protocol = buf.DecodeUint8() + m.Entry.RemoteAddressStart.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemoteAddressStop.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStart.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.LocalAddressStop.Af = AddressFamily(buf.DecodeUint32()) + copy(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Entry.RemotePortStart = buf.DecodeUint16() + m.Entry.RemotePortStop = buf.DecodeUint16() + m.Entry.LocalPortStart = buf.DecodeUint16() + m.Entry.LocalPortStop = buf.DecodeUint16() + return nil +} + +// IpsecSpdEntryAddDelReply defines message 'ipsec_spd_entry_add_del_reply'. +type IpsecSpdEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatIndex uint32 `binapi:"u32,name=stat_index" json:"stat_index,omitempty"` +} + +func (m *IpsecSpdEntryAddDelReply) Reset() { *m = IpsecSpdEntryAddDelReply{} } +func (*IpsecSpdEntryAddDelReply) GetMessageName() string { return "ipsec_spd_entry_add_del_reply" } +func (*IpsecSpdEntryAddDelReply) GetCrcString() string { return "9ffac24b" } +func (*IpsecSpdEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdEntryAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.StatIndex + return size +} +func (m *IpsecSpdEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.StatIndex) + return buf.Bytes(), nil +} +func (m *IpsecSpdEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.StatIndex = buf.DecodeUint32() + return nil +} + +// IpsecSpdInterfaceDetails defines message 'ipsec_spd_interface_details'. +type IpsecSpdInterfaceDetails struct { + SpdIndex uint32 `binapi:"u32,name=spd_index" json:"spd_index,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecSpdInterfaceDetails) Reset() { *m = IpsecSpdInterfaceDetails{} } +func (*IpsecSpdInterfaceDetails) GetMessageName() string { return "ipsec_spd_interface_details" } +func (*IpsecSpdInterfaceDetails) GetCrcString() string { return "2c54296d" } +func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdInterfaceDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SpdIndex + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecSpdInterfaceDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SpdIndex) + buf.EncodeUint32(m.SwIfIndex) + return buf.Bytes(), nil +} +func (m *IpsecSpdInterfaceDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdIndex = buf.DecodeUint32() + m.SwIfIndex = buf.DecodeUint32() + return nil +} + +// IpsecSpdInterfaceDump defines message 'ipsec_spd_interface_dump'. +type IpsecSpdInterfaceDump struct { + SpdIndex uint32 `binapi:"u32,name=spd_index" json:"spd_index,omitempty"` + SpdIndexValid uint8 `binapi:"u8,name=spd_index_valid" json:"spd_index_valid,omitempty"` +} + +func (m *IpsecSpdInterfaceDump) Reset() { *m = IpsecSpdInterfaceDump{} } +func (*IpsecSpdInterfaceDump) GetMessageName() string { return "ipsec_spd_interface_dump" } +func (*IpsecSpdInterfaceDump) GetCrcString() string { return "8971de19" } +func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdInterfaceDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SpdIndex + size += 1 // m.SpdIndexValid + return size +} +func (m *IpsecSpdInterfaceDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SpdIndex) + buf.EncodeUint8(m.SpdIndexValid) + return buf.Bytes(), nil +} +func (m *IpsecSpdInterfaceDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdIndex = buf.DecodeUint32() + m.SpdIndexValid = buf.DecodeUint8() + return nil +} + +// IpsecSpdsDetails defines message 'ipsec_spds_details'. +type IpsecSpdsDetails struct { + SpdID uint32 `binapi:"u32,name=spd_id" json:"spd_id,omitempty"` + Npolicies uint32 `binapi:"u32,name=npolicies" json:"npolicies,omitempty"` +} + +func (m *IpsecSpdsDetails) Reset() { *m = IpsecSpdsDetails{} } +func (*IpsecSpdsDetails) GetMessageName() string { return "ipsec_spds_details" } +func (*IpsecSpdsDetails) GetCrcString() string { return "a04bb254" } +func (*IpsecSpdsDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecSpdsDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SpdID + size += 4 // m.Npolicies + return size +} +func (m *IpsecSpdsDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SpdID) + buf.EncodeUint32(m.Npolicies) + return buf.Bytes(), nil +} +func (m *IpsecSpdsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SpdID = buf.DecodeUint32() + m.Npolicies = buf.DecodeUint32() + return nil +} + +// IpsecSpdsDump defines message 'ipsec_spds_dump'. +type IpsecSpdsDump struct{} + +func (m *IpsecSpdsDump) Reset() { *m = IpsecSpdsDump{} } +func (*IpsecSpdsDump) GetMessageName() string { return "ipsec_spds_dump" } +func (*IpsecSpdsDump) GetCrcString() string { return "51077d14" } +func (*IpsecSpdsDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecSpdsDump) Size() (size int) { + if m == nil { + return 0 + } + return size +} +func (m *IpsecSpdsDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + return buf.Bytes(), nil +} +func (m *IpsecSpdsDump) Unmarshal(b []byte) error { + return nil +} + +// IpsecTunnelIfAddDel defines message 'ipsec_tunnel_if_add_del'. +type IpsecTunnelIfAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + Esn uint8 `binapi:"u8,name=esn" json:"esn,omitempty"` + AntiReplay uint8 `binapi:"u8,name=anti_replay" json:"anti_replay,omitempty"` + LocalIP Address `binapi:"address,name=local_ip" json:"local_ip,omitempty"` + RemoteIP Address `binapi:"address,name=remote_ip" json:"remote_ip,omitempty"` + LocalSpi uint32 `binapi:"u32,name=local_spi" json:"local_spi,omitempty"` + RemoteSpi uint32 `binapi:"u32,name=remote_spi" json:"remote_spi,omitempty"` + CryptoAlg uint8 `binapi:"u8,name=crypto_alg" json:"crypto_alg,omitempty"` + LocalCryptoKeyLen uint8 `binapi:"u8,name=local_crypto_key_len" json:"local_crypto_key_len,omitempty"` + LocalCryptoKey []byte `binapi:"u8[128],name=local_crypto_key" json:"local_crypto_key,omitempty"` + RemoteCryptoKeyLen uint8 `binapi:"u8,name=remote_crypto_key_len" json:"remote_crypto_key_len,omitempty"` + RemoteCryptoKey []byte `binapi:"u8[128],name=remote_crypto_key" json:"remote_crypto_key,omitempty"` + IntegAlg uint8 `binapi:"u8,name=integ_alg" json:"integ_alg,omitempty"` + LocalIntegKeyLen uint8 `binapi:"u8,name=local_integ_key_len" json:"local_integ_key_len,omitempty"` + LocalIntegKey []byte `binapi:"u8[128],name=local_integ_key" json:"local_integ_key,omitempty"` + RemoteIntegKeyLen uint8 `binapi:"u8,name=remote_integ_key_len" json:"remote_integ_key_len,omitempty"` + RemoteIntegKey []byte `binapi:"u8[128],name=remote_integ_key" json:"remote_integ_key,omitempty"` + Renumber uint8 `binapi:"u8,name=renumber" json:"renumber,omitempty"` + ShowInstance uint32 `binapi:"u32,name=show_instance" json:"show_instance,omitempty"` + UDPEncap uint8 `binapi:"u8,name=udp_encap" json:"udp_encap,omitempty"` + TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"` + Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"` +} + +func (m *IpsecTunnelIfAddDel) Reset() { *m = IpsecTunnelIfAddDel{} } +func (*IpsecTunnelIfAddDel) GetMessageName() string { return "ipsec_tunnel_if_add_del" } +func (*IpsecTunnelIfAddDel) GetCrcString() string { return "d5a98274" } +func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelIfAddDel) Size() (size int) { + if m == nil { + return 0 + } + size += 1 // m.IsAdd + size += 1 // m.Esn + size += 1 // m.AntiReplay + size += 4 // m.LocalIP.Af + size += 1 * 16 // m.LocalIP.Un + size += 4 // m.RemoteIP.Af + size += 1 * 16 // m.RemoteIP.Un + size += 4 // m.LocalSpi + size += 4 // m.RemoteSpi + size += 1 // m.CryptoAlg + size += 1 // m.LocalCryptoKeyLen + size += 1 * 128 // m.LocalCryptoKey + size += 1 // m.RemoteCryptoKeyLen + size += 1 * 128 // m.RemoteCryptoKey + size += 1 // m.IntegAlg + size += 1 // m.LocalIntegKeyLen + size += 1 * 128 // m.LocalIntegKey + size += 1 // m.RemoteIntegKeyLen + size += 1 * 128 // m.RemoteIntegKey + size += 1 // m.Renumber + size += 4 // m.ShowInstance + size += 1 // m.UDPEncap + size += 4 // m.TxTableID + size += 4 // m.Salt + return size +} +func (m *IpsecTunnelIfAddDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsAdd) + buf.EncodeUint8(m.Esn) + buf.EncodeUint8(m.AntiReplay) + buf.EncodeUint32(uint32(m.LocalIP.Af)) + buf.EncodeBytes(m.LocalIP.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(uint32(m.RemoteIP.Af)) + buf.EncodeBytes(m.RemoteIP.Un.XXX_UnionData[:], 16) + buf.EncodeUint32(m.LocalSpi) + buf.EncodeUint32(m.RemoteSpi) + buf.EncodeUint8(m.CryptoAlg) + buf.EncodeUint8(m.LocalCryptoKeyLen) + buf.EncodeBytes(m.LocalCryptoKey, 128) + buf.EncodeUint8(m.RemoteCryptoKeyLen) + buf.EncodeBytes(m.RemoteCryptoKey, 128) + buf.EncodeUint8(m.IntegAlg) + buf.EncodeUint8(m.LocalIntegKeyLen) + buf.EncodeBytes(m.LocalIntegKey, 128) + buf.EncodeUint8(m.RemoteIntegKeyLen) + buf.EncodeBytes(m.RemoteIntegKey, 128) + buf.EncodeUint8(m.Renumber) + buf.EncodeUint32(m.ShowInstance) + buf.EncodeUint8(m.UDPEncap) + buf.EncodeUint32(m.TxTableID) + buf.EncodeUint32(m.Salt) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeUint8() + m.Esn = buf.DecodeUint8() + m.AntiReplay = buf.DecodeUint8() + m.LocalIP.Af = AddressFamily(buf.DecodeUint32()) + copy(m.LocalIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.RemoteIP.Af = AddressFamily(buf.DecodeUint32()) + copy(m.RemoteIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.LocalSpi = buf.DecodeUint32() + m.RemoteSpi = buf.DecodeUint32() + m.CryptoAlg = buf.DecodeUint8() + m.LocalCryptoKeyLen = buf.DecodeUint8() + m.LocalCryptoKey = make([]byte, 128) + copy(m.LocalCryptoKey, buf.DecodeBytes(len(m.LocalCryptoKey))) + m.RemoteCryptoKeyLen = buf.DecodeUint8() + m.RemoteCryptoKey = make([]byte, 128) + copy(m.RemoteCryptoKey, buf.DecodeBytes(len(m.RemoteCryptoKey))) + m.IntegAlg = buf.DecodeUint8() + m.LocalIntegKeyLen = buf.DecodeUint8() + m.LocalIntegKey = make([]byte, 128) + copy(m.LocalIntegKey, buf.DecodeBytes(len(m.LocalIntegKey))) + m.RemoteIntegKeyLen = buf.DecodeUint8() + m.RemoteIntegKey = make([]byte, 128) + copy(m.RemoteIntegKey, buf.DecodeBytes(len(m.RemoteIntegKey))) + m.Renumber = buf.DecodeUint8() + m.ShowInstance = buf.DecodeUint32() + m.UDPEncap = buf.DecodeUint8() + m.TxTableID = buf.DecodeUint32() + m.Salt = buf.DecodeUint32() + return nil +} + +// IpsecTunnelIfAddDelReply defines message 'ipsec_tunnel_if_add_del_reply'. +type IpsecTunnelIfAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecTunnelIfAddDelReply) Reset() { *m = IpsecTunnelIfAddDelReply{} } +func (*IpsecTunnelIfAddDelReply) GetMessageName() string { return "ipsec_tunnel_if_add_del_reply" } +func (*IpsecTunnelIfAddDelReply) GetCrcString() string { return "fda5941f" } +func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelIfAddDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecTunnelIfAddDelReply) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + buf.EncodeUint32(m.SwIfIndex) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = buf.DecodeUint32() + return nil +} + +// IpsecTunnelIfSetSa defines message 'ipsec_tunnel_if_set_sa'. +type IpsecTunnelIfSetSa struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SaID uint32 `binapi:"u32,name=sa_id" json:"sa_id,omitempty"` + IsOutbound uint8 `binapi:"u8,name=is_outbound" json:"is_outbound,omitempty"` +} + +func (m *IpsecTunnelIfSetSa) Reset() { *m = IpsecTunnelIfSetSa{} } +func (*IpsecTunnelIfSetSa) GetMessageName() string { return "ipsec_tunnel_if_set_sa" } +func (*IpsecTunnelIfSetSa) GetCrcString() string { return "6ab567f2" } +func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelIfSetSa) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + size += 4 // m.SaID + size += 1 // m.IsOutbound + return size +} +func (m *IpsecTunnelIfSetSa) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeUint32(m.SaID) + buf.EncodeUint8(m.IsOutbound) + return buf.Bytes(), nil +} +func (m *IpsecTunnelIfSetSa) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + m.SaID = buf.DecodeUint32() + m.IsOutbound = buf.DecodeUint8() + return nil +} + +// IpsecTunnelIfSetSaReply defines message 'ipsec_tunnel_if_set_sa_reply'. +type IpsecTunnelIfSetSaReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelIfSetSaReply) Reset() { *m = IpsecTunnelIfSetSaReply{} } +func (*IpsecTunnelIfSetSaReply) GetMessageName() string { return "ipsec_tunnel_if_set_sa_reply" } +func (*IpsecTunnelIfSetSaReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelIfSetSaReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelIfSetSaReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelIfSetSaReply) 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 *IpsecTunnelIfSetSaReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecTunnelProtectDel defines message 'ipsec_tunnel_protect_del'. +type IpsecTunnelProtectDel struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecTunnelProtectDel) Reset() { *m = IpsecTunnelProtectDel{} } +func (*IpsecTunnelProtectDel) GetMessageName() string { return "ipsec_tunnel_protect_del" } +func (*IpsecTunnelProtectDel) GetCrcString() string { return "f9e6675e" } +func (*IpsecTunnelProtectDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectDel) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecTunnelProtectDel) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelProtectDelReply defines message 'ipsec_tunnel_protect_del_reply'. +type IpsecTunnelProtectDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelProtectDelReply) Reset() { *m = IpsecTunnelProtectDelReply{} } +func (*IpsecTunnelProtectDelReply) GetMessageName() string { return "ipsec_tunnel_protect_del_reply" } +func (*IpsecTunnelProtectDelReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelProtectDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectDelReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelProtectDelReply) 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 *IpsecTunnelProtectDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +// IpsecTunnelProtectDetails defines message 'ipsec_tunnel_protect_details'. +type IpsecTunnelProtectDetails struct { + Tun IpsecTunnelProtect `binapi:"ipsec_tunnel_protect,name=tun" json:"tun,omitempty"` +} + +func (m *IpsecTunnelProtectDetails) Reset() { *m = IpsecTunnelProtectDetails{} } +func (*IpsecTunnelProtectDetails) GetMessageName() string { return "ipsec_tunnel_protect_details" } +func (*IpsecTunnelProtectDetails) GetCrcString() string { return "7520eefe" } +func (*IpsecTunnelProtectDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectDetails) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Tun.SwIfIndex + size += 4 // m.Tun.SaOut + size += 1 // m.Tun.NSaIn + size += 4 * len(m.Tun.SaIn) // m.Tun.SaIn + return size +} +func (m *IpsecTunnelProtectDetails) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Tun.SwIfIndex)) + buf.EncodeUint32(m.Tun.SaOut) + buf.EncodeUint8(uint8(len(m.Tun.SaIn))) + for i := 0; i < len(m.Tun.SaIn); i++ { + var x uint32 + if i < len(m.Tun.SaIn) { + x = uint32(m.Tun.SaIn[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tun.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Tun.SaOut = buf.DecodeUint32() + m.Tun.NSaIn = buf.DecodeUint8() + m.Tun.SaIn = make([]uint32, m.Tun.NSaIn) + for i := 0; i < len(m.Tun.SaIn); i++ { + m.Tun.SaIn[i] = buf.DecodeUint32() + } + return nil +} + +// IpsecTunnelProtectDump defines message 'ipsec_tunnel_protect_dump'. +type IpsecTunnelProtectDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IpsecTunnelProtectDump) Reset() { *m = IpsecTunnelProtectDump{} } +func (*IpsecTunnelProtectDump) GetMessageName() string { return "ipsec_tunnel_protect_dump" } +func (*IpsecTunnelProtectDump) GetCrcString() string { return "f9e6675e" } +func (*IpsecTunnelProtectDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectDump) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.SwIfIndex + return size +} +func (m *IpsecTunnelProtectDump) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// IpsecTunnelProtectUpdate defines message 'ipsec_tunnel_protect_update'. +type IpsecTunnelProtectUpdate struct { + Tunnel IpsecTunnelProtect `binapi:"ipsec_tunnel_protect,name=tunnel" json:"tunnel,omitempty"` +} + +func (m *IpsecTunnelProtectUpdate) Reset() { *m = IpsecTunnelProtectUpdate{} } +func (*IpsecTunnelProtectUpdate) GetMessageName() string { return "ipsec_tunnel_protect_update" } +func (*IpsecTunnelProtectUpdate) GetCrcString() string { return "eccbc177" } +func (*IpsecTunnelProtectUpdate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IpsecTunnelProtectUpdate) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Tunnel.SwIfIndex + size += 4 // m.Tunnel.SaOut + size += 1 // m.Tunnel.NSaIn + size += 4 * len(m.Tunnel.SaIn) // m.Tunnel.SaIn + return size +} +func (m *IpsecTunnelProtectUpdate) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex)) + buf.EncodeUint32(m.Tunnel.SaOut) + buf.EncodeUint8(uint8(len(m.Tunnel.SaIn))) + for i := 0; i < len(m.Tunnel.SaIn); i++ { + var x uint32 + if i < len(m.Tunnel.SaIn) { + x = uint32(m.Tunnel.SaIn[i]) + } + buf.EncodeUint32(x) + } + return buf.Bytes(), nil +} +func (m *IpsecTunnelProtectUpdate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tunnel.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + m.Tunnel.SaOut = buf.DecodeUint32() + m.Tunnel.NSaIn = buf.DecodeUint8() + m.Tunnel.SaIn = make([]uint32, m.Tunnel.NSaIn) + for i := 0; i < len(m.Tunnel.SaIn); i++ { + m.Tunnel.SaIn[i] = buf.DecodeUint32() + } + return nil +} + +// IpsecTunnelProtectUpdateReply defines message 'ipsec_tunnel_protect_update_reply'. +type IpsecTunnelProtectUpdateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IpsecTunnelProtectUpdateReply) Reset() { *m = IpsecTunnelProtectUpdateReply{} } +func (*IpsecTunnelProtectUpdateReply) GetMessageName() string { + return "ipsec_tunnel_protect_update_reply" +} +func (*IpsecTunnelProtectUpdateReply) GetCrcString() string { return "e8d4e804" } +func (*IpsecTunnelProtectUpdateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IpsecTunnelProtectUpdateReply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + return size +} +func (m *IpsecTunnelProtectUpdateReply) 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 *IpsecTunnelProtectUpdateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + return nil +} + +func init() { file_ipsec_binapi_init() } +func file_ipsec_binapi_init() { + api.RegisterMessage((*IpsecBackendDetails)(nil), "ipsec_backend_details_7700751c") + api.RegisterMessage((*IpsecBackendDump)(nil), "ipsec_backend_dump_51077d14") + api.RegisterMessage((*IpsecInterfaceAddDelSpd)(nil), "ipsec_interface_add_del_spd_1e3b8286") + api.RegisterMessage((*IpsecInterfaceAddDelSpdReply)(nil), "ipsec_interface_add_del_spd_reply_e8d4e804") + api.RegisterMessage((*IpsecSaDetails)(nil), "ipsec_sa_details_9c8d829a") + api.RegisterMessage((*IpsecSaDump)(nil), "ipsec_sa_dump_2076c2f4") + api.RegisterMessage((*IpsecSadEntryAddDel)(nil), "ipsec_sad_entry_add_del_a25ab61e") + api.RegisterMessage((*IpsecSadEntryAddDelReply)(nil), "ipsec_sad_entry_add_del_reply_9ffac24b") + api.RegisterMessage((*IpsecSelectBackend)(nil), "ipsec_select_backend_4fd24836") + api.RegisterMessage((*IpsecSelectBackendReply)(nil), "ipsec_select_backend_reply_e8d4e804") + api.RegisterMessage((*IpsecSpdAddDel)(nil), "ipsec_spd_add_del_9ffdf5da") + api.RegisterMessage((*IpsecSpdAddDelReply)(nil), "ipsec_spd_add_del_reply_e8d4e804") + api.RegisterMessage((*IpsecSpdDetails)(nil), "ipsec_spd_details_021e2c20") + api.RegisterMessage((*IpsecSpdDump)(nil), "ipsec_spd_dump_afefbf7d") + api.RegisterMessage((*IpsecSpdEntryAddDel)(nil), "ipsec_spd_entry_add_del_db217840") + api.RegisterMessage((*IpsecSpdEntryAddDelReply)(nil), "ipsec_spd_entry_add_del_reply_9ffac24b") + api.RegisterMessage((*IpsecSpdInterfaceDetails)(nil), "ipsec_spd_interface_details_2c54296d") + api.RegisterMessage((*IpsecSpdInterfaceDump)(nil), "ipsec_spd_interface_dump_8971de19") + api.RegisterMessage((*IpsecSpdsDetails)(nil), "ipsec_spds_details_a04bb254") + api.RegisterMessage((*IpsecSpdsDump)(nil), "ipsec_spds_dump_51077d14") + api.RegisterMessage((*IpsecTunnelIfAddDel)(nil), "ipsec_tunnel_if_add_del_d5a98274") + api.RegisterMessage((*IpsecTunnelIfAddDelReply)(nil), "ipsec_tunnel_if_add_del_reply_fda5941f") + api.RegisterMessage((*IpsecTunnelIfSetSa)(nil), "ipsec_tunnel_if_set_sa_6ab567f2") + api.RegisterMessage((*IpsecTunnelIfSetSaReply)(nil), "ipsec_tunnel_if_set_sa_reply_e8d4e804") + api.RegisterMessage((*IpsecTunnelProtectDel)(nil), "ipsec_tunnel_protect_del_f9e6675e") + api.RegisterMessage((*IpsecTunnelProtectDelReply)(nil), "ipsec_tunnel_protect_del_reply_e8d4e804") + api.RegisterMessage((*IpsecTunnelProtectDetails)(nil), "ipsec_tunnel_protect_details_7520eefe") + api.RegisterMessage((*IpsecTunnelProtectDump)(nil), "ipsec_tunnel_protect_dump_f9e6675e") + api.RegisterMessage((*IpsecTunnelProtectUpdate)(nil), "ipsec_tunnel_protect_update_eccbc177") + api.RegisterMessage((*IpsecTunnelProtectUpdateReply)(nil), "ipsec_tunnel_protect_update_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IpsecBackendDetails)(nil), + (*IpsecBackendDump)(nil), + (*IpsecInterfaceAddDelSpd)(nil), + (*IpsecInterfaceAddDelSpdReply)(nil), + (*IpsecSaDetails)(nil), + (*IpsecSaDump)(nil), + (*IpsecSadEntryAddDel)(nil), + (*IpsecSadEntryAddDelReply)(nil), + (*IpsecSelectBackend)(nil), + (*IpsecSelectBackendReply)(nil), + (*IpsecSpdAddDel)(nil), + (*IpsecSpdAddDelReply)(nil), + (*IpsecSpdDetails)(nil), + (*IpsecSpdDump)(nil), + (*IpsecSpdEntryAddDel)(nil), + (*IpsecSpdEntryAddDelReply)(nil), + (*IpsecSpdInterfaceDetails)(nil), + (*IpsecSpdInterfaceDump)(nil), + (*IpsecSpdsDetails)(nil), + (*IpsecSpdsDump)(nil), + (*IpsecTunnelIfAddDel)(nil), + (*IpsecTunnelIfAddDelReply)(nil), + (*IpsecTunnelIfSetSa)(nil), + (*IpsecTunnelIfSetSaReply)(nil), + (*IpsecTunnelProtectDel)(nil), + (*IpsecTunnelProtectDelReply)(nil), + (*IpsecTunnelProtectDetails)(nil), + (*IpsecTunnelProtectDump)(nil), + (*IpsecTunnelProtectUpdate)(nil), + (*IpsecTunnelProtectUpdateReply)(nil), + } +} diff --git a/internal/testbinapi/binapi2001/ipsec/ipsec_rpc.ba.go b/internal/testbinapi/binapi2001/ipsec/ipsec_rpc.ba.go new file mode 100644 index 0000000..c14df44 --- /dev/null +++ b/internal/testbinapi/binapi2001/ipsec/ipsec_rpc.ba.go @@ -0,0 +1,353 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ipsec + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" + "io" +) + +// RPCService defines RPC service ipsec. +type RPCService interface { + IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) + IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) + IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) + IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) + IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) + IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) + IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) + IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) + IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) + IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (RPCService_IpsecSpdsDumpClient, error) + IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) + IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) + IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) + IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) + IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) IpsecBackendDump(ctx context.Context, in *IpsecBackendDump) (RPCService_IpsecBackendDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecBackendDumpClient{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_IpsecBackendDumpClient interface { + Recv() (*IpsecBackendDetails, error) + api.Stream +} + +type serviceClient_IpsecBackendDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecBackendDumpClient) Recv() (*IpsecBackendDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecBackendDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecInterfaceAddDelSpd(ctx context.Context, in *IpsecInterfaceAddDelSpd) (*IpsecInterfaceAddDelSpdReply, error) { + out := new(IpsecInterfaceAddDelSpdReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSaDump(ctx context.Context, in *IpsecSaDump) (RPCService_IpsecSaDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSaDumpClient{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_IpsecSaDumpClient interface { + Recv() (*IpsecSaDetails, error) + api.Stream +} + +type serviceClient_IpsecSaDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSaDumpClient) Recv() (*IpsecSaDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSaDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSadEntryAddDel(ctx context.Context, in *IpsecSadEntryAddDel) (*IpsecSadEntryAddDelReply, error) { + out := new(IpsecSadEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSelectBackend(ctx context.Context, in *IpsecSelectBackend) (*IpsecSelectBackendReply, error) { + out := new(IpsecSelectBackendReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdAddDel(ctx context.Context, in *IpsecSpdAddDel) (*IpsecSpdAddDelReply, error) { + out := new(IpsecSpdAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdDump(ctx context.Context, in *IpsecSpdDump) (RPCService_IpsecSpdDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdDumpClient{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_IpsecSpdDumpClient interface { + Recv() (*IpsecSpdDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdDumpClient) Recv() (*IpsecSpdDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSpdEntryAddDel(ctx context.Context, in *IpsecSpdEntryAddDel) (*IpsecSpdEntryAddDelReply, error) { + out := new(IpsecSpdEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecSpdInterfaceDump(ctx context.Context, in *IpsecSpdInterfaceDump) (RPCService_IpsecSpdInterfaceDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdInterfaceDumpClient{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_IpsecSpdInterfaceDumpClient interface { + Recv() (*IpsecSpdInterfaceDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdInterfaceDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdInterfaceDumpClient) Recv() (*IpsecSpdInterfaceDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdInterfaceDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecSpdsDump(ctx context.Context, in *IpsecSpdsDump) (RPCService_IpsecSpdsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecSpdsDumpClient{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_IpsecSpdsDumpClient interface { + Recv() (*IpsecSpdsDetails, error) + api.Stream +} + +type serviceClient_IpsecSpdsDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecSpdsDumpClient) Recv() (*IpsecSpdsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecSpdsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecTunnelIfAddDel(ctx context.Context, in *IpsecTunnelIfAddDel) (*IpsecTunnelIfAddDelReply, error) { + out := new(IpsecTunnelIfAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelIfSetSa(ctx context.Context, in *IpsecTunnelIfSetSa) (*IpsecTunnelIfSetSaReply, error) { + out := new(IpsecTunnelIfSetSaReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectDel(ctx context.Context, in *IpsecTunnelProtectDel) (*IpsecTunnelProtectDelReply, error) { + out := new(IpsecTunnelProtectDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IpsecTunnelProtectDump(ctx context.Context, in *IpsecTunnelProtectDump) (RPCService_IpsecTunnelProtectDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_IpsecTunnelProtectDumpClient{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_IpsecTunnelProtectDumpClient interface { + Recv() (*IpsecTunnelProtectDetails, error) + api.Stream +} + +type serviceClient_IpsecTunnelProtectDumpClient struct { + api.Stream +} + +func (c *serviceClient_IpsecTunnelProtectDumpClient) Recv() (*IpsecTunnelProtectDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *IpsecTunnelProtectDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) IpsecTunnelProtectUpdate(ctx context.Context, in *IpsecTunnelProtectUpdate) (*IpsecTunnelProtectUpdateReply, error) { + out := new(IpsecTunnelProtectUpdateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} |