11ab34b67ee49229816bd70905cad22130a637c4
[govpp.git] / internal / testbinapi / binapi2001 / mpls / mpls.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/core/mpls.api.json
6
7 // Package mpls contains generated bindings for API file mpls.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  13 enums
12 //  12 structs
13 //   1 union
14 //  16 messages
15 //
16 package mpls
17
18 import (
19         "fmt"
20         api "git.fd.io/govpp.git/api"
21         codec "git.fd.io/govpp.git/codec"
22         "net"
23         "strconv"
24         "strings"
25 )
26
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
32
33 const (
34         APIFile    = "mpls"
35         APIVersion = "1.1.1"
36         VersionCrc = 0xfe593e14
37 )
38
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
41
42 const (
43         ADDRESS_IP4 AddressFamily = 0
44         ADDRESS_IP6 AddressFamily = 1
45 )
46
47 var (
48         AddressFamily_name = map[uint32]string{
49                 0: "ADDRESS_IP4",
50                 1: "ADDRESS_IP6",
51         }
52         AddressFamily_value = map[string]uint32{
53                 "ADDRESS_IP4": 0,
54                 "ADDRESS_IP6": 1,
55         }
56 )
57
58 func (x AddressFamily) String() string {
59         s, ok := AddressFamily_name[uint32(x)]
60         if ok {
61                 return s
62         }
63         return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
64 }
65
66 // FibPathFlags defines enum 'fib_path_flags'.
67 type FibPathFlags uint32
68
69 const (
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
74 )
75
76 var (
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",
82         }
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,
88         }
89 )
90
91 func (x FibPathFlags) String() string {
92         s, ok := FibPathFlags_name[uint32(x)]
93         if ok {
94                 return s
95         }
96         str := func(n uint32) string {
97                 s, ok := FibPathFlags_name[uint32(n)]
98                 if ok {
99                         return s
100                 }
101                 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
102         }
103         for i := uint32(0); i <= 32; i++ {
104                 val := uint32(x)
105                 if val&(1<<i) != 0 {
106                         if s != "" {
107                                 s += "|"
108                         }
109                         s += str(1 << i)
110                 }
111         }
112         if s == "" {
113                 return str(uint32(x))
114         }
115         return s
116 }
117
118 // FibPathNhProto defines enum 'fib_path_nh_proto'.
119 type FibPathNhProto uint32
120
121 const (
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
127 )
128
129 var (
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",
136         }
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,
143         }
144 )
145
146 func (x FibPathNhProto) String() string {
147         s, ok := FibPathNhProto_name[uint32(x)]
148         if ok {
149                 return s
150         }
151         return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
152 }
153
154 // FibPathType defines enum 'fib_path_type'.
155 type FibPathType uint32
156
157 const (
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
169 )
170
171 var (
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",
184         }
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,
197         }
198 )
199
200 func (x FibPathType) String() string {
201         s, ok := FibPathType_name[uint32(x)]
202         if ok {
203                 return s
204         }
205         return "FibPathType(" + strconv.Itoa(int(x)) + ")"
206 }
207
208 // IfStatusFlags defines enum 'if_status_flags'.
209 type IfStatusFlags uint32
210
211 const (
212         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
213         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
214 )
215
216 var (
217         IfStatusFlags_name = map[uint32]string{
218                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
219                 2: "IF_STATUS_API_FLAG_LINK_UP",
220         }
221         IfStatusFlags_value = map[string]uint32{
222                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
223                 "IF_STATUS_API_FLAG_LINK_UP":  2,
224         }
225 )
226
227 func (x IfStatusFlags) String() string {
228         s, ok := IfStatusFlags_name[uint32(x)]
229         if ok {
230                 return s
231         }
232         str := func(n uint32) string {
233                 s, ok := IfStatusFlags_name[uint32(n)]
234                 if ok {
235                         return s
236                 }
237                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
238         }
239         for i := uint32(0); i <= 32; i++ {
240                 val := uint32(x)
241                 if val&(1<<i) != 0 {
242                         if s != "" {
243                                 s += "|"
244                         }
245                         s += str(1 << i)
246                 }
247         }
248         if s == "" {
249                 return str(uint32(x))
250         }
251         return s
252 }
253
254 // IfType defines enum 'if_type'.
255 type IfType uint32
256
257 const (
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
262 )
263
264 var (
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",
270         }
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,
276         }
277 )
278
279 func (x IfType) String() string {
280         s, ok := IfType_name[uint32(x)]
281         if ok {
282                 return s
283         }
284         return "IfType(" + strconv.Itoa(int(x)) + ")"
285 }
286
287 // IPDscp defines enum 'ip_dscp'.
288 type IPDscp uint8
289
290 const (
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
312 )
313
314 var (
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",
337         }
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,
360         }
361 )
362
363 func (x IPDscp) String() string {
364         s, ok := IPDscp_name[uint8(x)]
365         if ok {
366                 return s
367         }
368         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
369 }
370
371 // IPEcn defines enum 'ip_ecn'.
372 type IPEcn uint8
373
374 const (
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
379 )
380
381 var (
382         IPEcn_name = map[uint8]string{
383                 0: "IP_API_ECN_NONE",
384                 1: "IP_API_ECN_ECT0",
385                 2: "IP_API_ECN_ECT1",
386                 3: "IP_API_ECN_CE",
387         }
388         IPEcn_value = map[string]uint8{
389                 "IP_API_ECN_NONE": 0,
390                 "IP_API_ECN_ECT0": 1,
391                 "IP_API_ECN_ECT1": 2,
392                 "IP_API_ECN_CE":   3,
393         }
394 )
395
396 func (x IPEcn) String() string {
397         s, ok := IPEcn_name[uint8(x)]
398         if ok {
399                 return s
400         }
401         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
402 }
403
404 // IPProto defines enum 'ip_proto'.
405 type IPProto uint32
406
407 const (
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
420 )
421
422 var (
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",
436         }
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,
450         }
451 )
452
453 func (x IPProto) String() string {
454         s, ok := IPProto_name[uint32(x)]
455         if ok {
456                 return s
457         }
458         return "IPProto(" + strconv.Itoa(int(x)) + ")"
459 }
460
461 // LinkDuplex defines enum 'link_duplex'.
462 type LinkDuplex uint32
463
464 const (
465         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
466         LINK_DUPLEX_API_HALF    LinkDuplex = 1
467         LINK_DUPLEX_API_FULL    LinkDuplex = 2
468 )
469
470 var (
471         LinkDuplex_name = map[uint32]string{
472                 0: "LINK_DUPLEX_API_UNKNOWN",
473                 1: "LINK_DUPLEX_API_HALF",
474                 2: "LINK_DUPLEX_API_FULL",
475         }
476         LinkDuplex_value = map[string]uint32{
477                 "LINK_DUPLEX_API_UNKNOWN": 0,
478                 "LINK_DUPLEX_API_HALF":    1,
479                 "LINK_DUPLEX_API_FULL":    2,
480         }
481 )
482
483 func (x LinkDuplex) String() string {
484         s, ok := LinkDuplex_name[uint32(x)]
485         if ok {
486                 return s
487         }
488         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
489 }
490
491 // MtuProto defines enum 'mtu_proto'.
492 type MtuProto uint32
493
494 const (
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
500 )
501
502 var (
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",
509         }
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,
516         }
517 )
518
519 func (x MtuProto) String() string {
520         s, ok := MtuProto_name[uint32(x)]
521         if ok {
522                 return s
523         }
524         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
525 }
526
527 // RxMode defines enum 'rx_mode'.
528 type RxMode uint32
529
530 const (
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
536 )
537
538 var (
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",
545         }
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,
552         }
553 )
554
555 func (x RxMode) String() string {
556         s, ok := RxMode_name[uint32(x)]
557         if ok {
558                 return s
559         }
560         return "RxMode(" + strconv.Itoa(int(x)) + ")"
561 }
562
563 // SubIfFlags defines enum 'sub_if_flags'.
564 type SubIfFlags uint32
565
566 const (
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
577 )
578
579 var (
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",
591         }
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,
603         }
604 )
605
606 func (x SubIfFlags) String() string {
607         s, ok := SubIfFlags_name[uint32(x)]
608         if ok {
609                 return s
610         }
611         str := func(n uint32) string {
612                 s, ok := SubIfFlags_name[uint32(n)]
613                 if ok {
614                         return s
615                 }
616                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
617         }
618         for i := uint32(0); i <= 32; i++ {
619                 val := uint32(x)
620                 if val&(1<<i) != 0 {
621                         if s != "" {
622                                 s += "|"
623                         }
624                         s += str(1 << i)
625                 }
626         }
627         if s == "" {
628                 return str(uint32(x))
629         }
630         return s
631 }
632
633 // AddressWithPrefix defines alias 'address_with_prefix'.
634 type AddressWithPrefix Prefix
635
636 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
637         prefix, err := ParsePrefix(s)
638         if err != nil {
639                 return AddressWithPrefix{}, err
640         }
641         return AddressWithPrefix(prefix), nil
642 }
643 func (x AddressWithPrefix) String() string {
644         return Prefix(x).String()
645 }
646 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
647         return []byte(x.String()), nil
648 }
649 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
650         prefix, err := ParseAddressWithPrefix(string(text))
651         if err != nil {
652                 return err
653         }
654         *x = prefix
655         return nil
656 }
657
658 // InterfaceIndex defines alias 'interface_index'.
659 type InterfaceIndex uint32
660
661 // IP4Address defines alias 'ip4_address'.
662 type IP4Address [4]uint8
663
664 func ParseIP4Address(s string) (IP4Address, error) {
665         ip := net.ParseIP(s).To4()
666         if ip == nil {
667                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
668         }
669         var ipaddr IP4Address
670         copy(ipaddr[:], ip.To4())
671         return ipaddr, nil
672 }
673
674 func (x IP4Address) ToIP() net.IP {
675         return net.IP(x[:]).To4()
676 }
677 func (x IP4Address) String() string {
678         return x.ToIP().String()
679 }
680 func (x *IP4Address) MarshalText() ([]byte, error) {
681         return []byte(x.String()), nil
682 }
683 func (x *IP4Address) UnmarshalText(text []byte) error {
684         ipaddr, err := ParseIP4Address(string(text))
685         if err != nil {
686                 return err
687         }
688         *x = ipaddr
689         return nil
690 }
691
692 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
693 type IP4AddressWithPrefix IP4Prefix
694
695 // IP6Address defines alias 'ip6_address'.
696 type IP6Address [16]uint8
697
698 func ParseIP6Address(s string) (IP6Address, error) {
699         ip := net.ParseIP(s).To16()
700         if ip == nil {
701                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
702         }
703         var ipaddr IP6Address
704         copy(ipaddr[:], ip.To16())
705         return ipaddr, nil
706 }
707
708 func (x IP6Address) ToIP() net.IP {
709         return net.IP(x[:]).To16()
710 }
711 func (x IP6Address) String() string {
712         return x.ToIP().String()
713 }
714 func (x *IP6Address) MarshalText() ([]byte, error) {
715         return []byte(x.String()), nil
716 }
717 func (x *IP6Address) UnmarshalText(text []byte) error {
718         ipaddr, err := ParseIP6Address(string(text))
719         if err != nil {
720                 return err
721         }
722         *x = ipaddr
723         return nil
724 }
725
726 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
727 type IP6AddressWithPrefix IP6Prefix
728
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"`
733 }
734
735 func ParseAddress(s string) (Address, error) {
736         ip := net.ParseIP(s)
737         if ip == nil {
738                 return Address{}, fmt.Errorf("invalid address: %s", s)
739         }
740         var addr Address
741         if ip.To4() == nil {
742                 addr.Af = ADDRESS_IP6
743                 var ip6 IP6Address
744                 copy(ip6[:], ip.To16())
745                 addr.Un.SetIP6(ip6)
746         } else {
747                 addr.Af = ADDRESS_IP4
748                 var ip4 IP4Address
749                 copy(ip4[:], ip.To4())
750                 addr.Un.SetIP4(ip4)
751         }
752         return addr, nil
753 }
754 func (x Address) ToIP() net.IP {
755         if x.Af == ADDRESS_IP6 {
756                 ip6 := x.Un.GetIP6()
757                 return net.IP(ip6[:]).To16()
758         } else {
759                 ip4 := x.Un.GetIP4()
760                 return net.IP(ip4[:]).To4()
761         }
762 }
763 func (x Address) String() string {
764         return x.ToIP().String()
765 }
766 func (x *Address) MarshalText() ([]byte, error) {
767         return []byte(x.String()), nil
768 }
769 func (x *Address) UnmarshalText(text []byte) error {
770         addr, err := ParseAddress(string(text))
771         if err != nil {
772                 return err
773         }
774         *x = addr
775         return nil
776 }
777
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"`
784 }
785
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"`
799 }
800
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"`
807 }
808
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"`
813 }
814
815 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
816         hasPrefix := strings.Contains(s, "/")
817         if hasPrefix {
818                 ip, network, err := net.ParseCIDR(s)
819                 if err != nil {
820                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
821                 }
822                 maskSize, _ := network.Mask.Size()
823                 prefix.Len = byte(maskSize)
824                 prefix.Address, err = ParseIP4Address(ip.String())
825                 if err != nil {
826                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
827                 }
828         } else {
829                 ip := net.ParseIP(s)
830                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
831                 if ip.To4() == nil {
832                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
833                 }
834                 prefix.Len = byte(defaultMaskSize)
835                 prefix.Address, err = ParseIP4Address(ip.String())
836                 if err != nil {
837                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
838                 }
839         }
840         return prefix, nil
841 }
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}
845         return ipnet
846 }
847 func (x IP4Prefix) String() string {
848         ip := x.Address.String()
849         return ip + "/" + strconv.Itoa(int(x.Len))
850 }
851 func (x *IP4Prefix) MarshalText() ([]byte, error) {
852         return []byte(x.String()), nil
853 }
854 func (x *IP4Prefix) UnmarshalText(text []byte) error {
855         prefix, err := ParseIP4Prefix(string(text))
856         if err != nil {
857                 return err
858         }
859         *x = prefix
860         return nil
861 }
862
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"`
867 }
868
869 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
870         hasPrefix := strings.Contains(s, "/")
871         if hasPrefix {
872                 ip, network, err := net.ParseCIDR(s)
873                 if err != nil {
874                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
875                 }
876                 maskSize, _ := network.Mask.Size()
877                 prefix.Len = byte(maskSize)
878                 prefix.Address, err = ParseIP6Address(ip.String())
879                 if err != nil {
880                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
881                 }
882         } else {
883                 ip := net.ParseIP(s)
884                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
885                 if ip.To4() == nil {
886                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
887                 }
888                 prefix.Len = byte(defaultMaskSize)
889                 prefix.Address, err = ParseIP6Address(ip.String())
890                 if err != nil {
891                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
892                 }
893         }
894         return prefix, nil
895 }
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}
899         return ipnet
900 }
901 func (x IP6Prefix) String() string {
902         ip := x.Address.String()
903         return ip + "/" + strconv.Itoa(int(x.Len))
904 }
905 func (x *IP6Prefix) MarshalText() ([]byte, error) {
906         return []byte(x.String()), nil
907 }
908 func (x *IP6Prefix) UnmarshalText(text []byte) error {
909         prefix, err := ParseIP6Prefix(string(text))
910         if err != nil {
911                 return err
912         }
913         *x = prefix
914         return nil
915 }
916
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"`
926 }
927
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"`
932 }
933
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"`
942 }
943
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"`
950 }
951
952 // Prefix defines type 'prefix'.
953 type Prefix struct {
954         Address Address `binapi:"address,name=address" json:"address,omitempty"`
955         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
956 }
957
958 func ParsePrefix(ip string) (prefix Prefix, err error) {
959         hasPrefix := strings.Contains(ip, "/")
960         if hasPrefix {
961                 netIP, network, err := net.ParseCIDR(ip)
962                 if err != nil {
963                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
964                 }
965                 maskSize, _ := network.Mask.Size()
966                 prefix.Len = byte(maskSize)
967                 prefix.Address, err = ParseAddress(netIP.String())
968                 if err != nil {
969                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
970                 }
971         } else {
972                 netIP := net.ParseIP(ip)
973                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
974                 if netIP.To4() == nil {
975                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
976                 }
977                 prefix.Len = byte(defaultMaskSize)
978                 prefix.Address, err = ParseAddress(netIP.String())
979                 if err != nil {
980                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
981                 }
982         }
983         return prefix, nil
984 }
985 func (x Prefix) ToIPNet() *net.IPNet {
986         var mask net.IPMask
987         if x.Address.Af == ADDRESS_IP4 {
988                 mask = net.CIDRMask(int(x.Len), 32)
989         } else {
990                 mask = net.CIDRMask(int(x.Len), 128)
991         }
992         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
993         return ipnet
994 }
995 func (x Prefix) String() string {
996         ip := x.Address.String()
997         return ip + "/" + strconv.Itoa(int(x.Len))
998 }
999 func (x *Prefix) MarshalText() ([]byte, error) {
1000         return []byte(x.String()), nil
1001 }
1002 func (x *Prefix) UnmarshalText(text []byte) error {
1003         prefix, err := ParsePrefix(string(text))
1004         if err != nil {
1005                 return err
1006         }
1007         *x = prefix
1008         return nil
1009 }
1010
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"`
1015 }
1016
1017 // AddressUnion defines union 'address_union'.
1018 type AddressUnion struct {
1019         // IP4 *IP4Address
1020         // IP6 *IP6Address
1021         XXX_UnionData [16]byte
1022 }
1023
1024 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1025         u.SetIP4(a)
1026         return
1027 }
1028 func (u *AddressUnion) SetIP4(a IP4Address) {
1029         buf := codec.NewBuffer(u.XXX_UnionData[:])
1030         buf.EncodeBytes(a[:], 4)
1031 }
1032 func (u *AddressUnion) GetIP4() (a IP4Address) {
1033         buf := codec.NewBuffer(u.XXX_UnionData[:])
1034         copy(a[:], buf.DecodeBytes(4))
1035         return
1036 }
1037
1038 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1039         u.SetIP6(a)
1040         return
1041 }
1042 func (u *AddressUnion) SetIP6(a IP6Address) {
1043         buf := codec.NewBuffer(u.XXX_UnionData[:])
1044         buf.EncodeBytes(a[:], 16)
1045 }
1046 func (u *AddressUnion) GetIP6() (a IP6Address) {
1047         buf := codec.NewBuffer(u.XXX_UnionData[:])
1048         copy(a[:], buf.DecodeBytes(16))
1049         return
1050 }
1051
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"`
1059 }
1060
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
1066 }
1067
1068 func (m *MplsIPBindUnbind) Size() (size int) {
1069         if m == nil {
1070                 return 0
1071         }
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
1079         return size
1080 }
1081 func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) {
1082         if b == nil {
1083                 b = make([]byte, m.Size())
1084         }
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
1094 }
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()
1104         return nil
1105 }
1106
1107 // MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'.
1108 type MplsIPBindUnbindReply struct {
1109         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1110 }
1111
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
1117 }
1118
1119 func (m *MplsIPBindUnbindReply) Size() (size int) {
1120         if m == nil {
1121                 return 0
1122         }
1123         size += 4 // m.Retval
1124         return size
1125 }
1126 func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) {
1127         if b == nil {
1128                 b = make([]byte, m.Size())
1129         }
1130         buf := codec.NewBuffer(b)
1131         buf.EncodeInt32(m.Retval)
1132         return buf.Bytes(), nil
1133 }
1134 func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error {
1135         buf := codec.NewBuffer(b)
1136         m.Retval = buf.DecodeInt32()
1137         return nil
1138 }
1139
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"`
1145 }
1146
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
1152 }
1153
1154 func (m *MplsRouteAddDel) Size() (size int) {
1155         if m == nil {
1156                 return 0
1157         }
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++ {
1167                 var s2 FibPath
1168                 _ = s2
1169                 if j2 < len(m.MrRoute.MrPaths) {
1170                         s2 = m.MrRoute.MrPaths[j2]
1171                 }
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
1190                 }
1191         }
1192         return size
1193 }
1194 func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) {
1195         if b == nil {
1196                 b = make([]byte, m.Size())
1197         }
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]
1211                 }
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)
1230                 }
1231         }
1232         return buf.Bytes(), nil
1233 }
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()
1264                 }
1265         }
1266         return nil
1267 }
1268
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"`
1273 }
1274
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
1280 }
1281
1282 func (m *MplsRouteAddDelReply) Size() (size int) {
1283         if m == nil {
1284                 return 0
1285         }
1286         size += 4 // m.Retval
1287         size += 4 // m.StatsIndex
1288         return size
1289 }
1290 func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
1291         if b == nil {
1292                 b = make([]byte, m.Size())
1293         }
1294         buf := codec.NewBuffer(b)
1295         buf.EncodeInt32(m.Retval)
1296         buf.EncodeUint32(m.StatsIndex)
1297         return buf.Bytes(), nil
1298 }
1299 func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error {
1300         buf := codec.NewBuffer(b)
1301         m.Retval = buf.DecodeInt32()
1302         m.StatsIndex = buf.DecodeUint32()
1303         return nil
1304 }
1305
1306 // MplsRouteDetails defines message 'mpls_route_details'.
1307 type MplsRouteDetails struct {
1308         MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1309 }
1310
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
1316 }
1317
1318 func (m *MplsRouteDetails) Size() (size int) {
1319         if m == nil {
1320                 return 0
1321         }
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++ {
1329                 var s2 FibPath
1330                 _ = s2
1331                 if j2 < len(m.MrRoute.MrPaths) {
1332                         s2 = m.MrRoute.MrPaths[j2]
1333                 }
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
1352                 }
1353         }
1354         return size
1355 }
1356 func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) {
1357         if b == nil {
1358                 b = make([]byte, m.Size())
1359         }
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]
1371                 }
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)
1390                 }
1391         }
1392         return buf.Bytes(), nil
1393 }
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()
1422                 }
1423         }
1424         return nil
1425 }
1426
1427 // MplsRouteDump defines message 'mpls_route_dump'.
1428 type MplsRouteDump struct {
1429         Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"`
1430 }
1431
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
1437 }
1438
1439 func (m *MplsRouteDump) Size() (size int) {
1440         if m == nil {
1441                 return 0
1442         }
1443         size += 4  // m.Table.MtTableID
1444         size += 64 // m.Table.MtName
1445         return size
1446 }
1447 func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) {
1448         if b == nil {
1449                 b = make([]byte, m.Size())
1450         }
1451         buf := codec.NewBuffer(b)
1452         buf.EncodeUint32(m.Table.MtTableID)
1453         buf.EncodeString(m.Table.MtName, 64)
1454         return buf.Bytes(), nil
1455 }
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)
1460         return nil
1461 }
1462
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"`
1467 }
1468
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
1474 }
1475
1476 func (m *MplsTableAddDel) Size() (size int) {
1477         if m == nil {
1478                 return 0
1479         }
1480         size += 1  // m.MtIsAdd
1481         size += 4  // m.MtTable.MtTableID
1482         size += 64 // m.MtTable.MtName
1483         return size
1484 }
1485 func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) {
1486         if b == nil {
1487                 b = make([]byte, m.Size())
1488         }
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
1494 }
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)
1500         return nil
1501 }
1502
1503 // MplsTableAddDelReply defines message 'mpls_table_add_del_reply'.
1504 type MplsTableAddDelReply struct {
1505         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1506 }
1507
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
1513 }
1514
1515 func (m *MplsTableAddDelReply) Size() (size int) {
1516         if m == nil {
1517                 return 0
1518         }
1519         size += 4 // m.Retval
1520         return size
1521 }
1522 func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1523         if b == nil {
1524                 b = make([]byte, m.Size())
1525         }
1526         buf := codec.NewBuffer(b)
1527         buf.EncodeInt32(m.Retval)
1528         return buf.Bytes(), nil
1529 }
1530 func (m *MplsTableAddDelReply) Unmarshal(b []byte) error {
1531         buf := codec.NewBuffer(b)
1532         m.Retval = buf.DecodeInt32()
1533         return nil
1534 }
1535
1536 // MplsTableDetails defines message 'mpls_table_details'.
1537 type MplsTableDetails struct {
1538         MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1539 }
1540
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
1546 }
1547
1548 func (m *MplsTableDetails) Size() (size int) {
1549         if m == nil {
1550                 return 0
1551         }
1552         size += 4  // m.MtTable.MtTableID
1553         size += 64 // m.MtTable.MtName
1554         return size
1555 }
1556 func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) {
1557         if b == nil {
1558                 b = make([]byte, m.Size())
1559         }
1560         buf := codec.NewBuffer(b)
1561         buf.EncodeUint32(m.MtTable.MtTableID)
1562         buf.EncodeString(m.MtTable.MtName, 64)
1563         return buf.Bytes(), nil
1564 }
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)
1569         return nil
1570 }
1571
1572 // MplsTableDump defines message 'mpls_table_dump'.
1573 type MplsTableDump struct{}
1574
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
1580 }
1581
1582 func (m *MplsTableDump) Size() (size int) {
1583         if m == nil {
1584                 return 0
1585         }
1586         return size
1587 }
1588 func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) {
1589         if b == nil {
1590                 b = make([]byte, m.Size())
1591         }
1592         buf := codec.NewBuffer(b)
1593         return buf.Bytes(), nil
1594 }
1595 func (m *MplsTableDump) Unmarshal(b []byte) error {
1596         return nil
1597 }
1598
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"`
1603 }
1604
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
1610 }
1611
1612 func (m *MplsTunnelAddDel) Size() (size int) {
1613         if m == nil {
1614                 return 0
1615         }
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++ {
1623                 var s2 FibPath
1624                 _ = s2
1625                 if j2 < len(m.MtTunnel.MtPaths) {
1626                         s2 = m.MtTunnel.MtPaths[j2]
1627                 }
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
1646                 }
1647         }
1648         return size
1649 }
1650 func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) {
1651         if b == nil {
1652                 b = make([]byte, m.Size())
1653         }
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]
1665                 }
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)
1684                 }
1685         }
1686         return buf.Bytes(), nil
1687 }
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()
1716                 }
1717         }
1718         return nil
1719 }
1720
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"`
1726 }
1727
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
1733 }
1734
1735 func (m *MplsTunnelAddDelReply) Size() (size int) {
1736         if m == nil {
1737                 return 0
1738         }
1739         size += 4 // m.Retval
1740         size += 4 // m.SwIfIndex
1741         size += 4 // m.TunnelIndex
1742         return size
1743 }
1744 func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
1745         if b == nil {
1746                 b = make([]byte, m.Size())
1747         }
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
1753 }
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()
1759         return nil
1760 }
1761
1762 // MplsTunnelDetails defines message 'mpls_tunnel_details'.
1763 type MplsTunnelDetails struct {
1764         MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1765 }
1766
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
1772 }
1773
1774 func (m *MplsTunnelDetails) Size() (size int) {
1775         if m == nil {
1776                 return 0
1777         }
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++ {
1784                 var s2 FibPath
1785                 _ = s2
1786                 if j2 < len(m.MtTunnel.MtPaths) {
1787                         s2 = m.MtTunnel.MtPaths[j2]
1788                 }
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
1807                 }
1808         }
1809         return size
1810 }
1811 func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) {
1812         if b == nil {
1813                 b = make([]byte, m.Size())
1814         }
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]
1825                 }
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)
1844                 }
1845         }
1846         return buf.Bytes(), nil
1847 }
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()
1875                 }
1876         }
1877         return nil
1878 }
1879
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"`
1883 }
1884
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
1890 }
1891
1892 func (m *MplsTunnelDump) Size() (size int) {
1893         if m == nil {
1894                 return 0
1895         }
1896         size += 4 // m.SwIfIndex
1897         return size
1898 }
1899 func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) {
1900         if b == nil {
1901                 b = make([]byte, m.Size())
1902         }
1903         buf := codec.NewBuffer(b)
1904         buf.EncodeUint32(uint32(m.SwIfIndex))
1905         return buf.Bytes(), nil
1906 }
1907 func (m *MplsTunnelDump) Unmarshal(b []byte) error {
1908         buf := codec.NewBuffer(b)
1909         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1910         return nil
1911 }
1912
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"`
1917 }
1918
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
1924 }
1925
1926 func (m *SwInterfaceSetMplsEnable) Size() (size int) {
1927         if m == nil {
1928                 return 0
1929         }
1930         size += 4 // m.SwIfIndex
1931         size += 1 // m.Enable
1932         return size
1933 }
1934 func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) {
1935         if b == nil {
1936                 b = make([]byte, m.Size())
1937         }
1938         buf := codec.NewBuffer(b)
1939         buf.EncodeUint32(uint32(m.SwIfIndex))
1940         buf.EncodeBool(m.Enable)
1941         return buf.Bytes(), nil
1942 }
1943 func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error {
1944         buf := codec.NewBuffer(b)
1945         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1946         m.Enable = buf.DecodeBool()
1947         return nil
1948 }
1949
1950 // SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'.
1951 type SwInterfaceSetMplsEnableReply struct {
1952         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1953 }
1954
1955 func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} }
1956 func (*SwInterfaceSetMplsEnableReply) GetMessageName() string {
1957         return "sw_interface_set_mpls_enable_reply"
1958 }
1959 func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" }
1960 func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType {
1961         return api.ReplyMessage
1962 }
1963
1964 func (m *SwInterfaceSetMplsEnableReply) Size() (size int) {
1965         if m == nil {
1966                 return 0
1967         }
1968         size += 4 // m.Retval
1969         return size
1970 }
1971 func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) {
1972         if b == nil {
1973                 b = make([]byte, m.Size())
1974         }
1975         buf := codec.NewBuffer(b)
1976         buf.EncodeInt32(m.Retval)
1977         return buf.Bytes(), nil
1978 }
1979 func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error {
1980         buf := codec.NewBuffer(b)
1981         m.Retval = buf.DecodeInt32()
1982         return nil
1983 }
1984
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")
2003 }
2004
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),
2024         }
2025 }