1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: .vppapi/plugins/lb.api.json
7 // Package lb contains generated bindings for API file lb.api.
20 api "git.fd.io/govpp.git/api"
21 codec "git.fd.io/govpp.git/codec"
27 // This is a compile-time assertion to ensure that this generated file
28 // is compatible with the GoVPP api package it is being compiled against.
29 // A compilation error at this line likely means your copy of the
30 // GoVPP api package needs to be updated.
31 const _ = api.GoVppAPIPackageIsVersion2
36 VersionCrc = 0x76c36b4c
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
43 ADDRESS_IP4 AddressFamily = 0
44 ADDRESS_IP6 AddressFamily = 1
48 AddressFamily_name = map[uint32]string{
52 AddressFamily_value = map[string]uint32{
58 func (x AddressFamily) String() string {
59 s, ok := AddressFamily_name[uint32(x)]
63 return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
66 // IfStatusFlags defines enum 'if_status_flags'.
67 type IfStatusFlags uint32
70 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
71 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
75 IfStatusFlags_name = map[uint32]string{
76 1: "IF_STATUS_API_FLAG_ADMIN_UP",
77 2: "IF_STATUS_API_FLAG_LINK_UP",
79 IfStatusFlags_value = map[string]uint32{
80 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
81 "IF_STATUS_API_FLAG_LINK_UP": 2,
85 func (x IfStatusFlags) String() string {
86 s, ok := IfStatusFlags_name[uint32(x)]
90 str := func(n uint32) string {
91 s, ok := IfStatusFlags_name[uint32(n)]
95 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
97 for i := uint32(0); i <= 32; i++ {
107 return str(uint32(x))
112 // IfType defines enum 'if_type'.
116 IF_API_TYPE_HARDWARE IfType = 1
117 IF_API_TYPE_SUB IfType = 2
118 IF_API_TYPE_P2P IfType = 3
119 IF_API_TYPE_PIPE IfType = 4
123 IfType_name = map[uint32]string{
124 1: "IF_API_TYPE_HARDWARE",
125 2: "IF_API_TYPE_SUB",
126 3: "IF_API_TYPE_P2P",
127 4: "IF_API_TYPE_PIPE",
129 IfType_value = map[string]uint32{
130 "IF_API_TYPE_HARDWARE": 1,
131 "IF_API_TYPE_SUB": 2,
132 "IF_API_TYPE_P2P": 3,
133 "IF_API_TYPE_PIPE": 4,
137 func (x IfType) String() string {
138 s, ok := IfType_name[uint32(x)]
142 return "IfType(" + strconv.Itoa(int(x)) + ")"
145 // IPDscp defines enum 'ip_dscp'.
149 IP_API_DSCP_CS0 IPDscp = 0
150 IP_API_DSCP_CS1 IPDscp = 8
151 IP_API_DSCP_AF11 IPDscp = 10
152 IP_API_DSCP_AF12 IPDscp = 12
153 IP_API_DSCP_AF13 IPDscp = 14
154 IP_API_DSCP_CS2 IPDscp = 16
155 IP_API_DSCP_AF21 IPDscp = 18
156 IP_API_DSCP_AF22 IPDscp = 20
157 IP_API_DSCP_AF23 IPDscp = 22
158 IP_API_DSCP_CS3 IPDscp = 24
159 IP_API_DSCP_AF31 IPDscp = 26
160 IP_API_DSCP_AF32 IPDscp = 28
161 IP_API_DSCP_AF33 IPDscp = 30
162 IP_API_DSCP_CS4 IPDscp = 32
163 IP_API_DSCP_AF41 IPDscp = 34
164 IP_API_DSCP_AF42 IPDscp = 36
165 IP_API_DSCP_AF43 IPDscp = 38
166 IP_API_DSCP_CS5 IPDscp = 40
167 IP_API_DSCP_EF IPDscp = 46
168 IP_API_DSCP_CS6 IPDscp = 48
169 IP_API_DSCP_CS7 IPDscp = 50
173 IPDscp_name = map[uint8]string{
174 0: "IP_API_DSCP_CS0",
175 8: "IP_API_DSCP_CS1",
176 10: "IP_API_DSCP_AF11",
177 12: "IP_API_DSCP_AF12",
178 14: "IP_API_DSCP_AF13",
179 16: "IP_API_DSCP_CS2",
180 18: "IP_API_DSCP_AF21",
181 20: "IP_API_DSCP_AF22",
182 22: "IP_API_DSCP_AF23",
183 24: "IP_API_DSCP_CS3",
184 26: "IP_API_DSCP_AF31",
185 28: "IP_API_DSCP_AF32",
186 30: "IP_API_DSCP_AF33",
187 32: "IP_API_DSCP_CS4",
188 34: "IP_API_DSCP_AF41",
189 36: "IP_API_DSCP_AF42",
190 38: "IP_API_DSCP_AF43",
191 40: "IP_API_DSCP_CS5",
192 46: "IP_API_DSCP_EF",
193 48: "IP_API_DSCP_CS6",
194 50: "IP_API_DSCP_CS7",
196 IPDscp_value = map[string]uint8{
197 "IP_API_DSCP_CS0": 0,
198 "IP_API_DSCP_CS1": 8,
199 "IP_API_DSCP_AF11": 10,
200 "IP_API_DSCP_AF12": 12,
201 "IP_API_DSCP_AF13": 14,
202 "IP_API_DSCP_CS2": 16,
203 "IP_API_DSCP_AF21": 18,
204 "IP_API_DSCP_AF22": 20,
205 "IP_API_DSCP_AF23": 22,
206 "IP_API_DSCP_CS3": 24,
207 "IP_API_DSCP_AF31": 26,
208 "IP_API_DSCP_AF32": 28,
209 "IP_API_DSCP_AF33": 30,
210 "IP_API_DSCP_CS4": 32,
211 "IP_API_DSCP_AF41": 34,
212 "IP_API_DSCP_AF42": 36,
213 "IP_API_DSCP_AF43": 38,
214 "IP_API_DSCP_CS5": 40,
215 "IP_API_DSCP_EF": 46,
216 "IP_API_DSCP_CS6": 48,
217 "IP_API_DSCP_CS7": 50,
221 func (x IPDscp) String() string {
222 s, ok := IPDscp_name[uint8(x)]
226 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
229 // IPEcn defines enum 'ip_ecn'.
233 IP_API_ECN_NONE IPEcn = 0
234 IP_API_ECN_ECT0 IPEcn = 1
235 IP_API_ECN_ECT1 IPEcn = 2
236 IP_API_ECN_CE IPEcn = 3
240 IPEcn_name = map[uint8]string{
241 0: "IP_API_ECN_NONE",
242 1: "IP_API_ECN_ECT0",
243 2: "IP_API_ECN_ECT1",
246 IPEcn_value = map[string]uint8{
247 "IP_API_ECN_NONE": 0,
248 "IP_API_ECN_ECT0": 1,
249 "IP_API_ECN_ECT1": 2,
254 func (x IPEcn) String() string {
255 s, ok := IPEcn_name[uint8(x)]
259 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
262 // IPProto defines enum 'ip_proto'.
266 IP_API_PROTO_HOPOPT IPProto = 0
267 IP_API_PROTO_ICMP IPProto = 1
268 IP_API_PROTO_IGMP IPProto = 2
269 IP_API_PROTO_TCP IPProto = 6
270 IP_API_PROTO_UDP IPProto = 17
271 IP_API_PROTO_GRE IPProto = 47
272 IP_API_PROTO_AH IPProto = 50
273 IP_API_PROTO_ESP IPProto = 51
274 IP_API_PROTO_EIGRP IPProto = 88
275 IP_API_PROTO_OSPF IPProto = 89
276 IP_API_PROTO_SCTP IPProto = 132
277 IP_API_PROTO_RESERVED IPProto = 255
281 IPProto_name = map[uint32]string{
282 0: "IP_API_PROTO_HOPOPT",
283 1: "IP_API_PROTO_ICMP",
284 2: "IP_API_PROTO_IGMP",
285 6: "IP_API_PROTO_TCP",
286 17: "IP_API_PROTO_UDP",
287 47: "IP_API_PROTO_GRE",
288 50: "IP_API_PROTO_AH",
289 51: "IP_API_PROTO_ESP",
290 88: "IP_API_PROTO_EIGRP",
291 89: "IP_API_PROTO_OSPF",
292 132: "IP_API_PROTO_SCTP",
293 255: "IP_API_PROTO_RESERVED",
295 IPProto_value = map[string]uint32{
296 "IP_API_PROTO_HOPOPT": 0,
297 "IP_API_PROTO_ICMP": 1,
298 "IP_API_PROTO_IGMP": 2,
299 "IP_API_PROTO_TCP": 6,
300 "IP_API_PROTO_UDP": 17,
301 "IP_API_PROTO_GRE": 47,
302 "IP_API_PROTO_AH": 50,
303 "IP_API_PROTO_ESP": 51,
304 "IP_API_PROTO_EIGRP": 88,
305 "IP_API_PROTO_OSPF": 89,
306 "IP_API_PROTO_SCTP": 132,
307 "IP_API_PROTO_RESERVED": 255,
311 func (x IPProto) String() string {
312 s, ok := IPProto_name[uint32(x)]
316 return "IPProto(" + strconv.Itoa(int(x)) + ")"
319 // LbEncapType defines enum 'lb_encap_type'.
320 type LbEncapType uint32
323 LB_API_ENCAP_TYPE_GRE4 LbEncapType = 0
324 LB_API_ENCAP_TYPE_GRE6 LbEncapType = 1
325 LB_API_ENCAP_TYPE_L3DSR LbEncapType = 2
326 LB_API_ENCAP_TYPE_NAT4 LbEncapType = 3
327 LB_API_ENCAP_TYPE_NAT6 LbEncapType = 4
328 LB_API_ENCAP_N_TYPES LbEncapType = 5
332 LbEncapType_name = map[uint32]string{
333 0: "LB_API_ENCAP_TYPE_GRE4",
334 1: "LB_API_ENCAP_TYPE_GRE6",
335 2: "LB_API_ENCAP_TYPE_L3DSR",
336 3: "LB_API_ENCAP_TYPE_NAT4",
337 4: "LB_API_ENCAP_TYPE_NAT6",
338 5: "LB_API_ENCAP_N_TYPES",
340 LbEncapType_value = map[string]uint32{
341 "LB_API_ENCAP_TYPE_GRE4": 0,
342 "LB_API_ENCAP_TYPE_GRE6": 1,
343 "LB_API_ENCAP_TYPE_L3DSR": 2,
344 "LB_API_ENCAP_TYPE_NAT4": 3,
345 "LB_API_ENCAP_TYPE_NAT6": 4,
346 "LB_API_ENCAP_N_TYPES": 5,
350 func (x LbEncapType) String() string {
351 s, ok := LbEncapType_name[uint32(x)]
355 return "LbEncapType(" + strconv.Itoa(int(x)) + ")"
358 // LbLkpTypeT defines enum 'lb_lkp_type_t'.
359 type LbLkpTypeT uint32
362 LB_API_LKP_SAME_IP_PORT LbLkpTypeT = 0
363 LB_API_LKP_DIFF_IP_PORT LbLkpTypeT = 1
364 LB_API_LKP_ALL_PORT_IP LbLkpTypeT = 2
365 LB_API_LKP_N_TYPES LbLkpTypeT = 3
369 LbLkpTypeT_name = map[uint32]string{
370 0: "LB_API_LKP_SAME_IP_PORT",
371 1: "LB_API_LKP_DIFF_IP_PORT",
372 2: "LB_API_LKP_ALL_PORT_IP",
373 3: "LB_API_LKP_N_TYPES",
375 LbLkpTypeT_value = map[string]uint32{
376 "LB_API_LKP_SAME_IP_PORT": 0,
377 "LB_API_LKP_DIFF_IP_PORT": 1,
378 "LB_API_LKP_ALL_PORT_IP": 2,
379 "LB_API_LKP_N_TYPES": 3,
383 func (x LbLkpTypeT) String() string {
384 s, ok := LbLkpTypeT_name[uint32(x)]
388 return "LbLkpTypeT(" + strconv.Itoa(int(x)) + ")"
391 // LbNatProtocol defines enum 'lb_nat_protocol'.
392 type LbNatProtocol uint32
395 LB_API_NAT_PROTOCOL_UDP LbNatProtocol = 6
396 LB_API_NAT_PROTOCOL_TCP LbNatProtocol = 23
397 LB_API_NAT_PROTOCOL_ANY LbNatProtocol = 4294967295
401 LbNatProtocol_name = map[uint32]string{
402 6: "LB_API_NAT_PROTOCOL_UDP",
403 23: "LB_API_NAT_PROTOCOL_TCP",
404 4294967295: "LB_API_NAT_PROTOCOL_ANY",
406 LbNatProtocol_value = map[string]uint32{
407 "LB_API_NAT_PROTOCOL_UDP": 6,
408 "LB_API_NAT_PROTOCOL_TCP": 23,
409 "LB_API_NAT_PROTOCOL_ANY": 4294967295,
413 func (x LbNatProtocol) String() string {
414 s, ok := LbNatProtocol_name[uint32(x)]
418 return "LbNatProtocol(" + strconv.Itoa(int(x)) + ")"
421 // LbSrvType defines enum 'lb_srv_type'.
422 type LbSrvType uint32
425 LB_API_SRV_TYPE_CLUSTERIP LbSrvType = 0
426 LB_API_SRV_TYPE_NODEPORT LbSrvType = 1
427 LB_API_SRV_N_TYPES LbSrvType = 2
431 LbSrvType_name = map[uint32]string{
432 0: "LB_API_SRV_TYPE_CLUSTERIP",
433 1: "LB_API_SRV_TYPE_NODEPORT",
434 2: "LB_API_SRV_N_TYPES",
436 LbSrvType_value = map[string]uint32{
437 "LB_API_SRV_TYPE_CLUSTERIP": 0,
438 "LB_API_SRV_TYPE_NODEPORT": 1,
439 "LB_API_SRV_N_TYPES": 2,
443 func (x LbSrvType) String() string {
444 s, ok := LbSrvType_name[uint32(x)]
448 return "LbSrvType(" + strconv.Itoa(int(x)) + ")"
451 // LbVipType defines enum 'lb_vip_type'.
452 type LbVipType uint32
455 LB_API_VIP_TYPE_IP6_GRE6 LbVipType = 0
456 LB_API_VIP_TYPE_IP6_GRE4 LbVipType = 1
457 LB_API_VIP_TYPE_IP4_GRE6 LbVipType = 2
458 LB_API_VIP_TYPE_IP4_GRE4 LbVipType = 3
459 LB_API_VIP_TYPE_IP4_L3DSR LbVipType = 4
460 LB_API_VIP_TYPE_IP4_NAT4 LbVipType = 5
461 LB_API_VIP_TYPE_IP6_NAT6 LbVipType = 6
462 LB_API_VIP_N_TYPES LbVipType = 7
466 LbVipType_name = map[uint32]string{
467 0: "LB_API_VIP_TYPE_IP6_GRE6",
468 1: "LB_API_VIP_TYPE_IP6_GRE4",
469 2: "LB_API_VIP_TYPE_IP4_GRE6",
470 3: "LB_API_VIP_TYPE_IP4_GRE4",
471 4: "LB_API_VIP_TYPE_IP4_L3DSR",
472 5: "LB_API_VIP_TYPE_IP4_NAT4",
473 6: "LB_API_VIP_TYPE_IP6_NAT6",
474 7: "LB_API_VIP_N_TYPES",
476 LbVipType_value = map[string]uint32{
477 "LB_API_VIP_TYPE_IP6_GRE6": 0,
478 "LB_API_VIP_TYPE_IP6_GRE4": 1,
479 "LB_API_VIP_TYPE_IP4_GRE6": 2,
480 "LB_API_VIP_TYPE_IP4_GRE4": 3,
481 "LB_API_VIP_TYPE_IP4_L3DSR": 4,
482 "LB_API_VIP_TYPE_IP4_NAT4": 5,
483 "LB_API_VIP_TYPE_IP6_NAT6": 6,
484 "LB_API_VIP_N_TYPES": 7,
488 func (x LbVipType) String() string {
489 s, ok := LbVipType_name[uint32(x)]
493 return "LbVipType(" + strconv.Itoa(int(x)) + ")"
496 // LinkDuplex defines enum 'link_duplex'.
497 type LinkDuplex uint32
500 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
501 LINK_DUPLEX_API_HALF LinkDuplex = 1
502 LINK_DUPLEX_API_FULL LinkDuplex = 2
506 LinkDuplex_name = map[uint32]string{
507 0: "LINK_DUPLEX_API_UNKNOWN",
508 1: "LINK_DUPLEX_API_HALF",
509 2: "LINK_DUPLEX_API_FULL",
511 LinkDuplex_value = map[string]uint32{
512 "LINK_DUPLEX_API_UNKNOWN": 0,
513 "LINK_DUPLEX_API_HALF": 1,
514 "LINK_DUPLEX_API_FULL": 2,
518 func (x LinkDuplex) String() string {
519 s, ok := LinkDuplex_name[uint32(x)]
523 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
526 // MtuProto defines enum 'mtu_proto'.
530 MTU_PROTO_API_L3 MtuProto = 1
531 MTU_PROTO_API_IP4 MtuProto = 2
532 MTU_PROTO_API_IP6 MtuProto = 3
533 MTU_PROTO_API_MPLS MtuProto = 4
534 MTU_PROTO_API_N MtuProto = 5
538 MtuProto_name = map[uint32]string{
539 1: "MTU_PROTO_API_L3",
540 2: "MTU_PROTO_API_IP4",
541 3: "MTU_PROTO_API_IP6",
542 4: "MTU_PROTO_API_MPLS",
543 5: "MTU_PROTO_API_N",
545 MtuProto_value = map[string]uint32{
546 "MTU_PROTO_API_L3": 1,
547 "MTU_PROTO_API_IP4": 2,
548 "MTU_PROTO_API_IP6": 3,
549 "MTU_PROTO_API_MPLS": 4,
550 "MTU_PROTO_API_N": 5,
554 func (x MtuProto) String() string {
555 s, ok := MtuProto_name[uint32(x)]
559 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
562 // RxMode defines enum 'rx_mode'.
566 RX_MODE_API_UNKNOWN RxMode = 0
567 RX_MODE_API_POLLING RxMode = 1
568 RX_MODE_API_INTERRUPT RxMode = 2
569 RX_MODE_API_ADAPTIVE RxMode = 3
570 RX_MODE_API_DEFAULT RxMode = 4
574 RxMode_name = map[uint32]string{
575 0: "RX_MODE_API_UNKNOWN",
576 1: "RX_MODE_API_POLLING",
577 2: "RX_MODE_API_INTERRUPT",
578 3: "RX_MODE_API_ADAPTIVE",
579 4: "RX_MODE_API_DEFAULT",
581 RxMode_value = map[string]uint32{
582 "RX_MODE_API_UNKNOWN": 0,
583 "RX_MODE_API_POLLING": 1,
584 "RX_MODE_API_INTERRUPT": 2,
585 "RX_MODE_API_ADAPTIVE": 3,
586 "RX_MODE_API_DEFAULT": 4,
590 func (x RxMode) String() string {
591 s, ok := RxMode_name[uint32(x)]
595 return "RxMode(" + strconv.Itoa(int(x)) + ")"
598 // SubIfFlags defines enum 'sub_if_flags'.
599 type SubIfFlags uint32
602 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
603 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
604 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
605 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
606 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
607 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
608 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
609 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
610 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
611 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
615 SubIfFlags_name = map[uint32]string{
616 1: "SUB_IF_API_FLAG_NO_TAGS",
617 2: "SUB_IF_API_FLAG_ONE_TAG",
618 4: "SUB_IF_API_FLAG_TWO_TAGS",
619 8: "SUB_IF_API_FLAG_DOT1AD",
620 16: "SUB_IF_API_FLAG_EXACT_MATCH",
621 32: "SUB_IF_API_FLAG_DEFAULT",
622 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
623 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
624 254: "SUB_IF_API_FLAG_MASK_VNET",
625 256: "SUB_IF_API_FLAG_DOT1AH",
627 SubIfFlags_value = map[string]uint32{
628 "SUB_IF_API_FLAG_NO_TAGS": 1,
629 "SUB_IF_API_FLAG_ONE_TAG": 2,
630 "SUB_IF_API_FLAG_TWO_TAGS": 4,
631 "SUB_IF_API_FLAG_DOT1AD": 8,
632 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
633 "SUB_IF_API_FLAG_DEFAULT": 32,
634 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
635 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
636 "SUB_IF_API_FLAG_MASK_VNET": 254,
637 "SUB_IF_API_FLAG_DOT1AH": 256,
641 func (x SubIfFlags) String() string {
642 s, ok := SubIfFlags_name[uint32(x)]
646 str := func(n uint32) string {
647 s, ok := SubIfFlags_name[uint32(n)]
651 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
653 for i := uint32(0); i <= 32; i++ {
663 return str(uint32(x))
668 // AddressWithPrefix defines alias 'address_with_prefix'.
669 type AddressWithPrefix Prefix
671 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
672 prefix, err := ParsePrefix(s)
674 return AddressWithPrefix{}, err
676 return AddressWithPrefix(prefix), nil
678 func (x AddressWithPrefix) String() string {
679 return Prefix(x).String()
681 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
682 return []byte(x.String()), nil
684 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
685 prefix, err := ParseAddressWithPrefix(string(text))
693 // InterfaceIndex defines alias 'interface_index'.
694 type InterfaceIndex uint32
696 // IP4Address defines alias 'ip4_address'.
697 type IP4Address [4]uint8
699 func ParseIP4Address(s string) (IP4Address, error) {
700 ip := net.ParseIP(s).To4()
702 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
704 var ipaddr IP4Address
705 copy(ipaddr[:], ip.To4())
709 func (x IP4Address) ToIP() net.IP {
710 return net.IP(x[:]).To4()
712 func (x IP4Address) String() string {
713 return x.ToIP().String()
715 func (x *IP4Address) MarshalText() ([]byte, error) {
716 return []byte(x.String()), nil
718 func (x *IP4Address) UnmarshalText(text []byte) error {
719 ipaddr, err := ParseIP4Address(string(text))
727 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
728 type IP4AddressWithPrefix IP4Prefix
730 // IP6Address defines alias 'ip6_address'.
731 type IP6Address [16]uint8
733 func ParseIP6Address(s string) (IP6Address, error) {
734 ip := net.ParseIP(s).To16()
736 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
738 var ipaddr IP6Address
739 copy(ipaddr[:], ip.To16())
743 func (x IP6Address) ToIP() net.IP {
744 return net.IP(x[:]).To16()
746 func (x IP6Address) String() string {
747 return x.ToIP().String()
749 func (x *IP6Address) MarshalText() ([]byte, error) {
750 return []byte(x.String()), nil
752 func (x *IP6Address) UnmarshalText(text []byte) error {
753 ipaddr, err := ParseIP6Address(string(text))
761 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
762 type IP6AddressWithPrefix IP6Prefix
764 // Address defines type 'address'.
765 type Address struct {
766 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
767 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
770 func ParseAddress(s string) (Address, error) {
773 return Address{}, fmt.Errorf("invalid address: %s", s)
777 addr.Af = ADDRESS_IP6
779 copy(ip6[:], ip.To16())
782 addr.Af = ADDRESS_IP4
784 copy(ip4[:], ip.To4())
789 func (x Address) ToIP() net.IP {
790 if x.Af == ADDRESS_IP6 {
792 return net.IP(ip6[:]).To16()
795 return net.IP(ip4[:]).To4()
798 func (x Address) String() string {
799 return x.ToIP().String()
801 func (x *Address) MarshalText() ([]byte, error) {
802 return []byte(x.String()), nil
804 func (x *Address) UnmarshalText(text []byte) error {
805 addr, err := ParseAddress(string(text))
813 // IP4Prefix defines type 'ip4_prefix'.
814 type IP4Prefix struct {
815 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
816 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
819 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
820 hasPrefix := strings.Contains(s, "/")
822 ip, network, err := net.ParseCIDR(s)
824 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
826 maskSize, _ := network.Mask.Size()
827 prefix.Len = byte(maskSize)
828 prefix.Address, err = ParseIP4Address(ip.String())
830 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
834 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
836 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
838 prefix.Len = byte(defaultMaskSize)
839 prefix.Address, err = ParseIP4Address(ip.String())
841 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
846 func (x IP4Prefix) ToIPNet() *net.IPNet {
847 mask := net.CIDRMask(int(x.Len), 32)
848 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
851 func (x IP4Prefix) String() string {
852 ip := x.Address.String()
853 return ip + "/" + strconv.Itoa(int(x.Len))
855 func (x *IP4Prefix) MarshalText() ([]byte, error) {
856 return []byte(x.String()), nil
858 func (x *IP4Prefix) UnmarshalText(text []byte) error {
859 prefix, err := ParseIP4Prefix(string(text))
867 // IP6Prefix defines type 'ip6_prefix'.
868 type IP6Prefix struct {
869 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
870 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
873 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
874 hasPrefix := strings.Contains(s, "/")
876 ip, network, err := net.ParseCIDR(s)
878 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
880 maskSize, _ := network.Mask.Size()
881 prefix.Len = byte(maskSize)
882 prefix.Address, err = ParseIP6Address(ip.String())
884 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
888 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
890 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
892 prefix.Len = byte(defaultMaskSize)
893 prefix.Address, err = ParseIP6Address(ip.String())
895 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
900 func (x IP6Prefix) ToIPNet() *net.IPNet {
901 mask := net.CIDRMask(int(x.Len), 128)
902 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
905 func (x IP6Prefix) String() string {
906 ip := x.Address.String()
907 return ip + "/" + strconv.Itoa(int(x.Len))
909 func (x *IP6Prefix) MarshalText() ([]byte, error) {
910 return []byte(x.String()), nil
912 func (x *IP6Prefix) UnmarshalText(text []byte) error {
913 prefix, err := ParseIP6Prefix(string(text))
921 // LbVip defines type 'lb_vip'.
923 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
924 Protocol IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
925 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
928 // Mprefix defines type 'mprefix'.
929 type Mprefix struct {
930 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
931 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
932 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
933 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
936 // Prefix defines type 'prefix'.
938 Address Address `binapi:"address,name=address" json:"address,omitempty"`
939 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
942 func ParsePrefix(ip string) (prefix Prefix, err error) {
943 hasPrefix := strings.Contains(ip, "/")
945 netIP, network, err := net.ParseCIDR(ip)
947 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
949 maskSize, _ := network.Mask.Size()
950 prefix.Len = byte(maskSize)
951 prefix.Address, err = ParseAddress(netIP.String())
953 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
956 netIP := net.ParseIP(ip)
957 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
958 if netIP.To4() == nil {
959 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
961 prefix.Len = byte(defaultMaskSize)
962 prefix.Address, err = ParseAddress(netIP.String())
964 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
969 func (x Prefix) ToIPNet() *net.IPNet {
971 if x.Address.Af == ADDRESS_IP4 {
972 mask = net.CIDRMask(int(x.Len), 32)
974 mask = net.CIDRMask(int(x.Len), 128)
976 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
979 func (x Prefix) String() string {
980 ip := x.Address.String()
981 return ip + "/" + strconv.Itoa(int(x.Len))
983 func (x *Prefix) MarshalText() ([]byte, error) {
984 return []byte(x.String()), nil
986 func (x *Prefix) UnmarshalText(text []byte) error {
987 prefix, err := ParsePrefix(string(text))
995 // PrefixMatcher defines type 'prefix_matcher'.
996 type PrefixMatcher struct {
997 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
998 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1001 // AddressUnion defines union 'address_union'.
1002 type AddressUnion struct {
1005 XXX_UnionData [16]byte
1008 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1012 func (u *AddressUnion) SetIP4(a IP4Address) {
1013 buf := codec.NewBuffer(u.XXX_UnionData[:])
1014 buf.EncodeBytes(a[:], 4)
1016 func (u *AddressUnion) GetIP4() (a IP4Address) {
1017 buf := codec.NewBuffer(u.XXX_UnionData[:])
1018 copy(a[:], buf.DecodeBytes(4))
1022 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1026 func (u *AddressUnion) SetIP6(a IP6Address) {
1027 buf := codec.NewBuffer(u.XXX_UnionData[:])
1028 buf.EncodeBytes(a[:], 16)
1030 func (u *AddressUnion) GetIP6() (a IP6Address) {
1031 buf := codec.NewBuffer(u.XXX_UnionData[:])
1032 copy(a[:], buf.DecodeBytes(16))
1036 // LbAddDelAs defines message 'lb_add_del_as'.
1037 type LbAddDelAs struct {
1038 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1039 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1040 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1041 AsAddress Address `binapi:"address,name=as_address" json:"as_address,omitempty"`
1042 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
1043 IsFlush bool `binapi:"bool,name=is_flush" json:"is_flush,omitempty"`
1046 func (m *LbAddDelAs) Reset() { *m = LbAddDelAs{} }
1047 func (*LbAddDelAs) GetMessageName() string { return "lb_add_del_as" }
1048 func (*LbAddDelAs) GetCrcString() string { return "78628987" }
1049 func (*LbAddDelAs) GetMessageType() api.MessageType {
1050 return api.RequestMessage
1053 func (m *LbAddDelAs) Size() (size int) {
1057 size += 4 // m.Pfx.Address.Af
1058 size += 1 * 16 // m.Pfx.Address.Un
1059 size += 1 // m.Pfx.Len
1060 size += 1 // m.Protocol
1062 size += 4 // m.AsAddress.Af
1063 size += 1 * 16 // m.AsAddress.Un
1064 size += 1 // m.IsDel
1065 size += 1 // m.IsFlush
1068 func (m *LbAddDelAs) Marshal(b []byte) ([]byte, error) {
1070 b = make([]byte, m.Size())
1072 buf := codec.NewBuffer(b)
1073 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1074 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1075 buf.EncodeUint8(m.Pfx.Len)
1076 buf.EncodeUint8(m.Protocol)
1077 buf.EncodeUint16(m.Port)
1078 buf.EncodeUint32(uint32(m.AsAddress.Af))
1079 buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 16)
1080 buf.EncodeBool(m.IsDel)
1081 buf.EncodeBool(m.IsFlush)
1082 return buf.Bytes(), nil
1084 func (m *LbAddDelAs) Unmarshal(b []byte) error {
1085 buf := codec.NewBuffer(b)
1086 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1087 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1088 m.Pfx.Len = buf.DecodeUint8()
1089 m.Protocol = buf.DecodeUint8()
1090 m.Port = buf.DecodeUint16()
1091 m.AsAddress.Af = AddressFamily(buf.DecodeUint32())
1092 copy(m.AsAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1093 m.IsDel = buf.DecodeBool()
1094 m.IsFlush = buf.DecodeBool()
1098 // LbAddDelAsReply defines message 'lb_add_del_as_reply'.
1099 type LbAddDelAsReply struct {
1100 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1103 func (m *LbAddDelAsReply) Reset() { *m = LbAddDelAsReply{} }
1104 func (*LbAddDelAsReply) GetMessageName() string { return "lb_add_del_as_reply" }
1105 func (*LbAddDelAsReply) GetCrcString() string { return "e8d4e804" }
1106 func (*LbAddDelAsReply) GetMessageType() api.MessageType {
1107 return api.ReplyMessage
1110 func (m *LbAddDelAsReply) Size() (size int) {
1114 size += 4 // m.Retval
1117 func (m *LbAddDelAsReply) Marshal(b []byte) ([]byte, error) {
1119 b = make([]byte, m.Size())
1121 buf := codec.NewBuffer(b)
1122 buf.EncodeInt32(m.Retval)
1123 return buf.Bytes(), nil
1125 func (m *LbAddDelAsReply) Unmarshal(b []byte) error {
1126 buf := codec.NewBuffer(b)
1127 m.Retval = buf.DecodeInt32()
1131 // LbAddDelIntfNat4 defines message 'lb_add_del_intf_nat4'.
1132 type LbAddDelIntfNat4 struct {
1133 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1134 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1137 func (m *LbAddDelIntfNat4) Reset() { *m = LbAddDelIntfNat4{} }
1138 func (*LbAddDelIntfNat4) GetMessageName() string { return "lb_add_del_intf_nat4" }
1139 func (*LbAddDelIntfNat4) GetCrcString() string { return "47d6e753" }
1140 func (*LbAddDelIntfNat4) GetMessageType() api.MessageType {
1141 return api.RequestMessage
1144 func (m *LbAddDelIntfNat4) Size() (size int) {
1148 size += 1 // m.IsAdd
1149 size += 4 // m.SwIfIndex
1152 func (m *LbAddDelIntfNat4) Marshal(b []byte) ([]byte, error) {
1154 b = make([]byte, m.Size())
1156 buf := codec.NewBuffer(b)
1157 buf.EncodeBool(m.IsAdd)
1158 buf.EncodeUint32(uint32(m.SwIfIndex))
1159 return buf.Bytes(), nil
1161 func (m *LbAddDelIntfNat4) Unmarshal(b []byte) error {
1162 buf := codec.NewBuffer(b)
1163 m.IsAdd = buf.DecodeBool()
1164 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1168 // LbAddDelIntfNat4Reply defines message 'lb_add_del_intf_nat4_reply'.
1169 type LbAddDelIntfNat4Reply struct {
1170 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1173 func (m *LbAddDelIntfNat4Reply) Reset() { *m = LbAddDelIntfNat4Reply{} }
1174 func (*LbAddDelIntfNat4Reply) GetMessageName() string { return "lb_add_del_intf_nat4_reply" }
1175 func (*LbAddDelIntfNat4Reply) GetCrcString() string { return "e8d4e804" }
1176 func (*LbAddDelIntfNat4Reply) GetMessageType() api.MessageType {
1177 return api.ReplyMessage
1180 func (m *LbAddDelIntfNat4Reply) Size() (size int) {
1184 size += 4 // m.Retval
1187 func (m *LbAddDelIntfNat4Reply) Marshal(b []byte) ([]byte, error) {
1189 b = make([]byte, m.Size())
1191 buf := codec.NewBuffer(b)
1192 buf.EncodeInt32(m.Retval)
1193 return buf.Bytes(), nil
1195 func (m *LbAddDelIntfNat4Reply) Unmarshal(b []byte) error {
1196 buf := codec.NewBuffer(b)
1197 m.Retval = buf.DecodeInt32()
1201 // LbAddDelIntfNat6 defines message 'lb_add_del_intf_nat6'.
1202 type LbAddDelIntfNat6 struct {
1203 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1204 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1207 func (m *LbAddDelIntfNat6) Reset() { *m = LbAddDelIntfNat6{} }
1208 func (*LbAddDelIntfNat6) GetMessageName() string { return "lb_add_del_intf_nat6" }
1209 func (*LbAddDelIntfNat6) GetCrcString() string { return "47d6e753" }
1210 func (*LbAddDelIntfNat6) GetMessageType() api.MessageType {
1211 return api.RequestMessage
1214 func (m *LbAddDelIntfNat6) Size() (size int) {
1218 size += 1 // m.IsAdd
1219 size += 4 // m.SwIfIndex
1222 func (m *LbAddDelIntfNat6) Marshal(b []byte) ([]byte, error) {
1224 b = make([]byte, m.Size())
1226 buf := codec.NewBuffer(b)
1227 buf.EncodeBool(m.IsAdd)
1228 buf.EncodeUint32(uint32(m.SwIfIndex))
1229 return buf.Bytes(), nil
1231 func (m *LbAddDelIntfNat6) Unmarshal(b []byte) error {
1232 buf := codec.NewBuffer(b)
1233 m.IsAdd = buf.DecodeBool()
1234 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1238 // LbAddDelIntfNat6Reply defines message 'lb_add_del_intf_nat6_reply'.
1239 type LbAddDelIntfNat6Reply struct {
1240 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1243 func (m *LbAddDelIntfNat6Reply) Reset() { *m = LbAddDelIntfNat6Reply{} }
1244 func (*LbAddDelIntfNat6Reply) GetMessageName() string { return "lb_add_del_intf_nat6_reply" }
1245 func (*LbAddDelIntfNat6Reply) GetCrcString() string { return "e8d4e804" }
1246 func (*LbAddDelIntfNat6Reply) GetMessageType() api.MessageType {
1247 return api.ReplyMessage
1250 func (m *LbAddDelIntfNat6Reply) Size() (size int) {
1254 size += 4 // m.Retval
1257 func (m *LbAddDelIntfNat6Reply) Marshal(b []byte) ([]byte, error) {
1259 b = make([]byte, m.Size())
1261 buf := codec.NewBuffer(b)
1262 buf.EncodeInt32(m.Retval)
1263 return buf.Bytes(), nil
1265 func (m *LbAddDelIntfNat6Reply) Unmarshal(b []byte) error {
1266 buf := codec.NewBuffer(b)
1267 m.Retval = buf.DecodeInt32()
1271 // LbAddDelVip defines message 'lb_add_del_vip'.
1272 type LbAddDelVip struct {
1273 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1274 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1275 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1276 Encap LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"`
1277 Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"`
1278 Type LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"`
1279 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"`
1280 NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"`
1281 NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=1024" json:"new_flows_table_length,omitempty"`
1282 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
1285 func (m *LbAddDelVip) Reset() { *m = LbAddDelVip{} }
1286 func (*LbAddDelVip) GetMessageName() string { return "lb_add_del_vip" }
1287 func (*LbAddDelVip) GetCrcString() string { return "d15b7ddc" }
1288 func (*LbAddDelVip) GetMessageType() api.MessageType {
1289 return api.RequestMessage
1292 func (m *LbAddDelVip) Size() (size int) {
1296 size += 4 // m.Pfx.Address.Af
1297 size += 1 * 16 // m.Pfx.Address.Un
1298 size += 1 // m.Pfx.Len
1299 size += 1 // m.Protocol
1301 size += 4 // m.Encap
1304 size += 2 // m.TargetPort
1305 size += 2 // m.NodePort
1306 size += 4 // m.NewFlowsTableLength
1307 size += 1 // m.IsDel
1310 func (m *LbAddDelVip) Marshal(b []byte) ([]byte, error) {
1312 b = make([]byte, m.Size())
1314 buf := codec.NewBuffer(b)
1315 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1316 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1317 buf.EncodeUint8(m.Pfx.Len)
1318 buf.EncodeUint8(m.Protocol)
1319 buf.EncodeUint16(m.Port)
1320 buf.EncodeUint32(uint32(m.Encap))
1321 buf.EncodeUint8(m.Dscp)
1322 buf.EncodeUint32(uint32(m.Type))
1323 buf.EncodeUint16(m.TargetPort)
1324 buf.EncodeUint16(m.NodePort)
1325 buf.EncodeUint32(m.NewFlowsTableLength)
1326 buf.EncodeBool(m.IsDel)
1327 return buf.Bytes(), nil
1329 func (m *LbAddDelVip) Unmarshal(b []byte) error {
1330 buf := codec.NewBuffer(b)
1331 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1332 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1333 m.Pfx.Len = buf.DecodeUint8()
1334 m.Protocol = buf.DecodeUint8()
1335 m.Port = buf.DecodeUint16()
1336 m.Encap = LbEncapType(buf.DecodeUint32())
1337 m.Dscp = buf.DecodeUint8()
1338 m.Type = LbSrvType(buf.DecodeUint32())
1339 m.TargetPort = buf.DecodeUint16()
1340 m.NodePort = buf.DecodeUint16()
1341 m.NewFlowsTableLength = buf.DecodeUint32()
1342 m.IsDel = buf.DecodeBool()
1346 // LbAddDelVipReply defines message 'lb_add_del_vip_reply'.
1347 type LbAddDelVipReply struct {
1348 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1351 func (m *LbAddDelVipReply) Reset() { *m = LbAddDelVipReply{} }
1352 func (*LbAddDelVipReply) GetMessageName() string { return "lb_add_del_vip_reply" }
1353 func (*LbAddDelVipReply) GetCrcString() string { return "e8d4e804" }
1354 func (*LbAddDelVipReply) GetMessageType() api.MessageType {
1355 return api.ReplyMessage
1358 func (m *LbAddDelVipReply) Size() (size int) {
1362 size += 4 // m.Retval
1365 func (m *LbAddDelVipReply) Marshal(b []byte) ([]byte, error) {
1367 b = make([]byte, m.Size())
1369 buf := codec.NewBuffer(b)
1370 buf.EncodeInt32(m.Retval)
1371 return buf.Bytes(), nil
1373 func (m *LbAddDelVipReply) Unmarshal(b []byte) error {
1374 buf := codec.NewBuffer(b)
1375 m.Retval = buf.DecodeInt32()
1379 // LbAsDetails defines message 'lb_as_details'.
1380 type LbAsDetails struct {
1381 Vip LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"`
1382 AppSrv Address `binapi:"address,name=app_srv" json:"app_srv,omitempty"`
1383 Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"`
1384 InUseSince uint32 `binapi:"u32,name=in_use_since" json:"in_use_since,omitempty"`
1387 func (m *LbAsDetails) Reset() { *m = LbAsDetails{} }
1388 func (*LbAsDetails) GetMessageName() string { return "lb_as_details" }
1389 func (*LbAsDetails) GetCrcString() string { return "9c39f60e" }
1390 func (*LbAsDetails) GetMessageType() api.MessageType {
1391 return api.ReplyMessage
1394 func (m *LbAsDetails) Size() (size int) {
1398 size += 4 // m.Vip.Pfx.Address.Af
1399 size += 1 * 16 // m.Vip.Pfx.Address.Un
1400 size += 1 // m.Vip.Pfx.Len
1401 size += 4 // m.Vip.Protocol
1402 size += 2 // m.Vip.Port
1403 size += 4 // m.AppSrv.Af
1404 size += 1 * 16 // m.AppSrv.Un
1405 size += 1 // m.Flags
1406 size += 4 // m.InUseSince
1409 func (m *LbAsDetails) Marshal(b []byte) ([]byte, error) {
1411 b = make([]byte, m.Size())
1413 buf := codec.NewBuffer(b)
1414 buf.EncodeUint32(uint32(m.Vip.Pfx.Address.Af))
1415 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
1416 buf.EncodeUint8(m.Vip.Pfx.Len)
1417 buf.EncodeUint32(uint32(m.Vip.Protocol))
1418 buf.EncodeUint16(m.Vip.Port)
1419 buf.EncodeUint32(uint32(m.AppSrv.Af))
1420 buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 16)
1421 buf.EncodeUint8(m.Flags)
1422 buf.EncodeUint32(m.InUseSince)
1423 return buf.Bytes(), nil
1425 func (m *LbAsDetails) Unmarshal(b []byte) error {
1426 buf := codec.NewBuffer(b)
1427 m.Vip.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1428 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1429 m.Vip.Pfx.Len = buf.DecodeUint8()
1430 m.Vip.Protocol = IPProto(buf.DecodeUint32())
1431 m.Vip.Port = buf.DecodeUint16()
1432 m.AppSrv.Af = AddressFamily(buf.DecodeUint32())
1433 copy(m.AppSrv.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1434 m.Flags = buf.DecodeUint8()
1435 m.InUseSince = buf.DecodeUint32()
1439 // LbAsDump defines message 'lb_as_dump'.
1440 type LbAsDump struct {
1441 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1442 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"`
1443 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1446 func (m *LbAsDump) Reset() { *m = LbAsDump{} }
1447 func (*LbAsDump) GetMessageName() string { return "lb_as_dump" }
1448 func (*LbAsDump) GetCrcString() string { return "1063f819" }
1449 func (*LbAsDump) GetMessageType() api.MessageType {
1450 return api.RequestMessage
1453 func (m *LbAsDump) Size() (size int) {
1457 size += 4 // m.Pfx.Address.Af
1458 size += 1 * 16 // m.Pfx.Address.Un
1459 size += 1 // m.Pfx.Len
1460 size += 1 // m.Protocol
1464 func (m *LbAsDump) Marshal(b []byte) ([]byte, error) {
1466 b = make([]byte, m.Size())
1468 buf := codec.NewBuffer(b)
1469 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1470 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1471 buf.EncodeUint8(m.Pfx.Len)
1472 buf.EncodeUint8(m.Protocol)
1473 buf.EncodeUint16(m.Port)
1474 return buf.Bytes(), nil
1476 func (m *LbAsDump) Unmarshal(b []byte) error {
1477 buf := codec.NewBuffer(b)
1478 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1479 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1480 m.Pfx.Len = buf.DecodeUint8()
1481 m.Protocol = buf.DecodeUint8()
1482 m.Port = buf.DecodeUint16()
1486 // LbConf defines message 'lb_conf'.
1487 type LbConf struct {
1488 IP4SrcAddress IP4Address `binapi:"ip4_address,name=ip4_src_address" json:"ip4_src_address,omitempty"`
1489 IP6SrcAddress IP6Address `binapi:"ip6_address,name=ip6_src_address" json:"ip6_src_address,omitempty"`
1490 StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core" json:"sticky_buckets_per_core,omitempty"`
1491 FlowTimeout uint32 `binapi:"u32,name=flow_timeout" json:"flow_timeout,omitempty"`
1494 func (m *LbConf) Reset() { *m = LbConf{} }
1495 func (*LbConf) GetMessageName() string { return "lb_conf" }
1496 func (*LbConf) GetCrcString() string { return "22ddb739" }
1497 func (*LbConf) GetMessageType() api.MessageType {
1498 return api.RequestMessage
1501 func (m *LbConf) Size() (size int) {
1505 size += 1 * 4 // m.IP4SrcAddress
1506 size += 1 * 16 // m.IP6SrcAddress
1507 size += 4 // m.StickyBucketsPerCore
1508 size += 4 // m.FlowTimeout
1511 func (m *LbConf) Marshal(b []byte) ([]byte, error) {
1513 b = make([]byte, m.Size())
1515 buf := codec.NewBuffer(b)
1516 buf.EncodeBytes(m.IP4SrcAddress[:], 4)
1517 buf.EncodeBytes(m.IP6SrcAddress[:], 16)
1518 buf.EncodeUint32(m.StickyBucketsPerCore)
1519 buf.EncodeUint32(m.FlowTimeout)
1520 return buf.Bytes(), nil
1522 func (m *LbConf) Unmarshal(b []byte) error {
1523 buf := codec.NewBuffer(b)
1524 copy(m.IP4SrcAddress[:], buf.DecodeBytes(4))
1525 copy(m.IP6SrcAddress[:], buf.DecodeBytes(16))
1526 m.StickyBucketsPerCore = buf.DecodeUint32()
1527 m.FlowTimeout = buf.DecodeUint32()
1531 // LbConfReply defines message 'lb_conf_reply'.
1532 type LbConfReply struct {
1533 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1536 func (m *LbConfReply) Reset() { *m = LbConfReply{} }
1537 func (*LbConfReply) GetMessageName() string { return "lb_conf_reply" }
1538 func (*LbConfReply) GetCrcString() string { return "e8d4e804" }
1539 func (*LbConfReply) GetMessageType() api.MessageType {
1540 return api.ReplyMessage
1543 func (m *LbConfReply) Size() (size int) {
1547 size += 4 // m.Retval
1550 func (m *LbConfReply) Marshal(b []byte) ([]byte, error) {
1552 b = make([]byte, m.Size())
1554 buf := codec.NewBuffer(b)
1555 buf.EncodeInt32(m.Retval)
1556 return buf.Bytes(), nil
1558 func (m *LbConfReply) Unmarshal(b []byte) error {
1559 buf := codec.NewBuffer(b)
1560 m.Retval = buf.DecodeInt32()
1564 // LbFlushVip defines message 'lb_flush_vip'.
1565 type LbFlushVip struct {
1566 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1567 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"`
1568 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1571 func (m *LbFlushVip) Reset() { *m = LbFlushVip{} }
1572 func (*LbFlushVip) GetMessageName() string { return "lb_flush_vip" }
1573 func (*LbFlushVip) GetCrcString() string { return "1063f819" }
1574 func (*LbFlushVip) GetMessageType() api.MessageType {
1575 return api.RequestMessage
1578 func (m *LbFlushVip) Size() (size int) {
1582 size += 4 // m.Pfx.Address.Af
1583 size += 1 * 16 // m.Pfx.Address.Un
1584 size += 1 // m.Pfx.Len
1585 size += 1 // m.Protocol
1589 func (m *LbFlushVip) Marshal(b []byte) ([]byte, error) {
1591 b = make([]byte, m.Size())
1593 buf := codec.NewBuffer(b)
1594 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1595 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1596 buf.EncodeUint8(m.Pfx.Len)
1597 buf.EncodeUint8(m.Protocol)
1598 buf.EncodeUint16(m.Port)
1599 return buf.Bytes(), nil
1601 func (m *LbFlushVip) Unmarshal(b []byte) error {
1602 buf := codec.NewBuffer(b)
1603 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1604 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1605 m.Pfx.Len = buf.DecodeUint8()
1606 m.Protocol = buf.DecodeUint8()
1607 m.Port = buf.DecodeUint16()
1611 // LbFlushVipReply defines message 'lb_flush_vip_reply'.
1612 type LbFlushVipReply struct {
1613 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1616 func (m *LbFlushVipReply) Reset() { *m = LbFlushVipReply{} }
1617 func (*LbFlushVipReply) GetMessageName() string { return "lb_flush_vip_reply" }
1618 func (*LbFlushVipReply) GetCrcString() string { return "e8d4e804" }
1619 func (*LbFlushVipReply) GetMessageType() api.MessageType {
1620 return api.ReplyMessage
1623 func (m *LbFlushVipReply) Size() (size int) {
1627 size += 4 // m.Retval
1630 func (m *LbFlushVipReply) Marshal(b []byte) ([]byte, error) {
1632 b = make([]byte, m.Size())
1634 buf := codec.NewBuffer(b)
1635 buf.EncodeInt32(m.Retval)
1636 return buf.Bytes(), nil
1638 func (m *LbFlushVipReply) Unmarshal(b []byte) error {
1639 buf := codec.NewBuffer(b)
1640 m.Retval = buf.DecodeInt32()
1644 // LbVipDetails defines message 'lb_vip_details'.
1645 type LbVipDetails struct {
1646 Vip LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"`
1647 Encap LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"`
1648 Dscp IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"`
1649 SrvType LbSrvType `binapi:"lb_srv_type,name=srv_type" json:"srv_type,omitempty"`
1650 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"`
1651 FlowTableLength uint16 `binapi:"u16,name=flow_table_length" json:"flow_table_length,omitempty"`
1654 func (m *LbVipDetails) Reset() { *m = LbVipDetails{} }
1655 func (*LbVipDetails) GetMessageName() string { return "lb_vip_details" }
1656 func (*LbVipDetails) GetCrcString() string { return "08f39bed" }
1657 func (*LbVipDetails) GetMessageType() api.MessageType {
1658 return api.ReplyMessage
1661 func (m *LbVipDetails) Size() (size int) {
1665 size += 4 // m.Vip.Pfx.Address.Af
1666 size += 1 * 16 // m.Vip.Pfx.Address.Un
1667 size += 1 // m.Vip.Pfx.Len
1668 size += 4 // m.Vip.Protocol
1669 size += 2 // m.Vip.Port
1670 size += 4 // m.Encap
1672 size += 4 // m.SrvType
1673 size += 2 // m.TargetPort
1674 size += 2 // m.FlowTableLength
1677 func (m *LbVipDetails) Marshal(b []byte) ([]byte, error) {
1679 b = make([]byte, m.Size())
1681 buf := codec.NewBuffer(b)
1682 buf.EncodeUint32(uint32(m.Vip.Pfx.Address.Af))
1683 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
1684 buf.EncodeUint8(m.Vip.Pfx.Len)
1685 buf.EncodeUint32(uint32(m.Vip.Protocol))
1686 buf.EncodeUint16(m.Vip.Port)
1687 buf.EncodeUint32(uint32(m.Encap))
1688 buf.EncodeUint8(uint8(m.Dscp))
1689 buf.EncodeUint32(uint32(m.SrvType))
1690 buf.EncodeUint16(m.TargetPort)
1691 buf.EncodeUint16(m.FlowTableLength)
1692 return buf.Bytes(), nil
1694 func (m *LbVipDetails) Unmarshal(b []byte) error {
1695 buf := codec.NewBuffer(b)
1696 m.Vip.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1697 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1698 m.Vip.Pfx.Len = buf.DecodeUint8()
1699 m.Vip.Protocol = IPProto(buf.DecodeUint32())
1700 m.Vip.Port = buf.DecodeUint16()
1701 m.Encap = LbEncapType(buf.DecodeUint32())
1702 m.Dscp = IPDscp(buf.DecodeUint8())
1703 m.SrvType = LbSrvType(buf.DecodeUint32())
1704 m.TargetPort = buf.DecodeUint16()
1705 m.FlowTableLength = buf.DecodeUint16()
1709 // LbVipDump defines message 'lb_vip_dump'.
1710 type LbVipDump struct {
1711 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1712 PfxMatcher PrefixMatcher `binapi:"prefix_matcher,name=pfx_matcher" json:"pfx_matcher,omitempty"`
1713 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1714 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1717 func (m *LbVipDump) Reset() { *m = LbVipDump{} }
1718 func (*LbVipDump) GetMessageName() string { return "lb_vip_dump" }
1719 func (*LbVipDump) GetCrcString() string { return "c7bcb124" }
1720 func (*LbVipDump) GetMessageType() api.MessageType {
1721 return api.RequestMessage
1724 func (m *LbVipDump) Size() (size int) {
1728 size += 4 // m.Pfx.Address.Af
1729 size += 1 * 16 // m.Pfx.Address.Un
1730 size += 1 // m.Pfx.Len
1731 size += 1 // m.PfxMatcher.Le
1732 size += 1 // m.PfxMatcher.Ge
1733 size += 1 // m.Protocol
1737 func (m *LbVipDump) Marshal(b []byte) ([]byte, error) {
1739 b = make([]byte, m.Size())
1741 buf := codec.NewBuffer(b)
1742 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1743 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1744 buf.EncodeUint8(m.Pfx.Len)
1745 buf.EncodeUint8(m.PfxMatcher.Le)
1746 buf.EncodeUint8(m.PfxMatcher.Ge)
1747 buf.EncodeUint8(m.Protocol)
1748 buf.EncodeUint16(m.Port)
1749 return buf.Bytes(), nil
1751 func (m *LbVipDump) Unmarshal(b []byte) error {
1752 buf := codec.NewBuffer(b)
1753 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1754 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1755 m.Pfx.Len = buf.DecodeUint8()
1756 m.PfxMatcher.Le = buf.DecodeUint8()
1757 m.PfxMatcher.Ge = buf.DecodeUint8()
1758 m.Protocol = buf.DecodeUint8()
1759 m.Port = buf.DecodeUint16()
1763 func init() { file_lb_binapi_init() }
1764 func file_lb_binapi_init() {
1765 api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_78628987")
1766 api.RegisterMessage((*LbAddDelAsReply)(nil), "lb_add_del_as_reply_e8d4e804")
1767 api.RegisterMessage((*LbAddDelIntfNat4)(nil), "lb_add_del_intf_nat4_47d6e753")
1768 api.RegisterMessage((*LbAddDelIntfNat4Reply)(nil), "lb_add_del_intf_nat4_reply_e8d4e804")
1769 api.RegisterMessage((*LbAddDelIntfNat6)(nil), "lb_add_del_intf_nat6_47d6e753")
1770 api.RegisterMessage((*LbAddDelIntfNat6Reply)(nil), "lb_add_del_intf_nat6_reply_e8d4e804")
1771 api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_d15b7ddc")
1772 api.RegisterMessage((*LbAddDelVipReply)(nil), "lb_add_del_vip_reply_e8d4e804")
1773 api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_9c39f60e")
1774 api.RegisterMessage((*LbAsDump)(nil), "lb_as_dump_1063f819")
1775 api.RegisterMessage((*LbConf)(nil), "lb_conf_22ddb739")
1776 api.RegisterMessage((*LbConfReply)(nil), "lb_conf_reply_e8d4e804")
1777 api.RegisterMessage((*LbFlushVip)(nil), "lb_flush_vip_1063f819")
1778 api.RegisterMessage((*LbFlushVipReply)(nil), "lb_flush_vip_reply_e8d4e804")
1779 api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_08f39bed")
1780 api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_c7bcb124")
1783 // Messages returns list of all messages in this module.
1784 func AllMessages() []api.Message {
1785 return []api.Message{
1787 (*LbAddDelAsReply)(nil),
1788 (*LbAddDelIntfNat4)(nil),
1789 (*LbAddDelIntfNat4Reply)(nil),
1790 (*LbAddDelIntfNat6)(nil),
1791 (*LbAddDelIntfNat6Reply)(nil),
1792 (*LbAddDelVip)(nil),
1793 (*LbAddDelVipReply)(nil),
1794 (*LbAsDetails)(nil),
1797 (*LbConfReply)(nil),
1799 (*LbFlushVipReply)(nil),
1800 (*LbVipDetails)(nil),