1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: .vppapi/plugins/abf.api.json
7 // Package abf contains generated bindings for API file abf.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 = 0xc2e5c644
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 // FibPathFlags defines enum 'fib_path_flags'.
67 type FibPathFlags uint32
70 FIB_API_PATH_FLAG_NONE FibPathFlags = 0
71 FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
72 FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2
73 FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4
77 FibPathFlags_name = map[uint32]string{
78 0: "FIB_API_PATH_FLAG_NONE",
79 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
80 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
81 4: "FIB_API_PATH_FLAG_POP_PW_CW",
83 FibPathFlags_value = map[string]uint32{
84 "FIB_API_PATH_FLAG_NONE": 0,
85 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
86 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2,
87 "FIB_API_PATH_FLAG_POP_PW_CW": 4,
91 func (x FibPathFlags) String() string {
92 s, ok := FibPathFlags_name[uint32(x)]
96 str := func(n uint32) string {
97 s, ok := FibPathFlags_name[uint32(n)]
101 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
103 for i := uint32(0); i <= 32; i++ {
113 return str(uint32(x))
118 // FibPathNhProto defines enum 'fib_path_nh_proto'.
119 type FibPathNhProto uint32
122 FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0
123 FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1
124 FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2
125 FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
126 FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4
130 FibPathNhProto_name = map[uint32]string{
131 0: "FIB_API_PATH_NH_PROTO_IP4",
132 1: "FIB_API_PATH_NH_PROTO_IP6",
133 2: "FIB_API_PATH_NH_PROTO_MPLS",
134 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
135 4: "FIB_API_PATH_NH_PROTO_BIER",
137 FibPathNhProto_value = map[string]uint32{
138 "FIB_API_PATH_NH_PROTO_IP4": 0,
139 "FIB_API_PATH_NH_PROTO_IP6": 1,
140 "FIB_API_PATH_NH_PROTO_MPLS": 2,
141 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
142 "FIB_API_PATH_NH_PROTO_BIER": 4,
146 func (x FibPathNhProto) String() string {
147 s, ok := FibPathNhProto_name[uint32(x)]
151 return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
154 // FibPathType defines enum 'fib_path_type'.
155 type FibPathType uint32
158 FIB_API_PATH_TYPE_NORMAL FibPathType = 0
159 FIB_API_PATH_TYPE_LOCAL FibPathType = 1
160 FIB_API_PATH_TYPE_DROP FibPathType = 2
161 FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3
162 FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4
163 FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5
164 FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
165 FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
166 FIB_API_PATH_TYPE_DVR FibPathType = 8
167 FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9
168 FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10
172 FibPathType_name = map[uint32]string{
173 0: "FIB_API_PATH_TYPE_NORMAL",
174 1: "FIB_API_PATH_TYPE_LOCAL",
175 2: "FIB_API_PATH_TYPE_DROP",
176 3: "FIB_API_PATH_TYPE_UDP_ENCAP",
177 4: "FIB_API_PATH_TYPE_BIER_IMP",
178 5: "FIB_API_PATH_TYPE_ICMP_UNREACH",
179 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
180 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
181 8: "FIB_API_PATH_TYPE_DVR",
182 9: "FIB_API_PATH_TYPE_INTERFACE_RX",
183 10: "FIB_API_PATH_TYPE_CLASSIFY",
185 FibPathType_value = map[string]uint32{
186 "FIB_API_PATH_TYPE_NORMAL": 0,
187 "FIB_API_PATH_TYPE_LOCAL": 1,
188 "FIB_API_PATH_TYPE_DROP": 2,
189 "FIB_API_PATH_TYPE_UDP_ENCAP": 3,
190 "FIB_API_PATH_TYPE_BIER_IMP": 4,
191 "FIB_API_PATH_TYPE_ICMP_UNREACH": 5,
192 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
193 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
194 "FIB_API_PATH_TYPE_DVR": 8,
195 "FIB_API_PATH_TYPE_INTERFACE_RX": 9,
196 "FIB_API_PATH_TYPE_CLASSIFY": 10,
200 func (x FibPathType) String() string {
201 s, ok := FibPathType_name[uint32(x)]
205 return "FibPathType(" + strconv.Itoa(int(x)) + ")"
208 // IfStatusFlags defines enum 'if_status_flags'.
209 type IfStatusFlags uint32
212 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
213 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
217 IfStatusFlags_name = map[uint32]string{
218 1: "IF_STATUS_API_FLAG_ADMIN_UP",
219 2: "IF_STATUS_API_FLAG_LINK_UP",
221 IfStatusFlags_value = map[string]uint32{
222 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
223 "IF_STATUS_API_FLAG_LINK_UP": 2,
227 func (x IfStatusFlags) String() string {
228 s, ok := IfStatusFlags_name[uint32(x)]
232 str := func(n uint32) string {
233 s, ok := IfStatusFlags_name[uint32(n)]
237 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
239 for i := uint32(0); i <= 32; i++ {
249 return str(uint32(x))
254 // IfType defines enum 'if_type'.
258 IF_API_TYPE_HARDWARE IfType = 1
259 IF_API_TYPE_SUB IfType = 2
260 IF_API_TYPE_P2P IfType = 3
261 IF_API_TYPE_PIPE IfType = 4
265 IfType_name = map[uint32]string{
266 1: "IF_API_TYPE_HARDWARE",
267 2: "IF_API_TYPE_SUB",
268 3: "IF_API_TYPE_P2P",
269 4: "IF_API_TYPE_PIPE",
271 IfType_value = map[string]uint32{
272 "IF_API_TYPE_HARDWARE": 1,
273 "IF_API_TYPE_SUB": 2,
274 "IF_API_TYPE_P2P": 3,
275 "IF_API_TYPE_PIPE": 4,
279 func (x IfType) String() string {
280 s, ok := IfType_name[uint32(x)]
284 return "IfType(" + strconv.Itoa(int(x)) + ")"
287 // IPDscp defines enum 'ip_dscp'.
291 IP_API_DSCP_CS0 IPDscp = 0
292 IP_API_DSCP_CS1 IPDscp = 8
293 IP_API_DSCP_AF11 IPDscp = 10
294 IP_API_DSCP_AF12 IPDscp = 12
295 IP_API_DSCP_AF13 IPDscp = 14
296 IP_API_DSCP_CS2 IPDscp = 16
297 IP_API_DSCP_AF21 IPDscp = 18
298 IP_API_DSCP_AF22 IPDscp = 20
299 IP_API_DSCP_AF23 IPDscp = 22
300 IP_API_DSCP_CS3 IPDscp = 24
301 IP_API_DSCP_AF31 IPDscp = 26
302 IP_API_DSCP_AF32 IPDscp = 28
303 IP_API_DSCP_AF33 IPDscp = 30
304 IP_API_DSCP_CS4 IPDscp = 32
305 IP_API_DSCP_AF41 IPDscp = 34
306 IP_API_DSCP_AF42 IPDscp = 36
307 IP_API_DSCP_AF43 IPDscp = 38
308 IP_API_DSCP_CS5 IPDscp = 40
309 IP_API_DSCP_EF IPDscp = 46
310 IP_API_DSCP_CS6 IPDscp = 48
311 IP_API_DSCP_CS7 IPDscp = 50
315 IPDscp_name = map[uint8]string{
316 0: "IP_API_DSCP_CS0",
317 8: "IP_API_DSCP_CS1",
318 10: "IP_API_DSCP_AF11",
319 12: "IP_API_DSCP_AF12",
320 14: "IP_API_DSCP_AF13",
321 16: "IP_API_DSCP_CS2",
322 18: "IP_API_DSCP_AF21",
323 20: "IP_API_DSCP_AF22",
324 22: "IP_API_DSCP_AF23",
325 24: "IP_API_DSCP_CS3",
326 26: "IP_API_DSCP_AF31",
327 28: "IP_API_DSCP_AF32",
328 30: "IP_API_DSCP_AF33",
329 32: "IP_API_DSCP_CS4",
330 34: "IP_API_DSCP_AF41",
331 36: "IP_API_DSCP_AF42",
332 38: "IP_API_DSCP_AF43",
333 40: "IP_API_DSCP_CS5",
334 46: "IP_API_DSCP_EF",
335 48: "IP_API_DSCP_CS6",
336 50: "IP_API_DSCP_CS7",
338 IPDscp_value = map[string]uint8{
339 "IP_API_DSCP_CS0": 0,
340 "IP_API_DSCP_CS1": 8,
341 "IP_API_DSCP_AF11": 10,
342 "IP_API_DSCP_AF12": 12,
343 "IP_API_DSCP_AF13": 14,
344 "IP_API_DSCP_CS2": 16,
345 "IP_API_DSCP_AF21": 18,
346 "IP_API_DSCP_AF22": 20,
347 "IP_API_DSCP_AF23": 22,
348 "IP_API_DSCP_CS3": 24,
349 "IP_API_DSCP_AF31": 26,
350 "IP_API_DSCP_AF32": 28,
351 "IP_API_DSCP_AF33": 30,
352 "IP_API_DSCP_CS4": 32,
353 "IP_API_DSCP_AF41": 34,
354 "IP_API_DSCP_AF42": 36,
355 "IP_API_DSCP_AF43": 38,
356 "IP_API_DSCP_CS5": 40,
357 "IP_API_DSCP_EF": 46,
358 "IP_API_DSCP_CS6": 48,
359 "IP_API_DSCP_CS7": 50,
363 func (x IPDscp) String() string {
364 s, ok := IPDscp_name[uint8(x)]
368 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
371 // IPEcn defines enum 'ip_ecn'.
375 IP_API_ECN_NONE IPEcn = 0
376 IP_API_ECN_ECT0 IPEcn = 1
377 IP_API_ECN_ECT1 IPEcn = 2
378 IP_API_ECN_CE IPEcn = 3
382 IPEcn_name = map[uint8]string{
383 0: "IP_API_ECN_NONE",
384 1: "IP_API_ECN_ECT0",
385 2: "IP_API_ECN_ECT1",
388 IPEcn_value = map[string]uint8{
389 "IP_API_ECN_NONE": 0,
390 "IP_API_ECN_ECT0": 1,
391 "IP_API_ECN_ECT1": 2,
396 func (x IPEcn) String() string {
397 s, ok := IPEcn_name[uint8(x)]
401 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
404 // IPProto defines enum 'ip_proto'.
408 IP_API_PROTO_HOPOPT IPProto = 0
409 IP_API_PROTO_ICMP IPProto = 1
410 IP_API_PROTO_IGMP IPProto = 2
411 IP_API_PROTO_TCP IPProto = 6
412 IP_API_PROTO_UDP IPProto = 17
413 IP_API_PROTO_GRE IPProto = 47
414 IP_API_PROTO_AH IPProto = 50
415 IP_API_PROTO_ESP IPProto = 51
416 IP_API_PROTO_EIGRP IPProto = 88
417 IP_API_PROTO_OSPF IPProto = 89
418 IP_API_PROTO_SCTP IPProto = 132
419 IP_API_PROTO_RESERVED IPProto = 255
423 IPProto_name = map[uint32]string{
424 0: "IP_API_PROTO_HOPOPT",
425 1: "IP_API_PROTO_ICMP",
426 2: "IP_API_PROTO_IGMP",
427 6: "IP_API_PROTO_TCP",
428 17: "IP_API_PROTO_UDP",
429 47: "IP_API_PROTO_GRE",
430 50: "IP_API_PROTO_AH",
431 51: "IP_API_PROTO_ESP",
432 88: "IP_API_PROTO_EIGRP",
433 89: "IP_API_PROTO_OSPF",
434 132: "IP_API_PROTO_SCTP",
435 255: "IP_API_PROTO_RESERVED",
437 IPProto_value = map[string]uint32{
438 "IP_API_PROTO_HOPOPT": 0,
439 "IP_API_PROTO_ICMP": 1,
440 "IP_API_PROTO_IGMP": 2,
441 "IP_API_PROTO_TCP": 6,
442 "IP_API_PROTO_UDP": 17,
443 "IP_API_PROTO_GRE": 47,
444 "IP_API_PROTO_AH": 50,
445 "IP_API_PROTO_ESP": 51,
446 "IP_API_PROTO_EIGRP": 88,
447 "IP_API_PROTO_OSPF": 89,
448 "IP_API_PROTO_SCTP": 132,
449 "IP_API_PROTO_RESERVED": 255,
453 func (x IPProto) String() string {
454 s, ok := IPProto_name[uint32(x)]
458 return "IPProto(" + strconv.Itoa(int(x)) + ")"
461 // LinkDuplex defines enum 'link_duplex'.
462 type LinkDuplex uint32
465 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
466 LINK_DUPLEX_API_HALF LinkDuplex = 1
467 LINK_DUPLEX_API_FULL LinkDuplex = 2
471 LinkDuplex_name = map[uint32]string{
472 0: "LINK_DUPLEX_API_UNKNOWN",
473 1: "LINK_DUPLEX_API_HALF",
474 2: "LINK_DUPLEX_API_FULL",
476 LinkDuplex_value = map[string]uint32{
477 "LINK_DUPLEX_API_UNKNOWN": 0,
478 "LINK_DUPLEX_API_HALF": 1,
479 "LINK_DUPLEX_API_FULL": 2,
483 func (x LinkDuplex) String() string {
484 s, ok := LinkDuplex_name[uint32(x)]
488 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
491 // MtuProto defines enum 'mtu_proto'.
495 MTU_PROTO_API_L3 MtuProto = 1
496 MTU_PROTO_API_IP4 MtuProto = 2
497 MTU_PROTO_API_IP6 MtuProto = 3
498 MTU_PROTO_API_MPLS MtuProto = 4
499 MTU_PROTO_API_N MtuProto = 5
503 MtuProto_name = map[uint32]string{
504 1: "MTU_PROTO_API_L3",
505 2: "MTU_PROTO_API_IP4",
506 3: "MTU_PROTO_API_IP6",
507 4: "MTU_PROTO_API_MPLS",
508 5: "MTU_PROTO_API_N",
510 MtuProto_value = map[string]uint32{
511 "MTU_PROTO_API_L3": 1,
512 "MTU_PROTO_API_IP4": 2,
513 "MTU_PROTO_API_IP6": 3,
514 "MTU_PROTO_API_MPLS": 4,
515 "MTU_PROTO_API_N": 5,
519 func (x MtuProto) String() string {
520 s, ok := MtuProto_name[uint32(x)]
524 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
527 // RxMode defines enum 'rx_mode'.
531 RX_MODE_API_UNKNOWN RxMode = 0
532 RX_MODE_API_POLLING RxMode = 1
533 RX_MODE_API_INTERRUPT RxMode = 2
534 RX_MODE_API_ADAPTIVE RxMode = 3
535 RX_MODE_API_DEFAULT RxMode = 4
539 RxMode_name = map[uint32]string{
540 0: "RX_MODE_API_UNKNOWN",
541 1: "RX_MODE_API_POLLING",
542 2: "RX_MODE_API_INTERRUPT",
543 3: "RX_MODE_API_ADAPTIVE",
544 4: "RX_MODE_API_DEFAULT",
546 RxMode_value = map[string]uint32{
547 "RX_MODE_API_UNKNOWN": 0,
548 "RX_MODE_API_POLLING": 1,
549 "RX_MODE_API_INTERRUPT": 2,
550 "RX_MODE_API_ADAPTIVE": 3,
551 "RX_MODE_API_DEFAULT": 4,
555 func (x RxMode) String() string {
556 s, ok := RxMode_name[uint32(x)]
560 return "RxMode(" + strconv.Itoa(int(x)) + ")"
563 // SubIfFlags defines enum 'sub_if_flags'.
564 type SubIfFlags uint32
567 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
568 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
569 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
570 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
571 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
572 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
573 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
574 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
575 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
576 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
580 SubIfFlags_name = map[uint32]string{
581 1: "SUB_IF_API_FLAG_NO_TAGS",
582 2: "SUB_IF_API_FLAG_ONE_TAG",
583 4: "SUB_IF_API_FLAG_TWO_TAGS",
584 8: "SUB_IF_API_FLAG_DOT1AD",
585 16: "SUB_IF_API_FLAG_EXACT_MATCH",
586 32: "SUB_IF_API_FLAG_DEFAULT",
587 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
588 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
589 254: "SUB_IF_API_FLAG_MASK_VNET",
590 256: "SUB_IF_API_FLAG_DOT1AH",
592 SubIfFlags_value = map[string]uint32{
593 "SUB_IF_API_FLAG_NO_TAGS": 1,
594 "SUB_IF_API_FLAG_ONE_TAG": 2,
595 "SUB_IF_API_FLAG_TWO_TAGS": 4,
596 "SUB_IF_API_FLAG_DOT1AD": 8,
597 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
598 "SUB_IF_API_FLAG_DEFAULT": 32,
599 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
600 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
601 "SUB_IF_API_FLAG_MASK_VNET": 254,
602 "SUB_IF_API_FLAG_DOT1AH": 256,
606 func (x SubIfFlags) String() string {
607 s, ok := SubIfFlags_name[uint32(x)]
611 str := func(n uint32) string {
612 s, ok := SubIfFlags_name[uint32(n)]
616 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
618 for i := uint32(0); i <= 32; i++ {
628 return str(uint32(x))
633 // AddressWithPrefix defines alias 'address_with_prefix'.
634 type AddressWithPrefix Prefix
636 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
637 prefix, err := ParsePrefix(s)
639 return AddressWithPrefix{}, err
641 return AddressWithPrefix(prefix), nil
643 func (x AddressWithPrefix) String() string {
644 return Prefix(x).String()
646 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
647 return []byte(x.String()), nil
649 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
650 prefix, err := ParseAddressWithPrefix(string(text))
658 // InterfaceIndex defines alias 'interface_index'.
659 type InterfaceIndex uint32
661 // IP4Address defines alias 'ip4_address'.
662 type IP4Address [4]uint8
664 func ParseIP4Address(s string) (IP4Address, error) {
665 ip := net.ParseIP(s).To4()
667 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
669 var ipaddr IP4Address
670 copy(ipaddr[:], ip.To4())
674 func (x IP4Address) ToIP() net.IP {
675 return net.IP(x[:]).To4()
677 func (x IP4Address) String() string {
678 return x.ToIP().String()
680 func (x *IP4Address) MarshalText() ([]byte, error) {
681 return []byte(x.String()), nil
683 func (x *IP4Address) UnmarshalText(text []byte) error {
684 ipaddr, err := ParseIP4Address(string(text))
692 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
693 type IP4AddressWithPrefix IP4Prefix
695 // IP6Address defines alias 'ip6_address'.
696 type IP6Address [16]uint8
698 func ParseIP6Address(s string) (IP6Address, error) {
699 ip := net.ParseIP(s).To16()
701 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
703 var ipaddr IP6Address
704 copy(ipaddr[:], ip.To16())
708 func (x IP6Address) ToIP() net.IP {
709 return net.IP(x[:]).To16()
711 func (x IP6Address) String() string {
712 return x.ToIP().String()
714 func (x *IP6Address) MarshalText() ([]byte, error) {
715 return []byte(x.String()), nil
717 func (x *IP6Address) UnmarshalText(text []byte) error {
718 ipaddr, err := ParseIP6Address(string(text))
726 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
727 type IP6AddressWithPrefix IP6Prefix
729 // AbfItfAttach defines type 'abf_itf_attach'.
730 type AbfItfAttach struct {
731 PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
732 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
733 Priority uint32 `binapi:"u32,name=priority" json:"priority,omitempty"`
734 IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
737 // AbfPolicy defines type 'abf_policy'.
738 type AbfPolicy struct {
739 PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
740 ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"`
741 NPaths uint8 `binapi:"u8,name=n_paths" json:"-"`
742 Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
745 // Address defines type 'address'.
746 type Address struct {
747 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
748 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
751 func ParseAddress(s string) (Address, error) {
754 return Address{}, fmt.Errorf("invalid address: %s", s)
758 addr.Af = ADDRESS_IP6
760 copy(ip6[:], ip.To16())
763 addr.Af = ADDRESS_IP4
765 copy(ip4[:], ip.To4())
770 func (x Address) ToIP() net.IP {
771 if x.Af == ADDRESS_IP6 {
773 return net.IP(ip6[:]).To16()
776 return net.IP(ip4[:]).To4()
779 func (x Address) String() string {
780 return x.ToIP().String()
782 func (x *Address) MarshalText() ([]byte, error) {
783 return []byte(x.String()), nil
785 func (x *Address) UnmarshalText(text []byte) error {
786 addr, err := ParseAddress(string(text))
794 // FibMplsLabel defines type 'fib_mpls_label'.
795 type FibMplsLabel struct {
796 IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
797 Label uint32 `binapi:"u32,name=label" json:"label,omitempty"`
798 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"`
799 Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"`
802 // FibPath defines type 'fib_path'.
803 type FibPath struct {
804 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
805 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
806 RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
807 Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"`
808 Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"`
809 Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"`
810 Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
811 Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
812 Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
813 NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
814 LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
817 // FibPathNh defines type 'fib_path_nh'.
818 type FibPathNh struct {
819 Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
820 ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"`
821 ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
822 ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
825 // IP4Prefix defines type 'ip4_prefix'.
826 type IP4Prefix struct {
827 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
828 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
831 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
832 hasPrefix := strings.Contains(s, "/")
834 ip, network, err := net.ParseCIDR(s)
836 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
838 maskSize, _ := network.Mask.Size()
839 prefix.Len = byte(maskSize)
840 prefix.Address, err = ParseIP4Address(ip.String())
842 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
846 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
848 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
850 prefix.Len = byte(defaultMaskSize)
851 prefix.Address, err = ParseIP4Address(ip.String())
853 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
858 func (x IP4Prefix) ToIPNet() *net.IPNet {
859 mask := net.CIDRMask(int(x.Len), 32)
860 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
863 func (x IP4Prefix) String() string {
864 ip := x.Address.String()
865 return ip + "/" + strconv.Itoa(int(x.Len))
867 func (x *IP4Prefix) MarshalText() ([]byte, error) {
868 return []byte(x.String()), nil
870 func (x *IP4Prefix) UnmarshalText(text []byte) error {
871 prefix, err := ParseIP4Prefix(string(text))
879 // IP6Prefix defines type 'ip6_prefix'.
880 type IP6Prefix struct {
881 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
882 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
885 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
886 hasPrefix := strings.Contains(s, "/")
888 ip, network, err := net.ParseCIDR(s)
890 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
892 maskSize, _ := network.Mask.Size()
893 prefix.Len = byte(maskSize)
894 prefix.Address, err = ParseIP6Address(ip.String())
896 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
900 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
902 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
904 prefix.Len = byte(defaultMaskSize)
905 prefix.Address, err = ParseIP6Address(ip.String())
907 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
912 func (x IP6Prefix) ToIPNet() *net.IPNet {
913 mask := net.CIDRMask(int(x.Len), 128)
914 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
917 func (x IP6Prefix) String() string {
918 ip := x.Address.String()
919 return ip + "/" + strconv.Itoa(int(x.Len))
921 func (x *IP6Prefix) MarshalText() ([]byte, error) {
922 return []byte(x.String()), nil
924 func (x *IP6Prefix) UnmarshalText(text []byte) error {
925 prefix, err := ParseIP6Prefix(string(text))
933 // Mprefix defines type 'mprefix'.
934 type Mprefix struct {
935 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
936 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
937 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
938 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
941 // Prefix defines type 'prefix'.
943 Address Address `binapi:"address,name=address" json:"address,omitempty"`
944 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
947 func ParsePrefix(ip string) (prefix Prefix, err error) {
948 hasPrefix := strings.Contains(ip, "/")
950 netIP, network, err := net.ParseCIDR(ip)
952 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
954 maskSize, _ := network.Mask.Size()
955 prefix.Len = byte(maskSize)
956 prefix.Address, err = ParseAddress(netIP.String())
958 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
961 netIP := net.ParseIP(ip)
962 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
963 if netIP.To4() == nil {
964 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
966 prefix.Len = byte(defaultMaskSize)
967 prefix.Address, err = ParseAddress(netIP.String())
969 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
974 func (x Prefix) ToIPNet() *net.IPNet {
976 if x.Address.Af == ADDRESS_IP4 {
977 mask = net.CIDRMask(int(x.Len), 32)
979 mask = net.CIDRMask(int(x.Len), 128)
981 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
984 func (x Prefix) String() string {
985 ip := x.Address.String()
986 return ip + "/" + strconv.Itoa(int(x.Len))
988 func (x *Prefix) MarshalText() ([]byte, error) {
989 return []byte(x.String()), nil
991 func (x *Prefix) UnmarshalText(text []byte) error {
992 prefix, err := ParsePrefix(string(text))
1000 // PrefixMatcher defines type 'prefix_matcher'.
1001 type PrefixMatcher struct {
1002 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1003 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1006 // AddressUnion defines union 'address_union'.
1007 type AddressUnion struct {
1010 XXX_UnionData [16]byte
1013 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1017 func (u *AddressUnion) SetIP4(a IP4Address) {
1018 buf := codec.NewBuffer(u.XXX_UnionData[:])
1019 buf.EncodeBytes(a[:], 4)
1021 func (u *AddressUnion) GetIP4() (a IP4Address) {
1022 buf := codec.NewBuffer(u.XXX_UnionData[:])
1023 copy(a[:], buf.DecodeBytes(4))
1027 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1031 func (u *AddressUnion) SetIP6(a IP6Address) {
1032 buf := codec.NewBuffer(u.XXX_UnionData[:])
1033 buf.EncodeBytes(a[:], 16)
1035 func (u *AddressUnion) GetIP6() (a IP6Address) {
1036 buf := codec.NewBuffer(u.XXX_UnionData[:])
1037 copy(a[:], buf.DecodeBytes(16))
1041 // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'.
1042 type AbfItfAttachAddDel struct {
1043 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1044 Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1047 func (m *AbfItfAttachAddDel) Reset() { *m = AbfItfAttachAddDel{} }
1048 func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" }
1049 func (*AbfItfAttachAddDel) GetCrcString() string { return "25c8621b" }
1050 func (*AbfItfAttachAddDel) GetMessageType() api.MessageType {
1051 return api.RequestMessage
1054 func (m *AbfItfAttachAddDel) Size() (size int) {
1058 size += 1 // m.IsAdd
1059 size += 4 // m.Attach.PolicyID
1060 size += 4 // m.Attach.SwIfIndex
1061 size += 4 // m.Attach.Priority
1062 size += 1 // m.Attach.IsIPv6
1065 func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) {
1067 b = make([]byte, m.Size())
1069 buf := codec.NewBuffer(b)
1070 buf.EncodeBool(m.IsAdd)
1071 buf.EncodeUint32(m.Attach.PolicyID)
1072 buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1073 buf.EncodeUint32(m.Attach.Priority)
1074 buf.EncodeBool(m.Attach.IsIPv6)
1075 return buf.Bytes(), nil
1077 func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error {
1078 buf := codec.NewBuffer(b)
1079 m.IsAdd = buf.DecodeBool()
1080 m.Attach.PolicyID = buf.DecodeUint32()
1081 m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1082 m.Attach.Priority = buf.DecodeUint32()
1083 m.Attach.IsIPv6 = buf.DecodeBool()
1087 // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'.
1088 type AbfItfAttachAddDelReply struct {
1089 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1092 func (m *AbfItfAttachAddDelReply) Reset() { *m = AbfItfAttachAddDelReply{} }
1093 func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" }
1094 func (*AbfItfAttachAddDelReply) GetCrcString() string { return "e8d4e804" }
1095 func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType {
1096 return api.ReplyMessage
1099 func (m *AbfItfAttachAddDelReply) Size() (size int) {
1103 size += 4 // m.Retval
1106 func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) {
1108 b = make([]byte, m.Size())
1110 buf := codec.NewBuffer(b)
1111 buf.EncodeInt32(m.Retval)
1112 return buf.Bytes(), nil
1114 func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error {
1115 buf := codec.NewBuffer(b)
1116 m.Retval = buf.DecodeInt32()
1120 // AbfItfAttachDetails defines message 'abf_itf_attach_details'.
1121 type AbfItfAttachDetails struct {
1122 Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1125 func (m *AbfItfAttachDetails) Reset() { *m = AbfItfAttachDetails{} }
1126 func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" }
1127 func (*AbfItfAttachDetails) GetCrcString() string { return "7819523e" }
1128 func (*AbfItfAttachDetails) GetMessageType() api.MessageType {
1129 return api.ReplyMessage
1132 func (m *AbfItfAttachDetails) Size() (size int) {
1136 size += 4 // m.Attach.PolicyID
1137 size += 4 // m.Attach.SwIfIndex
1138 size += 4 // m.Attach.Priority
1139 size += 1 // m.Attach.IsIPv6
1142 func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) {
1144 b = make([]byte, m.Size())
1146 buf := codec.NewBuffer(b)
1147 buf.EncodeUint32(m.Attach.PolicyID)
1148 buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1149 buf.EncodeUint32(m.Attach.Priority)
1150 buf.EncodeBool(m.Attach.IsIPv6)
1151 return buf.Bytes(), nil
1153 func (m *AbfItfAttachDetails) Unmarshal(b []byte) error {
1154 buf := codec.NewBuffer(b)
1155 m.Attach.PolicyID = buf.DecodeUint32()
1156 m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1157 m.Attach.Priority = buf.DecodeUint32()
1158 m.Attach.IsIPv6 = buf.DecodeBool()
1162 // AbfItfAttachDump defines message 'abf_itf_attach_dump'.
1163 type AbfItfAttachDump struct{}
1165 func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} }
1166 func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" }
1167 func (*AbfItfAttachDump) GetCrcString() string { return "51077d14" }
1168 func (*AbfItfAttachDump) GetMessageType() api.MessageType {
1169 return api.RequestMessage
1172 func (m *AbfItfAttachDump) Size() (size int) {
1178 func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) {
1180 b = make([]byte, m.Size())
1182 buf := codec.NewBuffer(b)
1183 return buf.Bytes(), nil
1185 func (m *AbfItfAttachDump) Unmarshal(b []byte) error {
1189 // AbfPluginGetVersion defines message 'abf_plugin_get_version'.
1190 type AbfPluginGetVersion struct{}
1192 func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} }
1193 func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" }
1194 func (*AbfPluginGetVersion) GetCrcString() string { return "51077d14" }
1195 func (*AbfPluginGetVersion) GetMessageType() api.MessageType {
1196 return api.RequestMessage
1199 func (m *AbfPluginGetVersion) Size() (size int) {
1205 func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) {
1207 b = make([]byte, m.Size())
1209 buf := codec.NewBuffer(b)
1210 return buf.Bytes(), nil
1212 func (m *AbfPluginGetVersion) Unmarshal(b []byte) error {
1216 // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'.
1217 type AbfPluginGetVersionReply struct {
1218 Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1219 Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1222 func (m *AbfPluginGetVersionReply) Reset() { *m = AbfPluginGetVersionReply{} }
1223 func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" }
1224 func (*AbfPluginGetVersionReply) GetCrcString() string { return "9b32cf86" }
1225 func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType {
1226 return api.ReplyMessage
1229 func (m *AbfPluginGetVersionReply) Size() (size int) {
1233 size += 4 // m.Major
1234 size += 4 // m.Minor
1237 func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1239 b = make([]byte, m.Size())
1241 buf := codec.NewBuffer(b)
1242 buf.EncodeUint32(m.Major)
1243 buf.EncodeUint32(m.Minor)
1244 return buf.Bytes(), nil
1246 func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error {
1247 buf := codec.NewBuffer(b)
1248 m.Major = buf.DecodeUint32()
1249 m.Minor = buf.DecodeUint32()
1253 // AbfPolicyAddDel defines message 'abf_policy_add_del'.
1254 type AbfPolicyAddDel struct {
1255 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1256 Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1259 func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} }
1260 func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" }
1261 func (*AbfPolicyAddDel) GetCrcString() string { return "ee66f93e" }
1262 func (*AbfPolicyAddDel) GetMessageType() api.MessageType {
1263 return api.RequestMessage
1266 func (m *AbfPolicyAddDel) Size() (size int) {
1270 size += 1 // m.IsAdd
1271 size += 4 // m.Policy.PolicyID
1272 size += 4 // m.Policy.ACLIndex
1273 size += 1 // m.Policy.NPaths
1274 for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1277 if j2 < len(m.Policy.Paths) {
1278 s2 = m.Policy.Paths[j2]
1280 size += 4 // s2.SwIfIndex
1281 size += 4 // s2.TableID
1282 size += 4 // s2.RpfID
1283 size += 1 // s2.Weight
1284 size += 1 // s2.Preference
1285 size += 4 // s2.Type
1286 size += 4 // s2.Flags
1287 size += 4 // s2.Proto
1288 size += 1 * 16 // s2.Nh.Address
1289 size += 4 // s2.Nh.ViaLabel
1290 size += 4 // s2.Nh.ObjID
1291 size += 4 // s2.Nh.ClassifyTableIndex
1292 size += 1 // s2.NLabels
1293 for j3 := 0; j3 < 16; j3++ {
1294 size += 1 // s2.LabelStack[j3].IsUniform
1295 size += 4 // s2.LabelStack[j3].Label
1296 size += 1 // s2.LabelStack[j3].TTL
1297 size += 1 // s2.LabelStack[j3].Exp
1302 func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) {
1304 b = make([]byte, m.Size())
1306 buf := codec.NewBuffer(b)
1307 buf.EncodeBool(m.IsAdd)
1308 buf.EncodeUint32(m.Policy.PolicyID)
1309 buf.EncodeUint32(m.Policy.ACLIndex)
1310 buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1311 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1312 var v1 FibPath // Paths
1313 if j1 < len(m.Policy.Paths) {
1314 v1 = m.Policy.Paths[j1]
1316 buf.EncodeUint32(v1.SwIfIndex)
1317 buf.EncodeUint32(v1.TableID)
1318 buf.EncodeUint32(v1.RpfID)
1319 buf.EncodeUint8(v1.Weight)
1320 buf.EncodeUint8(v1.Preference)
1321 buf.EncodeUint32(uint32(v1.Type))
1322 buf.EncodeUint32(uint32(v1.Flags))
1323 buf.EncodeUint32(uint32(v1.Proto))
1324 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1325 buf.EncodeUint32(v1.Nh.ViaLabel)
1326 buf.EncodeUint32(v1.Nh.ObjID)
1327 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1328 buf.EncodeUint8(v1.NLabels)
1329 for j2 := 0; j2 < 16; j2++ {
1330 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1331 buf.EncodeUint32(v1.LabelStack[j2].Label)
1332 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1333 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1336 return buf.Bytes(), nil
1338 func (m *AbfPolicyAddDel) Unmarshal(b []byte) error {
1339 buf := codec.NewBuffer(b)
1340 m.IsAdd = buf.DecodeBool()
1341 m.Policy.PolicyID = buf.DecodeUint32()
1342 m.Policy.ACLIndex = buf.DecodeUint32()
1343 m.Policy.NPaths = buf.DecodeUint8()
1344 m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1345 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1346 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1347 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1348 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1349 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1350 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1351 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1352 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1353 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1354 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1355 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1356 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1357 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1358 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1359 for j2 := 0; j2 < 16; j2++ {
1360 m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1361 m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1362 m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1363 m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1369 // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'.
1370 type AbfPolicyAddDelReply struct {
1371 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1374 func (m *AbfPolicyAddDelReply) Reset() { *m = AbfPolicyAddDelReply{} }
1375 func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" }
1376 func (*AbfPolicyAddDelReply) GetCrcString() string { return "e8d4e804" }
1377 func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType {
1378 return api.ReplyMessage
1381 func (m *AbfPolicyAddDelReply) Size() (size int) {
1385 size += 4 // m.Retval
1388 func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) {
1390 b = make([]byte, m.Size())
1392 buf := codec.NewBuffer(b)
1393 buf.EncodeInt32(m.Retval)
1394 return buf.Bytes(), nil
1396 func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error {
1397 buf := codec.NewBuffer(b)
1398 m.Retval = buf.DecodeInt32()
1402 // AbfPolicyDetails defines message 'abf_policy_details'.
1403 type AbfPolicyDetails struct {
1404 Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1407 func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} }
1408 func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" }
1409 func (*AbfPolicyDetails) GetCrcString() string { return "6769e504" }
1410 func (*AbfPolicyDetails) GetMessageType() api.MessageType {
1411 return api.ReplyMessage
1414 func (m *AbfPolicyDetails) Size() (size int) {
1418 size += 4 // m.Policy.PolicyID
1419 size += 4 // m.Policy.ACLIndex
1420 size += 1 // m.Policy.NPaths
1421 for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1424 if j2 < len(m.Policy.Paths) {
1425 s2 = m.Policy.Paths[j2]
1427 size += 4 // s2.SwIfIndex
1428 size += 4 // s2.TableID
1429 size += 4 // s2.RpfID
1430 size += 1 // s2.Weight
1431 size += 1 // s2.Preference
1432 size += 4 // s2.Type
1433 size += 4 // s2.Flags
1434 size += 4 // s2.Proto
1435 size += 1 * 16 // s2.Nh.Address
1436 size += 4 // s2.Nh.ViaLabel
1437 size += 4 // s2.Nh.ObjID
1438 size += 4 // s2.Nh.ClassifyTableIndex
1439 size += 1 // s2.NLabels
1440 for j3 := 0; j3 < 16; j3++ {
1441 size += 1 // s2.LabelStack[j3].IsUniform
1442 size += 4 // s2.LabelStack[j3].Label
1443 size += 1 // s2.LabelStack[j3].TTL
1444 size += 1 // s2.LabelStack[j3].Exp
1449 func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) {
1451 b = make([]byte, m.Size())
1453 buf := codec.NewBuffer(b)
1454 buf.EncodeUint32(m.Policy.PolicyID)
1455 buf.EncodeUint32(m.Policy.ACLIndex)
1456 buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1457 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1458 var v1 FibPath // Paths
1459 if j1 < len(m.Policy.Paths) {
1460 v1 = m.Policy.Paths[j1]
1462 buf.EncodeUint32(v1.SwIfIndex)
1463 buf.EncodeUint32(v1.TableID)
1464 buf.EncodeUint32(v1.RpfID)
1465 buf.EncodeUint8(v1.Weight)
1466 buf.EncodeUint8(v1.Preference)
1467 buf.EncodeUint32(uint32(v1.Type))
1468 buf.EncodeUint32(uint32(v1.Flags))
1469 buf.EncodeUint32(uint32(v1.Proto))
1470 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1471 buf.EncodeUint32(v1.Nh.ViaLabel)
1472 buf.EncodeUint32(v1.Nh.ObjID)
1473 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1474 buf.EncodeUint8(v1.NLabels)
1475 for j2 := 0; j2 < 16; j2++ {
1476 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1477 buf.EncodeUint32(v1.LabelStack[j2].Label)
1478 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1479 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1482 return buf.Bytes(), nil
1484 func (m *AbfPolicyDetails) Unmarshal(b []byte) error {
1485 buf := codec.NewBuffer(b)
1486 m.Policy.PolicyID = buf.DecodeUint32()
1487 m.Policy.ACLIndex = buf.DecodeUint32()
1488 m.Policy.NPaths = buf.DecodeUint8()
1489 m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1490 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1491 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1492 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1493 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1494 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1495 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1496 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1497 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1498 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1499 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1500 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1501 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1502 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1503 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1504 for j2 := 0; j2 < 16; j2++ {
1505 m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1506 m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1507 m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1508 m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1514 // AbfPolicyDump defines message 'abf_policy_dump'.
1515 type AbfPolicyDump struct{}
1517 func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} }
1518 func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" }
1519 func (*AbfPolicyDump) GetCrcString() string { return "51077d14" }
1520 func (*AbfPolicyDump) GetMessageType() api.MessageType {
1521 return api.RequestMessage
1524 func (m *AbfPolicyDump) Size() (size int) {
1530 func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) {
1532 b = make([]byte, m.Size())
1534 buf := codec.NewBuffer(b)
1535 return buf.Bytes(), nil
1537 func (m *AbfPolicyDump) Unmarshal(b []byte) error {
1541 func init() { file_abf_binapi_init() }
1542 func file_abf_binapi_init() {
1543 api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b")
1544 api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804")
1545 api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e")
1546 api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14")
1547 api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14")
1548 api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86")
1549 api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e")
1550 api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804")
1551 api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504")
1552 api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14")
1555 // Messages returns list of all messages in this module.
1556 func AllMessages() []api.Message {
1557 return []api.Message{
1558 (*AbfItfAttachAddDel)(nil),
1559 (*AbfItfAttachAddDelReply)(nil),
1560 (*AbfItfAttachDetails)(nil),
1561 (*AbfItfAttachDump)(nil),
1562 (*AbfPluginGetVersion)(nil),
1563 (*AbfPluginGetVersionReply)(nil),
1564 (*AbfPolicyAddDel)(nil),
1565 (*AbfPolicyAddDelReply)(nil),
1566 (*AbfPolicyDetails)(nil),
1567 (*AbfPolicyDump)(nil),