1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: .vppapi/core/mpls.api.json
7 // Package mpls contains generated bindings for API file mpls.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 = 0xfe593e14
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 // Address defines type 'address'.
740 type Address struct {
741 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
742 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
745 func ParseAddress(s string) (Address, error) {
748 return Address{}, fmt.Errorf("invalid address: %s", s)
750 return AddressFromIP(ip), nil
753 func AddressFromIP(ip net.IP) Address {
756 addr.Af = ADDRESS_IP6
758 copy(ip6[:], ip.To16())
761 addr.Af = ADDRESS_IP4
763 copy(ip4[:], ip.To4())
769 func (x Address) ToIP() net.IP {
770 if x.Af == ADDRESS_IP6 {
772 return net.IP(ip6[:]).To16()
775 return net.IP(ip4[:]).To4()
779 func (x Address) String() string {
780 return x.ToIP().String()
783 func (x *Address) MarshalText() ([]byte, error) {
784 return []byte(x.String()), nil
787 func (x *Address) UnmarshalText(text []byte) error {
788 addr, err := ParseAddress(string(text))
796 // FibMplsLabel defines type 'fib_mpls_label'.
797 type FibMplsLabel struct {
798 IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
799 Label uint32 `binapi:"u32,name=label" json:"label,omitempty"`
800 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"`
801 Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"`
804 // FibPath defines type 'fib_path'.
805 type FibPath struct {
806 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
807 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
808 RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
809 Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"`
810 Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"`
811 Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"`
812 Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
813 Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
814 Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
815 NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
816 LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
819 // FibPathNh defines type 'fib_path_nh'.
820 type FibPathNh struct {
821 Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
822 ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"`
823 ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
824 ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
827 // IP4Prefix defines type 'ip4_prefix'.
828 type IP4Prefix struct {
829 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
830 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
833 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
834 hasPrefix := strings.Contains(s, "/")
836 ip, network, err := net.ParseCIDR(s)
838 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
840 maskSize, _ := network.Mask.Size()
841 prefix.Len = byte(maskSize)
842 prefix.Address, err = ParseIP4Address(ip.String())
844 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
848 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
850 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
852 prefix.Len = byte(defaultMaskSize)
853 prefix.Address, err = ParseIP4Address(ip.String())
855 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
861 func (x IP4Prefix) ToIPNet() *net.IPNet {
862 mask := net.CIDRMask(int(x.Len), 32)
863 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
867 func (x IP4Prefix) String() string {
868 ip := x.Address.String()
869 return ip + "/" + strconv.Itoa(int(x.Len))
872 func (x *IP4Prefix) MarshalText() ([]byte, error) {
873 return []byte(x.String()), nil
876 func (x *IP4Prefix) UnmarshalText(text []byte) error {
877 prefix, err := ParseIP4Prefix(string(text))
885 // IP6Prefix defines type 'ip6_prefix'.
886 type IP6Prefix struct {
887 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
888 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
891 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
892 hasPrefix := strings.Contains(s, "/")
894 ip, network, err := net.ParseCIDR(s)
896 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
898 maskSize, _ := network.Mask.Size()
899 prefix.Len = byte(maskSize)
900 prefix.Address, err = ParseIP6Address(ip.String())
902 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
906 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
908 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
910 prefix.Len = byte(defaultMaskSize)
911 prefix.Address, err = ParseIP6Address(ip.String())
913 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
919 func (x IP6Prefix) ToIPNet() *net.IPNet {
920 mask := net.CIDRMask(int(x.Len), 128)
921 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
925 func (x IP6Prefix) String() string {
926 ip := x.Address.String()
927 return ip + "/" + strconv.Itoa(int(x.Len))
930 func (x *IP6Prefix) MarshalText() ([]byte, error) {
931 return []byte(x.String()), nil
934 func (x *IP6Prefix) UnmarshalText(text []byte) error {
935 prefix, err := ParseIP6Prefix(string(text))
943 // MplsRoute defines type 'mpls_route'.
944 type MplsRoute struct {
945 MrTableID uint32 `binapi:"u32,name=mr_table_id" json:"mr_table_id,omitempty"`
946 MrLabel uint32 `binapi:"u32,name=mr_label" json:"mr_label,omitempty"`
947 MrEos uint8 `binapi:"u8,name=mr_eos" json:"mr_eos,omitempty"`
948 MrEosProto uint8 `binapi:"u8,name=mr_eos_proto" json:"mr_eos_proto,omitempty"`
949 MrIsMulticast bool `binapi:"bool,name=mr_is_multicast" json:"mr_is_multicast,omitempty"`
950 MrNPaths uint8 `binapi:"u8,name=mr_n_paths" json:"-"`
951 MrPaths []FibPath `binapi:"fib_path[mr_n_paths],name=mr_paths" json:"mr_paths,omitempty"`
954 // MplsTable defines type 'mpls_table'.
955 type MplsTable struct {
956 MtTableID uint32 `binapi:"u32,name=mt_table_id" json:"mt_table_id,omitempty"`
957 MtName string `binapi:"string[64],name=mt_name" json:"mt_name,omitempty"`
960 // MplsTunnel defines type 'mpls_tunnel'.
961 type MplsTunnel struct {
962 MtSwIfIndex InterfaceIndex `binapi:"interface_index,name=mt_sw_if_index" json:"mt_sw_if_index,omitempty"`
963 MtTunnelIndex uint32 `binapi:"u32,name=mt_tunnel_index" json:"mt_tunnel_index,omitempty"`
964 MtL2Only bool `binapi:"bool,name=mt_l2_only" json:"mt_l2_only,omitempty"`
965 MtIsMulticast bool `binapi:"bool,name=mt_is_multicast" json:"mt_is_multicast,omitempty"`
966 MtNPaths uint8 `binapi:"u8,name=mt_n_paths" json:"-"`
967 MtPaths []FibPath `binapi:"fib_path[mt_n_paths],name=mt_paths" json:"mt_paths,omitempty"`
970 // Mprefix defines type 'mprefix'.
971 type Mprefix struct {
972 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
973 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
974 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
975 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
978 // Prefix defines type 'prefix'.
980 Address Address `binapi:"address,name=address" json:"address,omitempty"`
981 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
984 func ParsePrefix(ip string) (prefix Prefix, err error) {
985 hasPrefix := strings.Contains(ip, "/")
987 netIP, network, err := net.ParseCIDR(ip)
989 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
991 maskSize, _ := network.Mask.Size()
992 prefix.Len = byte(maskSize)
993 prefix.Address, err = ParseAddress(netIP.String())
995 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
998 netIP := net.ParseIP(ip)
999 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
1000 if netIP.To4() == nil {
1001 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
1003 prefix.Len = byte(defaultMaskSize)
1004 prefix.Address, err = ParseAddress(netIP.String())
1006 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
1012 func (x Prefix) ToIPNet() *net.IPNet {
1014 if x.Address.Af == ADDRESS_IP4 {
1015 mask = net.CIDRMask(int(x.Len), 32)
1017 mask = net.CIDRMask(int(x.Len), 128)
1019 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1023 func (x Prefix) String() string {
1024 ip := x.Address.String()
1025 return ip + "/" + strconv.Itoa(int(x.Len))
1028 func (x *Prefix) MarshalText() ([]byte, error) {
1029 return []byte(x.String()), nil
1032 func (x *Prefix) UnmarshalText(text []byte) error {
1033 prefix, err := ParsePrefix(string(text))
1041 // PrefixMatcher defines type 'prefix_matcher'.
1042 type PrefixMatcher struct {
1043 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1044 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1047 // AddressUnion defines union 'address_union'.
1048 type AddressUnion struct {
1049 // AddressUnion can be one of:
1050 // - IP4 *IP4Address
1051 // - IP6 *IP6Address
1052 XXX_UnionData [16]byte
1055 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1059 func (u *AddressUnion) SetIP4(a IP4Address) {
1060 buf := codec.NewBuffer(u.XXX_UnionData[:])
1061 buf.EncodeBytes(a[:], 4)
1063 func (u *AddressUnion) GetIP4() (a IP4Address) {
1064 buf := codec.NewBuffer(u.XXX_UnionData[:])
1065 copy(a[:], buf.DecodeBytes(4))
1069 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1073 func (u *AddressUnion) SetIP6(a IP6Address) {
1074 buf := codec.NewBuffer(u.XXX_UnionData[:])
1075 buf.EncodeBytes(a[:], 16)
1077 func (u *AddressUnion) GetIP6() (a IP6Address) {
1078 buf := codec.NewBuffer(u.XXX_UnionData[:])
1079 copy(a[:], buf.DecodeBytes(16))
1083 // MplsIPBindUnbind defines message 'mpls_ip_bind_unbind'.
1084 type MplsIPBindUnbind struct {
1085 MbMplsTableID uint32 `binapi:"u32,name=mb_mpls_table_id" json:"mb_mpls_table_id,omitempty"`
1086 MbLabel uint32 `binapi:"u32,name=mb_label" json:"mb_label,omitempty"`
1087 MbIPTableID uint32 `binapi:"u32,name=mb_ip_table_id" json:"mb_ip_table_id,omitempty"`
1088 MbIsBind bool `binapi:"bool,name=mb_is_bind" json:"mb_is_bind,omitempty"`
1089 MbPrefix Prefix `binapi:"prefix,name=mb_prefix" json:"mb_prefix,omitempty"`
1092 func (m *MplsIPBindUnbind) Reset() { *m = MplsIPBindUnbind{} }
1093 func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" }
1094 func (*MplsIPBindUnbind) GetCrcString() string { return "48249a27" }
1095 func (*MplsIPBindUnbind) GetMessageType() api.MessageType {
1096 return api.RequestMessage
1099 func (m *MplsIPBindUnbind) Size() (size int) {
1103 size += 4 // m.MbMplsTableID
1104 size += 4 // m.MbLabel
1105 size += 4 // m.MbIPTableID
1106 size += 1 // m.MbIsBind
1107 size += 4 // m.MbPrefix.Address.Af
1108 size += 1 * 16 // m.MbPrefix.Address.Un
1109 size += 1 // m.MbPrefix.Len
1112 func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) {
1114 b = make([]byte, m.Size())
1116 buf := codec.NewBuffer(b)
1117 buf.EncodeUint32(m.MbMplsTableID)
1118 buf.EncodeUint32(m.MbLabel)
1119 buf.EncodeUint32(m.MbIPTableID)
1120 buf.EncodeBool(m.MbIsBind)
1121 buf.EncodeUint32(uint32(m.MbPrefix.Address.Af))
1122 buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 16)
1123 buf.EncodeUint8(m.MbPrefix.Len)
1124 return buf.Bytes(), nil
1126 func (m *MplsIPBindUnbind) Unmarshal(b []byte) error {
1127 buf := codec.NewBuffer(b)
1128 m.MbMplsTableID = buf.DecodeUint32()
1129 m.MbLabel = buf.DecodeUint32()
1130 m.MbIPTableID = buf.DecodeUint32()
1131 m.MbIsBind = buf.DecodeBool()
1132 m.MbPrefix.Address.Af = AddressFamily(buf.DecodeUint32())
1133 copy(m.MbPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1134 m.MbPrefix.Len = buf.DecodeUint8()
1138 // MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'.
1139 type MplsIPBindUnbindReply struct {
1140 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1143 func (m *MplsIPBindUnbindReply) Reset() { *m = MplsIPBindUnbindReply{} }
1144 func (*MplsIPBindUnbindReply) GetMessageName() string { return "mpls_ip_bind_unbind_reply" }
1145 func (*MplsIPBindUnbindReply) GetCrcString() string { return "e8d4e804" }
1146 func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType {
1147 return api.ReplyMessage
1150 func (m *MplsIPBindUnbindReply) Size() (size int) {
1154 size += 4 // m.Retval
1157 func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) {
1159 b = make([]byte, m.Size())
1161 buf := codec.NewBuffer(b)
1162 buf.EncodeInt32(m.Retval)
1163 return buf.Bytes(), nil
1165 func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error {
1166 buf := codec.NewBuffer(b)
1167 m.Retval = buf.DecodeInt32()
1171 // MplsRouteAddDel defines message 'mpls_route_add_del'.
1172 type MplsRouteAddDel struct {
1173 MrIsAdd bool `binapi:"bool,name=mr_is_add" json:"mr_is_add,omitempty"`
1174 MrIsMultipath bool `binapi:"bool,name=mr_is_multipath" json:"mr_is_multipath,omitempty"`
1175 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1178 func (m *MplsRouteAddDel) Reset() { *m = MplsRouteAddDel{} }
1179 func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" }
1180 func (*MplsRouteAddDel) GetCrcString() string { return "343cff54" }
1181 func (*MplsRouteAddDel) GetMessageType() api.MessageType {
1182 return api.RequestMessage
1185 func (m *MplsRouteAddDel) Size() (size int) {
1189 size += 1 // m.MrIsAdd
1190 size += 1 // m.MrIsMultipath
1191 size += 4 // m.MrRoute.MrTableID
1192 size += 4 // m.MrRoute.MrLabel
1193 size += 1 // m.MrRoute.MrEos
1194 size += 1 // m.MrRoute.MrEosProto
1195 size += 1 // m.MrRoute.MrIsMulticast
1196 size += 1 // m.MrRoute.MrNPaths
1197 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1200 if j2 < len(m.MrRoute.MrPaths) {
1201 s2 = m.MrRoute.MrPaths[j2]
1203 size += 4 // s2.SwIfIndex
1204 size += 4 // s2.TableID
1205 size += 4 // s2.RpfID
1206 size += 1 // s2.Weight
1207 size += 1 // s2.Preference
1208 size += 4 // s2.Type
1209 size += 4 // s2.Flags
1210 size += 4 // s2.Proto
1211 size += 1 * 16 // s2.Nh.Address
1212 size += 4 // s2.Nh.ViaLabel
1213 size += 4 // s2.Nh.ObjID
1214 size += 4 // s2.Nh.ClassifyTableIndex
1215 size += 1 // s2.NLabels
1216 for j3 := 0; j3 < 16; j3++ {
1217 size += 1 // s2.LabelStack[j3].IsUniform
1218 size += 4 // s2.LabelStack[j3].Label
1219 size += 1 // s2.LabelStack[j3].TTL
1220 size += 1 // s2.LabelStack[j3].Exp
1225 func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) {
1227 b = make([]byte, m.Size())
1229 buf := codec.NewBuffer(b)
1230 buf.EncodeBool(m.MrIsAdd)
1231 buf.EncodeBool(m.MrIsMultipath)
1232 buf.EncodeUint32(m.MrRoute.MrTableID)
1233 buf.EncodeUint32(m.MrRoute.MrLabel)
1234 buf.EncodeUint8(m.MrRoute.MrEos)
1235 buf.EncodeUint8(m.MrRoute.MrEosProto)
1236 buf.EncodeBool(m.MrRoute.MrIsMulticast)
1237 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1238 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1239 var v1 FibPath // MrPaths
1240 if j1 < len(m.MrRoute.MrPaths) {
1241 v1 = m.MrRoute.MrPaths[j1]
1243 buf.EncodeUint32(v1.SwIfIndex)
1244 buf.EncodeUint32(v1.TableID)
1245 buf.EncodeUint32(v1.RpfID)
1246 buf.EncodeUint8(v1.Weight)
1247 buf.EncodeUint8(v1.Preference)
1248 buf.EncodeUint32(uint32(v1.Type))
1249 buf.EncodeUint32(uint32(v1.Flags))
1250 buf.EncodeUint32(uint32(v1.Proto))
1251 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1252 buf.EncodeUint32(v1.Nh.ViaLabel)
1253 buf.EncodeUint32(v1.Nh.ObjID)
1254 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1255 buf.EncodeUint8(v1.NLabels)
1256 for j2 := 0; j2 < 16; j2++ {
1257 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1258 buf.EncodeUint32(v1.LabelStack[j2].Label)
1259 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1260 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1263 return buf.Bytes(), nil
1265 func (m *MplsRouteAddDel) Unmarshal(b []byte) error {
1266 buf := codec.NewBuffer(b)
1267 m.MrIsAdd = buf.DecodeBool()
1268 m.MrIsMultipath = buf.DecodeBool()
1269 m.MrRoute.MrTableID = buf.DecodeUint32()
1270 m.MrRoute.MrLabel = buf.DecodeUint32()
1271 m.MrRoute.MrEos = buf.DecodeUint8()
1272 m.MrRoute.MrEosProto = buf.DecodeUint8()
1273 m.MrRoute.MrIsMulticast = buf.DecodeBool()
1274 m.MrRoute.MrNPaths = buf.DecodeUint8()
1275 m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1276 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1277 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1278 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1279 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1280 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1281 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1282 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1283 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1284 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1285 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1286 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1287 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1288 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1289 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1290 for j2 := 0; j2 < 16; j2++ {
1291 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1292 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1293 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1294 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1300 // MplsRouteAddDelReply defines message 'mpls_route_add_del_reply'.
1301 type MplsRouteAddDelReply struct {
1302 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1303 StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"`
1306 func (m *MplsRouteAddDelReply) Reset() { *m = MplsRouteAddDelReply{} }
1307 func (*MplsRouteAddDelReply) GetMessageName() string { return "mpls_route_add_del_reply" }
1308 func (*MplsRouteAddDelReply) GetCrcString() string { return "1992deab" }
1309 func (*MplsRouteAddDelReply) GetMessageType() api.MessageType {
1310 return api.ReplyMessage
1313 func (m *MplsRouteAddDelReply) Size() (size int) {
1317 size += 4 // m.Retval
1318 size += 4 // m.StatsIndex
1321 func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
1323 b = make([]byte, m.Size())
1325 buf := codec.NewBuffer(b)
1326 buf.EncodeInt32(m.Retval)
1327 buf.EncodeUint32(m.StatsIndex)
1328 return buf.Bytes(), nil
1330 func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error {
1331 buf := codec.NewBuffer(b)
1332 m.Retval = buf.DecodeInt32()
1333 m.StatsIndex = buf.DecodeUint32()
1337 // MplsRouteDetails defines message 'mpls_route_details'.
1338 type MplsRouteDetails struct {
1339 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1342 func (m *MplsRouteDetails) Reset() { *m = MplsRouteDetails{} }
1343 func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" }
1344 func (*MplsRouteDetails) GetCrcString() string { return "d0ac384c" }
1345 func (*MplsRouteDetails) GetMessageType() api.MessageType {
1346 return api.ReplyMessage
1349 func (m *MplsRouteDetails) Size() (size int) {
1353 size += 4 // m.MrRoute.MrTableID
1354 size += 4 // m.MrRoute.MrLabel
1355 size += 1 // m.MrRoute.MrEos
1356 size += 1 // m.MrRoute.MrEosProto
1357 size += 1 // m.MrRoute.MrIsMulticast
1358 size += 1 // m.MrRoute.MrNPaths
1359 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1362 if j2 < len(m.MrRoute.MrPaths) {
1363 s2 = m.MrRoute.MrPaths[j2]
1365 size += 4 // s2.SwIfIndex
1366 size += 4 // s2.TableID
1367 size += 4 // s2.RpfID
1368 size += 1 // s2.Weight
1369 size += 1 // s2.Preference
1370 size += 4 // s2.Type
1371 size += 4 // s2.Flags
1372 size += 4 // s2.Proto
1373 size += 1 * 16 // s2.Nh.Address
1374 size += 4 // s2.Nh.ViaLabel
1375 size += 4 // s2.Nh.ObjID
1376 size += 4 // s2.Nh.ClassifyTableIndex
1377 size += 1 // s2.NLabels
1378 for j3 := 0; j3 < 16; j3++ {
1379 size += 1 // s2.LabelStack[j3].IsUniform
1380 size += 4 // s2.LabelStack[j3].Label
1381 size += 1 // s2.LabelStack[j3].TTL
1382 size += 1 // s2.LabelStack[j3].Exp
1387 func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) {
1389 b = make([]byte, m.Size())
1391 buf := codec.NewBuffer(b)
1392 buf.EncodeUint32(m.MrRoute.MrTableID)
1393 buf.EncodeUint32(m.MrRoute.MrLabel)
1394 buf.EncodeUint8(m.MrRoute.MrEos)
1395 buf.EncodeUint8(m.MrRoute.MrEosProto)
1396 buf.EncodeBool(m.MrRoute.MrIsMulticast)
1397 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1398 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1399 var v1 FibPath // MrPaths
1400 if j1 < len(m.MrRoute.MrPaths) {
1401 v1 = m.MrRoute.MrPaths[j1]
1403 buf.EncodeUint32(v1.SwIfIndex)
1404 buf.EncodeUint32(v1.TableID)
1405 buf.EncodeUint32(v1.RpfID)
1406 buf.EncodeUint8(v1.Weight)
1407 buf.EncodeUint8(v1.Preference)
1408 buf.EncodeUint32(uint32(v1.Type))
1409 buf.EncodeUint32(uint32(v1.Flags))
1410 buf.EncodeUint32(uint32(v1.Proto))
1411 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1412 buf.EncodeUint32(v1.Nh.ViaLabel)
1413 buf.EncodeUint32(v1.Nh.ObjID)
1414 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1415 buf.EncodeUint8(v1.NLabels)
1416 for j2 := 0; j2 < 16; j2++ {
1417 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1418 buf.EncodeUint32(v1.LabelStack[j2].Label)
1419 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1420 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1423 return buf.Bytes(), nil
1425 func (m *MplsRouteDetails) Unmarshal(b []byte) error {
1426 buf := codec.NewBuffer(b)
1427 m.MrRoute.MrTableID = buf.DecodeUint32()
1428 m.MrRoute.MrLabel = buf.DecodeUint32()
1429 m.MrRoute.MrEos = buf.DecodeUint8()
1430 m.MrRoute.MrEosProto = buf.DecodeUint8()
1431 m.MrRoute.MrIsMulticast = buf.DecodeBool()
1432 m.MrRoute.MrNPaths = buf.DecodeUint8()
1433 m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1434 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1435 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1436 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1437 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1438 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1439 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1440 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1441 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1442 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1443 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1444 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1445 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1446 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1447 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1448 for j2 := 0; j2 < 16; j2++ {
1449 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1450 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1451 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1452 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1458 // MplsRouteDump defines message 'mpls_route_dump'.
1459 type MplsRouteDump struct {
1460 Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"`
1463 func (m *MplsRouteDump) Reset() { *m = MplsRouteDump{} }
1464 func (*MplsRouteDump) GetMessageName() string { return "mpls_route_dump" }
1465 func (*MplsRouteDump) GetCrcString() string { return "935fdefa" }
1466 func (*MplsRouteDump) GetMessageType() api.MessageType {
1467 return api.RequestMessage
1470 func (m *MplsRouteDump) Size() (size int) {
1474 size += 4 // m.Table.MtTableID
1475 size += 64 // m.Table.MtName
1478 func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) {
1480 b = make([]byte, m.Size())
1482 buf := codec.NewBuffer(b)
1483 buf.EncodeUint32(m.Table.MtTableID)
1484 buf.EncodeString(m.Table.MtName, 64)
1485 return buf.Bytes(), nil
1487 func (m *MplsRouteDump) Unmarshal(b []byte) error {
1488 buf := codec.NewBuffer(b)
1489 m.Table.MtTableID = buf.DecodeUint32()
1490 m.Table.MtName = buf.DecodeString(64)
1494 // MplsTableAddDel defines message 'mpls_table_add_del'.
1495 type MplsTableAddDel struct {
1496 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1497 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1500 func (m *MplsTableAddDel) Reset() { *m = MplsTableAddDel{} }
1501 func (*MplsTableAddDel) GetMessageName() string { return "mpls_table_add_del" }
1502 func (*MplsTableAddDel) GetCrcString() string { return "57817512" }
1503 func (*MplsTableAddDel) GetMessageType() api.MessageType {
1504 return api.RequestMessage
1507 func (m *MplsTableAddDel) Size() (size int) {
1511 size += 1 // m.MtIsAdd
1512 size += 4 // m.MtTable.MtTableID
1513 size += 64 // m.MtTable.MtName
1516 func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) {
1518 b = make([]byte, m.Size())
1520 buf := codec.NewBuffer(b)
1521 buf.EncodeBool(m.MtIsAdd)
1522 buf.EncodeUint32(m.MtTable.MtTableID)
1523 buf.EncodeString(m.MtTable.MtName, 64)
1524 return buf.Bytes(), nil
1526 func (m *MplsTableAddDel) Unmarshal(b []byte) error {
1527 buf := codec.NewBuffer(b)
1528 m.MtIsAdd = buf.DecodeBool()
1529 m.MtTable.MtTableID = buf.DecodeUint32()
1530 m.MtTable.MtName = buf.DecodeString(64)
1534 // MplsTableAddDelReply defines message 'mpls_table_add_del_reply'.
1535 type MplsTableAddDelReply struct {
1536 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1539 func (m *MplsTableAddDelReply) Reset() { *m = MplsTableAddDelReply{} }
1540 func (*MplsTableAddDelReply) GetMessageName() string { return "mpls_table_add_del_reply" }
1541 func (*MplsTableAddDelReply) GetCrcString() string { return "e8d4e804" }
1542 func (*MplsTableAddDelReply) GetMessageType() api.MessageType {
1543 return api.ReplyMessage
1546 func (m *MplsTableAddDelReply) Size() (size int) {
1550 size += 4 // m.Retval
1553 func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1555 b = make([]byte, m.Size())
1557 buf := codec.NewBuffer(b)
1558 buf.EncodeInt32(m.Retval)
1559 return buf.Bytes(), nil
1561 func (m *MplsTableAddDelReply) Unmarshal(b []byte) error {
1562 buf := codec.NewBuffer(b)
1563 m.Retval = buf.DecodeInt32()
1567 // MplsTableDetails defines message 'mpls_table_details'.
1568 type MplsTableDetails struct {
1569 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1572 func (m *MplsTableDetails) Reset() { *m = MplsTableDetails{} }
1573 func (*MplsTableDetails) GetMessageName() string { return "mpls_table_details" }
1574 func (*MplsTableDetails) GetCrcString() string { return "f03ecdc8" }
1575 func (*MplsTableDetails) GetMessageType() api.MessageType {
1576 return api.ReplyMessage
1579 func (m *MplsTableDetails) Size() (size int) {
1583 size += 4 // m.MtTable.MtTableID
1584 size += 64 // m.MtTable.MtName
1587 func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) {
1589 b = make([]byte, m.Size())
1591 buf := codec.NewBuffer(b)
1592 buf.EncodeUint32(m.MtTable.MtTableID)
1593 buf.EncodeString(m.MtTable.MtName, 64)
1594 return buf.Bytes(), nil
1596 func (m *MplsTableDetails) Unmarshal(b []byte) error {
1597 buf := codec.NewBuffer(b)
1598 m.MtTable.MtTableID = buf.DecodeUint32()
1599 m.MtTable.MtName = buf.DecodeString(64)
1603 // MplsTableDump defines message 'mpls_table_dump'.
1604 type MplsTableDump struct{}
1606 func (m *MplsTableDump) Reset() { *m = MplsTableDump{} }
1607 func (*MplsTableDump) GetMessageName() string { return "mpls_table_dump" }
1608 func (*MplsTableDump) GetCrcString() string { return "51077d14" }
1609 func (*MplsTableDump) GetMessageType() api.MessageType {
1610 return api.RequestMessage
1613 func (m *MplsTableDump) Size() (size int) {
1619 func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) {
1621 b = make([]byte, m.Size())
1623 buf := codec.NewBuffer(b)
1624 return buf.Bytes(), nil
1626 func (m *MplsTableDump) Unmarshal(b []byte) error {
1630 // MplsTunnelAddDel defines message 'mpls_tunnel_add_del'.
1631 type MplsTunnelAddDel struct {
1632 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1633 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1636 func (m *MplsTunnelAddDel) Reset() { *m = MplsTunnelAddDel{} }
1637 func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" }
1638 func (*MplsTunnelAddDel) GetCrcString() string { return "0de2478e" }
1639 func (*MplsTunnelAddDel) GetMessageType() api.MessageType {
1640 return api.RequestMessage
1643 func (m *MplsTunnelAddDel) Size() (size int) {
1647 size += 1 // m.MtIsAdd
1648 size += 4 // m.MtTunnel.MtSwIfIndex
1649 size += 4 // m.MtTunnel.MtTunnelIndex
1650 size += 1 // m.MtTunnel.MtL2Only
1651 size += 1 // m.MtTunnel.MtIsMulticast
1652 size += 1 // m.MtTunnel.MtNPaths
1653 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1656 if j2 < len(m.MtTunnel.MtPaths) {
1657 s2 = m.MtTunnel.MtPaths[j2]
1659 size += 4 // s2.SwIfIndex
1660 size += 4 // s2.TableID
1661 size += 4 // s2.RpfID
1662 size += 1 // s2.Weight
1663 size += 1 // s2.Preference
1664 size += 4 // s2.Type
1665 size += 4 // s2.Flags
1666 size += 4 // s2.Proto
1667 size += 1 * 16 // s2.Nh.Address
1668 size += 4 // s2.Nh.ViaLabel
1669 size += 4 // s2.Nh.ObjID
1670 size += 4 // s2.Nh.ClassifyTableIndex
1671 size += 1 // s2.NLabels
1672 for j3 := 0; j3 < 16; j3++ {
1673 size += 1 // s2.LabelStack[j3].IsUniform
1674 size += 4 // s2.LabelStack[j3].Label
1675 size += 1 // s2.LabelStack[j3].TTL
1676 size += 1 // s2.LabelStack[j3].Exp
1681 func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) {
1683 b = make([]byte, m.Size())
1685 buf := codec.NewBuffer(b)
1686 buf.EncodeBool(m.MtIsAdd)
1687 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1688 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1689 buf.EncodeBool(m.MtTunnel.MtL2Only)
1690 buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1691 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1692 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1693 var v1 FibPath // MtPaths
1694 if j1 < len(m.MtTunnel.MtPaths) {
1695 v1 = m.MtTunnel.MtPaths[j1]
1697 buf.EncodeUint32(v1.SwIfIndex)
1698 buf.EncodeUint32(v1.TableID)
1699 buf.EncodeUint32(v1.RpfID)
1700 buf.EncodeUint8(v1.Weight)
1701 buf.EncodeUint8(v1.Preference)
1702 buf.EncodeUint32(uint32(v1.Type))
1703 buf.EncodeUint32(uint32(v1.Flags))
1704 buf.EncodeUint32(uint32(v1.Proto))
1705 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1706 buf.EncodeUint32(v1.Nh.ViaLabel)
1707 buf.EncodeUint32(v1.Nh.ObjID)
1708 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1709 buf.EncodeUint8(v1.NLabels)
1710 for j2 := 0; j2 < 16; j2++ {
1711 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1712 buf.EncodeUint32(v1.LabelStack[j2].Label)
1713 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1714 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1717 return buf.Bytes(), nil
1719 func (m *MplsTunnelAddDel) Unmarshal(b []byte) error {
1720 buf := codec.NewBuffer(b)
1721 m.MtIsAdd = buf.DecodeBool()
1722 m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1723 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1724 m.MtTunnel.MtL2Only = buf.DecodeBool()
1725 m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1726 m.MtTunnel.MtNPaths = buf.DecodeUint8()
1727 m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1728 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1729 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1730 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1731 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1732 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1733 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1734 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1735 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1736 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1737 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1738 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1739 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1740 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1741 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1742 for j2 := 0; j2 < 16; j2++ {
1743 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1744 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1745 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1746 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1752 // MplsTunnelAddDelReply defines message 'mpls_tunnel_add_del_reply'.
1753 type MplsTunnelAddDelReply struct {
1754 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1755 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1756 TunnelIndex uint32 `binapi:"u32,name=tunnel_index" json:"tunnel_index,omitempty"`
1759 func (m *MplsTunnelAddDelReply) Reset() { *m = MplsTunnelAddDelReply{} }
1760 func (*MplsTunnelAddDelReply) GetMessageName() string { return "mpls_tunnel_add_del_reply" }
1761 func (*MplsTunnelAddDelReply) GetCrcString() string { return "afb01472" }
1762 func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType {
1763 return api.ReplyMessage
1766 func (m *MplsTunnelAddDelReply) Size() (size int) {
1770 size += 4 // m.Retval
1771 size += 4 // m.SwIfIndex
1772 size += 4 // m.TunnelIndex
1775 func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
1777 b = make([]byte, m.Size())
1779 buf := codec.NewBuffer(b)
1780 buf.EncodeInt32(m.Retval)
1781 buf.EncodeUint32(uint32(m.SwIfIndex))
1782 buf.EncodeUint32(m.TunnelIndex)
1783 return buf.Bytes(), nil
1785 func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error {
1786 buf := codec.NewBuffer(b)
1787 m.Retval = buf.DecodeInt32()
1788 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1789 m.TunnelIndex = buf.DecodeUint32()
1793 // MplsTunnelDetails defines message 'mpls_tunnel_details'.
1794 type MplsTunnelDetails struct {
1795 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1798 func (m *MplsTunnelDetails) Reset() { *m = MplsTunnelDetails{} }
1799 func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" }
1800 func (*MplsTunnelDetails) GetCrcString() string { return "bdc55cce" }
1801 func (*MplsTunnelDetails) GetMessageType() api.MessageType {
1802 return api.ReplyMessage
1805 func (m *MplsTunnelDetails) Size() (size int) {
1809 size += 4 // m.MtTunnel.MtSwIfIndex
1810 size += 4 // m.MtTunnel.MtTunnelIndex
1811 size += 1 // m.MtTunnel.MtL2Only
1812 size += 1 // m.MtTunnel.MtIsMulticast
1813 size += 1 // m.MtTunnel.MtNPaths
1814 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1817 if j2 < len(m.MtTunnel.MtPaths) {
1818 s2 = m.MtTunnel.MtPaths[j2]
1820 size += 4 // s2.SwIfIndex
1821 size += 4 // s2.TableID
1822 size += 4 // s2.RpfID
1823 size += 1 // s2.Weight
1824 size += 1 // s2.Preference
1825 size += 4 // s2.Type
1826 size += 4 // s2.Flags
1827 size += 4 // s2.Proto
1828 size += 1 * 16 // s2.Nh.Address
1829 size += 4 // s2.Nh.ViaLabel
1830 size += 4 // s2.Nh.ObjID
1831 size += 4 // s2.Nh.ClassifyTableIndex
1832 size += 1 // s2.NLabels
1833 for j3 := 0; j3 < 16; j3++ {
1834 size += 1 // s2.LabelStack[j3].IsUniform
1835 size += 4 // s2.LabelStack[j3].Label
1836 size += 1 // s2.LabelStack[j3].TTL
1837 size += 1 // s2.LabelStack[j3].Exp
1842 func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) {
1844 b = make([]byte, m.Size())
1846 buf := codec.NewBuffer(b)
1847 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1848 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1849 buf.EncodeBool(m.MtTunnel.MtL2Only)
1850 buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1851 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1852 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1853 var v1 FibPath // MtPaths
1854 if j1 < len(m.MtTunnel.MtPaths) {
1855 v1 = m.MtTunnel.MtPaths[j1]
1857 buf.EncodeUint32(v1.SwIfIndex)
1858 buf.EncodeUint32(v1.TableID)
1859 buf.EncodeUint32(v1.RpfID)
1860 buf.EncodeUint8(v1.Weight)
1861 buf.EncodeUint8(v1.Preference)
1862 buf.EncodeUint32(uint32(v1.Type))
1863 buf.EncodeUint32(uint32(v1.Flags))
1864 buf.EncodeUint32(uint32(v1.Proto))
1865 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1866 buf.EncodeUint32(v1.Nh.ViaLabel)
1867 buf.EncodeUint32(v1.Nh.ObjID)
1868 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1869 buf.EncodeUint8(v1.NLabels)
1870 for j2 := 0; j2 < 16; j2++ {
1871 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1872 buf.EncodeUint32(v1.LabelStack[j2].Label)
1873 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1874 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1877 return buf.Bytes(), nil
1879 func (m *MplsTunnelDetails) Unmarshal(b []byte) error {
1880 buf := codec.NewBuffer(b)
1881 m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1882 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1883 m.MtTunnel.MtL2Only = buf.DecodeBool()
1884 m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1885 m.MtTunnel.MtNPaths = buf.DecodeUint8()
1886 m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1887 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1888 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1889 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1890 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1891 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1892 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1893 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1894 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1895 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1896 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1897 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1898 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1899 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1900 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1901 for j2 := 0; j2 < 16; j2++ {
1902 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1903 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1904 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1905 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1911 // MplsTunnelDump defines message 'mpls_tunnel_dump'.
1912 type MplsTunnelDump struct {
1913 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1916 func (m *MplsTunnelDump) Reset() { *m = MplsTunnelDump{} }
1917 func (*MplsTunnelDump) GetMessageName() string { return "mpls_tunnel_dump" }
1918 func (*MplsTunnelDump) GetCrcString() string { return "f9e6675e" }
1919 func (*MplsTunnelDump) GetMessageType() api.MessageType {
1920 return api.RequestMessage
1923 func (m *MplsTunnelDump) Size() (size int) {
1927 size += 4 // m.SwIfIndex
1930 func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) {
1932 b = make([]byte, m.Size())
1934 buf := codec.NewBuffer(b)
1935 buf.EncodeUint32(uint32(m.SwIfIndex))
1936 return buf.Bytes(), nil
1938 func (m *MplsTunnelDump) Unmarshal(b []byte) error {
1939 buf := codec.NewBuffer(b)
1940 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1944 // SwInterfaceSetMplsEnable defines message 'sw_interface_set_mpls_enable'.
1945 type SwInterfaceSetMplsEnable struct {
1946 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1947 Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1950 func (m *SwInterfaceSetMplsEnable) Reset() { *m = SwInterfaceSetMplsEnable{} }
1951 func (*SwInterfaceSetMplsEnable) GetMessageName() string { return "sw_interface_set_mpls_enable" }
1952 func (*SwInterfaceSetMplsEnable) GetCrcString() string { return "ae6cfcfb" }
1953 func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType {
1954 return api.RequestMessage
1957 func (m *SwInterfaceSetMplsEnable) Size() (size int) {
1961 size += 4 // m.SwIfIndex
1962 size += 1 // m.Enable
1965 func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) {
1967 b = make([]byte, m.Size())
1969 buf := codec.NewBuffer(b)
1970 buf.EncodeUint32(uint32(m.SwIfIndex))
1971 buf.EncodeBool(m.Enable)
1972 return buf.Bytes(), nil
1974 func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error {
1975 buf := codec.NewBuffer(b)
1976 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1977 m.Enable = buf.DecodeBool()
1981 // SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'.
1982 type SwInterfaceSetMplsEnableReply struct {
1983 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1986 func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} }
1987 func (*SwInterfaceSetMplsEnableReply) GetMessageName() string {
1988 return "sw_interface_set_mpls_enable_reply"
1990 func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" }
1991 func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType {
1992 return api.ReplyMessage
1995 func (m *SwInterfaceSetMplsEnableReply) Size() (size int) {
1999 size += 4 // m.Retval
2002 func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) {
2004 b = make([]byte, m.Size())
2006 buf := codec.NewBuffer(b)
2007 buf.EncodeInt32(m.Retval)
2008 return buf.Bytes(), nil
2010 func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error {
2011 buf := codec.NewBuffer(b)
2012 m.Retval = buf.DecodeInt32()
2016 func init() { file_mpls_binapi_init() }
2017 func file_mpls_binapi_init() {
2018 api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_48249a27")
2019 api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804")
2020 api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_343cff54")
2021 api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab")
2022 api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_d0ac384c")
2023 api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa")
2024 api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512")
2025 api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804")
2026 api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8")
2027 api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14")
2028 api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_0de2478e")
2029 api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472")
2030 api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_bdc55cce")
2031 api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e")
2032 api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb")
2033 api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804")
2036 // Messages returns list of all messages in this module.
2037 func AllMessages() []api.Message {
2038 return []api.Message{
2039 (*MplsIPBindUnbind)(nil),
2040 (*MplsIPBindUnbindReply)(nil),
2041 (*MplsRouteAddDel)(nil),
2042 (*MplsRouteAddDelReply)(nil),
2043 (*MplsRouteDetails)(nil),
2044 (*MplsRouteDump)(nil),
2045 (*MplsTableAddDel)(nil),
2046 (*MplsTableAddDelReply)(nil),
2047 (*MplsTableDetails)(nil),
2048 (*MplsTableDump)(nil),
2049 (*MplsTunnelAddDel)(nil),
2050 (*MplsTunnelAddDelReply)(nil),
2051 (*MplsTunnelDetails)(nil),
2052 (*MplsTunnelDump)(nil),
2053 (*SwInterfaceSetMplsEnable)(nil),
2054 (*SwInterfaceSetMplsEnableReply)(nil),