1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: .vppapi/plugins/abf.api.json
7 // Package abf contains generated bindings for API file abf.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 = 0xc2e5c644
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 // FibPathFlags defines enum 'fib_path_flags'.
68 type FibPathFlags uint32
71 FIB_API_PATH_FLAG_NONE FibPathFlags = 0
72 FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
73 FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2
74 FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4
78 FibPathFlags_name = map[uint32]string{
79 0: "FIB_API_PATH_FLAG_NONE",
80 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
81 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
82 4: "FIB_API_PATH_FLAG_POP_PW_CW",
84 FibPathFlags_value = map[string]uint32{
85 "FIB_API_PATH_FLAG_NONE": 0,
86 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
87 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2,
88 "FIB_API_PATH_FLAG_POP_PW_CW": 4,
92 func (x FibPathFlags) String() string {
93 s, ok := FibPathFlags_name[uint32(x)]
97 str := func(n uint32) string {
98 s, ok := FibPathFlags_name[uint32(n)]
102 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
104 for i := uint32(0); i <= 32; i++ {
114 return str(uint32(x))
119 // FibPathNhProto defines enum 'fib_path_nh_proto'.
120 type FibPathNhProto uint32
123 FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0
124 FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1
125 FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2
126 FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
127 FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4
131 FibPathNhProto_name = map[uint32]string{
132 0: "FIB_API_PATH_NH_PROTO_IP4",
133 1: "FIB_API_PATH_NH_PROTO_IP6",
134 2: "FIB_API_PATH_NH_PROTO_MPLS",
135 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
136 4: "FIB_API_PATH_NH_PROTO_BIER",
138 FibPathNhProto_value = map[string]uint32{
139 "FIB_API_PATH_NH_PROTO_IP4": 0,
140 "FIB_API_PATH_NH_PROTO_IP6": 1,
141 "FIB_API_PATH_NH_PROTO_MPLS": 2,
142 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
143 "FIB_API_PATH_NH_PROTO_BIER": 4,
147 func (x FibPathNhProto) String() string {
148 s, ok := FibPathNhProto_name[uint32(x)]
152 return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
155 // FibPathType defines enum 'fib_path_type'.
156 type FibPathType uint32
159 FIB_API_PATH_TYPE_NORMAL FibPathType = 0
160 FIB_API_PATH_TYPE_LOCAL FibPathType = 1
161 FIB_API_PATH_TYPE_DROP FibPathType = 2
162 FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3
163 FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4
164 FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5
165 FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
166 FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
167 FIB_API_PATH_TYPE_DVR FibPathType = 8
168 FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9
169 FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10
173 FibPathType_name = map[uint32]string{
174 0: "FIB_API_PATH_TYPE_NORMAL",
175 1: "FIB_API_PATH_TYPE_LOCAL",
176 2: "FIB_API_PATH_TYPE_DROP",
177 3: "FIB_API_PATH_TYPE_UDP_ENCAP",
178 4: "FIB_API_PATH_TYPE_BIER_IMP",
179 5: "FIB_API_PATH_TYPE_ICMP_UNREACH",
180 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
181 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
182 8: "FIB_API_PATH_TYPE_DVR",
183 9: "FIB_API_PATH_TYPE_INTERFACE_RX",
184 10: "FIB_API_PATH_TYPE_CLASSIFY",
186 FibPathType_value = map[string]uint32{
187 "FIB_API_PATH_TYPE_NORMAL": 0,
188 "FIB_API_PATH_TYPE_LOCAL": 1,
189 "FIB_API_PATH_TYPE_DROP": 2,
190 "FIB_API_PATH_TYPE_UDP_ENCAP": 3,
191 "FIB_API_PATH_TYPE_BIER_IMP": 4,
192 "FIB_API_PATH_TYPE_ICMP_UNREACH": 5,
193 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
194 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
195 "FIB_API_PATH_TYPE_DVR": 8,
196 "FIB_API_PATH_TYPE_INTERFACE_RX": 9,
197 "FIB_API_PATH_TYPE_CLASSIFY": 10,
201 func (x FibPathType) String() string {
202 s, ok := FibPathType_name[uint32(x)]
206 return "FibPathType(" + strconv.Itoa(int(x)) + ")"
209 // IfStatusFlags defines enum 'if_status_flags'.
210 type IfStatusFlags uint32
213 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
214 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
218 IfStatusFlags_name = map[uint32]string{
219 1: "IF_STATUS_API_FLAG_ADMIN_UP",
220 2: "IF_STATUS_API_FLAG_LINK_UP",
222 IfStatusFlags_value = map[string]uint32{
223 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
224 "IF_STATUS_API_FLAG_LINK_UP": 2,
228 func (x IfStatusFlags) String() string {
229 s, ok := IfStatusFlags_name[uint32(x)]
233 str := func(n uint32) string {
234 s, ok := IfStatusFlags_name[uint32(n)]
238 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
240 for i := uint32(0); i <= 32; i++ {
250 return str(uint32(x))
255 // IfType defines enum 'if_type'.
259 IF_API_TYPE_HARDWARE IfType = 1
260 IF_API_TYPE_SUB IfType = 2
261 IF_API_TYPE_P2P IfType = 3
262 IF_API_TYPE_PIPE IfType = 4
266 IfType_name = map[uint32]string{
267 1: "IF_API_TYPE_HARDWARE",
268 2: "IF_API_TYPE_SUB",
269 3: "IF_API_TYPE_P2P",
270 4: "IF_API_TYPE_PIPE",
272 IfType_value = map[string]uint32{
273 "IF_API_TYPE_HARDWARE": 1,
274 "IF_API_TYPE_SUB": 2,
275 "IF_API_TYPE_P2P": 3,
276 "IF_API_TYPE_PIPE": 4,
280 func (x IfType) String() string {
281 s, ok := IfType_name[uint32(x)]
285 return "IfType(" + strconv.Itoa(int(x)) + ")"
288 // IPDscp defines enum 'ip_dscp'.
292 IP_API_DSCP_CS0 IPDscp = 0
293 IP_API_DSCP_CS1 IPDscp = 8
294 IP_API_DSCP_AF11 IPDscp = 10
295 IP_API_DSCP_AF12 IPDscp = 12
296 IP_API_DSCP_AF13 IPDscp = 14
297 IP_API_DSCP_CS2 IPDscp = 16
298 IP_API_DSCP_AF21 IPDscp = 18
299 IP_API_DSCP_AF22 IPDscp = 20
300 IP_API_DSCP_AF23 IPDscp = 22
301 IP_API_DSCP_CS3 IPDscp = 24
302 IP_API_DSCP_AF31 IPDscp = 26
303 IP_API_DSCP_AF32 IPDscp = 28
304 IP_API_DSCP_AF33 IPDscp = 30
305 IP_API_DSCP_CS4 IPDscp = 32
306 IP_API_DSCP_AF41 IPDscp = 34
307 IP_API_DSCP_AF42 IPDscp = 36
308 IP_API_DSCP_AF43 IPDscp = 38
309 IP_API_DSCP_CS5 IPDscp = 40
310 IP_API_DSCP_EF IPDscp = 46
311 IP_API_DSCP_CS6 IPDscp = 48
312 IP_API_DSCP_CS7 IPDscp = 50
316 IPDscp_name = map[uint8]string{
317 0: "IP_API_DSCP_CS0",
318 8: "IP_API_DSCP_CS1",
319 10: "IP_API_DSCP_AF11",
320 12: "IP_API_DSCP_AF12",
321 14: "IP_API_DSCP_AF13",
322 16: "IP_API_DSCP_CS2",
323 18: "IP_API_DSCP_AF21",
324 20: "IP_API_DSCP_AF22",
325 22: "IP_API_DSCP_AF23",
326 24: "IP_API_DSCP_CS3",
327 26: "IP_API_DSCP_AF31",
328 28: "IP_API_DSCP_AF32",
329 30: "IP_API_DSCP_AF33",
330 32: "IP_API_DSCP_CS4",
331 34: "IP_API_DSCP_AF41",
332 36: "IP_API_DSCP_AF42",
333 38: "IP_API_DSCP_AF43",
334 40: "IP_API_DSCP_CS5",
335 46: "IP_API_DSCP_EF",
336 48: "IP_API_DSCP_CS6",
337 50: "IP_API_DSCP_CS7",
339 IPDscp_value = map[string]uint8{
340 "IP_API_DSCP_CS0": 0,
341 "IP_API_DSCP_CS1": 8,
342 "IP_API_DSCP_AF11": 10,
343 "IP_API_DSCP_AF12": 12,
344 "IP_API_DSCP_AF13": 14,
345 "IP_API_DSCP_CS2": 16,
346 "IP_API_DSCP_AF21": 18,
347 "IP_API_DSCP_AF22": 20,
348 "IP_API_DSCP_AF23": 22,
349 "IP_API_DSCP_CS3": 24,
350 "IP_API_DSCP_AF31": 26,
351 "IP_API_DSCP_AF32": 28,
352 "IP_API_DSCP_AF33": 30,
353 "IP_API_DSCP_CS4": 32,
354 "IP_API_DSCP_AF41": 34,
355 "IP_API_DSCP_AF42": 36,
356 "IP_API_DSCP_AF43": 38,
357 "IP_API_DSCP_CS5": 40,
358 "IP_API_DSCP_EF": 46,
359 "IP_API_DSCP_CS6": 48,
360 "IP_API_DSCP_CS7": 50,
364 func (x IPDscp) String() string {
365 s, ok := IPDscp_name[uint8(x)]
369 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
372 // IPEcn defines enum 'ip_ecn'.
376 IP_API_ECN_NONE IPEcn = 0
377 IP_API_ECN_ECT0 IPEcn = 1
378 IP_API_ECN_ECT1 IPEcn = 2
379 IP_API_ECN_CE IPEcn = 3
383 IPEcn_name = map[uint8]string{
384 0: "IP_API_ECN_NONE",
385 1: "IP_API_ECN_ECT0",
386 2: "IP_API_ECN_ECT1",
389 IPEcn_value = map[string]uint8{
390 "IP_API_ECN_NONE": 0,
391 "IP_API_ECN_ECT0": 1,
392 "IP_API_ECN_ECT1": 2,
397 func (x IPEcn) String() string {
398 s, ok := IPEcn_name[uint8(x)]
402 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
405 // IPProto defines enum 'ip_proto'.
409 IP_API_PROTO_HOPOPT IPProto = 0
410 IP_API_PROTO_ICMP IPProto = 1
411 IP_API_PROTO_IGMP IPProto = 2
412 IP_API_PROTO_TCP IPProto = 6
413 IP_API_PROTO_UDP IPProto = 17
414 IP_API_PROTO_GRE IPProto = 47
415 IP_API_PROTO_AH IPProto = 50
416 IP_API_PROTO_ESP IPProto = 51
417 IP_API_PROTO_EIGRP IPProto = 88
418 IP_API_PROTO_OSPF IPProto = 89
419 IP_API_PROTO_SCTP IPProto = 132
420 IP_API_PROTO_RESERVED IPProto = 255
424 IPProto_name = map[uint32]string{
425 0: "IP_API_PROTO_HOPOPT",
426 1: "IP_API_PROTO_ICMP",
427 2: "IP_API_PROTO_IGMP",
428 6: "IP_API_PROTO_TCP",
429 17: "IP_API_PROTO_UDP",
430 47: "IP_API_PROTO_GRE",
431 50: "IP_API_PROTO_AH",
432 51: "IP_API_PROTO_ESP",
433 88: "IP_API_PROTO_EIGRP",
434 89: "IP_API_PROTO_OSPF",
435 132: "IP_API_PROTO_SCTP",
436 255: "IP_API_PROTO_RESERVED",
438 IPProto_value = map[string]uint32{
439 "IP_API_PROTO_HOPOPT": 0,
440 "IP_API_PROTO_ICMP": 1,
441 "IP_API_PROTO_IGMP": 2,
442 "IP_API_PROTO_TCP": 6,
443 "IP_API_PROTO_UDP": 17,
444 "IP_API_PROTO_GRE": 47,
445 "IP_API_PROTO_AH": 50,
446 "IP_API_PROTO_ESP": 51,
447 "IP_API_PROTO_EIGRP": 88,
448 "IP_API_PROTO_OSPF": 89,
449 "IP_API_PROTO_SCTP": 132,
450 "IP_API_PROTO_RESERVED": 255,
454 func (x IPProto) String() string {
455 s, ok := IPProto_name[uint32(x)]
459 return "IPProto(" + strconv.Itoa(int(x)) + ")"
462 // LinkDuplex defines enum 'link_duplex'.
463 type LinkDuplex uint32
466 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
467 LINK_DUPLEX_API_HALF LinkDuplex = 1
468 LINK_DUPLEX_API_FULL LinkDuplex = 2
472 LinkDuplex_name = map[uint32]string{
473 0: "LINK_DUPLEX_API_UNKNOWN",
474 1: "LINK_DUPLEX_API_HALF",
475 2: "LINK_DUPLEX_API_FULL",
477 LinkDuplex_value = map[string]uint32{
478 "LINK_DUPLEX_API_UNKNOWN": 0,
479 "LINK_DUPLEX_API_HALF": 1,
480 "LINK_DUPLEX_API_FULL": 2,
484 func (x LinkDuplex) String() string {
485 s, ok := LinkDuplex_name[uint32(x)]
489 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
492 // MtuProto defines enum 'mtu_proto'.
496 MTU_PROTO_API_L3 MtuProto = 1
497 MTU_PROTO_API_IP4 MtuProto = 2
498 MTU_PROTO_API_IP6 MtuProto = 3
499 MTU_PROTO_API_MPLS MtuProto = 4
500 MTU_PROTO_API_N MtuProto = 5
504 MtuProto_name = map[uint32]string{
505 1: "MTU_PROTO_API_L3",
506 2: "MTU_PROTO_API_IP4",
507 3: "MTU_PROTO_API_IP6",
508 4: "MTU_PROTO_API_MPLS",
509 5: "MTU_PROTO_API_N",
511 MtuProto_value = map[string]uint32{
512 "MTU_PROTO_API_L3": 1,
513 "MTU_PROTO_API_IP4": 2,
514 "MTU_PROTO_API_IP6": 3,
515 "MTU_PROTO_API_MPLS": 4,
516 "MTU_PROTO_API_N": 5,
520 func (x MtuProto) String() string {
521 s, ok := MtuProto_name[uint32(x)]
525 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
528 // RxMode defines enum 'rx_mode'.
532 RX_MODE_API_UNKNOWN RxMode = 0
533 RX_MODE_API_POLLING RxMode = 1
534 RX_MODE_API_INTERRUPT RxMode = 2
535 RX_MODE_API_ADAPTIVE RxMode = 3
536 RX_MODE_API_DEFAULT RxMode = 4
540 RxMode_name = map[uint32]string{
541 0: "RX_MODE_API_UNKNOWN",
542 1: "RX_MODE_API_POLLING",
543 2: "RX_MODE_API_INTERRUPT",
544 3: "RX_MODE_API_ADAPTIVE",
545 4: "RX_MODE_API_DEFAULT",
547 RxMode_value = map[string]uint32{
548 "RX_MODE_API_UNKNOWN": 0,
549 "RX_MODE_API_POLLING": 1,
550 "RX_MODE_API_INTERRUPT": 2,
551 "RX_MODE_API_ADAPTIVE": 3,
552 "RX_MODE_API_DEFAULT": 4,
556 func (x RxMode) String() string {
557 s, ok := RxMode_name[uint32(x)]
561 return "RxMode(" + strconv.Itoa(int(x)) + ")"
564 // SubIfFlags defines enum 'sub_if_flags'.
565 type SubIfFlags uint32
568 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
569 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
570 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
571 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
572 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
573 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
574 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
575 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
576 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
577 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
581 SubIfFlags_name = map[uint32]string{
582 1: "SUB_IF_API_FLAG_NO_TAGS",
583 2: "SUB_IF_API_FLAG_ONE_TAG",
584 4: "SUB_IF_API_FLAG_TWO_TAGS",
585 8: "SUB_IF_API_FLAG_DOT1AD",
586 16: "SUB_IF_API_FLAG_EXACT_MATCH",
587 32: "SUB_IF_API_FLAG_DEFAULT",
588 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
589 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
590 254: "SUB_IF_API_FLAG_MASK_VNET",
591 256: "SUB_IF_API_FLAG_DOT1AH",
593 SubIfFlags_value = map[string]uint32{
594 "SUB_IF_API_FLAG_NO_TAGS": 1,
595 "SUB_IF_API_FLAG_ONE_TAG": 2,
596 "SUB_IF_API_FLAG_TWO_TAGS": 4,
597 "SUB_IF_API_FLAG_DOT1AD": 8,
598 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
599 "SUB_IF_API_FLAG_DEFAULT": 32,
600 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
601 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
602 "SUB_IF_API_FLAG_MASK_VNET": 254,
603 "SUB_IF_API_FLAG_DOT1AH": 256,
607 func (x SubIfFlags) String() string {
608 s, ok := SubIfFlags_name[uint32(x)]
612 str := func(n uint32) string {
613 s, ok := SubIfFlags_name[uint32(n)]
617 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
619 for i := uint32(0); i <= 32; i++ {
629 return str(uint32(x))
634 // AddressWithPrefix defines alias 'address_with_prefix'.
635 type AddressWithPrefix Prefix
637 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
638 prefix, err := ParsePrefix(s)
640 return AddressWithPrefix{}, err
642 return AddressWithPrefix(prefix), nil
645 func (x AddressWithPrefix) String() string {
646 return Prefix(x).String()
649 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
650 return []byte(x.String()), nil
653 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
654 prefix, err := ParseAddressWithPrefix(string(text))
662 // InterfaceIndex defines alias 'interface_index'.
663 type InterfaceIndex uint32
665 // IP4Address defines alias 'ip4_address'.
666 type IP4Address [4]uint8
668 func ParseIP4Address(s string) (IP4Address, error) {
669 ip := net.ParseIP(s).To4()
671 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
673 var ipaddr IP4Address
674 copy(ipaddr[:], ip.To4())
678 func (x IP4Address) ToIP() net.IP {
679 return net.IP(x[:]).To4()
682 func (x IP4Address) String() string {
683 return x.ToIP().String()
686 func (x *IP4Address) MarshalText() ([]byte, error) {
687 return []byte(x.String()), nil
690 func (x *IP4Address) UnmarshalText(text []byte) error {
691 ipaddr, err := ParseIP4Address(string(text))
699 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
700 type IP4AddressWithPrefix IP4Prefix
702 // IP6Address defines alias 'ip6_address'.
703 type IP6Address [16]uint8
705 func ParseIP6Address(s string) (IP6Address, error) {
706 ip := net.ParseIP(s).To16()
708 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
710 var ipaddr IP6Address
711 copy(ipaddr[:], ip.To16())
715 func (x IP6Address) ToIP() net.IP {
716 return net.IP(x[:]).To16()
719 func (x IP6Address) String() string {
720 return x.ToIP().String()
723 func (x *IP6Address) MarshalText() ([]byte, error) {
724 return []byte(x.String()), nil
727 func (x *IP6Address) UnmarshalText(text []byte) error {
728 ipaddr, err := ParseIP6Address(string(text))
736 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
737 type IP6AddressWithPrefix IP6Prefix
739 // AbfItfAttach defines type 'abf_itf_attach'.
740 type AbfItfAttach struct {
741 PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
742 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
743 Priority uint32 `binapi:"u32,name=priority" json:"priority,omitempty"`
744 IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
747 // AbfPolicy defines type 'abf_policy'.
748 type AbfPolicy struct {
749 PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
750 ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"`
751 NPaths uint8 `binapi:"u8,name=n_paths" json:"-"`
752 Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
755 // Address defines type 'address'.
756 type Address struct {
757 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
758 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
761 func ParseAddress(s string) (Address, error) {
764 return Address{}, fmt.Errorf("invalid address: %s", s)
766 return AddressFromIP(ip), nil
769 func AddressFromIP(ip net.IP) Address {
772 addr.Af = ADDRESS_IP6
774 copy(ip6[:], ip.To16())
777 addr.Af = ADDRESS_IP4
779 copy(ip4[:], ip.To4())
785 func (x Address) ToIP() net.IP {
786 if x.Af == ADDRESS_IP6 {
788 return net.IP(ip6[:]).To16()
791 return net.IP(ip4[:]).To4()
795 func (x Address) String() string {
796 return x.ToIP().String()
799 func (x *Address) MarshalText() ([]byte, error) {
800 return []byte(x.String()), nil
803 func (x *Address) UnmarshalText(text []byte) error {
804 addr, err := ParseAddress(string(text))
812 // FibMplsLabel defines type 'fib_mpls_label'.
813 type FibMplsLabel struct {
814 IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
815 Label uint32 `binapi:"u32,name=label" json:"label,omitempty"`
816 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"`
817 Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"`
820 // FibPath defines type 'fib_path'.
821 type FibPath struct {
822 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
823 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
824 RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
825 Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"`
826 Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"`
827 Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"`
828 Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
829 Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
830 Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
831 NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
832 LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
835 // FibPathNh defines type 'fib_path_nh'.
836 type FibPathNh struct {
837 Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
838 ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"`
839 ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
840 ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
843 // IP4Prefix defines type 'ip4_prefix'.
844 type IP4Prefix struct {
845 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
846 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
849 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
850 hasPrefix := strings.Contains(s, "/")
852 ip, network, err := net.ParseCIDR(s)
854 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
856 maskSize, _ := network.Mask.Size()
857 prefix.Len = byte(maskSize)
858 prefix.Address, err = ParseIP4Address(ip.String())
860 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
864 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
866 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
868 prefix.Len = byte(defaultMaskSize)
869 prefix.Address, err = ParseIP4Address(ip.String())
871 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
877 func (x IP4Prefix) ToIPNet() *net.IPNet {
878 mask := net.CIDRMask(int(x.Len), 32)
879 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
883 func (x IP4Prefix) String() string {
884 ip := x.Address.String()
885 return ip + "/" + strconv.Itoa(int(x.Len))
888 func (x *IP4Prefix) MarshalText() ([]byte, error) {
889 return []byte(x.String()), nil
892 func (x *IP4Prefix) UnmarshalText(text []byte) error {
893 prefix, err := ParseIP4Prefix(string(text))
901 // IP6Prefix defines type 'ip6_prefix'.
902 type IP6Prefix struct {
903 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
904 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
907 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
908 hasPrefix := strings.Contains(s, "/")
910 ip, network, err := net.ParseCIDR(s)
912 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
914 maskSize, _ := network.Mask.Size()
915 prefix.Len = byte(maskSize)
916 prefix.Address, err = ParseIP6Address(ip.String())
918 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
922 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
924 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
926 prefix.Len = byte(defaultMaskSize)
927 prefix.Address, err = ParseIP6Address(ip.String())
929 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
935 func (x IP6Prefix) ToIPNet() *net.IPNet {
936 mask := net.CIDRMask(int(x.Len), 128)
937 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
941 func (x IP6Prefix) String() string {
942 ip := x.Address.String()
943 return ip + "/" + strconv.Itoa(int(x.Len))
946 func (x *IP6Prefix) MarshalText() ([]byte, error) {
947 return []byte(x.String()), nil
950 func (x *IP6Prefix) UnmarshalText(text []byte) error {
951 prefix, err := ParseIP6Prefix(string(text))
959 // Mprefix defines type 'mprefix'.
960 type Mprefix struct {
961 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
962 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
963 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
964 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
967 // Prefix defines type 'prefix'.
969 Address Address `binapi:"address,name=address" json:"address,omitempty"`
970 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
973 func ParsePrefix(ip string) (prefix Prefix, err error) {
974 hasPrefix := strings.Contains(ip, "/")
976 netIP, network, err := net.ParseCIDR(ip)
978 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
980 maskSize, _ := network.Mask.Size()
981 prefix.Len = byte(maskSize)
982 prefix.Address, err = ParseAddress(netIP.String())
984 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
987 netIP := net.ParseIP(ip)
988 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
989 if netIP.To4() == nil {
990 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
992 prefix.Len = byte(defaultMaskSize)
993 prefix.Address, err = ParseAddress(netIP.String())
995 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
1001 func (x Prefix) ToIPNet() *net.IPNet {
1003 if x.Address.Af == ADDRESS_IP4 {
1004 mask = net.CIDRMask(int(x.Len), 32)
1006 mask = net.CIDRMask(int(x.Len), 128)
1008 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1012 func (x Prefix) String() string {
1013 ip := x.Address.String()
1014 return ip + "/" + strconv.Itoa(int(x.Len))
1017 func (x *Prefix) MarshalText() ([]byte, error) {
1018 return []byte(x.String()), nil
1021 func (x *Prefix) UnmarshalText(text []byte) error {
1022 prefix, err := ParsePrefix(string(text))
1030 // PrefixMatcher defines type 'prefix_matcher'.
1031 type PrefixMatcher struct {
1032 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1033 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1036 // AddressUnion defines union 'address_union'.
1037 type AddressUnion struct {
1038 // AddressUnion can be one of:
1039 // - IP4 *IP4Address
1040 // - IP6 *IP6Address
1041 XXX_UnionData [16]byte
1044 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1048 func (u *AddressUnion) SetIP4(a IP4Address) {
1049 buf := codec.NewBuffer(u.XXX_UnionData[:])
1050 buf.EncodeBytes(a[:], 4)
1052 func (u *AddressUnion) GetIP4() (a IP4Address) {
1053 buf := codec.NewBuffer(u.XXX_UnionData[:])
1054 copy(a[:], buf.DecodeBytes(4))
1058 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1062 func (u *AddressUnion) SetIP6(a IP6Address) {
1063 buf := codec.NewBuffer(u.XXX_UnionData[:])
1064 buf.EncodeBytes(a[:], 16)
1066 func (u *AddressUnion) GetIP6() (a IP6Address) {
1067 buf := codec.NewBuffer(u.XXX_UnionData[:])
1068 copy(a[:], buf.DecodeBytes(16))
1072 // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'.
1073 type AbfItfAttachAddDel struct {
1074 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1075 Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1078 func (m *AbfItfAttachAddDel) Reset() { *m = AbfItfAttachAddDel{} }
1079 func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" }
1080 func (*AbfItfAttachAddDel) GetCrcString() string { return "25c8621b" }
1081 func (*AbfItfAttachAddDel) GetMessageType() api.MessageType {
1082 return api.RequestMessage
1085 func (m *AbfItfAttachAddDel) Size() (size int) {
1089 size += 1 // m.IsAdd
1090 size += 4 // m.Attach.PolicyID
1091 size += 4 // m.Attach.SwIfIndex
1092 size += 4 // m.Attach.Priority
1093 size += 1 // m.Attach.IsIPv6
1096 func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) {
1098 b = make([]byte, m.Size())
1100 buf := codec.NewBuffer(b)
1101 buf.EncodeBool(m.IsAdd)
1102 buf.EncodeUint32(m.Attach.PolicyID)
1103 buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1104 buf.EncodeUint32(m.Attach.Priority)
1105 buf.EncodeBool(m.Attach.IsIPv6)
1106 return buf.Bytes(), nil
1108 func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error {
1109 buf := codec.NewBuffer(b)
1110 m.IsAdd = buf.DecodeBool()
1111 m.Attach.PolicyID = buf.DecodeUint32()
1112 m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1113 m.Attach.Priority = buf.DecodeUint32()
1114 m.Attach.IsIPv6 = buf.DecodeBool()
1118 // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'.
1119 type AbfItfAttachAddDelReply struct {
1120 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1123 func (m *AbfItfAttachAddDelReply) Reset() { *m = AbfItfAttachAddDelReply{} }
1124 func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" }
1125 func (*AbfItfAttachAddDelReply) GetCrcString() string { return "e8d4e804" }
1126 func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType {
1127 return api.ReplyMessage
1130 func (m *AbfItfAttachAddDelReply) Size() (size int) {
1134 size += 4 // m.Retval
1137 func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) {
1139 b = make([]byte, m.Size())
1141 buf := codec.NewBuffer(b)
1142 buf.EncodeInt32(m.Retval)
1143 return buf.Bytes(), nil
1145 func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error {
1146 buf := codec.NewBuffer(b)
1147 m.Retval = buf.DecodeInt32()
1151 // AbfItfAttachDetails defines message 'abf_itf_attach_details'.
1152 type AbfItfAttachDetails struct {
1153 Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1156 func (m *AbfItfAttachDetails) Reset() { *m = AbfItfAttachDetails{} }
1157 func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" }
1158 func (*AbfItfAttachDetails) GetCrcString() string { return "7819523e" }
1159 func (*AbfItfAttachDetails) GetMessageType() api.MessageType {
1160 return api.ReplyMessage
1163 func (m *AbfItfAttachDetails) Size() (size int) {
1167 size += 4 // m.Attach.PolicyID
1168 size += 4 // m.Attach.SwIfIndex
1169 size += 4 // m.Attach.Priority
1170 size += 1 // m.Attach.IsIPv6
1173 func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) {
1175 b = make([]byte, m.Size())
1177 buf := codec.NewBuffer(b)
1178 buf.EncodeUint32(m.Attach.PolicyID)
1179 buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1180 buf.EncodeUint32(m.Attach.Priority)
1181 buf.EncodeBool(m.Attach.IsIPv6)
1182 return buf.Bytes(), nil
1184 func (m *AbfItfAttachDetails) Unmarshal(b []byte) error {
1185 buf := codec.NewBuffer(b)
1186 m.Attach.PolicyID = buf.DecodeUint32()
1187 m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1188 m.Attach.Priority = buf.DecodeUint32()
1189 m.Attach.IsIPv6 = buf.DecodeBool()
1193 // AbfItfAttachDump defines message 'abf_itf_attach_dump'.
1194 type AbfItfAttachDump struct{}
1196 func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} }
1197 func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" }
1198 func (*AbfItfAttachDump) GetCrcString() string { return "51077d14" }
1199 func (*AbfItfAttachDump) GetMessageType() api.MessageType {
1200 return api.RequestMessage
1203 func (m *AbfItfAttachDump) Size() (size int) {
1209 func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) {
1211 b = make([]byte, m.Size())
1213 buf := codec.NewBuffer(b)
1214 return buf.Bytes(), nil
1216 func (m *AbfItfAttachDump) Unmarshal(b []byte) error {
1220 // AbfPluginGetVersion defines message 'abf_plugin_get_version'.
1221 type AbfPluginGetVersion struct{}
1223 func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} }
1224 func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" }
1225 func (*AbfPluginGetVersion) GetCrcString() string { return "51077d14" }
1226 func (*AbfPluginGetVersion) GetMessageType() api.MessageType {
1227 return api.RequestMessage
1230 func (m *AbfPluginGetVersion) Size() (size int) {
1236 func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) {
1238 b = make([]byte, m.Size())
1240 buf := codec.NewBuffer(b)
1241 return buf.Bytes(), nil
1243 func (m *AbfPluginGetVersion) Unmarshal(b []byte) error {
1247 // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'.
1248 type AbfPluginGetVersionReply struct {
1249 Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1250 Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1253 func (m *AbfPluginGetVersionReply) Reset() { *m = AbfPluginGetVersionReply{} }
1254 func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" }
1255 func (*AbfPluginGetVersionReply) GetCrcString() string { return "9b32cf86" }
1256 func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType {
1257 return api.ReplyMessage
1260 func (m *AbfPluginGetVersionReply) Size() (size int) {
1264 size += 4 // m.Major
1265 size += 4 // m.Minor
1268 func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1270 b = make([]byte, m.Size())
1272 buf := codec.NewBuffer(b)
1273 buf.EncodeUint32(m.Major)
1274 buf.EncodeUint32(m.Minor)
1275 return buf.Bytes(), nil
1277 func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error {
1278 buf := codec.NewBuffer(b)
1279 m.Major = buf.DecodeUint32()
1280 m.Minor = buf.DecodeUint32()
1284 // AbfPolicyAddDel defines message 'abf_policy_add_del'.
1285 type AbfPolicyAddDel struct {
1286 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1287 Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1290 func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} }
1291 func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" }
1292 func (*AbfPolicyAddDel) GetCrcString() string { return "ee66f93e" }
1293 func (*AbfPolicyAddDel) GetMessageType() api.MessageType {
1294 return api.RequestMessage
1297 func (m *AbfPolicyAddDel) Size() (size int) {
1301 size += 1 // m.IsAdd
1302 size += 4 // m.Policy.PolicyID
1303 size += 4 // m.Policy.ACLIndex
1304 size += 1 // m.Policy.NPaths
1305 for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1308 if j2 < len(m.Policy.Paths) {
1309 s2 = m.Policy.Paths[j2]
1311 size += 4 // s2.SwIfIndex
1312 size += 4 // s2.TableID
1313 size += 4 // s2.RpfID
1314 size += 1 // s2.Weight
1315 size += 1 // s2.Preference
1316 size += 4 // s2.Type
1317 size += 4 // s2.Flags
1318 size += 4 // s2.Proto
1319 size += 1 * 16 // s2.Nh.Address
1320 size += 4 // s2.Nh.ViaLabel
1321 size += 4 // s2.Nh.ObjID
1322 size += 4 // s2.Nh.ClassifyTableIndex
1323 size += 1 // s2.NLabels
1324 for j3 := 0; j3 < 16; j3++ {
1325 size += 1 // s2.LabelStack[j3].IsUniform
1326 size += 4 // s2.LabelStack[j3].Label
1327 size += 1 // s2.LabelStack[j3].TTL
1328 size += 1 // s2.LabelStack[j3].Exp
1333 func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) {
1335 b = make([]byte, m.Size())
1337 buf := codec.NewBuffer(b)
1338 buf.EncodeBool(m.IsAdd)
1339 buf.EncodeUint32(m.Policy.PolicyID)
1340 buf.EncodeUint32(m.Policy.ACLIndex)
1341 buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1342 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1343 var v1 FibPath // Paths
1344 if j1 < len(m.Policy.Paths) {
1345 v1 = m.Policy.Paths[j1]
1347 buf.EncodeUint32(v1.SwIfIndex)
1348 buf.EncodeUint32(v1.TableID)
1349 buf.EncodeUint32(v1.RpfID)
1350 buf.EncodeUint8(v1.Weight)
1351 buf.EncodeUint8(v1.Preference)
1352 buf.EncodeUint32(uint32(v1.Type))
1353 buf.EncodeUint32(uint32(v1.Flags))
1354 buf.EncodeUint32(uint32(v1.Proto))
1355 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1356 buf.EncodeUint32(v1.Nh.ViaLabel)
1357 buf.EncodeUint32(v1.Nh.ObjID)
1358 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1359 buf.EncodeUint8(v1.NLabels)
1360 for j2 := 0; j2 < 16; j2++ {
1361 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1362 buf.EncodeUint32(v1.LabelStack[j2].Label)
1363 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1364 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1367 return buf.Bytes(), nil
1369 func (m *AbfPolicyAddDel) Unmarshal(b []byte) error {
1370 buf := codec.NewBuffer(b)
1371 m.IsAdd = buf.DecodeBool()
1372 m.Policy.PolicyID = buf.DecodeUint32()
1373 m.Policy.ACLIndex = buf.DecodeUint32()
1374 m.Policy.NPaths = buf.DecodeUint8()
1375 m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1376 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1377 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1378 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1379 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1380 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1381 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1382 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1383 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1384 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1385 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1386 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1387 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1388 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1389 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1390 for j2 := 0; j2 < 16; j2++ {
1391 m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1392 m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1393 m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1394 m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1400 // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'.
1401 type AbfPolicyAddDelReply struct {
1402 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1405 func (m *AbfPolicyAddDelReply) Reset() { *m = AbfPolicyAddDelReply{} }
1406 func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" }
1407 func (*AbfPolicyAddDelReply) GetCrcString() string { return "e8d4e804" }
1408 func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType {
1409 return api.ReplyMessage
1412 func (m *AbfPolicyAddDelReply) Size() (size int) {
1416 size += 4 // m.Retval
1419 func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) {
1421 b = make([]byte, m.Size())
1423 buf := codec.NewBuffer(b)
1424 buf.EncodeInt32(m.Retval)
1425 return buf.Bytes(), nil
1427 func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error {
1428 buf := codec.NewBuffer(b)
1429 m.Retval = buf.DecodeInt32()
1433 // AbfPolicyDetails defines message 'abf_policy_details'.
1434 type AbfPolicyDetails struct {
1435 Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1438 func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} }
1439 func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" }
1440 func (*AbfPolicyDetails) GetCrcString() string { return "6769e504" }
1441 func (*AbfPolicyDetails) GetMessageType() api.MessageType {
1442 return api.ReplyMessage
1445 func (m *AbfPolicyDetails) Size() (size int) {
1449 size += 4 // m.Policy.PolicyID
1450 size += 4 // m.Policy.ACLIndex
1451 size += 1 // m.Policy.NPaths
1452 for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1455 if j2 < len(m.Policy.Paths) {
1456 s2 = m.Policy.Paths[j2]
1458 size += 4 // s2.SwIfIndex
1459 size += 4 // s2.TableID
1460 size += 4 // s2.RpfID
1461 size += 1 // s2.Weight
1462 size += 1 // s2.Preference
1463 size += 4 // s2.Type
1464 size += 4 // s2.Flags
1465 size += 4 // s2.Proto
1466 size += 1 * 16 // s2.Nh.Address
1467 size += 4 // s2.Nh.ViaLabel
1468 size += 4 // s2.Nh.ObjID
1469 size += 4 // s2.Nh.ClassifyTableIndex
1470 size += 1 // s2.NLabels
1471 for j3 := 0; j3 < 16; j3++ {
1472 size += 1 // s2.LabelStack[j3].IsUniform
1473 size += 4 // s2.LabelStack[j3].Label
1474 size += 1 // s2.LabelStack[j3].TTL
1475 size += 1 // s2.LabelStack[j3].Exp
1480 func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) {
1482 b = make([]byte, m.Size())
1484 buf := codec.NewBuffer(b)
1485 buf.EncodeUint32(m.Policy.PolicyID)
1486 buf.EncodeUint32(m.Policy.ACLIndex)
1487 buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1488 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1489 var v1 FibPath // Paths
1490 if j1 < len(m.Policy.Paths) {
1491 v1 = m.Policy.Paths[j1]
1493 buf.EncodeUint32(v1.SwIfIndex)
1494 buf.EncodeUint32(v1.TableID)
1495 buf.EncodeUint32(v1.RpfID)
1496 buf.EncodeUint8(v1.Weight)
1497 buf.EncodeUint8(v1.Preference)
1498 buf.EncodeUint32(uint32(v1.Type))
1499 buf.EncodeUint32(uint32(v1.Flags))
1500 buf.EncodeUint32(uint32(v1.Proto))
1501 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1502 buf.EncodeUint32(v1.Nh.ViaLabel)
1503 buf.EncodeUint32(v1.Nh.ObjID)
1504 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1505 buf.EncodeUint8(v1.NLabels)
1506 for j2 := 0; j2 < 16; j2++ {
1507 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1508 buf.EncodeUint32(v1.LabelStack[j2].Label)
1509 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1510 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1513 return buf.Bytes(), nil
1515 func (m *AbfPolicyDetails) Unmarshal(b []byte) error {
1516 buf := codec.NewBuffer(b)
1517 m.Policy.PolicyID = buf.DecodeUint32()
1518 m.Policy.ACLIndex = buf.DecodeUint32()
1519 m.Policy.NPaths = buf.DecodeUint8()
1520 m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1521 for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1522 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1523 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1524 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1525 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1526 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1527 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1528 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1529 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1530 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1531 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1532 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1533 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1534 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1535 for j2 := 0; j2 < 16; j2++ {
1536 m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1537 m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1538 m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1539 m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1545 // AbfPolicyDump defines message 'abf_policy_dump'.
1546 type AbfPolicyDump struct{}
1548 func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} }
1549 func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" }
1550 func (*AbfPolicyDump) GetCrcString() string { return "51077d14" }
1551 func (*AbfPolicyDump) GetMessageType() api.MessageType {
1552 return api.RequestMessage
1555 func (m *AbfPolicyDump) Size() (size int) {
1561 func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) {
1563 b = make([]byte, m.Size())
1565 buf := codec.NewBuffer(b)
1566 return buf.Bytes(), nil
1568 func (m *AbfPolicyDump) Unmarshal(b []byte) error {
1572 func init() { file_abf_binapi_init() }
1573 func file_abf_binapi_init() {
1574 api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b")
1575 api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804")
1576 api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e")
1577 api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14")
1578 api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14")
1579 api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86")
1580 api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e")
1581 api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804")
1582 api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504")
1583 api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14")
1586 // Messages returns list of all messages in this module.
1587 func AllMessages() []api.Message {
1588 return []api.Message{
1589 (*AbfItfAttachAddDel)(nil),
1590 (*AbfItfAttachAddDelReply)(nil),
1591 (*AbfItfAttachDetails)(nil),
1592 (*AbfItfAttachDump)(nil),
1593 (*AbfPluginGetVersion)(nil),
1594 (*AbfPluginGetVersionReply)(nil),
1595 (*AbfPolicyAddDel)(nil),
1596 (*AbfPolicyAddDelReply)(nil),
1597 (*AbfPolicyDetails)(nil),
1598 (*AbfPolicyDump)(nil),