1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: .vppapi/core/mpls.api.json
7 // Package mpls contains generated bindings for API file mpls.api.
20 api "git.fd.io/govpp.git/api"
21 codec "git.fd.io/govpp.git/codec"
27 // This is a compile-time assertion to ensure that this generated file
28 // is compatible with the GoVPP api package it is being compiled against.
29 // A compilation error at this line likely means your copy of the
30 // GoVPP api package needs to be updated.
31 const _ = api.GoVppAPIPackageIsVersion2
36 VersionCrc = 0xfe593e14
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
43 ADDRESS_IP4 AddressFamily = 0
44 ADDRESS_IP6 AddressFamily = 1
48 AddressFamily_name = map[uint32]string{
52 AddressFamily_value = map[string]uint32{
58 func (x AddressFamily) String() string {
59 s, ok := AddressFamily_name[uint32(x)]
63 return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
66 // FibPathFlags defines enum 'fib_path_flags'.
67 type FibPathFlags uint32
70 FIB_API_PATH_FLAG_NONE FibPathFlags = 0
71 FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
72 FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2
73 FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4
77 FibPathFlags_name = map[uint32]string{
78 0: "FIB_API_PATH_FLAG_NONE",
79 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
80 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
81 4: "FIB_API_PATH_FLAG_POP_PW_CW",
83 FibPathFlags_value = map[string]uint32{
84 "FIB_API_PATH_FLAG_NONE": 0,
85 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
86 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2,
87 "FIB_API_PATH_FLAG_POP_PW_CW": 4,
91 func (x FibPathFlags) String() string {
92 s, ok := FibPathFlags_name[uint32(x)]
96 str := func(n uint32) string {
97 s, ok := FibPathFlags_name[uint32(n)]
101 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
103 for i := uint32(0); i <= 32; i++ {
113 return str(uint32(x))
118 // FibPathNhProto defines enum 'fib_path_nh_proto'.
119 type FibPathNhProto uint32
122 FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0
123 FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1
124 FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2
125 FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
126 FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4
130 FibPathNhProto_name = map[uint32]string{
131 0: "FIB_API_PATH_NH_PROTO_IP4",
132 1: "FIB_API_PATH_NH_PROTO_IP6",
133 2: "FIB_API_PATH_NH_PROTO_MPLS",
134 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
135 4: "FIB_API_PATH_NH_PROTO_BIER",
137 FibPathNhProto_value = map[string]uint32{
138 "FIB_API_PATH_NH_PROTO_IP4": 0,
139 "FIB_API_PATH_NH_PROTO_IP6": 1,
140 "FIB_API_PATH_NH_PROTO_MPLS": 2,
141 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
142 "FIB_API_PATH_NH_PROTO_BIER": 4,
146 func (x FibPathNhProto) String() string {
147 s, ok := FibPathNhProto_name[uint32(x)]
151 return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
154 // FibPathType defines enum 'fib_path_type'.
155 type FibPathType uint32
158 FIB_API_PATH_TYPE_NORMAL FibPathType = 0
159 FIB_API_PATH_TYPE_LOCAL FibPathType = 1
160 FIB_API_PATH_TYPE_DROP FibPathType = 2
161 FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3
162 FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4
163 FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5
164 FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
165 FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
166 FIB_API_PATH_TYPE_DVR FibPathType = 8
167 FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9
168 FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10
172 FibPathType_name = map[uint32]string{
173 0: "FIB_API_PATH_TYPE_NORMAL",
174 1: "FIB_API_PATH_TYPE_LOCAL",
175 2: "FIB_API_PATH_TYPE_DROP",
176 3: "FIB_API_PATH_TYPE_UDP_ENCAP",
177 4: "FIB_API_PATH_TYPE_BIER_IMP",
178 5: "FIB_API_PATH_TYPE_ICMP_UNREACH",
179 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
180 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
181 8: "FIB_API_PATH_TYPE_DVR",
182 9: "FIB_API_PATH_TYPE_INTERFACE_RX",
183 10: "FIB_API_PATH_TYPE_CLASSIFY",
185 FibPathType_value = map[string]uint32{
186 "FIB_API_PATH_TYPE_NORMAL": 0,
187 "FIB_API_PATH_TYPE_LOCAL": 1,
188 "FIB_API_PATH_TYPE_DROP": 2,
189 "FIB_API_PATH_TYPE_UDP_ENCAP": 3,
190 "FIB_API_PATH_TYPE_BIER_IMP": 4,
191 "FIB_API_PATH_TYPE_ICMP_UNREACH": 5,
192 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
193 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
194 "FIB_API_PATH_TYPE_DVR": 8,
195 "FIB_API_PATH_TYPE_INTERFACE_RX": 9,
196 "FIB_API_PATH_TYPE_CLASSIFY": 10,
200 func (x FibPathType) String() string {
201 s, ok := FibPathType_name[uint32(x)]
205 return "FibPathType(" + strconv.Itoa(int(x)) + ")"
208 // IfStatusFlags defines enum 'if_status_flags'.
209 type IfStatusFlags uint32
212 IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
213 IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2
217 IfStatusFlags_name = map[uint32]string{
218 1: "IF_STATUS_API_FLAG_ADMIN_UP",
219 2: "IF_STATUS_API_FLAG_LINK_UP",
221 IfStatusFlags_value = map[string]uint32{
222 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
223 "IF_STATUS_API_FLAG_LINK_UP": 2,
227 func (x IfStatusFlags) String() string {
228 s, ok := IfStatusFlags_name[uint32(x)]
232 str := func(n uint32) string {
233 s, ok := IfStatusFlags_name[uint32(n)]
237 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
239 for i := uint32(0); i <= 32; i++ {
249 return str(uint32(x))
254 // IfType defines enum 'if_type'.
258 IF_API_TYPE_HARDWARE IfType = 1
259 IF_API_TYPE_SUB IfType = 2
260 IF_API_TYPE_P2P IfType = 3
261 IF_API_TYPE_PIPE IfType = 4
265 IfType_name = map[uint32]string{
266 1: "IF_API_TYPE_HARDWARE",
267 2: "IF_API_TYPE_SUB",
268 3: "IF_API_TYPE_P2P",
269 4: "IF_API_TYPE_PIPE",
271 IfType_value = map[string]uint32{
272 "IF_API_TYPE_HARDWARE": 1,
273 "IF_API_TYPE_SUB": 2,
274 "IF_API_TYPE_P2P": 3,
275 "IF_API_TYPE_PIPE": 4,
279 func (x IfType) String() string {
280 s, ok := IfType_name[uint32(x)]
284 return "IfType(" + strconv.Itoa(int(x)) + ")"
287 // IPDscp defines enum 'ip_dscp'.
291 IP_API_DSCP_CS0 IPDscp = 0
292 IP_API_DSCP_CS1 IPDscp = 8
293 IP_API_DSCP_AF11 IPDscp = 10
294 IP_API_DSCP_AF12 IPDscp = 12
295 IP_API_DSCP_AF13 IPDscp = 14
296 IP_API_DSCP_CS2 IPDscp = 16
297 IP_API_DSCP_AF21 IPDscp = 18
298 IP_API_DSCP_AF22 IPDscp = 20
299 IP_API_DSCP_AF23 IPDscp = 22
300 IP_API_DSCP_CS3 IPDscp = 24
301 IP_API_DSCP_AF31 IPDscp = 26
302 IP_API_DSCP_AF32 IPDscp = 28
303 IP_API_DSCP_AF33 IPDscp = 30
304 IP_API_DSCP_CS4 IPDscp = 32
305 IP_API_DSCP_AF41 IPDscp = 34
306 IP_API_DSCP_AF42 IPDscp = 36
307 IP_API_DSCP_AF43 IPDscp = 38
308 IP_API_DSCP_CS5 IPDscp = 40
309 IP_API_DSCP_EF IPDscp = 46
310 IP_API_DSCP_CS6 IPDscp = 48
311 IP_API_DSCP_CS7 IPDscp = 50
315 IPDscp_name = map[uint8]string{
316 0: "IP_API_DSCP_CS0",
317 8: "IP_API_DSCP_CS1",
318 10: "IP_API_DSCP_AF11",
319 12: "IP_API_DSCP_AF12",
320 14: "IP_API_DSCP_AF13",
321 16: "IP_API_DSCP_CS2",
322 18: "IP_API_DSCP_AF21",
323 20: "IP_API_DSCP_AF22",
324 22: "IP_API_DSCP_AF23",
325 24: "IP_API_DSCP_CS3",
326 26: "IP_API_DSCP_AF31",
327 28: "IP_API_DSCP_AF32",
328 30: "IP_API_DSCP_AF33",
329 32: "IP_API_DSCP_CS4",
330 34: "IP_API_DSCP_AF41",
331 36: "IP_API_DSCP_AF42",
332 38: "IP_API_DSCP_AF43",
333 40: "IP_API_DSCP_CS5",
334 46: "IP_API_DSCP_EF",
335 48: "IP_API_DSCP_CS6",
336 50: "IP_API_DSCP_CS7",
338 IPDscp_value = map[string]uint8{
339 "IP_API_DSCP_CS0": 0,
340 "IP_API_DSCP_CS1": 8,
341 "IP_API_DSCP_AF11": 10,
342 "IP_API_DSCP_AF12": 12,
343 "IP_API_DSCP_AF13": 14,
344 "IP_API_DSCP_CS2": 16,
345 "IP_API_DSCP_AF21": 18,
346 "IP_API_DSCP_AF22": 20,
347 "IP_API_DSCP_AF23": 22,
348 "IP_API_DSCP_CS3": 24,
349 "IP_API_DSCP_AF31": 26,
350 "IP_API_DSCP_AF32": 28,
351 "IP_API_DSCP_AF33": 30,
352 "IP_API_DSCP_CS4": 32,
353 "IP_API_DSCP_AF41": 34,
354 "IP_API_DSCP_AF42": 36,
355 "IP_API_DSCP_AF43": 38,
356 "IP_API_DSCP_CS5": 40,
357 "IP_API_DSCP_EF": 46,
358 "IP_API_DSCP_CS6": 48,
359 "IP_API_DSCP_CS7": 50,
363 func (x IPDscp) String() string {
364 s, ok := IPDscp_name[uint8(x)]
368 return "IPDscp(" + strconv.Itoa(int(x)) + ")"
371 // IPEcn defines enum 'ip_ecn'.
375 IP_API_ECN_NONE IPEcn = 0
376 IP_API_ECN_ECT0 IPEcn = 1
377 IP_API_ECN_ECT1 IPEcn = 2
378 IP_API_ECN_CE IPEcn = 3
382 IPEcn_name = map[uint8]string{
383 0: "IP_API_ECN_NONE",
384 1: "IP_API_ECN_ECT0",
385 2: "IP_API_ECN_ECT1",
388 IPEcn_value = map[string]uint8{
389 "IP_API_ECN_NONE": 0,
390 "IP_API_ECN_ECT0": 1,
391 "IP_API_ECN_ECT1": 2,
396 func (x IPEcn) String() string {
397 s, ok := IPEcn_name[uint8(x)]
401 return "IPEcn(" + strconv.Itoa(int(x)) + ")"
404 // IPProto defines enum 'ip_proto'.
408 IP_API_PROTO_HOPOPT IPProto = 0
409 IP_API_PROTO_ICMP IPProto = 1
410 IP_API_PROTO_IGMP IPProto = 2
411 IP_API_PROTO_TCP IPProto = 6
412 IP_API_PROTO_UDP IPProto = 17
413 IP_API_PROTO_GRE IPProto = 47
414 IP_API_PROTO_AH IPProto = 50
415 IP_API_PROTO_ESP IPProto = 51
416 IP_API_PROTO_EIGRP IPProto = 88
417 IP_API_PROTO_OSPF IPProto = 89
418 IP_API_PROTO_SCTP IPProto = 132
419 IP_API_PROTO_RESERVED IPProto = 255
423 IPProto_name = map[uint32]string{
424 0: "IP_API_PROTO_HOPOPT",
425 1: "IP_API_PROTO_ICMP",
426 2: "IP_API_PROTO_IGMP",
427 6: "IP_API_PROTO_TCP",
428 17: "IP_API_PROTO_UDP",
429 47: "IP_API_PROTO_GRE",
430 50: "IP_API_PROTO_AH",
431 51: "IP_API_PROTO_ESP",
432 88: "IP_API_PROTO_EIGRP",
433 89: "IP_API_PROTO_OSPF",
434 132: "IP_API_PROTO_SCTP",
435 255: "IP_API_PROTO_RESERVED",
437 IPProto_value = map[string]uint32{
438 "IP_API_PROTO_HOPOPT": 0,
439 "IP_API_PROTO_ICMP": 1,
440 "IP_API_PROTO_IGMP": 2,
441 "IP_API_PROTO_TCP": 6,
442 "IP_API_PROTO_UDP": 17,
443 "IP_API_PROTO_GRE": 47,
444 "IP_API_PROTO_AH": 50,
445 "IP_API_PROTO_ESP": 51,
446 "IP_API_PROTO_EIGRP": 88,
447 "IP_API_PROTO_OSPF": 89,
448 "IP_API_PROTO_SCTP": 132,
449 "IP_API_PROTO_RESERVED": 255,
453 func (x IPProto) String() string {
454 s, ok := IPProto_name[uint32(x)]
458 return "IPProto(" + strconv.Itoa(int(x)) + ")"
461 // LinkDuplex defines enum 'link_duplex'.
462 type LinkDuplex uint32
465 LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
466 LINK_DUPLEX_API_HALF LinkDuplex = 1
467 LINK_DUPLEX_API_FULL LinkDuplex = 2
471 LinkDuplex_name = map[uint32]string{
472 0: "LINK_DUPLEX_API_UNKNOWN",
473 1: "LINK_DUPLEX_API_HALF",
474 2: "LINK_DUPLEX_API_FULL",
476 LinkDuplex_value = map[string]uint32{
477 "LINK_DUPLEX_API_UNKNOWN": 0,
478 "LINK_DUPLEX_API_HALF": 1,
479 "LINK_DUPLEX_API_FULL": 2,
483 func (x LinkDuplex) String() string {
484 s, ok := LinkDuplex_name[uint32(x)]
488 return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
491 // MtuProto defines enum 'mtu_proto'.
495 MTU_PROTO_API_L3 MtuProto = 1
496 MTU_PROTO_API_IP4 MtuProto = 2
497 MTU_PROTO_API_IP6 MtuProto = 3
498 MTU_PROTO_API_MPLS MtuProto = 4
499 MTU_PROTO_API_N MtuProto = 5
503 MtuProto_name = map[uint32]string{
504 1: "MTU_PROTO_API_L3",
505 2: "MTU_PROTO_API_IP4",
506 3: "MTU_PROTO_API_IP6",
507 4: "MTU_PROTO_API_MPLS",
508 5: "MTU_PROTO_API_N",
510 MtuProto_value = map[string]uint32{
511 "MTU_PROTO_API_L3": 1,
512 "MTU_PROTO_API_IP4": 2,
513 "MTU_PROTO_API_IP6": 3,
514 "MTU_PROTO_API_MPLS": 4,
515 "MTU_PROTO_API_N": 5,
519 func (x MtuProto) String() string {
520 s, ok := MtuProto_name[uint32(x)]
524 return "MtuProto(" + strconv.Itoa(int(x)) + ")"
527 // RxMode defines enum 'rx_mode'.
531 RX_MODE_API_UNKNOWN RxMode = 0
532 RX_MODE_API_POLLING RxMode = 1
533 RX_MODE_API_INTERRUPT RxMode = 2
534 RX_MODE_API_ADAPTIVE RxMode = 3
535 RX_MODE_API_DEFAULT RxMode = 4
539 RxMode_name = map[uint32]string{
540 0: "RX_MODE_API_UNKNOWN",
541 1: "RX_MODE_API_POLLING",
542 2: "RX_MODE_API_INTERRUPT",
543 3: "RX_MODE_API_ADAPTIVE",
544 4: "RX_MODE_API_DEFAULT",
546 RxMode_value = map[string]uint32{
547 "RX_MODE_API_UNKNOWN": 0,
548 "RX_MODE_API_POLLING": 1,
549 "RX_MODE_API_INTERRUPT": 2,
550 "RX_MODE_API_ADAPTIVE": 3,
551 "RX_MODE_API_DEFAULT": 4,
555 func (x RxMode) String() string {
556 s, ok := RxMode_name[uint32(x)]
560 return "RxMode(" + strconv.Itoa(int(x)) + ")"
563 // SubIfFlags defines enum 'sub_if_flags'.
564 type SubIfFlags uint32
567 SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1
568 SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2
569 SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4
570 SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8
571 SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16
572 SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32
573 SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
574 SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
575 SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254
576 SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256
580 SubIfFlags_name = map[uint32]string{
581 1: "SUB_IF_API_FLAG_NO_TAGS",
582 2: "SUB_IF_API_FLAG_ONE_TAG",
583 4: "SUB_IF_API_FLAG_TWO_TAGS",
584 8: "SUB_IF_API_FLAG_DOT1AD",
585 16: "SUB_IF_API_FLAG_EXACT_MATCH",
586 32: "SUB_IF_API_FLAG_DEFAULT",
587 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
588 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
589 254: "SUB_IF_API_FLAG_MASK_VNET",
590 256: "SUB_IF_API_FLAG_DOT1AH",
592 SubIfFlags_value = map[string]uint32{
593 "SUB_IF_API_FLAG_NO_TAGS": 1,
594 "SUB_IF_API_FLAG_ONE_TAG": 2,
595 "SUB_IF_API_FLAG_TWO_TAGS": 4,
596 "SUB_IF_API_FLAG_DOT1AD": 8,
597 "SUB_IF_API_FLAG_EXACT_MATCH": 16,
598 "SUB_IF_API_FLAG_DEFAULT": 32,
599 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
600 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
601 "SUB_IF_API_FLAG_MASK_VNET": 254,
602 "SUB_IF_API_FLAG_DOT1AH": 256,
606 func (x SubIfFlags) String() string {
607 s, ok := SubIfFlags_name[uint32(x)]
611 str := func(n uint32) string {
612 s, ok := SubIfFlags_name[uint32(n)]
616 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
618 for i := uint32(0); i <= 32; i++ {
628 return str(uint32(x))
633 // AddressWithPrefix defines alias 'address_with_prefix'.
634 type AddressWithPrefix Prefix
636 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
637 prefix, err := ParsePrefix(s)
639 return AddressWithPrefix{}, err
641 return AddressWithPrefix(prefix), nil
643 func (x AddressWithPrefix) String() string {
644 return Prefix(x).String()
646 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
647 return []byte(x.String()), nil
649 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
650 prefix, err := ParseAddressWithPrefix(string(text))
658 // InterfaceIndex defines alias 'interface_index'.
659 type InterfaceIndex uint32
661 // IP4Address defines alias 'ip4_address'.
662 type IP4Address [4]uint8
664 func ParseIP4Address(s string) (IP4Address, error) {
665 ip := net.ParseIP(s).To4()
667 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
669 var ipaddr IP4Address
670 copy(ipaddr[:], ip.To4())
674 func (x IP4Address) ToIP() net.IP {
675 return net.IP(x[:]).To4()
677 func (x IP4Address) String() string {
678 return x.ToIP().String()
680 func (x *IP4Address) MarshalText() ([]byte, error) {
681 return []byte(x.String()), nil
683 func (x *IP4Address) UnmarshalText(text []byte) error {
684 ipaddr, err := ParseIP4Address(string(text))
692 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
693 type IP4AddressWithPrefix IP4Prefix
695 // IP6Address defines alias 'ip6_address'.
696 type IP6Address [16]uint8
698 func ParseIP6Address(s string) (IP6Address, error) {
699 ip := net.ParseIP(s).To16()
701 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
703 var ipaddr IP6Address
704 copy(ipaddr[:], ip.To16())
708 func (x IP6Address) ToIP() net.IP {
709 return net.IP(x[:]).To16()
711 func (x IP6Address) String() string {
712 return x.ToIP().String()
714 func (x *IP6Address) MarshalText() ([]byte, error) {
715 return []byte(x.String()), nil
717 func (x *IP6Address) UnmarshalText(text []byte) error {
718 ipaddr, err := ParseIP6Address(string(text))
726 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
727 type IP6AddressWithPrefix IP6Prefix
729 // Address defines type 'address'.
730 type Address struct {
731 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
732 Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"`
735 func ParseAddress(s string) (Address, error) {
738 return Address{}, fmt.Errorf("invalid address: %s", s)
742 addr.Af = ADDRESS_IP6
744 copy(ip6[:], ip.To16())
747 addr.Af = ADDRESS_IP4
749 copy(ip4[:], ip.To4())
754 func (x Address) ToIP() net.IP {
755 if x.Af == ADDRESS_IP6 {
757 return net.IP(ip6[:]).To16()
760 return net.IP(ip4[:]).To4()
763 func (x Address) String() string {
764 return x.ToIP().String()
766 func (x *Address) MarshalText() ([]byte, error) {
767 return []byte(x.String()), nil
769 func (x *Address) UnmarshalText(text []byte) error {
770 addr, err := ParseAddress(string(text))
778 // FibMplsLabel defines type 'fib_mpls_label'.
779 type FibMplsLabel struct {
780 IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
781 Label uint32 `binapi:"u32,name=label" json:"label,omitempty"`
782 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"`
783 Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"`
786 // FibPath defines type 'fib_path'.
787 type FibPath struct {
788 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
789 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
790 RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
791 Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"`
792 Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"`
793 Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"`
794 Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
795 Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
796 Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
797 NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
798 LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
801 // FibPathNh defines type 'fib_path_nh'.
802 type FibPathNh struct {
803 Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
804 ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"`
805 ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
806 ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
809 // IP4Prefix defines type 'ip4_prefix'.
810 type IP4Prefix struct {
811 Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
812 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
815 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
816 hasPrefix := strings.Contains(s, "/")
818 ip, network, err := net.ParseCIDR(s)
820 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
822 maskSize, _ := network.Mask.Size()
823 prefix.Len = byte(maskSize)
824 prefix.Address, err = ParseIP4Address(ip.String())
826 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
830 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
832 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
834 prefix.Len = byte(defaultMaskSize)
835 prefix.Address, err = ParseIP4Address(ip.String())
837 return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
842 func (x IP4Prefix) ToIPNet() *net.IPNet {
843 mask := net.CIDRMask(int(x.Len), 32)
844 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
847 func (x IP4Prefix) String() string {
848 ip := x.Address.String()
849 return ip + "/" + strconv.Itoa(int(x.Len))
851 func (x *IP4Prefix) MarshalText() ([]byte, error) {
852 return []byte(x.String()), nil
854 func (x *IP4Prefix) UnmarshalText(text []byte) error {
855 prefix, err := ParseIP4Prefix(string(text))
863 // IP6Prefix defines type 'ip6_prefix'.
864 type IP6Prefix struct {
865 Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
866 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
869 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
870 hasPrefix := strings.Contains(s, "/")
872 ip, network, err := net.ParseCIDR(s)
874 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
876 maskSize, _ := network.Mask.Size()
877 prefix.Len = byte(maskSize)
878 prefix.Address, err = ParseIP6Address(ip.String())
880 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
884 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
886 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
888 prefix.Len = byte(defaultMaskSize)
889 prefix.Address, err = ParseIP6Address(ip.String())
891 return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
896 func (x IP6Prefix) ToIPNet() *net.IPNet {
897 mask := net.CIDRMask(int(x.Len), 128)
898 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
901 func (x IP6Prefix) String() string {
902 ip := x.Address.String()
903 return ip + "/" + strconv.Itoa(int(x.Len))
905 func (x *IP6Prefix) MarshalText() ([]byte, error) {
906 return []byte(x.String()), nil
908 func (x *IP6Prefix) UnmarshalText(text []byte) error {
909 prefix, err := ParseIP6Prefix(string(text))
917 // MplsRoute defines type 'mpls_route'.
918 type MplsRoute struct {
919 MrTableID uint32 `binapi:"u32,name=mr_table_id" json:"mr_table_id,omitempty"`
920 MrLabel uint32 `binapi:"u32,name=mr_label" json:"mr_label,omitempty"`
921 MrEos uint8 `binapi:"u8,name=mr_eos" json:"mr_eos,omitempty"`
922 MrEosProto uint8 `binapi:"u8,name=mr_eos_proto" json:"mr_eos_proto,omitempty"`
923 MrIsMulticast bool `binapi:"bool,name=mr_is_multicast" json:"mr_is_multicast,omitempty"`
924 MrNPaths uint8 `binapi:"u8,name=mr_n_paths" json:"-"`
925 MrPaths []FibPath `binapi:"fib_path[mr_n_paths],name=mr_paths" json:"mr_paths,omitempty"`
928 // MplsTable defines type 'mpls_table'.
929 type MplsTable struct {
930 MtTableID uint32 `binapi:"u32,name=mt_table_id" json:"mt_table_id,omitempty"`
931 MtName string `binapi:"string[64],name=mt_name" json:"mt_name,omitempty"`
934 // MplsTunnel defines type 'mpls_tunnel'.
935 type MplsTunnel struct {
936 MtSwIfIndex InterfaceIndex `binapi:"interface_index,name=mt_sw_if_index" json:"mt_sw_if_index,omitempty"`
937 MtTunnelIndex uint32 `binapi:"u32,name=mt_tunnel_index" json:"mt_tunnel_index,omitempty"`
938 MtL2Only bool `binapi:"bool,name=mt_l2_only" json:"mt_l2_only,omitempty"`
939 MtIsMulticast bool `binapi:"bool,name=mt_is_multicast" json:"mt_is_multicast,omitempty"`
940 MtNPaths uint8 `binapi:"u8,name=mt_n_paths" json:"-"`
941 MtPaths []FibPath `binapi:"fib_path[mt_n_paths],name=mt_paths" json:"mt_paths,omitempty"`
944 // Mprefix defines type 'mprefix'.
945 type Mprefix struct {
946 Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
947 GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
948 GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
949 SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
952 // Prefix defines type 'prefix'.
954 Address Address `binapi:"address,name=address" json:"address,omitempty"`
955 Len uint8 `binapi:"u8,name=len" json:"len,omitempty"`
958 func ParsePrefix(ip string) (prefix Prefix, err error) {
959 hasPrefix := strings.Contains(ip, "/")
961 netIP, network, err := net.ParseCIDR(ip)
963 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
965 maskSize, _ := network.Mask.Size()
966 prefix.Len = byte(maskSize)
967 prefix.Address, err = ParseAddress(netIP.String())
969 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
972 netIP := net.ParseIP(ip)
973 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
974 if netIP.To4() == nil {
975 defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
977 prefix.Len = byte(defaultMaskSize)
978 prefix.Address, err = ParseAddress(netIP.String())
980 return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
985 func (x Prefix) ToIPNet() *net.IPNet {
987 if x.Address.Af == ADDRESS_IP4 {
988 mask = net.CIDRMask(int(x.Len), 32)
990 mask = net.CIDRMask(int(x.Len), 128)
992 ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
995 func (x Prefix) String() string {
996 ip := x.Address.String()
997 return ip + "/" + strconv.Itoa(int(x.Len))
999 func (x *Prefix) MarshalText() ([]byte, error) {
1000 return []byte(x.String()), nil
1002 func (x *Prefix) UnmarshalText(text []byte) error {
1003 prefix, err := ParsePrefix(string(text))
1011 // PrefixMatcher defines type 'prefix_matcher'.
1012 type PrefixMatcher struct {
1013 Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1014 Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1017 // AddressUnion defines union 'address_union'.
1018 type AddressUnion struct {
1021 XXX_UnionData [16]byte
1024 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1028 func (u *AddressUnion) SetIP4(a IP4Address) {
1029 buf := codec.NewBuffer(u.XXX_UnionData[:])
1030 buf.EncodeBytes(a[:], 4)
1032 func (u *AddressUnion) GetIP4() (a IP4Address) {
1033 buf := codec.NewBuffer(u.XXX_UnionData[:])
1034 copy(a[:], buf.DecodeBytes(4))
1038 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1042 func (u *AddressUnion) SetIP6(a IP6Address) {
1043 buf := codec.NewBuffer(u.XXX_UnionData[:])
1044 buf.EncodeBytes(a[:], 16)
1046 func (u *AddressUnion) GetIP6() (a IP6Address) {
1047 buf := codec.NewBuffer(u.XXX_UnionData[:])
1048 copy(a[:], buf.DecodeBytes(16))
1052 // MplsIPBindUnbind defines message 'mpls_ip_bind_unbind'.
1053 type MplsIPBindUnbind struct {
1054 MbMplsTableID uint32 `binapi:"u32,name=mb_mpls_table_id" json:"mb_mpls_table_id,omitempty"`
1055 MbLabel uint32 `binapi:"u32,name=mb_label" json:"mb_label,omitempty"`
1056 MbIPTableID uint32 `binapi:"u32,name=mb_ip_table_id" json:"mb_ip_table_id,omitempty"`
1057 MbIsBind bool `binapi:"bool,name=mb_is_bind" json:"mb_is_bind,omitempty"`
1058 MbPrefix Prefix `binapi:"prefix,name=mb_prefix" json:"mb_prefix,omitempty"`
1061 func (m *MplsIPBindUnbind) Reset() { *m = MplsIPBindUnbind{} }
1062 func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" }
1063 func (*MplsIPBindUnbind) GetCrcString() string { return "48249a27" }
1064 func (*MplsIPBindUnbind) GetMessageType() api.MessageType {
1065 return api.RequestMessage
1068 func (m *MplsIPBindUnbind) Size() (size int) {
1072 size += 4 // m.MbMplsTableID
1073 size += 4 // m.MbLabel
1074 size += 4 // m.MbIPTableID
1075 size += 1 // m.MbIsBind
1076 size += 4 // m.MbPrefix.Address.Af
1077 size += 1 * 16 // m.MbPrefix.Address.Un
1078 size += 1 // m.MbPrefix.Len
1081 func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) {
1083 b = make([]byte, m.Size())
1085 buf := codec.NewBuffer(b)
1086 buf.EncodeUint32(m.MbMplsTableID)
1087 buf.EncodeUint32(m.MbLabel)
1088 buf.EncodeUint32(m.MbIPTableID)
1089 buf.EncodeBool(m.MbIsBind)
1090 buf.EncodeUint32(uint32(m.MbPrefix.Address.Af))
1091 buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 16)
1092 buf.EncodeUint8(m.MbPrefix.Len)
1093 return buf.Bytes(), nil
1095 func (m *MplsIPBindUnbind) Unmarshal(b []byte) error {
1096 buf := codec.NewBuffer(b)
1097 m.MbMplsTableID = buf.DecodeUint32()
1098 m.MbLabel = buf.DecodeUint32()
1099 m.MbIPTableID = buf.DecodeUint32()
1100 m.MbIsBind = buf.DecodeBool()
1101 m.MbPrefix.Address.Af = AddressFamily(buf.DecodeUint32())
1102 copy(m.MbPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1103 m.MbPrefix.Len = buf.DecodeUint8()
1107 // MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'.
1108 type MplsIPBindUnbindReply struct {
1109 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1112 func (m *MplsIPBindUnbindReply) Reset() { *m = MplsIPBindUnbindReply{} }
1113 func (*MplsIPBindUnbindReply) GetMessageName() string { return "mpls_ip_bind_unbind_reply" }
1114 func (*MplsIPBindUnbindReply) GetCrcString() string { return "e8d4e804" }
1115 func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType {
1116 return api.ReplyMessage
1119 func (m *MplsIPBindUnbindReply) Size() (size int) {
1123 size += 4 // m.Retval
1126 func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) {
1128 b = make([]byte, m.Size())
1130 buf := codec.NewBuffer(b)
1131 buf.EncodeInt32(m.Retval)
1132 return buf.Bytes(), nil
1134 func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error {
1135 buf := codec.NewBuffer(b)
1136 m.Retval = buf.DecodeInt32()
1140 // MplsRouteAddDel defines message 'mpls_route_add_del'.
1141 type MplsRouteAddDel struct {
1142 MrIsAdd bool `binapi:"bool,name=mr_is_add" json:"mr_is_add,omitempty"`
1143 MrIsMultipath bool `binapi:"bool,name=mr_is_multipath" json:"mr_is_multipath,omitempty"`
1144 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1147 func (m *MplsRouteAddDel) Reset() { *m = MplsRouteAddDel{} }
1148 func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" }
1149 func (*MplsRouteAddDel) GetCrcString() string { return "343cff54" }
1150 func (*MplsRouteAddDel) GetMessageType() api.MessageType {
1151 return api.RequestMessage
1154 func (m *MplsRouteAddDel) Size() (size int) {
1158 size += 1 // m.MrIsAdd
1159 size += 1 // m.MrIsMultipath
1160 size += 4 // m.MrRoute.MrTableID
1161 size += 4 // m.MrRoute.MrLabel
1162 size += 1 // m.MrRoute.MrEos
1163 size += 1 // m.MrRoute.MrEosProto
1164 size += 1 // m.MrRoute.MrIsMulticast
1165 size += 1 // m.MrRoute.MrNPaths
1166 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1169 if j2 < len(m.MrRoute.MrPaths) {
1170 s2 = m.MrRoute.MrPaths[j2]
1172 size += 4 // s2.SwIfIndex
1173 size += 4 // s2.TableID
1174 size += 4 // s2.RpfID
1175 size += 1 // s2.Weight
1176 size += 1 // s2.Preference
1177 size += 4 // s2.Type
1178 size += 4 // s2.Flags
1179 size += 4 // s2.Proto
1180 size += 1 * 16 // s2.Nh.Address
1181 size += 4 // s2.Nh.ViaLabel
1182 size += 4 // s2.Nh.ObjID
1183 size += 4 // s2.Nh.ClassifyTableIndex
1184 size += 1 // s2.NLabels
1185 for j3 := 0; j3 < 16; j3++ {
1186 size += 1 // s2.LabelStack[j3].IsUniform
1187 size += 4 // s2.LabelStack[j3].Label
1188 size += 1 // s2.LabelStack[j3].TTL
1189 size += 1 // s2.LabelStack[j3].Exp
1194 func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) {
1196 b = make([]byte, m.Size())
1198 buf := codec.NewBuffer(b)
1199 buf.EncodeBool(m.MrIsAdd)
1200 buf.EncodeBool(m.MrIsMultipath)
1201 buf.EncodeUint32(m.MrRoute.MrTableID)
1202 buf.EncodeUint32(m.MrRoute.MrLabel)
1203 buf.EncodeUint8(m.MrRoute.MrEos)
1204 buf.EncodeUint8(m.MrRoute.MrEosProto)
1205 buf.EncodeBool(m.MrRoute.MrIsMulticast)
1206 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1207 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1208 var v1 FibPath // MrPaths
1209 if j1 < len(m.MrRoute.MrPaths) {
1210 v1 = m.MrRoute.MrPaths[j1]
1212 buf.EncodeUint32(v1.SwIfIndex)
1213 buf.EncodeUint32(v1.TableID)
1214 buf.EncodeUint32(v1.RpfID)
1215 buf.EncodeUint8(v1.Weight)
1216 buf.EncodeUint8(v1.Preference)
1217 buf.EncodeUint32(uint32(v1.Type))
1218 buf.EncodeUint32(uint32(v1.Flags))
1219 buf.EncodeUint32(uint32(v1.Proto))
1220 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1221 buf.EncodeUint32(v1.Nh.ViaLabel)
1222 buf.EncodeUint32(v1.Nh.ObjID)
1223 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1224 buf.EncodeUint8(v1.NLabels)
1225 for j2 := 0; j2 < 16; j2++ {
1226 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1227 buf.EncodeUint32(v1.LabelStack[j2].Label)
1228 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1229 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1232 return buf.Bytes(), nil
1234 func (m *MplsRouteAddDel) Unmarshal(b []byte) error {
1235 buf := codec.NewBuffer(b)
1236 m.MrIsAdd = buf.DecodeBool()
1237 m.MrIsMultipath = buf.DecodeBool()
1238 m.MrRoute.MrTableID = buf.DecodeUint32()
1239 m.MrRoute.MrLabel = buf.DecodeUint32()
1240 m.MrRoute.MrEos = buf.DecodeUint8()
1241 m.MrRoute.MrEosProto = buf.DecodeUint8()
1242 m.MrRoute.MrIsMulticast = buf.DecodeBool()
1243 m.MrRoute.MrNPaths = buf.DecodeUint8()
1244 m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1245 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1246 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1247 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1248 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1249 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1250 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1251 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1252 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1253 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1254 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1255 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1256 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1257 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1258 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1259 for j2 := 0; j2 < 16; j2++ {
1260 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1261 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1262 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1263 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1269 // MplsRouteAddDelReply defines message 'mpls_route_add_del_reply'.
1270 type MplsRouteAddDelReply struct {
1271 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1272 StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"`
1275 func (m *MplsRouteAddDelReply) Reset() { *m = MplsRouteAddDelReply{} }
1276 func (*MplsRouteAddDelReply) GetMessageName() string { return "mpls_route_add_del_reply" }
1277 func (*MplsRouteAddDelReply) GetCrcString() string { return "1992deab" }
1278 func (*MplsRouteAddDelReply) GetMessageType() api.MessageType {
1279 return api.ReplyMessage
1282 func (m *MplsRouteAddDelReply) Size() (size int) {
1286 size += 4 // m.Retval
1287 size += 4 // m.StatsIndex
1290 func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
1292 b = make([]byte, m.Size())
1294 buf := codec.NewBuffer(b)
1295 buf.EncodeInt32(m.Retval)
1296 buf.EncodeUint32(m.StatsIndex)
1297 return buf.Bytes(), nil
1299 func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error {
1300 buf := codec.NewBuffer(b)
1301 m.Retval = buf.DecodeInt32()
1302 m.StatsIndex = buf.DecodeUint32()
1306 // MplsRouteDetails defines message 'mpls_route_details'.
1307 type MplsRouteDetails struct {
1308 MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1311 func (m *MplsRouteDetails) Reset() { *m = MplsRouteDetails{} }
1312 func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" }
1313 func (*MplsRouteDetails) GetCrcString() string { return "d0ac384c" }
1314 func (*MplsRouteDetails) GetMessageType() api.MessageType {
1315 return api.ReplyMessage
1318 func (m *MplsRouteDetails) Size() (size int) {
1322 size += 4 // m.MrRoute.MrTableID
1323 size += 4 // m.MrRoute.MrLabel
1324 size += 1 // m.MrRoute.MrEos
1325 size += 1 // m.MrRoute.MrEosProto
1326 size += 1 // m.MrRoute.MrIsMulticast
1327 size += 1 // m.MrRoute.MrNPaths
1328 for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1331 if j2 < len(m.MrRoute.MrPaths) {
1332 s2 = m.MrRoute.MrPaths[j2]
1334 size += 4 // s2.SwIfIndex
1335 size += 4 // s2.TableID
1336 size += 4 // s2.RpfID
1337 size += 1 // s2.Weight
1338 size += 1 // s2.Preference
1339 size += 4 // s2.Type
1340 size += 4 // s2.Flags
1341 size += 4 // s2.Proto
1342 size += 1 * 16 // s2.Nh.Address
1343 size += 4 // s2.Nh.ViaLabel
1344 size += 4 // s2.Nh.ObjID
1345 size += 4 // s2.Nh.ClassifyTableIndex
1346 size += 1 // s2.NLabels
1347 for j3 := 0; j3 < 16; j3++ {
1348 size += 1 // s2.LabelStack[j3].IsUniform
1349 size += 4 // s2.LabelStack[j3].Label
1350 size += 1 // s2.LabelStack[j3].TTL
1351 size += 1 // s2.LabelStack[j3].Exp
1356 func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) {
1358 b = make([]byte, m.Size())
1360 buf := codec.NewBuffer(b)
1361 buf.EncodeUint32(m.MrRoute.MrTableID)
1362 buf.EncodeUint32(m.MrRoute.MrLabel)
1363 buf.EncodeUint8(m.MrRoute.MrEos)
1364 buf.EncodeUint8(m.MrRoute.MrEosProto)
1365 buf.EncodeBool(m.MrRoute.MrIsMulticast)
1366 buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1367 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1368 var v1 FibPath // MrPaths
1369 if j1 < len(m.MrRoute.MrPaths) {
1370 v1 = m.MrRoute.MrPaths[j1]
1372 buf.EncodeUint32(v1.SwIfIndex)
1373 buf.EncodeUint32(v1.TableID)
1374 buf.EncodeUint32(v1.RpfID)
1375 buf.EncodeUint8(v1.Weight)
1376 buf.EncodeUint8(v1.Preference)
1377 buf.EncodeUint32(uint32(v1.Type))
1378 buf.EncodeUint32(uint32(v1.Flags))
1379 buf.EncodeUint32(uint32(v1.Proto))
1380 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1381 buf.EncodeUint32(v1.Nh.ViaLabel)
1382 buf.EncodeUint32(v1.Nh.ObjID)
1383 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1384 buf.EncodeUint8(v1.NLabels)
1385 for j2 := 0; j2 < 16; j2++ {
1386 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1387 buf.EncodeUint32(v1.LabelStack[j2].Label)
1388 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1389 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1392 return buf.Bytes(), nil
1394 func (m *MplsRouteDetails) Unmarshal(b []byte) error {
1395 buf := codec.NewBuffer(b)
1396 m.MrRoute.MrTableID = buf.DecodeUint32()
1397 m.MrRoute.MrLabel = buf.DecodeUint32()
1398 m.MrRoute.MrEos = buf.DecodeUint8()
1399 m.MrRoute.MrEosProto = buf.DecodeUint8()
1400 m.MrRoute.MrIsMulticast = buf.DecodeBool()
1401 m.MrRoute.MrNPaths = buf.DecodeUint8()
1402 m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1403 for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1404 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1405 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1406 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1407 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1408 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1409 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1410 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1411 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1412 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1413 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1414 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1415 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1416 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1417 for j2 := 0; j2 < 16; j2++ {
1418 m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1419 m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1420 m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1421 m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1427 // MplsRouteDump defines message 'mpls_route_dump'.
1428 type MplsRouteDump struct {
1429 Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"`
1432 func (m *MplsRouteDump) Reset() { *m = MplsRouteDump{} }
1433 func (*MplsRouteDump) GetMessageName() string { return "mpls_route_dump" }
1434 func (*MplsRouteDump) GetCrcString() string { return "935fdefa" }
1435 func (*MplsRouteDump) GetMessageType() api.MessageType {
1436 return api.RequestMessage
1439 func (m *MplsRouteDump) Size() (size int) {
1443 size += 4 // m.Table.MtTableID
1444 size += 64 // m.Table.MtName
1447 func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) {
1449 b = make([]byte, m.Size())
1451 buf := codec.NewBuffer(b)
1452 buf.EncodeUint32(m.Table.MtTableID)
1453 buf.EncodeString(m.Table.MtName, 64)
1454 return buf.Bytes(), nil
1456 func (m *MplsRouteDump) Unmarshal(b []byte) error {
1457 buf := codec.NewBuffer(b)
1458 m.Table.MtTableID = buf.DecodeUint32()
1459 m.Table.MtName = buf.DecodeString(64)
1463 // MplsTableAddDel defines message 'mpls_table_add_del'.
1464 type MplsTableAddDel struct {
1465 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1466 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1469 func (m *MplsTableAddDel) Reset() { *m = MplsTableAddDel{} }
1470 func (*MplsTableAddDel) GetMessageName() string { return "mpls_table_add_del" }
1471 func (*MplsTableAddDel) GetCrcString() string { return "57817512" }
1472 func (*MplsTableAddDel) GetMessageType() api.MessageType {
1473 return api.RequestMessage
1476 func (m *MplsTableAddDel) Size() (size int) {
1480 size += 1 // m.MtIsAdd
1481 size += 4 // m.MtTable.MtTableID
1482 size += 64 // m.MtTable.MtName
1485 func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) {
1487 b = make([]byte, m.Size())
1489 buf := codec.NewBuffer(b)
1490 buf.EncodeBool(m.MtIsAdd)
1491 buf.EncodeUint32(m.MtTable.MtTableID)
1492 buf.EncodeString(m.MtTable.MtName, 64)
1493 return buf.Bytes(), nil
1495 func (m *MplsTableAddDel) Unmarshal(b []byte) error {
1496 buf := codec.NewBuffer(b)
1497 m.MtIsAdd = buf.DecodeBool()
1498 m.MtTable.MtTableID = buf.DecodeUint32()
1499 m.MtTable.MtName = buf.DecodeString(64)
1503 // MplsTableAddDelReply defines message 'mpls_table_add_del_reply'.
1504 type MplsTableAddDelReply struct {
1505 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1508 func (m *MplsTableAddDelReply) Reset() { *m = MplsTableAddDelReply{} }
1509 func (*MplsTableAddDelReply) GetMessageName() string { return "mpls_table_add_del_reply" }
1510 func (*MplsTableAddDelReply) GetCrcString() string { return "e8d4e804" }
1511 func (*MplsTableAddDelReply) GetMessageType() api.MessageType {
1512 return api.ReplyMessage
1515 func (m *MplsTableAddDelReply) Size() (size int) {
1519 size += 4 // m.Retval
1522 func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1524 b = make([]byte, m.Size())
1526 buf := codec.NewBuffer(b)
1527 buf.EncodeInt32(m.Retval)
1528 return buf.Bytes(), nil
1530 func (m *MplsTableAddDelReply) Unmarshal(b []byte) error {
1531 buf := codec.NewBuffer(b)
1532 m.Retval = buf.DecodeInt32()
1536 // MplsTableDetails defines message 'mpls_table_details'.
1537 type MplsTableDetails struct {
1538 MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1541 func (m *MplsTableDetails) Reset() { *m = MplsTableDetails{} }
1542 func (*MplsTableDetails) GetMessageName() string { return "mpls_table_details" }
1543 func (*MplsTableDetails) GetCrcString() string { return "f03ecdc8" }
1544 func (*MplsTableDetails) GetMessageType() api.MessageType {
1545 return api.ReplyMessage
1548 func (m *MplsTableDetails) Size() (size int) {
1552 size += 4 // m.MtTable.MtTableID
1553 size += 64 // m.MtTable.MtName
1556 func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) {
1558 b = make([]byte, m.Size())
1560 buf := codec.NewBuffer(b)
1561 buf.EncodeUint32(m.MtTable.MtTableID)
1562 buf.EncodeString(m.MtTable.MtName, 64)
1563 return buf.Bytes(), nil
1565 func (m *MplsTableDetails) Unmarshal(b []byte) error {
1566 buf := codec.NewBuffer(b)
1567 m.MtTable.MtTableID = buf.DecodeUint32()
1568 m.MtTable.MtName = buf.DecodeString(64)
1572 // MplsTableDump defines message 'mpls_table_dump'.
1573 type MplsTableDump struct{}
1575 func (m *MplsTableDump) Reset() { *m = MplsTableDump{} }
1576 func (*MplsTableDump) GetMessageName() string { return "mpls_table_dump" }
1577 func (*MplsTableDump) GetCrcString() string { return "51077d14" }
1578 func (*MplsTableDump) GetMessageType() api.MessageType {
1579 return api.RequestMessage
1582 func (m *MplsTableDump) Size() (size int) {
1588 func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) {
1590 b = make([]byte, m.Size())
1592 buf := codec.NewBuffer(b)
1593 return buf.Bytes(), nil
1595 func (m *MplsTableDump) Unmarshal(b []byte) error {
1599 // MplsTunnelAddDel defines message 'mpls_tunnel_add_del'.
1600 type MplsTunnelAddDel struct {
1601 MtIsAdd bool `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1602 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1605 func (m *MplsTunnelAddDel) Reset() { *m = MplsTunnelAddDel{} }
1606 func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" }
1607 func (*MplsTunnelAddDel) GetCrcString() string { return "0de2478e" }
1608 func (*MplsTunnelAddDel) GetMessageType() api.MessageType {
1609 return api.RequestMessage
1612 func (m *MplsTunnelAddDel) Size() (size int) {
1616 size += 1 // m.MtIsAdd
1617 size += 4 // m.MtTunnel.MtSwIfIndex
1618 size += 4 // m.MtTunnel.MtTunnelIndex
1619 size += 1 // m.MtTunnel.MtL2Only
1620 size += 1 // m.MtTunnel.MtIsMulticast
1621 size += 1 // m.MtTunnel.MtNPaths
1622 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1625 if j2 < len(m.MtTunnel.MtPaths) {
1626 s2 = m.MtTunnel.MtPaths[j2]
1628 size += 4 // s2.SwIfIndex
1629 size += 4 // s2.TableID
1630 size += 4 // s2.RpfID
1631 size += 1 // s2.Weight
1632 size += 1 // s2.Preference
1633 size += 4 // s2.Type
1634 size += 4 // s2.Flags
1635 size += 4 // s2.Proto
1636 size += 1 * 16 // s2.Nh.Address
1637 size += 4 // s2.Nh.ViaLabel
1638 size += 4 // s2.Nh.ObjID
1639 size += 4 // s2.Nh.ClassifyTableIndex
1640 size += 1 // s2.NLabels
1641 for j3 := 0; j3 < 16; j3++ {
1642 size += 1 // s2.LabelStack[j3].IsUniform
1643 size += 4 // s2.LabelStack[j3].Label
1644 size += 1 // s2.LabelStack[j3].TTL
1645 size += 1 // s2.LabelStack[j3].Exp
1650 func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) {
1652 b = make([]byte, m.Size())
1654 buf := codec.NewBuffer(b)
1655 buf.EncodeBool(m.MtIsAdd)
1656 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1657 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1658 buf.EncodeBool(m.MtTunnel.MtL2Only)
1659 buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1660 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1661 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1662 var v1 FibPath // MtPaths
1663 if j1 < len(m.MtTunnel.MtPaths) {
1664 v1 = m.MtTunnel.MtPaths[j1]
1666 buf.EncodeUint32(v1.SwIfIndex)
1667 buf.EncodeUint32(v1.TableID)
1668 buf.EncodeUint32(v1.RpfID)
1669 buf.EncodeUint8(v1.Weight)
1670 buf.EncodeUint8(v1.Preference)
1671 buf.EncodeUint32(uint32(v1.Type))
1672 buf.EncodeUint32(uint32(v1.Flags))
1673 buf.EncodeUint32(uint32(v1.Proto))
1674 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1675 buf.EncodeUint32(v1.Nh.ViaLabel)
1676 buf.EncodeUint32(v1.Nh.ObjID)
1677 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1678 buf.EncodeUint8(v1.NLabels)
1679 for j2 := 0; j2 < 16; j2++ {
1680 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1681 buf.EncodeUint32(v1.LabelStack[j2].Label)
1682 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1683 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1686 return buf.Bytes(), nil
1688 func (m *MplsTunnelAddDel) Unmarshal(b []byte) error {
1689 buf := codec.NewBuffer(b)
1690 m.MtIsAdd = buf.DecodeBool()
1691 m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1692 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1693 m.MtTunnel.MtL2Only = buf.DecodeBool()
1694 m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1695 m.MtTunnel.MtNPaths = buf.DecodeUint8()
1696 m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1697 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1698 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1699 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1700 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1701 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1702 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1703 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1704 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1705 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1706 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1707 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1708 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1709 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1710 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1711 for j2 := 0; j2 < 16; j2++ {
1712 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1713 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1714 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1715 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1721 // MplsTunnelAddDelReply defines message 'mpls_tunnel_add_del_reply'.
1722 type MplsTunnelAddDelReply struct {
1723 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1724 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1725 TunnelIndex uint32 `binapi:"u32,name=tunnel_index" json:"tunnel_index,omitempty"`
1728 func (m *MplsTunnelAddDelReply) Reset() { *m = MplsTunnelAddDelReply{} }
1729 func (*MplsTunnelAddDelReply) GetMessageName() string { return "mpls_tunnel_add_del_reply" }
1730 func (*MplsTunnelAddDelReply) GetCrcString() string { return "afb01472" }
1731 func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType {
1732 return api.ReplyMessage
1735 func (m *MplsTunnelAddDelReply) Size() (size int) {
1739 size += 4 // m.Retval
1740 size += 4 // m.SwIfIndex
1741 size += 4 // m.TunnelIndex
1744 func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
1746 b = make([]byte, m.Size())
1748 buf := codec.NewBuffer(b)
1749 buf.EncodeInt32(m.Retval)
1750 buf.EncodeUint32(uint32(m.SwIfIndex))
1751 buf.EncodeUint32(m.TunnelIndex)
1752 return buf.Bytes(), nil
1754 func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error {
1755 buf := codec.NewBuffer(b)
1756 m.Retval = buf.DecodeInt32()
1757 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1758 m.TunnelIndex = buf.DecodeUint32()
1762 // MplsTunnelDetails defines message 'mpls_tunnel_details'.
1763 type MplsTunnelDetails struct {
1764 MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1767 func (m *MplsTunnelDetails) Reset() { *m = MplsTunnelDetails{} }
1768 func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" }
1769 func (*MplsTunnelDetails) GetCrcString() string { return "bdc55cce" }
1770 func (*MplsTunnelDetails) GetMessageType() api.MessageType {
1771 return api.ReplyMessage
1774 func (m *MplsTunnelDetails) Size() (size int) {
1778 size += 4 // m.MtTunnel.MtSwIfIndex
1779 size += 4 // m.MtTunnel.MtTunnelIndex
1780 size += 1 // m.MtTunnel.MtL2Only
1781 size += 1 // m.MtTunnel.MtIsMulticast
1782 size += 1 // m.MtTunnel.MtNPaths
1783 for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1786 if j2 < len(m.MtTunnel.MtPaths) {
1787 s2 = m.MtTunnel.MtPaths[j2]
1789 size += 4 // s2.SwIfIndex
1790 size += 4 // s2.TableID
1791 size += 4 // s2.RpfID
1792 size += 1 // s2.Weight
1793 size += 1 // s2.Preference
1794 size += 4 // s2.Type
1795 size += 4 // s2.Flags
1796 size += 4 // s2.Proto
1797 size += 1 * 16 // s2.Nh.Address
1798 size += 4 // s2.Nh.ViaLabel
1799 size += 4 // s2.Nh.ObjID
1800 size += 4 // s2.Nh.ClassifyTableIndex
1801 size += 1 // s2.NLabels
1802 for j3 := 0; j3 < 16; j3++ {
1803 size += 1 // s2.LabelStack[j3].IsUniform
1804 size += 4 // s2.LabelStack[j3].Label
1805 size += 1 // s2.LabelStack[j3].TTL
1806 size += 1 // s2.LabelStack[j3].Exp
1811 func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) {
1813 b = make([]byte, m.Size())
1815 buf := codec.NewBuffer(b)
1816 buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1817 buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1818 buf.EncodeBool(m.MtTunnel.MtL2Only)
1819 buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1820 buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1821 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1822 var v1 FibPath // MtPaths
1823 if j1 < len(m.MtTunnel.MtPaths) {
1824 v1 = m.MtTunnel.MtPaths[j1]
1826 buf.EncodeUint32(v1.SwIfIndex)
1827 buf.EncodeUint32(v1.TableID)
1828 buf.EncodeUint32(v1.RpfID)
1829 buf.EncodeUint8(v1.Weight)
1830 buf.EncodeUint8(v1.Preference)
1831 buf.EncodeUint32(uint32(v1.Type))
1832 buf.EncodeUint32(uint32(v1.Flags))
1833 buf.EncodeUint32(uint32(v1.Proto))
1834 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1835 buf.EncodeUint32(v1.Nh.ViaLabel)
1836 buf.EncodeUint32(v1.Nh.ObjID)
1837 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1838 buf.EncodeUint8(v1.NLabels)
1839 for j2 := 0; j2 < 16; j2++ {
1840 buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1841 buf.EncodeUint32(v1.LabelStack[j2].Label)
1842 buf.EncodeUint8(v1.LabelStack[j2].TTL)
1843 buf.EncodeUint8(v1.LabelStack[j2].Exp)
1846 return buf.Bytes(), nil
1848 func (m *MplsTunnelDetails) Unmarshal(b []byte) error {
1849 buf := codec.NewBuffer(b)
1850 m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1851 m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1852 m.MtTunnel.MtL2Only = buf.DecodeBool()
1853 m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1854 m.MtTunnel.MtNPaths = buf.DecodeUint8()
1855 m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1856 for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1857 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1858 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1859 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1860 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1861 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1862 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1863 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1864 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1865 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1866 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1867 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1868 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1869 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1870 for j2 := 0; j2 < 16; j2++ {
1871 m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1872 m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1873 m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1874 m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1880 // MplsTunnelDump defines message 'mpls_tunnel_dump'.
1881 type MplsTunnelDump struct {
1882 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1885 func (m *MplsTunnelDump) Reset() { *m = MplsTunnelDump{} }
1886 func (*MplsTunnelDump) GetMessageName() string { return "mpls_tunnel_dump" }
1887 func (*MplsTunnelDump) GetCrcString() string { return "f9e6675e" }
1888 func (*MplsTunnelDump) GetMessageType() api.MessageType {
1889 return api.RequestMessage
1892 func (m *MplsTunnelDump) Size() (size int) {
1896 size += 4 // m.SwIfIndex
1899 func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) {
1901 b = make([]byte, m.Size())
1903 buf := codec.NewBuffer(b)
1904 buf.EncodeUint32(uint32(m.SwIfIndex))
1905 return buf.Bytes(), nil
1907 func (m *MplsTunnelDump) Unmarshal(b []byte) error {
1908 buf := codec.NewBuffer(b)
1909 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1913 // SwInterfaceSetMplsEnable defines message 'sw_interface_set_mpls_enable'.
1914 type SwInterfaceSetMplsEnable struct {
1915 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1916 Enable bool `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1919 func (m *SwInterfaceSetMplsEnable) Reset() { *m = SwInterfaceSetMplsEnable{} }
1920 func (*SwInterfaceSetMplsEnable) GetMessageName() string { return "sw_interface_set_mpls_enable" }
1921 func (*SwInterfaceSetMplsEnable) GetCrcString() string { return "ae6cfcfb" }
1922 func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType {
1923 return api.RequestMessage
1926 func (m *SwInterfaceSetMplsEnable) Size() (size int) {
1930 size += 4 // m.SwIfIndex
1931 size += 1 // m.Enable
1934 func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) {
1936 b = make([]byte, m.Size())
1938 buf := codec.NewBuffer(b)
1939 buf.EncodeUint32(uint32(m.SwIfIndex))
1940 buf.EncodeBool(m.Enable)
1941 return buf.Bytes(), nil
1943 func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error {
1944 buf := codec.NewBuffer(b)
1945 m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1946 m.Enable = buf.DecodeBool()
1950 // SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'.
1951 type SwInterfaceSetMplsEnableReply struct {
1952 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1955 func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} }
1956 func (*SwInterfaceSetMplsEnableReply) GetMessageName() string {
1957 return "sw_interface_set_mpls_enable_reply"
1959 func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" }
1960 func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType {
1961 return api.ReplyMessage
1964 func (m *SwInterfaceSetMplsEnableReply) Size() (size int) {
1968 size += 4 // m.Retval
1971 func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) {
1973 b = make([]byte, m.Size())
1975 buf := codec.NewBuffer(b)
1976 buf.EncodeInt32(m.Retval)
1977 return buf.Bytes(), nil
1979 func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error {
1980 buf := codec.NewBuffer(b)
1981 m.Retval = buf.DecodeInt32()
1985 func init() { file_mpls_binapi_init() }
1986 func file_mpls_binapi_init() {
1987 api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_48249a27")
1988 api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804")
1989 api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_343cff54")
1990 api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab")
1991 api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_d0ac384c")
1992 api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa")
1993 api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512")
1994 api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804")
1995 api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8")
1996 api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14")
1997 api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_0de2478e")
1998 api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472")
1999 api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_bdc55cce")
2000 api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e")
2001 api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb")
2002 api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804")
2005 // Messages returns list of all messages in this module.
2006 func AllMessages() []api.Message {
2007 return []api.Message{
2008 (*MplsIPBindUnbind)(nil),
2009 (*MplsIPBindUnbindReply)(nil),
2010 (*MplsRouteAddDel)(nil),
2011 (*MplsRouteAddDelReply)(nil),
2012 (*MplsRouteDetails)(nil),
2013 (*MplsRouteDump)(nil),
2014 (*MplsTableAddDel)(nil),
2015 (*MplsTableAddDelReply)(nil),
2016 (*MplsTableDetails)(nil),
2017 (*MplsTableDump)(nil),
2018 (*MplsTunnelAddDel)(nil),
2019 (*MplsTunnelAddDelReply)(nil),
2020 (*MplsTunnelDetails)(nil),
2021 (*MplsTunnelDump)(nil),
2022 (*SwInterfaceSetMplsEnable)(nil),
2023 (*SwInterfaceSetMplsEnableReply)(nil),