1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: .vppapi/plugins/lb.api.json
7 // Package lb contains generated bindings for API file lb.api.
24 api "git.fd.io/govpp.git/api"
25 codec "git.fd.io/govpp.git/codec"
28 // This is a compile-time assertion to ensure that this generated file
29 // is compatible with the GoVPP api package it is being compiled against.
30 // A compilation error at this line likely means your copy of the
31 // GoVPP api package needs to be updated.
32 const _ = api.GoVppAPIPackageIsVersion2
37 VersionCrc = 0x76c36b4c
40 // AddressFamily defines enum 'address_family'.
41 type AddressFamily uint32
44 ADDRESS_IP4 AddressFamily = 0
45 ADDRESS_IP6 AddressFamily = 1
49 AddressFamily_name = map[uint32]string{
53 AddressFamily_value = map[string]uint32{
59 func (x AddressFamily) String() string {
60 s, ok := AddressFamily_name[uint32(x)]
64 return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
67 // IfStatusFlags defines enum 'if_status_flags'.
68 type IfStatusFlags uint32
71 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
72 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
76 IfStatusFlags_name = map[uint32]string{
77 1: "IF_STATUS_API_FLAG_ADMIN_UP",
78 2: "IF_STATUS_API_FLAG_LINK_UP",
80 IfStatusFlags_value = map[string]uint32{
81 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
82 "IF_STATUS_API_FLAG_LINK_UP": 2,
86 func (x IfStatusFlags) String() string {
87 s, ok := IfStatusFlags_name[uint32(x)]
91 str := func(n uint32) string {
92 s, ok := IfStatusFlags_name[uint32(n)]
96 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
98 for i := uint32(0); i <= 32; i++ {
108 return str(uint32(x))
113 // IfType defines enum 'if_type'.
117 IF_API_TYPE_HARDWARE IfType = 1
118 IF_API_TYPE_SUB IfType = 2
119 IF_API_TYPE_P2P IfType = 3
120 IF_API_TYPE_PIPE IfType = 4
124 IfType_name = map[uint32]string{
125 1: "IF_API_TYPE_HARDWARE",
126 2: "IF_API_TYPE_SUB",
127 3: "IF_API_TYPE_P2P",
128 4: "IF_API_TYPE_PIPE",
130 IfType_value = map[string]uint32{
131 "IF_API_TYPE_HARDWARE": 1,
132 "IF_API_TYPE_SUB": 2,
133 "IF_API_TYPE_P2P": 3,
134 "IF_API_TYPE_PIPE": 4,
138 func (x IfType) String() string {
139 s, ok := IfType_name[uint32(x)]
143 return "IfType(" + strconv.Itoa(int(x)) + ")"
146 // IPDscp defines enum 'ip_dscp'.
150 IP_API_DSCP_CS0 IPDscp = 0
151 IP_API_DSCP_CS1 IPDscp = 8
152 IP_API_DSCP_AF11 IPDscp = 10
153 IP_API_DSCP_AF12 IPDscp = 12
154 IP_API_DSCP_AF13 IPDscp = 14
155 IP_API_DSCP_CS2 IPDscp = 16
156 IP_API_DSCP_AF21 IPDscp = 18
157 IP_API_DSCP_AF22 IPDscp = 20
158 IP_API_DSCP_AF23 IPDscp = 22
159 IP_API_DSCP_CS3 IPDscp = 24
160 IP_API_DSCP_AF31 IPDscp = 26
161 IP_API_DSCP_AF32 IPDscp = 28
162 IP_API_DSCP_AF33 IPDscp = 30
163 IP_API_DSCP_CS4 IPDscp = 32
164 IP_API_DSCP_AF41 IPDscp = 34
165 IP_API_DSCP_AF42 IPDscp = 36
166 IP_API_DSCP_AF43 IPDscp = 38
167 IP_API_DSCP_CS5 IPDscp = 40
168 IP_API_DSCP_EF IPDscp = 46
169 IP_API_DSCP_CS6 IPDscp = 48
170 IP_API_DSCP_CS7 IPDscp = 50
174 IPDscp_name = map[uint8]string{
175 0: "IP_API_DSCP_CS0",
176 8: "IP_API_DSCP_CS1",
177 10: "IP_API_DSCP_AF11",
178 12: "IP_API_DSCP_AF12",
179 14: "IP_API_DSCP_AF13",
180 16: "IP_API_DSCP_CS2",
181 18: "IP_API_DSCP_AF21",
182 20: "IP_API_DSCP_AF22",
183 22: "IP_API_DSCP_AF23",
184 24: "IP_API_DSCP_CS3",
185 26: "IP_API_DSCP_AF31",
186 28: "IP_API_DSCP_AF32",
187 30: "IP_API_DSCP_AF33",
188 32: "IP_API_DSCP_CS4",
189 34: "IP_API_DSCP_AF41",
190 36: "IP_API_DSCP_AF42",
191 38: "IP_API_DSCP_AF43",
192 40: "IP_API_DSCP_CS5",
193 46: "IP_API_DSCP_EF",
194 48: "IP_API_DSCP_CS6",
195 50: "IP_API_DSCP_CS7",
197 IPDscp_value = map[string]uint8{
198 "IP_API_DSCP_CS0": 0,
199 "IP_API_DSCP_CS1": 8,
200 "IP_API_DSCP_AF11": 10,
201 "IP_API_DSCP_AF12": 12,
202 "IP_API_DSCP_AF13": 14,
203 "IP_API_DSCP_CS2": 16,
204 "IP_API_DSCP_AF21": 18,
205 "IP_API_DSCP_AF22": 20,
206 "IP_API_DSCP_AF23": 22,
207 "IP_API_DSCP_CS3": 24,
208 "IP_API_DSCP_AF31": 26,
209 "IP_API_DSCP_AF32": 28,
210 "IP_API_DSCP_AF33": 30,
211 "IP_API_DSCP_CS4": 32,
212 "IP_API_DSCP_AF41": 34,
213 "IP_API_DSCP_AF42": 36,
214 "IP_API_DSCP_AF43": 38,
215 "IP_API_DSCP_CS5": 40,
216 "IP_API_DSCP_EF": 46,
217 "IP_API_DSCP_CS6": 48,
218 "IP_API_DSCP_CS7": 50,
222 func (x IPDscp) String() string {
223 s, ok := IPDscp_name[uint8(x)]
227 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
230 // IPEcn defines enum 'ip_ecn'.
234 IP_API_ECN_NONE IPEcn = 0
235 IP_API_ECN_ECT0 IPEcn = 1
236 IP_API_ECN_ECT1 IPEcn = 2
237 IP_API_ECN_CE IPEcn = 3
241 IPEcn_name = map[uint8]string{
242 0: "IP_API_ECN_NONE",
243 1: "IP_API_ECN_ECT0",
244 2: "IP_API_ECN_ECT1",
247 IPEcn_value = map[string]uint8{
248 "IP_API_ECN_NONE": 0,
249 "IP_API_ECN_ECT0": 1,
250 "IP_API_ECN_ECT1": 2,
255 func (x IPEcn) String() string {
256 s, ok := IPEcn_name[uint8(x)]
260 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
263 // IPProto defines enum 'ip_proto'.
267 IP_API_PROTO_HOPOPT IPProto = 0
268 IP_API_PROTO_ICMP IPProto = 1
269 IP_API_PROTO_IGMP IPProto = 2
270 IP_API_PROTO_TCP IPProto = 6
271 IP_API_PROTO_UDP IPProto = 17
272 IP_API_PROTO_GRE IPProto = 47
273 IP_API_PROTO_AH IPProto = 50
274 IP_API_PROTO_ESP IPProto = 51
275 IP_API_PROTO_EIGRP IPProto = 88
276 IP_API_PROTO_OSPF IPProto = 89
277 IP_API_PROTO_SCTP IPProto = 132
278 IP_API_PROTO_RESERVED IPProto = 255
282 IPProto_name = map[uint32]string{
283 0: "IP_API_PROTO_HOPOPT",
284 1: "IP_API_PROTO_ICMP",
285 2: "IP_API_PROTO_IGMP",
286 6: "IP_API_PROTO_TCP",
287 17: "IP_API_PROTO_UDP",
288 47: "IP_API_PROTO_GRE",
289 50: "IP_API_PROTO_AH",
290 51: "IP_API_PROTO_ESP",
291 88: "IP_API_PROTO_EIGRP",
292 89: "IP_API_PROTO_OSPF",
293 132: "IP_API_PROTO_SCTP",
294 255: "IP_API_PROTO_RESERVED",
296 IPProto_value = map[string]uint32{
297 "IP_API_PROTO_HOPOPT": 0,
298 "IP_API_PROTO_ICMP": 1,
299 "IP_API_PROTO_IGMP": 2,
300 "IP_API_PROTO_TCP": 6,
301 "IP_API_PROTO_UDP": 17,
302 "IP_API_PROTO_GRE": 47,
303 "IP_API_PROTO_AH": 50,
304 "IP_API_PROTO_ESP": 51,
305 "IP_API_PROTO_EIGRP": 88,
306 "IP_API_PROTO_OSPF": 89,
307 "IP_API_PROTO_SCTP": 132,
308 "IP_API_PROTO_RESERVED": 255,
312 func (x IPProto) String() string {
313 s, ok := IPProto_name[uint32(x)]
317 return "IPProto(" + strconv.Itoa(int(x)) + ")"
320 // LbEncapType defines enum 'lb_encap_type'.
321 type LbEncapType uint32
324 LB_API_ENCAP_TYPE_GRE4 LbEncapType = 0
325 LB_API_ENCAP_TYPE_GRE6 LbEncapType = 1
326 LB_API_ENCAP_TYPE_L3DSR LbEncapType = 2
327 LB_API_ENCAP_TYPE_NAT4 LbEncapType = 3
328 LB_API_ENCAP_TYPE_NAT6 LbEncapType = 4
329 LB_API_ENCAP_N_TYPES LbEncapType = 5
333 LbEncapType_name = map[uint32]string{
334 0: "LB_API_ENCAP_TYPE_GRE4",
335 1: "LB_API_ENCAP_TYPE_GRE6",
336 2: "LB_API_ENCAP_TYPE_L3DSR",
337 3: "LB_API_ENCAP_TYPE_NAT4",
338 4: "LB_API_ENCAP_TYPE_NAT6",
339 5: "LB_API_ENCAP_N_TYPES",
341 LbEncapType_value = map[string]uint32{
342 "LB_API_ENCAP_TYPE_GRE4": 0,
343 "LB_API_ENCAP_TYPE_GRE6": 1,
344 "LB_API_ENCAP_TYPE_L3DSR": 2,
345 "LB_API_ENCAP_TYPE_NAT4": 3,
346 "LB_API_ENCAP_TYPE_NAT6": 4,
347 "LB_API_ENCAP_N_TYPES": 5,
351 func (x LbEncapType) String() string {
352 s, ok := LbEncapType_name[uint32(x)]
356 return "LbEncapType(" + strconv.Itoa(int(x)) + ")"
359 // LbLkpTypeT defines enum 'lb_lkp_type_t'.
360 type LbLkpTypeT uint32
363 LB_API_LKP_SAME_IP_PORT LbLkpTypeT = 0
364 LB_API_LKP_DIFF_IP_PORT LbLkpTypeT = 1
365 LB_API_LKP_ALL_PORT_IP LbLkpTypeT = 2
366 LB_API_LKP_N_TYPES LbLkpTypeT = 3
370 LbLkpTypeT_name = map[uint32]string{
371 0: "LB_API_LKP_SAME_IP_PORT",
372 1: "LB_API_LKP_DIFF_IP_PORT",
373 2: "LB_API_LKP_ALL_PORT_IP",
374 3: "LB_API_LKP_N_TYPES",
376 LbLkpTypeT_value = map[string]uint32{
377 "LB_API_LKP_SAME_IP_PORT": 0,
378 "LB_API_LKP_DIFF_IP_PORT": 1,
379 "LB_API_LKP_ALL_PORT_IP": 2,
380 "LB_API_LKP_N_TYPES": 3,
384 func (x LbLkpTypeT) String() string {
385 s, ok := LbLkpTypeT_name[uint32(x)]
389 return "LbLkpTypeT(" + strconv.Itoa(int(x)) + ")"
392 // LbNatProtocol defines enum 'lb_nat_protocol'.
393 type LbNatProtocol uint32
396 LB_API_NAT_PROTOCOL_UDP LbNatProtocol = 6
397 LB_API_NAT_PROTOCOL_TCP LbNatProtocol = 23
398 LB_API_NAT_PROTOCOL_ANY LbNatProtocol = 4294967295
402 LbNatProtocol_name = map[uint32]string{
403 6: "LB_API_NAT_PROTOCOL_UDP",
404 23: "LB_API_NAT_PROTOCOL_TCP",
405 4294967295: "LB_API_NAT_PROTOCOL_ANY",
407 LbNatProtocol_value = map[string]uint32{
408 "LB_API_NAT_PROTOCOL_UDP": 6,
409 "LB_API_NAT_PROTOCOL_TCP": 23,
410 "LB_API_NAT_PROTOCOL_ANY": 4294967295,
414 func (x LbNatProtocol) String() string {
415 s, ok := LbNatProtocol_name[uint32(x)]
419 return "LbNatProtocol(" + strconv.Itoa(int(x)) + ")"
422 // LbSrvType defines enum 'lb_srv_type'.
423 type LbSrvType uint32
426 LB_API_SRV_TYPE_CLUSTERIP LbSrvType = 0
427 LB_API_SRV_TYPE_NODEPORT LbSrvType = 1
428 LB_API_SRV_N_TYPES LbSrvType = 2
432 LbSrvType_name = map[uint32]string{
433 0: "LB_API_SRV_TYPE_CLUSTERIP",
434 1: "LB_API_SRV_TYPE_NODEPORT",
435 2: "LB_API_SRV_N_TYPES",
437 LbSrvType_value = map[string]uint32{
438 "LB_API_SRV_TYPE_CLUSTERIP": 0,
439 "LB_API_SRV_TYPE_NODEPORT": 1,
440 "LB_API_SRV_N_TYPES": 2,
444 func (x LbSrvType) String() string {
445 s, ok := LbSrvType_name[uint32(x)]
449 return "LbSrvType(" + strconv.Itoa(int(x)) + ")"
452 // LbVipType defines enum 'lb_vip_type'.
453 type LbVipType uint32
456 LB_API_VIP_TYPE_IP6_GRE6 LbVipType = 0
457 LB_API_VIP_TYPE_IP6_GRE4 LbVipType = 1
458 LB_API_VIP_TYPE_IP4_GRE6 LbVipType = 2
459 LB_API_VIP_TYPE_IP4_GRE4 LbVipType = 3
460 LB_API_VIP_TYPE_IP4_L3DSR LbVipType = 4
461 LB_API_VIP_TYPE_IP4_NAT4 LbVipType = 5
462 LB_API_VIP_TYPE_IP6_NAT6 LbVipType = 6
463 LB_API_VIP_N_TYPES LbVipType = 7
467 LbVipType_name = map[uint32]string{
468 0: "LB_API_VIP_TYPE_IP6_GRE6",
469 1: "LB_API_VIP_TYPE_IP6_GRE4",
470 2: "LB_API_VIP_TYPE_IP4_GRE6",
471 3: "LB_API_VIP_TYPE_IP4_GRE4",
472 4: "LB_API_VIP_TYPE_IP4_L3DSR",
473 5: "LB_API_VIP_TYPE_IP4_NAT4",
474 6: "LB_API_VIP_TYPE_IP6_NAT6",
475 7: "LB_API_VIP_N_TYPES",
477 LbVipType_value = map[string]uint32{
478 "LB_API_VIP_TYPE_IP6_GRE6": 0,
479 "LB_API_VIP_TYPE_IP6_GRE4": 1,
480 "LB_API_VIP_TYPE_IP4_GRE6": 2,
481 "LB_API_VIP_TYPE_IP4_GRE4": 3,
482 "LB_API_VIP_TYPE_IP4_L3DSR": 4,
483 "LB_API_VIP_TYPE_IP4_NAT4": 5,
484 "LB_API_VIP_TYPE_IP6_NAT6": 6,
485 "LB_API_VIP_N_TYPES": 7,
489 func (x LbVipType) String() string {
490 s, ok := LbVipType_name[uint32(x)]
494 return "LbVipType(" + strconv.Itoa(int(x)) + ")"
497 // LinkDuplex defines enum 'link_duplex'.
498 type LinkDuplex uint32
501 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
502 LINK_DUPLEX_API_HALF LinkDuplex = 1
503 LINK_DUPLEX_API_FULL LinkDuplex = 2
507 LinkDuplex_name = map[uint32]string{
508 0: "LINK_DUPLEX_API_UNKNOWN",
509 1: "LINK_DUPLEX_API_HALF",
510 2: "LINK_DUPLEX_API_FULL",
512 LinkDuplex_value = map[string]uint32{
513 "LINK_DUPLEX_API_UNKNOWN": 0,
514 "LINK_DUPLEX_API_HALF": 1,
515 "LINK_DUPLEX_API_FULL": 2,
519 func (x LinkDuplex) String() string {
520 s, ok := LinkDuplex_name[uint32(x)]
524 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
527 // MtuProto defines enum 'mtu_proto'.
531 MTU_PROTO_API_L3 MtuProto = 1
532 MTU_PROTO_API_IP4 MtuProto = 2
533 MTU_PROTO_API_IP6 MtuProto = 3
534 MTU_PROTO_API_MPLS MtuProto = 4
535 MTU_PROTO_API_N MtuProto = 5
539 MtuProto_name = map[uint32]string{
540 1: "MTU_PROTO_API_L3",
541 2: "MTU_PROTO_API_IP4",
542 3: "MTU_PROTO_API_IP6",
543 4: "MTU_PROTO_API_MPLS",
544 5: "MTU_PROTO_API_N",
546 MtuProto_value = map[string]uint32{
547 "MTU_PROTO_API_L3": 1,
548 "MTU_PROTO_API_IP4": 2,
549 "MTU_PROTO_API_IP6": 3,
550 "MTU_PROTO_API_MPLS": 4,
551 "MTU_PROTO_API_N": 5,
555 func (x MtuProto) String() string {
556 s, ok := MtuProto_name[uint32(x)]
560 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
563 // RxMode defines enum 'rx_mode'.
567 RX_MODE_API_UNKNOWN RxMode = 0
568 RX_MODE_API_POLLING RxMode = 1
569 RX_MODE_API_INTERRUPT RxMode = 2
570 RX_MODE_API_ADAPTIVE RxMode = 3
571 RX_MODE_API_DEFAULT RxMode = 4
575 RxMode_name = map[uint32]string{
576 0: "RX_MODE_API_UNKNOWN",
577 1: "RX_MODE_API_POLLING",
578 2: "RX_MODE_API_INTERRUPT",
579 3: "RX_MODE_API_ADAPTIVE",
580 4: "RX_MODE_API_DEFAULT",
582 RxMode_value = map[string]uint32{
583 "RX_MODE_API_UNKNOWN": 0,
584 "RX_MODE_API_POLLING": 1,
585 "RX_MODE_API_INTERRUPT": 2,
586 "RX_MODE_API_ADAPTIVE": 3,
587 "RX_MODE_API_DEFAULT": 4,
591 func (x RxMode) String() string {
592 s, ok := RxMode_name[uint32(x)]
596 return "RxMode(" + strconv.Itoa(int(x)) + ")"
599 // SubIfFlags defines enum 'sub_if_flags'.
600 type SubIfFlags uint32
603 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
604 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
605 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
606 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
607 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
608 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
609 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
610 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
611 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
612 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
616 SubIfFlags_name = map[uint32]string{
617 1: "SUB_IF_API_FLAG_NO_TAGS",
618 2: "SUB_IF_API_FLAG_ONE_TAG",
619 4: "SUB_IF_API_FLAG_TWO_TAGS",
620 8: "SUB_IF_API_FLAG_DOT1AD",
621 16: "SUB_IF_API_FLAG_EXACT_MATCH",
622 32: "SUB_IF_API_FLAG_DEFAULT",
623 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
624 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
625 254: "SUB_IF_API_FLAG_MASK_VNET",
626 256: "SUB_IF_API_FLAG_DOT1AH",
628 SubIfFlags_value = map[string]uint32{
629 "SUB_IF_API_FLAG_NO_TAGS": 1,
630 "SUB_IF_API_FLAG_ONE_TAG": 2,
631 "SUB_IF_API_FLAG_TWO_TAGS": 4,
632 "SUB_IF_API_FLAG_DOT1AD": 8,
633 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
634 "SUB_IF_API_FLAG_DEFAULT": 32,
635 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
636 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
637 "SUB_IF_API_FLAG_MASK_VNET": 254,
638 "SUB_IF_API_FLAG_DOT1AH": 256,
642 func (x SubIfFlags) String() string {
643 s, ok := SubIfFlags_name[uint32(x)]
647 str := func(n uint32) string {
648 s, ok := SubIfFlags_name[uint32(n)]
652 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
654 for i := uint32(0); i <= 32; i++ {
664 return str(uint32(x))
669 // AddressWithPrefix defines alias 'address_with_prefix'.
670 type AddressWithPrefix Prefix
672 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
673 prefix, err := ParsePrefix(s)
675 return AddressWithPrefix{}, err
677 return AddressWithPrefix(prefix), nil
680 func (x AddressWithPrefix) String() string {
681 return Prefix(x).String()
684 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
685 return []byte(x.String()), nil
688 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
689 prefix, err := ParseAddressWithPrefix(string(text))
697 // InterfaceIndex defines alias 'interface_index'.
698 type InterfaceIndex uint32
700 // IP4Address defines alias 'ip4_address'.
701 type IP4Address [4]uint8
703 func ParseIP4Address(s string) (IP4Address, error) {
704 ip := net.ParseIP(s).To4()
706 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
708 var ipaddr IP4Address
709 copy(ipaddr[:], ip.To4())
713 func (x IP4Address) ToIP() net.IP {
714 return net.IP(x[:]).To4()
717 func (x IP4Address) String() string {
718 return x.ToIP().String()
721 func (x *IP4Address) MarshalText() ([]byte, error) {
722 return []byte(x.String()), nil
725 func (x *IP4Address) UnmarshalText(text []byte) error {
726 ipaddr, err := ParseIP4Address(string(text))
734 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
735 type IP4AddressWithPrefix IP4Prefix
737 // IP6Address defines alias 'ip6_address'.
738 type IP6Address [16]uint8
740 func ParseIP6Address(s string) (IP6Address, error) {
741 ip := net.ParseIP(s).To16()
743 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
745 var ipaddr IP6Address
746 copy(ipaddr[:], ip.To16())
750 func (x IP6Address) ToIP() net.IP {
751 return net.IP(x[:]).To16()
754 func (x IP6Address) String() string {
755 return x.ToIP().String()
758 func (x *IP6Address) MarshalText() ([]byte, error) {
759 return []byte(x.String()), nil
762 func (x *IP6Address) UnmarshalText(text []byte) error {
763 ipaddr, err := ParseIP6Address(string(text))
771 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
772 type IP6AddressWithPrefix IP6Prefix
774 // Address defines type 'address'.
775 type Address struct {
776 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
777 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
780 func ParseAddress(s string) (Address, error) {
783 return Address{}, fmt.Errorf("invalid address: %s", s)
785 return AddressFromIP(ip), nil
788 func AddressFromIP(ip net.IP) Address {
791 addr.Af = ADDRESS_IP6
793 copy(ip6[:], ip.To16())
796 addr.Af = ADDRESS_IP4
798 copy(ip4[:], ip.To4())
804 func (x Address) ToIP() net.IP {
805 if x.Af == ADDRESS_IP6 {
807 return net.IP(ip6[:]).To16()
810 return net.IP(ip4[:]).To4()
814 func (x Address) String() string {
815 return x.ToIP().String()
818 func (x *Address) MarshalText() ([]byte, error) {
819 return []byte(x.String()), nil
822 func (x *Address) UnmarshalText(text []byte) error {
823 addr, err := ParseAddress(string(text))
831 // IP4Prefix defines type 'ip4_prefix'.
832 type IP4Prefix struct {
833 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
834 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
837 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
838 hasPrefix := strings.Contains(s, "/")
840 ip, network, err := net.ParseCIDR(s)
842 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
844 maskSize, _ := network.Mask.Size()
845 prefix.Len = byte(maskSize)
846 prefix.Address, err = ParseIP4Address(ip.String())
848 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
852 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
854 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
856 prefix.Len = byte(defaultMaskSize)
857 prefix.Address, err = ParseIP4Address(ip.String())
859 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
865 func (x IP4Prefix) ToIPNet() *net.IPNet {
866 mask := net.CIDRMask(int(x.Len), 32)
867 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
871 func (x IP4Prefix) String() string {
872 ip := x.Address.String()
873 return ip + "/" + strconv.Itoa(int(x.Len))
876 func (x *IP4Prefix) MarshalText() ([]byte, error) {
877 return []byte(x.String()), nil
880 func (x *IP4Prefix) UnmarshalText(text []byte) error {
881 prefix, err := ParseIP4Prefix(string(text))
889 // IP6Prefix defines type 'ip6_prefix'.
890 type IP6Prefix struct {
891 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
892 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
895 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
896 hasPrefix := strings.Contains(s, "/")
898 ip, network, err := net.ParseCIDR(s)
900 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
902 maskSize, _ := network.Mask.Size()
903 prefix.Len = byte(maskSize)
904 prefix.Address, err = ParseIP6Address(ip.String())
906 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
910 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
912 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
914 prefix.Len = byte(defaultMaskSize)
915 prefix.Address, err = ParseIP6Address(ip.String())
917 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
923 func (x IP6Prefix) ToIPNet() *net.IPNet {
924 mask := net.CIDRMask(int(x.Len), 128)
925 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
929 func (x IP6Prefix) String() string {
930 ip := x.Address.String()
931 return ip + "/" + strconv.Itoa(int(x.Len))
934 func (x *IP6Prefix) MarshalText() ([]byte, error) {
935 return []byte(x.String()), nil
938 func (x *IP6Prefix) UnmarshalText(text []byte) error {
939 prefix, err := ParseIP6Prefix(string(text))
947 // LbVip defines type 'lb_vip'.
949 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
950 Protocol IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
951 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
954 // Mprefix defines type 'mprefix'.
955 type Mprefix struct {
956 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
957 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
958 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
959 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
962 // Prefix defines type 'prefix'.
964 Address Address `binapi:"address,name=address" json:"address,omitempty"`
965 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
968 func ParsePrefix(ip string) (prefix Prefix, err error) {
969 hasPrefix := strings.Contains(ip, "/")
971 netIP, network, err := net.ParseCIDR(ip)
973 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
975 maskSize, _ := network.Mask.Size()
976 prefix.Len = byte(maskSize)
977 prefix.Address, err = ParseAddress(netIP.String())
979 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
982 netIP := net.ParseIP(ip)
983 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
984 if netIP.To4() == nil {
985 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
987 prefix.Len = byte(defaultMaskSize)
988 prefix.Address, err = ParseAddress(netIP.String())
990 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
996 func (x Prefix) ToIPNet() *net.IPNet {
998 if x.Address.Af == ADDRESS_IP4 {
999 mask = net.CIDRMask(int(x.Len), 32)
1001 mask = net.CIDRMask(int(x.Len), 128)
1003 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1007 func (x Prefix) String() string {
1008 ip := x.Address.String()
1009 return ip + "/" + strconv.Itoa(int(x.Len))
1012 func (x *Prefix) MarshalText() ([]byte, error) {
1013 return []byte(x.String()), nil
1016 func (x *Prefix) UnmarshalText(text []byte) error {
1017 prefix, err := ParsePrefix(string(text))
1025 // PrefixMatcher defines type 'prefix_matcher'.
1026 type PrefixMatcher struct {
1027 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1028 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1031 // AddressUnion defines union 'address_union'.
1032 type AddressUnion struct {
1033 // AddressUnion can be one of:
1034 // - IP4 *IP4Address
1035 // - IP6 *IP6Address
1036 XXX_UnionData [16]byte
1039 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1043 func (u *AddressUnion) SetIP4(a IP4Address) {
1044 buf := codec.NewBuffer(u.XXX_UnionData[:])
1045 buf.EncodeBytes(a[:], 4)
1047 func (u *AddressUnion) GetIP4() (a IP4Address) {
1048 buf := codec.NewBuffer(u.XXX_UnionData[:])
1049 copy(a[:], buf.DecodeBytes(4))
1053 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1057 func (u *AddressUnion) SetIP6(a IP6Address) {
1058 buf := codec.NewBuffer(u.XXX_UnionData[:])
1059 buf.EncodeBytes(a[:], 16)
1061 func (u *AddressUnion) GetIP6() (a IP6Address) {
1062 buf := codec.NewBuffer(u.XXX_UnionData[:])
1063 copy(a[:], buf.DecodeBytes(16))
1067 // LbAddDelAs defines message 'lb_add_del_as'.
1068 type LbAddDelAs struct {
1069 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1070 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1071 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1072 AsAddress Address `binapi:"address,name=as_address" json:"as_address,omitempty"`
1073 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
1074 IsFlush bool `binapi:"bool,name=is_flush" json:"is_flush,omitempty"`
1077 func (m *LbAddDelAs) Reset() { *m = LbAddDelAs{} }
1078 func (*LbAddDelAs) GetMessageName() string { return "lb_add_del_as" }
1079 func (*LbAddDelAs) GetCrcString() string { return "78628987" }
1080 func (*LbAddDelAs) GetMessageType() api.MessageType {
1081 return api.RequestMessage
1084 func (m *LbAddDelAs) Size() (size int) {
1088 size += 4 // m.Pfx.Address.Af
1089 size += 1 * 16 // m.Pfx.Address.Un
1090 size += 1 // m.Pfx.Len
1091 size += 1 // m.Protocol
1093 size += 4 // m.AsAddress.Af
1094 size += 1 * 16 // m.AsAddress.Un
1095 size += 1 // m.IsDel
1096 size += 1 // m.IsFlush
1099 func (m *LbAddDelAs) Marshal(b []byte) ([]byte, error) {
1101 b = make([]byte, m.Size())
1103 buf := codec.NewBuffer(b)
1104 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1105 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1106 buf.EncodeUint8(m.Pfx.Len)
1107 buf.EncodeUint8(m.Protocol)
1108 buf.EncodeUint16(m.Port)
1109 buf.EncodeUint32(uint32(m.AsAddress.Af))
1110 buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 16)
1111 buf.EncodeBool(m.IsDel)
1112 buf.EncodeBool(m.IsFlush)
1113 return buf.Bytes(), nil
1115 func (m *LbAddDelAs) Unmarshal(b []byte) error {
1116 buf := codec.NewBuffer(b)
1117 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1118 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1119 m.Pfx.Len = buf.DecodeUint8()
1120 m.Protocol = buf.DecodeUint8()
1121 m.Port = buf.DecodeUint16()
1122 m.AsAddress.Af = AddressFamily(buf.DecodeUint32())
1123 copy(m.AsAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1124 m.IsDel = buf.DecodeBool()
1125 m.IsFlush = buf.DecodeBool()
1129 // LbAddDelAsReply defines message 'lb_add_del_as_reply'.
1130 type LbAddDelAsReply struct {
1131 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1134 func (m *LbAddDelAsReply) Reset() { *m = LbAddDelAsReply{} }
1135 func (*LbAddDelAsReply) GetMessageName() string { return "lb_add_del_as_reply" }
1136 func (*LbAddDelAsReply) GetCrcString() string { return "e8d4e804" }
1137 func (*LbAddDelAsReply) GetMessageType() api.MessageType {
1138 return api.ReplyMessage
1141 func (m *LbAddDelAsReply) Size() (size int) {
1145 size += 4 // m.Retval
1148 func (m *LbAddDelAsReply) Marshal(b []byte) ([]byte, error) {
1150 b = make([]byte, m.Size())
1152 buf := codec.NewBuffer(b)
1153 buf.EncodeInt32(m.Retval)
1154 return buf.Bytes(), nil
1156 func (m *LbAddDelAsReply) Unmarshal(b []byte) error {
1157 buf := codec.NewBuffer(b)
1158 m.Retval = buf.DecodeInt32()
1162 // LbAddDelIntfNat4 defines message 'lb_add_del_intf_nat4'.
1163 type LbAddDelIntfNat4 struct {
1164 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1165 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1168 func (m *LbAddDelIntfNat4) Reset() { *m = LbAddDelIntfNat4{} }
1169 func (*LbAddDelIntfNat4) GetMessageName() string { return "lb_add_del_intf_nat4" }
1170 func (*LbAddDelIntfNat4) GetCrcString() string { return "47d6e753" }
1171 func (*LbAddDelIntfNat4) GetMessageType() api.MessageType {
1172 return api.RequestMessage
1175 func (m *LbAddDelIntfNat4) Size() (size int) {
1179 size += 1 // m.IsAdd
1180 size += 4 // m.SwIfIndex
1183 func (m *LbAddDelIntfNat4) Marshal(b []byte) ([]byte, error) {
1185 b = make([]byte, m.Size())
1187 buf := codec.NewBuffer(b)
1188 buf.EncodeBool(m.IsAdd)
1189 buf.EncodeUint32(uint32(m.SwIfIndex))
1190 return buf.Bytes(), nil
1192 func (m *LbAddDelIntfNat4) Unmarshal(b []byte) error {
1193 buf := codec.NewBuffer(b)
1194 m.IsAdd = buf.DecodeBool()
1195 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1199 // LbAddDelIntfNat4Reply defines message 'lb_add_del_intf_nat4_reply'.
1200 type LbAddDelIntfNat4Reply struct {
1201 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1204 func (m *LbAddDelIntfNat4Reply) Reset() { *m = LbAddDelIntfNat4Reply{} }
1205 func (*LbAddDelIntfNat4Reply) GetMessageName() string { return "lb_add_del_intf_nat4_reply" }
1206 func (*LbAddDelIntfNat4Reply) GetCrcString() string { return "e8d4e804" }
1207 func (*LbAddDelIntfNat4Reply) GetMessageType() api.MessageType {
1208 return api.ReplyMessage
1211 func (m *LbAddDelIntfNat4Reply) Size() (size int) {
1215 size += 4 // m.Retval
1218 func (m *LbAddDelIntfNat4Reply) Marshal(b []byte) ([]byte, error) {
1220 b = make([]byte, m.Size())
1222 buf := codec.NewBuffer(b)
1223 buf.EncodeInt32(m.Retval)
1224 return buf.Bytes(), nil
1226 func (m *LbAddDelIntfNat4Reply) Unmarshal(b []byte) error {
1227 buf := codec.NewBuffer(b)
1228 m.Retval = buf.DecodeInt32()
1232 // LbAddDelIntfNat6 defines message 'lb_add_del_intf_nat6'.
1233 type LbAddDelIntfNat6 struct {
1234 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1235 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1238 func (m *LbAddDelIntfNat6) Reset() { *m = LbAddDelIntfNat6{} }
1239 func (*LbAddDelIntfNat6) GetMessageName() string { return "lb_add_del_intf_nat6" }
1240 func (*LbAddDelIntfNat6) GetCrcString() string { return "47d6e753" }
1241 func (*LbAddDelIntfNat6) GetMessageType() api.MessageType {
1242 return api.RequestMessage
1245 func (m *LbAddDelIntfNat6) Size() (size int) {
1249 size += 1 // m.IsAdd
1250 size += 4 // m.SwIfIndex
1253 func (m *LbAddDelIntfNat6) Marshal(b []byte) ([]byte, error) {
1255 b = make([]byte, m.Size())
1257 buf := codec.NewBuffer(b)
1258 buf.EncodeBool(m.IsAdd)
1259 buf.EncodeUint32(uint32(m.SwIfIndex))
1260 return buf.Bytes(), nil
1262 func (m *LbAddDelIntfNat6) Unmarshal(b []byte) error {
1263 buf := codec.NewBuffer(b)
1264 m.IsAdd = buf.DecodeBool()
1265 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1269 // LbAddDelIntfNat6Reply defines message 'lb_add_del_intf_nat6_reply'.
1270 type LbAddDelIntfNat6Reply struct {
1271 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1274 func (m *LbAddDelIntfNat6Reply) Reset() { *m = LbAddDelIntfNat6Reply{} }
1275 func (*LbAddDelIntfNat6Reply) GetMessageName() string { return "lb_add_del_intf_nat6_reply" }
1276 func (*LbAddDelIntfNat6Reply) GetCrcString() string { return "e8d4e804" }
1277 func (*LbAddDelIntfNat6Reply) GetMessageType() api.MessageType {
1278 return api.ReplyMessage
1281 func (m *LbAddDelIntfNat6Reply) Size() (size int) {
1285 size += 4 // m.Retval
1288 func (m *LbAddDelIntfNat6Reply) Marshal(b []byte) ([]byte, error) {
1290 b = make([]byte, m.Size())
1292 buf := codec.NewBuffer(b)
1293 buf.EncodeInt32(m.Retval)
1294 return buf.Bytes(), nil
1296 func (m *LbAddDelIntfNat6Reply) Unmarshal(b []byte) error {
1297 buf := codec.NewBuffer(b)
1298 m.Retval = buf.DecodeInt32()
1302 // LbAddDelVip defines message 'lb_add_del_vip'.
1303 type LbAddDelVip struct {
1304 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1305 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1306 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1307 Encap LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"`
1308 Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"`
1309 Type LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"`
1310 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"`
1311 NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"`
1312 NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=1024" json:"new_flows_table_length,omitempty"`
1313 IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
1316 func (m *LbAddDelVip) Reset() { *m = LbAddDelVip{} }
1317 func (*LbAddDelVip) GetMessageName() string { return "lb_add_del_vip" }
1318 func (*LbAddDelVip) GetCrcString() string { return "d15b7ddc" }
1319 func (*LbAddDelVip) GetMessageType() api.MessageType {
1320 return api.RequestMessage
1323 func (m *LbAddDelVip) Size() (size int) {
1327 size += 4 // m.Pfx.Address.Af
1328 size += 1 * 16 // m.Pfx.Address.Un
1329 size += 1 // m.Pfx.Len
1330 size += 1 // m.Protocol
1332 size += 4 // m.Encap
1335 size += 2 // m.TargetPort
1336 size += 2 // m.NodePort
1337 size += 4 // m.NewFlowsTableLength
1338 size += 1 // m.IsDel
1341 func (m *LbAddDelVip) Marshal(b []byte) ([]byte, error) {
1343 b = make([]byte, m.Size())
1345 buf := codec.NewBuffer(b)
1346 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1347 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1348 buf.EncodeUint8(m.Pfx.Len)
1349 buf.EncodeUint8(m.Protocol)
1350 buf.EncodeUint16(m.Port)
1351 buf.EncodeUint32(uint32(m.Encap))
1352 buf.EncodeUint8(m.Dscp)
1353 buf.EncodeUint32(uint32(m.Type))
1354 buf.EncodeUint16(m.TargetPort)
1355 buf.EncodeUint16(m.NodePort)
1356 buf.EncodeUint32(m.NewFlowsTableLength)
1357 buf.EncodeBool(m.IsDel)
1358 return buf.Bytes(), nil
1360 func (m *LbAddDelVip) Unmarshal(b []byte) error {
1361 buf := codec.NewBuffer(b)
1362 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1363 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1364 m.Pfx.Len = buf.DecodeUint8()
1365 m.Protocol = buf.DecodeUint8()
1366 m.Port = buf.DecodeUint16()
1367 m.Encap = LbEncapType(buf.DecodeUint32())
1368 m.Dscp = buf.DecodeUint8()
1369 m.Type = LbSrvType(buf.DecodeUint32())
1370 m.TargetPort = buf.DecodeUint16()
1371 m.NodePort = buf.DecodeUint16()
1372 m.NewFlowsTableLength = buf.DecodeUint32()
1373 m.IsDel = buf.DecodeBool()
1377 // LbAddDelVipReply defines message 'lb_add_del_vip_reply'.
1378 type LbAddDelVipReply struct {
1379 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1382 func (m *LbAddDelVipReply) Reset() { *m = LbAddDelVipReply{} }
1383 func (*LbAddDelVipReply) GetMessageName() string { return "lb_add_del_vip_reply" }
1384 func (*LbAddDelVipReply) GetCrcString() string { return "e8d4e804" }
1385 func (*LbAddDelVipReply) GetMessageType() api.MessageType {
1386 return api.ReplyMessage
1389 func (m *LbAddDelVipReply) Size() (size int) {
1393 size += 4 // m.Retval
1396 func (m *LbAddDelVipReply) Marshal(b []byte) ([]byte, error) {
1398 b = make([]byte, m.Size())
1400 buf := codec.NewBuffer(b)
1401 buf.EncodeInt32(m.Retval)
1402 return buf.Bytes(), nil
1404 func (m *LbAddDelVipReply) Unmarshal(b []byte) error {
1405 buf := codec.NewBuffer(b)
1406 m.Retval = buf.DecodeInt32()
1410 // LbAsDetails defines message 'lb_as_details'.
1411 type LbAsDetails struct {
1412 Vip LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"`
1413 AppSrv Address `binapi:"address,name=app_srv" json:"app_srv,omitempty"`
1414 Flags uint8 `binapi:"u8,name=flags" json:"flags,omitempty"`
1415 InUseSince uint32 `binapi:"u32,name=in_use_since" json:"in_use_since,omitempty"`
1418 func (m *LbAsDetails) Reset() { *m = LbAsDetails{} }
1419 func (*LbAsDetails) GetMessageName() string { return "lb_as_details" }
1420 func (*LbAsDetails) GetCrcString() string { return "9c39f60e" }
1421 func (*LbAsDetails) GetMessageType() api.MessageType {
1422 return api.ReplyMessage
1425 func (m *LbAsDetails) Size() (size int) {
1429 size += 4 // m.Vip.Pfx.Address.Af
1430 size += 1 * 16 // m.Vip.Pfx.Address.Un
1431 size += 1 // m.Vip.Pfx.Len
1432 size += 4 // m.Vip.Protocol
1433 size += 2 // m.Vip.Port
1434 size += 4 // m.AppSrv.Af
1435 size += 1 * 16 // m.AppSrv.Un
1436 size += 1 // m.Flags
1437 size += 4 // m.InUseSince
1440 func (m *LbAsDetails) Marshal(b []byte) ([]byte, error) {
1442 b = make([]byte, m.Size())
1444 buf := codec.NewBuffer(b)
1445 buf.EncodeUint32(uint32(m.Vip.Pfx.Address.Af))
1446 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
1447 buf.EncodeUint8(m.Vip.Pfx.Len)
1448 buf.EncodeUint32(uint32(m.Vip.Protocol))
1449 buf.EncodeUint16(m.Vip.Port)
1450 buf.EncodeUint32(uint32(m.AppSrv.Af))
1451 buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 16)
1452 buf.EncodeUint8(m.Flags)
1453 buf.EncodeUint32(m.InUseSince)
1454 return buf.Bytes(), nil
1456 func (m *LbAsDetails) Unmarshal(b []byte) error {
1457 buf := codec.NewBuffer(b)
1458 m.Vip.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1459 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1460 m.Vip.Pfx.Len = buf.DecodeUint8()
1461 m.Vip.Protocol = IPProto(buf.DecodeUint32())
1462 m.Vip.Port = buf.DecodeUint16()
1463 m.AppSrv.Af = AddressFamily(buf.DecodeUint32())
1464 copy(m.AppSrv.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1465 m.Flags = buf.DecodeUint8()
1466 m.InUseSince = buf.DecodeUint32()
1470 // LbAsDump defines message 'lb_as_dump'.
1471 type LbAsDump struct {
1472 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1473 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"`
1474 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1477 func (m *LbAsDump) Reset() { *m = LbAsDump{} }
1478 func (*LbAsDump) GetMessageName() string { return "lb_as_dump" }
1479 func (*LbAsDump) GetCrcString() string { return "1063f819" }
1480 func (*LbAsDump) GetMessageType() api.MessageType {
1481 return api.RequestMessage
1484 func (m *LbAsDump) Size() (size int) {
1488 size += 4 // m.Pfx.Address.Af
1489 size += 1 * 16 // m.Pfx.Address.Un
1490 size += 1 // m.Pfx.Len
1491 size += 1 // m.Protocol
1495 func (m *LbAsDump) Marshal(b []byte) ([]byte, error) {
1497 b = make([]byte, m.Size())
1499 buf := codec.NewBuffer(b)
1500 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1501 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1502 buf.EncodeUint8(m.Pfx.Len)
1503 buf.EncodeUint8(m.Protocol)
1504 buf.EncodeUint16(m.Port)
1505 return buf.Bytes(), nil
1507 func (m *LbAsDump) Unmarshal(b []byte) error {
1508 buf := codec.NewBuffer(b)
1509 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1510 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1511 m.Pfx.Len = buf.DecodeUint8()
1512 m.Protocol = buf.DecodeUint8()
1513 m.Port = buf.DecodeUint16()
1517 // LbConf defines message 'lb_conf'.
1518 type LbConf struct {
1519 IP4SrcAddress IP4Address `binapi:"ip4_address,name=ip4_src_address" json:"ip4_src_address,omitempty"`
1520 IP6SrcAddress IP6Address `binapi:"ip6_address,name=ip6_src_address" json:"ip6_src_address,omitempty"`
1521 StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core" json:"sticky_buckets_per_core,omitempty"`
1522 FlowTimeout uint32 `binapi:"u32,name=flow_timeout" json:"flow_timeout,omitempty"`
1525 func (m *LbConf) Reset() { *m = LbConf{} }
1526 func (*LbConf) GetMessageName() string { return "lb_conf" }
1527 func (*LbConf) GetCrcString() string { return "22ddb739" }
1528 func (*LbConf) GetMessageType() api.MessageType {
1529 return api.RequestMessage
1532 func (m *LbConf) Size() (size int) {
1536 size += 1 * 4 // m.IP4SrcAddress
1537 size += 1 * 16 // m.IP6SrcAddress
1538 size += 4 // m.StickyBucketsPerCore
1539 size += 4 // m.FlowTimeout
1542 func (m *LbConf) Marshal(b []byte) ([]byte, error) {
1544 b = make([]byte, m.Size())
1546 buf := codec.NewBuffer(b)
1547 buf.EncodeBytes(m.IP4SrcAddress[:], 4)
1548 buf.EncodeBytes(m.IP6SrcAddress[:], 16)
1549 buf.EncodeUint32(m.StickyBucketsPerCore)
1550 buf.EncodeUint32(m.FlowTimeout)
1551 return buf.Bytes(), nil
1553 func (m *LbConf) Unmarshal(b []byte) error {
1554 buf := codec.NewBuffer(b)
1555 copy(m.IP4SrcAddress[:], buf.DecodeBytes(4))
1556 copy(m.IP6SrcAddress[:], buf.DecodeBytes(16))
1557 m.StickyBucketsPerCore = buf.DecodeUint32()
1558 m.FlowTimeout = buf.DecodeUint32()
1562 // LbConfReply defines message 'lb_conf_reply'.
1563 type LbConfReply struct {
1564 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1567 func (m *LbConfReply) Reset() { *m = LbConfReply{} }
1568 func (*LbConfReply) GetMessageName() string { return "lb_conf_reply" }
1569 func (*LbConfReply) GetCrcString() string { return "e8d4e804" }
1570 func (*LbConfReply) GetMessageType() api.MessageType {
1571 return api.ReplyMessage
1574 func (m *LbConfReply) Size() (size int) {
1578 size += 4 // m.Retval
1581 func (m *LbConfReply) Marshal(b []byte) ([]byte, error) {
1583 b = make([]byte, m.Size())
1585 buf := codec.NewBuffer(b)
1586 buf.EncodeInt32(m.Retval)
1587 return buf.Bytes(), nil
1589 func (m *LbConfReply) Unmarshal(b []byte) error {
1590 buf := codec.NewBuffer(b)
1591 m.Retval = buf.DecodeInt32()
1595 // LbFlushVip defines message 'lb_flush_vip'.
1596 type LbFlushVip struct {
1597 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1598 Protocol uint8 `binapi:"u8,name=protocol" json:"protocol,omitempty"`
1599 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1602 func (m *LbFlushVip) Reset() { *m = LbFlushVip{} }
1603 func (*LbFlushVip) GetMessageName() string { return "lb_flush_vip" }
1604 func (*LbFlushVip) GetCrcString() string { return "1063f819" }
1605 func (*LbFlushVip) GetMessageType() api.MessageType {
1606 return api.RequestMessage
1609 func (m *LbFlushVip) Size() (size int) {
1613 size += 4 // m.Pfx.Address.Af
1614 size += 1 * 16 // m.Pfx.Address.Un
1615 size += 1 // m.Pfx.Len
1616 size += 1 // m.Protocol
1620 func (m *LbFlushVip) Marshal(b []byte) ([]byte, error) {
1622 b = make([]byte, m.Size())
1624 buf := codec.NewBuffer(b)
1625 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1626 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1627 buf.EncodeUint8(m.Pfx.Len)
1628 buf.EncodeUint8(m.Protocol)
1629 buf.EncodeUint16(m.Port)
1630 return buf.Bytes(), nil
1632 func (m *LbFlushVip) Unmarshal(b []byte) error {
1633 buf := codec.NewBuffer(b)
1634 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1635 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1636 m.Pfx.Len = buf.DecodeUint8()
1637 m.Protocol = buf.DecodeUint8()
1638 m.Port = buf.DecodeUint16()
1642 // LbFlushVipReply defines message 'lb_flush_vip_reply'.
1643 type LbFlushVipReply struct {
1644 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1647 func (m *LbFlushVipReply) Reset() { *m = LbFlushVipReply{} }
1648 func (*LbFlushVipReply) GetMessageName() string { return "lb_flush_vip_reply" }
1649 func (*LbFlushVipReply) GetCrcString() string { return "e8d4e804" }
1650 func (*LbFlushVipReply) GetMessageType() api.MessageType {
1651 return api.ReplyMessage
1654 func (m *LbFlushVipReply) Size() (size int) {
1658 size += 4 // m.Retval
1661 func (m *LbFlushVipReply) Marshal(b []byte) ([]byte, error) {
1663 b = make([]byte, m.Size())
1665 buf := codec.NewBuffer(b)
1666 buf.EncodeInt32(m.Retval)
1667 return buf.Bytes(), nil
1669 func (m *LbFlushVipReply) Unmarshal(b []byte) error {
1670 buf := codec.NewBuffer(b)
1671 m.Retval = buf.DecodeInt32()
1675 // LbVipDetails defines message 'lb_vip_details'.
1676 type LbVipDetails struct {
1677 Vip LbVip `binapi:"lb_vip,name=vip" json:"vip,omitempty"`
1678 Encap LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"`
1679 Dscp IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"`
1680 SrvType LbSrvType `binapi:"lb_srv_type,name=srv_type" json:"srv_type,omitempty"`
1681 TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"`
1682 FlowTableLength uint16 `binapi:"u16,name=flow_table_length" json:"flow_table_length,omitempty"`
1685 func (m *LbVipDetails) Reset() { *m = LbVipDetails{} }
1686 func (*LbVipDetails) GetMessageName() string { return "lb_vip_details" }
1687 func (*LbVipDetails) GetCrcString() string { return "08f39bed" }
1688 func (*LbVipDetails) GetMessageType() api.MessageType {
1689 return api.ReplyMessage
1692 func (m *LbVipDetails) Size() (size int) {
1696 size += 4 // m.Vip.Pfx.Address.Af
1697 size += 1 * 16 // m.Vip.Pfx.Address.Un
1698 size += 1 // m.Vip.Pfx.Len
1699 size += 4 // m.Vip.Protocol
1700 size += 2 // m.Vip.Port
1701 size += 4 // m.Encap
1703 size += 4 // m.SrvType
1704 size += 2 // m.TargetPort
1705 size += 2 // m.FlowTableLength
1708 func (m *LbVipDetails) Marshal(b []byte) ([]byte, error) {
1710 b = make([]byte, m.Size())
1712 buf := codec.NewBuffer(b)
1713 buf.EncodeUint32(uint32(m.Vip.Pfx.Address.Af))
1714 buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
1715 buf.EncodeUint8(m.Vip.Pfx.Len)
1716 buf.EncodeUint32(uint32(m.Vip.Protocol))
1717 buf.EncodeUint16(m.Vip.Port)
1718 buf.EncodeUint32(uint32(m.Encap))
1719 buf.EncodeUint8(uint8(m.Dscp))
1720 buf.EncodeUint32(uint32(m.SrvType))
1721 buf.EncodeUint16(m.TargetPort)
1722 buf.EncodeUint16(m.FlowTableLength)
1723 return buf.Bytes(), nil
1725 func (m *LbVipDetails) Unmarshal(b []byte) error {
1726 buf := codec.NewBuffer(b)
1727 m.Vip.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1728 copy(m.Vip.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1729 m.Vip.Pfx.Len = buf.DecodeUint8()
1730 m.Vip.Protocol = IPProto(buf.DecodeUint32())
1731 m.Vip.Port = buf.DecodeUint16()
1732 m.Encap = LbEncapType(buf.DecodeUint32())
1733 m.Dscp = IPDscp(buf.DecodeUint8())
1734 m.SrvType = LbSrvType(buf.DecodeUint32())
1735 m.TargetPort = buf.DecodeUint16()
1736 m.FlowTableLength = buf.DecodeUint16()
1740 // LbVipDump defines message 'lb_vip_dump'.
1741 type LbVipDump struct {
1742 Pfx AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
1743 PfxMatcher PrefixMatcher `binapi:"prefix_matcher,name=pfx_matcher" json:"pfx_matcher,omitempty"`
1744 Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
1745 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
1748 func (m *LbVipDump) Reset() { *m = LbVipDump{} }
1749 func (*LbVipDump) GetMessageName() string { return "lb_vip_dump" }
1750 func (*LbVipDump) GetCrcString() string { return "c7bcb124" }
1751 func (*LbVipDump) GetMessageType() api.MessageType {
1752 return api.RequestMessage
1755 func (m *LbVipDump) Size() (size int) {
1759 size += 4 // m.Pfx.Address.Af
1760 size += 1 * 16 // m.Pfx.Address.Un
1761 size += 1 // m.Pfx.Len
1762 size += 1 // m.PfxMatcher.Le
1763 size += 1 // m.PfxMatcher.Ge
1764 size += 1 // m.Protocol
1768 func (m *LbVipDump) Marshal(b []byte) ([]byte, error) {
1770 b = make([]byte, m.Size())
1772 buf := codec.NewBuffer(b)
1773 buf.EncodeUint32(uint32(m.Pfx.Address.Af))
1774 buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
1775 buf.EncodeUint8(m.Pfx.Len)
1776 buf.EncodeUint8(m.PfxMatcher.Le)
1777 buf.EncodeUint8(m.PfxMatcher.Ge)
1778 buf.EncodeUint8(m.Protocol)
1779 buf.EncodeUint16(m.Port)
1780 return buf.Bytes(), nil
1782 func (m *LbVipDump) Unmarshal(b []byte) error {
1783 buf := codec.NewBuffer(b)
1784 m.Pfx.Address.Af = AddressFamily(buf.DecodeUint32())
1785 copy(m.Pfx.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1786 m.Pfx.Len = buf.DecodeUint8()
1787 m.PfxMatcher.Le = buf.DecodeUint8()
1788 m.PfxMatcher.Ge = buf.DecodeUint8()
1789 m.Protocol = buf.DecodeUint8()
1790 m.Port = buf.DecodeUint16()
1794 func init() { file_lb_binapi_init() }
1795 func file_lb_binapi_init() {
1796 api.RegisterMessage((*LbAddDelAs)(nil), "lb_add_del_as_78628987")
1797 api.RegisterMessage((*LbAddDelAsReply)(nil), "lb_add_del_as_reply_e8d4e804")
1798 api.RegisterMessage((*LbAddDelIntfNat4)(nil), "lb_add_del_intf_nat4_47d6e753")
1799 api.RegisterMessage((*LbAddDelIntfNat4Reply)(nil), "lb_add_del_intf_nat4_reply_e8d4e804")
1800 api.RegisterMessage((*LbAddDelIntfNat6)(nil), "lb_add_del_intf_nat6_47d6e753")
1801 api.RegisterMessage((*LbAddDelIntfNat6Reply)(nil), "lb_add_del_intf_nat6_reply_e8d4e804")
1802 api.RegisterMessage((*LbAddDelVip)(nil), "lb_add_del_vip_d15b7ddc")
1803 api.RegisterMessage((*LbAddDelVipReply)(nil), "lb_add_del_vip_reply_e8d4e804")
1804 api.RegisterMessage((*LbAsDetails)(nil), "lb_as_details_9c39f60e")
1805 api.RegisterMessage((*LbAsDump)(nil), "lb_as_dump_1063f819")
1806 api.RegisterMessage((*LbConf)(nil), "lb_conf_22ddb739")
1807 api.RegisterMessage((*LbConfReply)(nil), "lb_conf_reply_e8d4e804")
1808 api.RegisterMessage((*LbFlushVip)(nil), "lb_flush_vip_1063f819")
1809 api.RegisterMessage((*LbFlushVipReply)(nil), "lb_flush_vip_reply_e8d4e804")
1810 api.RegisterMessage((*LbVipDetails)(nil), "lb_vip_details_08f39bed")
1811 api.RegisterMessage((*LbVipDump)(nil), "lb_vip_dump_c7bcb124")
1814 // Messages returns list of all messages in this module.
1815 func AllMessages() []api.Message {
1816 return []api.Message{
1818 (*LbAddDelAsReply)(nil),
1819 (*LbAddDelIntfNat4)(nil),
1820 (*LbAddDelIntfNat4Reply)(nil),
1821 (*LbAddDelIntfNat6)(nil),
1822 (*LbAddDelIntfNat6Reply)(nil),
1823 (*LbAddDelVip)(nil),
1824 (*LbAddDelVipReply)(nil),
1825 (*LbAsDetails)(nil),
1828 (*LbConfReply)(nil),
1830 (*LbFlushVipReply)(nil),
1831 (*LbVipDetails)(nil),