Update generated binapi to v22.02 & makefile changes
[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.5.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         "net"
21         "strconv"
22         "strings"
23
24         api "git.fd.io/govpp.git/api"
25         codec "git.fd.io/govpp.git/codec"
26 )
27
28 // This is a compile-time assertion to ensure that this generated file
29 // is compatible with the GoVPP api package it is being compiled against.
30 // A compilation error at this line likely means your copy of the
31 // GoVPP api package needs to be updated.
32 const _ = api.GoVppAPIPackageIsVersion2
33
34 const (
35         APIFile    = "mpls"
36         APIVersion = "1.1.1"
37         VersionCrc = 0xfe593e14
38 )
39
40 // AddressFamily defines enum 'address_family'.
41 type AddressFamily uint32
42
43 const (
44         ADDRESS_IP4 AddressFamily = 0
45         ADDRESS_IP6 AddressFamily = 1
46 )
47
48 var (
49         AddressFamily_name = map[uint32]string{
50                 0: "ADDRESS_IP4",
51                 1: "ADDRESS_IP6",
52         }
53         AddressFamily_value = map[string]uint32{
54                 "ADDRESS_IP4": 0,
55                 "ADDRESS_IP6": 1,
56         }
57 )
58
59 func (x AddressFamily) String() string {
60         s, ok := AddressFamily_name[uint32(x)]
61         if ok {
62                 return s
63         }
64         return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
65 }
66
67 // FibPathFlags defines enum 'fib_path_flags'.
68 type FibPathFlags uint32
69
70 const (
71         FIB_API_PATH_FLAG_NONE                 FibPathFlags = 0
72         FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
73         FIB_API_PATH_FLAG_RESOLVE_VIA_HOST     FibPathFlags = 2
74         FIB_API_PATH_FLAG_POP_PW_CW            FibPathFlags = 4
75 )
76
77 var (
78         FibPathFlags_name = map[uint32]string{
79                 0: "FIB_API_PATH_FLAG_NONE",
80                 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
81                 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
82                 4: "FIB_API_PATH_FLAG_POP_PW_CW",
83         }
84         FibPathFlags_value = map[string]uint32{
85                 "FIB_API_PATH_FLAG_NONE":                 0,
86                 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
87                 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST":     2,
88                 "FIB_API_PATH_FLAG_POP_PW_CW":            4,
89         }
90 )
91
92 func (x FibPathFlags) String() string {
93         s, ok := FibPathFlags_name[uint32(x)]
94         if ok {
95                 return s
96         }
97         str := func(n uint32) string {
98                 s, ok := FibPathFlags_name[uint32(n)]
99                 if ok {
100                         return s
101                 }
102                 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
103         }
104         for i := uint32(0); i <= 32; i++ {
105                 val := uint32(x)
106                 if val&(1<<i) != 0 {
107                         if s != "" {
108                                 s += "|"
109                         }
110                         s += str(1 << i)
111                 }
112         }
113         if s == "" {
114                 return str(uint32(x))
115         }
116         return s
117 }
118
119 // FibPathNhProto defines enum 'fib_path_nh_proto'.
120 type FibPathNhProto uint32
121
122 const (
123         FIB_API_PATH_NH_PROTO_IP4      FibPathNhProto = 0
124         FIB_API_PATH_NH_PROTO_IP6      FibPathNhProto = 1
125         FIB_API_PATH_NH_PROTO_MPLS     FibPathNhProto = 2
126         FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
127         FIB_API_PATH_NH_PROTO_BIER     FibPathNhProto = 4
128 )
129
130 var (
131         FibPathNhProto_name = map[uint32]string{
132                 0: "FIB_API_PATH_NH_PROTO_IP4",
133                 1: "FIB_API_PATH_NH_PROTO_IP6",
134                 2: "FIB_API_PATH_NH_PROTO_MPLS",
135                 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
136                 4: "FIB_API_PATH_NH_PROTO_BIER",
137         }
138         FibPathNhProto_value = map[string]uint32{
139                 "FIB_API_PATH_NH_PROTO_IP4":      0,
140                 "FIB_API_PATH_NH_PROTO_IP6":      1,
141                 "FIB_API_PATH_NH_PROTO_MPLS":     2,
142                 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
143                 "FIB_API_PATH_NH_PROTO_BIER":     4,
144         }
145 )
146
147 func (x FibPathNhProto) String() string {
148         s, ok := FibPathNhProto_name[uint32(x)]
149         if ok {
150                 return s
151         }
152         return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
153 }
154
155 // FibPathType defines enum 'fib_path_type'.
156 type FibPathType uint32
157
158 const (
159         FIB_API_PATH_TYPE_NORMAL        FibPathType = 0
160         FIB_API_PATH_TYPE_LOCAL         FibPathType = 1
161         FIB_API_PATH_TYPE_DROP          FibPathType = 2
162         FIB_API_PATH_TYPE_UDP_ENCAP     FibPathType = 3
163         FIB_API_PATH_TYPE_BIER_IMP      FibPathType = 4
164         FIB_API_PATH_TYPE_ICMP_UNREACH  FibPathType = 5
165         FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
166         FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
167         FIB_API_PATH_TYPE_DVR           FibPathType = 8
168         FIB_API_PATH_TYPE_INTERFACE_RX  FibPathType = 9
169         FIB_API_PATH_TYPE_CLASSIFY      FibPathType = 10
170 )
171
172 var (
173         FibPathType_name = map[uint32]string{
174                 0:  "FIB_API_PATH_TYPE_NORMAL",
175                 1:  "FIB_API_PATH_TYPE_LOCAL",
176                 2:  "FIB_API_PATH_TYPE_DROP",
177                 3:  "FIB_API_PATH_TYPE_UDP_ENCAP",
178                 4:  "FIB_API_PATH_TYPE_BIER_IMP",
179                 5:  "FIB_API_PATH_TYPE_ICMP_UNREACH",
180                 6:  "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
181                 7:  "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
182                 8:  "FIB_API_PATH_TYPE_DVR",
183                 9:  "FIB_API_PATH_TYPE_INTERFACE_RX",
184                 10: "FIB_API_PATH_TYPE_CLASSIFY",
185         }
186         FibPathType_value = map[string]uint32{
187                 "FIB_API_PATH_TYPE_NORMAL":        0,
188                 "FIB_API_PATH_TYPE_LOCAL":         1,
189                 "FIB_API_PATH_TYPE_DROP":          2,
190                 "FIB_API_PATH_TYPE_UDP_ENCAP":     3,
191                 "FIB_API_PATH_TYPE_BIER_IMP":      4,
192                 "FIB_API_PATH_TYPE_ICMP_UNREACH":  5,
193                 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
194                 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
195                 "FIB_API_PATH_TYPE_DVR":           8,
196                 "FIB_API_PATH_TYPE_INTERFACE_RX":  9,
197                 "FIB_API_PATH_TYPE_CLASSIFY":      10,
198         }
199 )
200
201 func (x FibPathType) String() string {
202         s, ok := FibPathType_name[uint32(x)]
203         if ok {
204                 return s
205         }
206         return "FibPathType(" + strconv.Itoa(int(x)) + ")"
207 }
208
209 // IfStatusFlags defines enum 'if_status_flags'.
210 type IfStatusFlags uint32
211
212 const (
213         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
214         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
215 )
216
217 var (
218         IfStatusFlags_name = map[uint32]string{
219                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
220                 2: "IF_STATUS_API_FLAG_LINK_UP",
221         }
222         IfStatusFlags_value = map[string]uint32{
223                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
224                 "IF_STATUS_API_FLAG_LINK_UP":  2,
225         }
226 )
227
228 func (x IfStatusFlags) String() string {
229         s, ok := IfStatusFlags_name[uint32(x)]
230         if ok {
231                 return s
232         }
233         str := func(n uint32) string {
234                 s, ok := IfStatusFlags_name[uint32(n)]
235                 if ok {
236                         return s
237                 }
238                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
239         }
240         for i := uint32(0); i <= 32; i++ {
241                 val := uint32(x)
242                 if val&(1<<i) != 0 {
243                         if s != "" {
244                                 s += "|"
245                         }
246                         s += str(1 << i)
247                 }
248         }
249         if s == "" {
250                 return str(uint32(x))
251         }
252         return s
253 }
254
255 // IfType defines enum 'if_type'.
256 type IfType uint32
257
258 const (
259         IF_API_TYPE_HARDWARE IfType = 1
260         IF_API_TYPE_SUB      IfType = 2
261         IF_API_TYPE_P2P      IfType = 3
262         IF_API_TYPE_PIPE     IfType = 4
263 )
264
265 var (
266         IfType_name = map[uint32]string{
267                 1: "IF_API_TYPE_HARDWARE",
268                 2: "IF_API_TYPE_SUB",
269                 3: "IF_API_TYPE_P2P",
270                 4: "IF_API_TYPE_PIPE",
271         }
272         IfType_value = map[string]uint32{
273                 "IF_API_TYPE_HARDWARE": 1,
274                 "IF_API_TYPE_SUB":      2,
275                 "IF_API_TYPE_P2P":      3,
276                 "IF_API_TYPE_PIPE":     4,
277         }
278 )
279
280 func (x IfType) String() string {
281         s, ok := IfType_name[uint32(x)]
282         if ok {
283                 return s
284         }
285         return "IfType(" + strconv.Itoa(int(x)) + ")"
286 }
287
288 // IPDscp defines enum 'ip_dscp'.
289 type IPDscp uint8
290
291 const (
292         IP_API_DSCP_CS0  IPDscp = 0
293         IP_API_DSCP_CS1  IPDscp = 8
294         IP_API_DSCP_AF11 IPDscp = 10
295         IP_API_DSCP_AF12 IPDscp = 12
296         IP_API_DSCP_AF13 IPDscp = 14
297         IP_API_DSCP_CS2  IPDscp = 16
298         IP_API_DSCP_AF21 IPDscp = 18
299         IP_API_DSCP_AF22 IPDscp = 20
300         IP_API_DSCP_AF23 IPDscp = 22
301         IP_API_DSCP_CS3  IPDscp = 24
302         IP_API_DSCP_AF31 IPDscp = 26
303         IP_API_DSCP_AF32 IPDscp = 28
304         IP_API_DSCP_AF33 IPDscp = 30
305         IP_API_DSCP_CS4  IPDscp = 32
306         IP_API_DSCP_AF41 IPDscp = 34
307         IP_API_DSCP_AF42 IPDscp = 36
308         IP_API_DSCP_AF43 IPDscp = 38
309         IP_API_DSCP_CS5  IPDscp = 40
310         IP_API_DSCP_EF   IPDscp = 46
311         IP_API_DSCP_CS6  IPDscp = 48
312         IP_API_DSCP_CS7  IPDscp = 50
313 )
314
315 var (
316         IPDscp_name = map[uint8]string{
317                 0:  "IP_API_DSCP_CS0",
318                 8:  "IP_API_DSCP_CS1",
319                 10: "IP_API_DSCP_AF11",
320                 12: "IP_API_DSCP_AF12",
321                 14: "IP_API_DSCP_AF13",
322                 16: "IP_API_DSCP_CS2",
323                 18: "IP_API_DSCP_AF21",
324                 20: "IP_API_DSCP_AF22",
325                 22: "IP_API_DSCP_AF23",
326                 24: "IP_API_DSCP_CS3",
327                 26: "IP_API_DSCP_AF31",
328                 28: "IP_API_DSCP_AF32",
329                 30: "IP_API_DSCP_AF33",
330                 32: "IP_API_DSCP_CS4",
331                 34: "IP_API_DSCP_AF41",
332                 36: "IP_API_DSCP_AF42",
333                 38: "IP_API_DSCP_AF43",
334                 40: "IP_API_DSCP_CS5",
335                 46: "IP_API_DSCP_EF",
336                 48: "IP_API_DSCP_CS6",
337                 50: "IP_API_DSCP_CS7",
338         }
339         IPDscp_value = map[string]uint8{
340                 "IP_API_DSCP_CS0":  0,
341                 "IP_API_DSCP_CS1":  8,
342                 "IP_API_DSCP_AF11": 10,
343                 "IP_API_DSCP_AF12": 12,
344                 "IP_API_DSCP_AF13": 14,
345                 "IP_API_DSCP_CS2":  16,
346                 "IP_API_DSCP_AF21": 18,
347                 "IP_API_DSCP_AF22": 20,
348                 "IP_API_DSCP_AF23": 22,
349                 "IP_API_DSCP_CS3":  24,
350                 "IP_API_DSCP_AF31": 26,
351                 "IP_API_DSCP_AF32": 28,
352                 "IP_API_DSCP_AF33": 30,
353                 "IP_API_DSCP_CS4":  32,
354                 "IP_API_DSCP_AF41": 34,
355                 "IP_API_DSCP_AF42": 36,
356                 "IP_API_DSCP_AF43": 38,
357                 "IP_API_DSCP_CS5":  40,
358                 "IP_API_DSCP_EF":   46,
359                 "IP_API_DSCP_CS6":  48,
360                 "IP_API_DSCP_CS7":  50,
361         }
362 )
363
364 func (x IPDscp) String() string {
365         s, ok := IPDscp_name[uint8(x)]
366         if ok {
367                 return s
368         }
369         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
370 }
371
372 // IPEcn defines enum 'ip_ecn'.
373 type IPEcn uint8
374
375 const (
376         IP_API_ECN_NONE IPEcn = 0
377         IP_API_ECN_ECT0 IPEcn = 1
378         IP_API_ECN_ECT1 IPEcn = 2
379         IP_API_ECN_CE   IPEcn = 3
380 )
381
382 var (
383         IPEcn_name = map[uint8]string{
384                 0: "IP_API_ECN_NONE",
385                 1: "IP_API_ECN_ECT0",
386                 2: "IP_API_ECN_ECT1",
387                 3: "IP_API_ECN_CE",
388         }
389         IPEcn_value = map[string]uint8{
390                 "IP_API_ECN_NONE": 0,
391                 "IP_API_ECN_ECT0": 1,
392                 "IP_API_ECN_ECT1": 2,
393                 "IP_API_ECN_CE":   3,
394         }
395 )
396
397 func (x IPEcn) String() string {
398         s, ok := IPEcn_name[uint8(x)]
399         if ok {
400                 return s
401         }
402         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
403 }
404
405 // IPProto defines enum 'ip_proto'.
406 type IPProto uint32
407
408 const (
409         IP_API_PROTO_HOPOPT   IPProto = 0
410         IP_API_PROTO_ICMP     IPProto = 1
411         IP_API_PROTO_IGMP     IPProto = 2
412         IP_API_PROTO_TCP      IPProto = 6
413         IP_API_PROTO_UDP      IPProto = 17
414         IP_API_PROTO_GRE      IPProto = 47
415         IP_API_PROTO_AH       IPProto = 50
416         IP_API_PROTO_ESP      IPProto = 51
417         IP_API_PROTO_EIGRP    IPProto = 88
418         IP_API_PROTO_OSPF     IPProto = 89
419         IP_API_PROTO_SCTP     IPProto = 132
420         IP_API_PROTO_RESERVED IPProto = 255
421 )
422
423 var (
424         IPProto_name = map[uint32]string{
425                 0:   "IP_API_PROTO_HOPOPT",
426                 1:   "IP_API_PROTO_ICMP",
427                 2:   "IP_API_PROTO_IGMP",
428                 6:   "IP_API_PROTO_TCP",
429                 17:  "IP_API_PROTO_UDP",
430                 47:  "IP_API_PROTO_GRE",
431                 50:  "IP_API_PROTO_AH",
432                 51:  "IP_API_PROTO_ESP",
433                 88:  "IP_API_PROTO_EIGRP",
434                 89:  "IP_API_PROTO_OSPF",
435                 132: "IP_API_PROTO_SCTP",
436                 255: "IP_API_PROTO_RESERVED",
437         }
438         IPProto_value = map[string]uint32{
439                 "IP_API_PROTO_HOPOPT":   0,
440                 "IP_API_PROTO_ICMP":     1,
441                 "IP_API_PROTO_IGMP":     2,
442                 "IP_API_PROTO_TCP":      6,
443                 "IP_API_PROTO_UDP":      17,
444                 "IP_API_PROTO_GRE":      47,
445                 "IP_API_PROTO_AH":       50,
446                 "IP_API_PROTO_ESP":      51,
447                 "IP_API_PROTO_EIGRP":    88,
448                 "IP_API_PROTO_OSPF":     89,
449                 "IP_API_PROTO_SCTP":     132,
450                 "IP_API_PROTO_RESERVED": 255,
451         }
452 )
453
454 func (x IPProto) String() string {
455         s, ok := IPProto_name[uint32(x)]
456         if ok {
457                 return s
458         }
459         return "IPProto(" + strconv.Itoa(int(x)) + ")"
460 }
461
462 // LinkDuplex defines enum 'link_duplex'.
463 type LinkDuplex uint32
464
465 const (
466         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
467         LINK_DUPLEX_API_HALF    LinkDuplex = 1
468         LINK_DUPLEX_API_FULL    LinkDuplex = 2
469 )
470
471 var (
472         LinkDuplex_name = map[uint32]string{
473                 0: "LINK_DUPLEX_API_UNKNOWN",
474                 1: "LINK_DUPLEX_API_HALF",
475                 2: "LINK_DUPLEX_API_FULL",
476         }
477         LinkDuplex_value = map[string]uint32{
478                 "LINK_DUPLEX_API_UNKNOWN": 0,
479                 "LINK_DUPLEX_API_HALF":    1,
480                 "LINK_DUPLEX_API_FULL":    2,
481         }
482 )
483
484 func (x LinkDuplex) String() string {
485         s, ok := LinkDuplex_name[uint32(x)]
486         if ok {
487                 return s
488         }
489         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
490 }
491
492 // MtuProto defines enum 'mtu_proto'.
493 type MtuProto uint32
494
495 const (
496         MTU_PROTO_API_L3   MtuProto = 1
497         MTU_PROTO_API_IP4  MtuProto = 2
498         MTU_PROTO_API_IP6  MtuProto = 3
499         MTU_PROTO_API_MPLS MtuProto = 4
500         MTU_PROTO_API_N    MtuProto = 5
501 )
502
503 var (
504         MtuProto_name = map[uint32]string{
505                 1: "MTU_PROTO_API_L3",
506                 2: "MTU_PROTO_API_IP4",
507                 3: "MTU_PROTO_API_IP6",
508                 4: "MTU_PROTO_API_MPLS",
509                 5: "MTU_PROTO_API_N",
510         }
511         MtuProto_value = map[string]uint32{
512                 "MTU_PROTO_API_L3":   1,
513                 "MTU_PROTO_API_IP4":  2,
514                 "MTU_PROTO_API_IP6":  3,
515                 "MTU_PROTO_API_MPLS": 4,
516                 "MTU_PROTO_API_N":    5,
517         }
518 )
519
520 func (x MtuProto) String() string {
521         s, ok := MtuProto_name[uint32(x)]
522         if ok {
523                 return s
524         }
525         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
526 }
527
528 // RxMode defines enum 'rx_mode'.
529 type RxMode uint32
530
531 const (
532         RX_MODE_API_UNKNOWN   RxMode = 0
533         RX_MODE_API_POLLING   RxMode = 1
534         RX_MODE_API_INTERRUPT RxMode = 2
535         RX_MODE_API_ADAPTIVE  RxMode = 3
536         RX_MODE_API_DEFAULT   RxMode = 4
537 )
538
539 var (
540         RxMode_name = map[uint32]string{
541                 0: "RX_MODE_API_UNKNOWN",
542                 1: "RX_MODE_API_POLLING",
543                 2: "RX_MODE_API_INTERRUPT",
544                 3: "RX_MODE_API_ADAPTIVE",
545                 4: "RX_MODE_API_DEFAULT",
546         }
547         RxMode_value = map[string]uint32{
548                 "RX_MODE_API_UNKNOWN":   0,
549                 "RX_MODE_API_POLLING":   1,
550                 "RX_MODE_API_INTERRUPT": 2,
551                 "RX_MODE_API_ADAPTIVE":  3,
552                 "RX_MODE_API_DEFAULT":   4,
553         }
554 )
555
556 func (x RxMode) String() string {
557         s, ok := RxMode_name[uint32(x)]
558         if ok {
559                 return s
560         }
561         return "RxMode(" + strconv.Itoa(int(x)) + ")"
562 }
563
564 // SubIfFlags defines enum 'sub_if_flags'.
565 type SubIfFlags uint32
566
567 const (
568         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
569         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
570         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
571         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
572         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
573         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
574         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
575         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
576         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
577         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
578 )
579
580 var (
581         SubIfFlags_name = map[uint32]string{
582                 1:   "SUB_IF_API_FLAG_NO_TAGS",
583                 2:   "SUB_IF_API_FLAG_ONE_TAG",
584                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
585                 8:   "SUB_IF_API_FLAG_DOT1AD",
586                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
587                 32:  "SUB_IF_API_FLAG_DEFAULT",
588                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
589                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
590                 254: "SUB_IF_API_FLAG_MASK_VNET",
591                 256: "SUB_IF_API_FLAG_DOT1AH",
592         }
593         SubIfFlags_value = map[string]uint32{
594                 "SUB_IF_API_FLAG_NO_TAGS":           1,
595                 "SUB_IF_API_FLAG_ONE_TAG":           2,
596                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
597                 "SUB_IF_API_FLAG_DOT1AD":            8,
598                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
599                 "SUB_IF_API_FLAG_DEFAULT":           32,
600                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
601                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
602                 "SUB_IF_API_FLAG_MASK_VNET":         254,
603                 "SUB_IF_API_FLAG_DOT1AH":            256,
604         }
605 )
606
607 func (x SubIfFlags) String() string {
608         s, ok := SubIfFlags_name[uint32(x)]
609         if ok {
610                 return s
611         }
612         str := func(n uint32) string {
613                 s, ok := SubIfFlags_name[uint32(n)]
614                 if ok {
615                         return s
616                 }
617                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
618         }
619         for i := uint32(0); i <= 32; i++ {
620                 val := uint32(x)
621                 if val&(1<<i) != 0 {
622                         if s != "" {
623                                 s += "|"
624                         }
625                         s += str(1 << i)
626                 }
627         }
628         if s == "" {
629                 return str(uint32(x))
630         }
631         return s
632 }
633
634 // AddressWithPrefix defines alias 'address_with_prefix'.
635 type AddressWithPrefix Prefix
636
637 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
638         prefix, err := ParsePrefix(s)
639         if err != nil {
640                 return AddressWithPrefix{}, err
641         }
642         return AddressWithPrefix(prefix), nil
643 }
644
645 func (x AddressWithPrefix) String() string {
646         return Prefix(x).String()
647 }
648
649 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
650         return []byte(x.String()), nil
651 }
652
653 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
654         prefix, err := ParseAddressWithPrefix(string(text))
655         if err != nil {
656                 return err
657         }
658         *x = prefix
659         return nil
660 }
661
662 // InterfaceIndex defines alias 'interface_index'.
663 type InterfaceIndex uint32
664
665 // IP4Address defines alias 'ip4_address'.
666 type IP4Address [4]uint8
667
668 func ParseIP4Address(s string) (IP4Address, error) {
669         ip := net.ParseIP(s).To4()
670         if ip == nil {
671                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
672         }
673         var ipaddr IP4Address
674         copy(ipaddr[:], ip.To4())
675         return ipaddr, nil
676 }
677
678 func (x IP4Address) ToIP() net.IP {
679         return net.IP(x[:]).To4()
680 }
681
682 func (x IP4Address) String() string {
683         return x.ToIP().String()
684 }
685
686 func (x *IP4Address) MarshalText() ([]byte, error) {
687         return []byte(x.String()), nil
688 }
689
690 func (x *IP4Address) UnmarshalText(text []byte) error {
691         ipaddr, err := ParseIP4Address(string(text))
692         if err != nil {
693                 return err
694         }
695         *x = ipaddr
696         return nil
697 }
698
699 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
700 type IP4AddressWithPrefix IP4Prefix
701
702 // IP6Address defines alias 'ip6_address'.
703 type IP6Address [16]uint8
704
705 func ParseIP6Address(s string) (IP6Address, error) {
706         ip := net.ParseIP(s).To16()
707         if ip == nil {
708                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
709         }
710         var ipaddr IP6Address
711         copy(ipaddr[:], ip.To16())
712         return ipaddr, nil
713 }
714
715 func (x IP6Address) ToIP() net.IP {
716         return net.IP(x[:]).To16()
717 }
718
719 func (x IP6Address) String() string {
720         return x.ToIP().String()
721 }
722
723 func (x *IP6Address) MarshalText() ([]byte, error) {
724         return []byte(x.String()), nil
725 }
726
727 func (x *IP6Address) UnmarshalText(text []byte) error {
728         ipaddr, err := ParseIP6Address(string(text))
729         if err != nil {
730                 return err
731         }
732         *x = ipaddr
733         return nil
734 }
735
736 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
737 type IP6AddressWithPrefix IP6Prefix
738
739 // Address defines type 'address'.
740 type Address struct {
741         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
742         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
743 }
744
745 func ParseAddress(s string) (Address, error) {
746         ip := net.ParseIP(s)
747         if ip == nil {
748                 return Address{}, fmt.Errorf("invalid address: %s", s)
749         }
750         return AddressFromIP(ip), nil
751 }
752
753 func AddressFromIP(ip net.IP) Address {
754         var addr Address
755         if ip.To4() == nil {
756                 addr.Af = ADDRESS_IP6
757                 var ip6 IP6Address
758                 copy(ip6[:], ip.To16())
759                 addr.Un.SetIP6(ip6)
760         } else {
761                 addr.Af = ADDRESS_IP4
762                 var ip4 IP4Address
763                 copy(ip4[:], ip.To4())
764                 addr.Un.SetIP4(ip4)
765         }
766         return addr
767 }
768
769 func (x Address) ToIP() net.IP {
770         if x.Af == ADDRESS_IP6 {
771                 ip6 := x.Un.GetIP6()
772                 return net.IP(ip6[:]).To16()
773         } else {
774                 ip4 := x.Un.GetIP4()
775                 return net.IP(ip4[:]).To4()
776         }
777 }
778
779 func (x Address) String() string {
780         return x.ToIP().String()
781 }
782
783 func (x *Address) MarshalText() ([]byte, error) {
784         return []byte(x.String()), nil
785 }
786
787 func (x *Address) UnmarshalText(text []byte) error {
788         addr, err := ParseAddress(string(text))
789         if err != nil {
790                 return err
791         }
792         *x = addr
793         return nil
794 }
795
796 // FibMplsLabel defines type 'fib_mpls_label'.
797 type FibMplsLabel struct {
798         IsUniform uint8  `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
799         Label     uint32 `binapi:"u32,name=label" json:"label,omitempty"`
800         TTL       uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
801         Exp       uint8  `binapi:"u8,name=exp" json:"exp,omitempty"`
802 }
803
804 // FibPath defines type 'fib_path'.
805 type FibPath struct {
806         SwIfIndex  uint32           `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
807         TableID    uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
808         RpfID      uint32           `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
809         Weight     uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
810         Preference uint8            `binapi:"u8,name=preference" json:"preference,omitempty"`
811         Type       FibPathType      `binapi:"fib_path_type,name=type" json:"type,omitempty"`
812         Flags      FibPathFlags     `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
813         Proto      FibPathNhProto   `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
814         Nh         FibPathNh        `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
815         NLabels    uint8            `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
816         LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
817 }
818
819 // FibPathNh defines type 'fib_path_nh'.
820 type FibPathNh struct {
821         Address            AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
822         ViaLabel           uint32       `binapi:"u32,name=via_label" json:"via_label,omitempty"`
823         ObjID              uint32       `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
824         ClassifyTableIndex uint32       `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
825 }
826
827 // IP4Prefix defines type 'ip4_prefix'.
828 type IP4Prefix struct {
829         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
830         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
831 }
832
833 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
834         hasPrefix := strings.Contains(s, "/")
835         if hasPrefix {
836                 ip, network, err := net.ParseCIDR(s)
837                 if err != nil {
838                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
839                 }
840                 maskSize, _ := network.Mask.Size()
841                 prefix.Len = byte(maskSize)
842                 prefix.Address, err = ParseIP4Address(ip.String())
843                 if err != nil {
844                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
845                 }
846         } else {
847                 ip := net.ParseIP(s)
848                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
849                 if ip.To4() == nil {
850                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
851                 }
852                 prefix.Len = byte(defaultMaskSize)
853                 prefix.Address, err = ParseIP4Address(ip.String())
854                 if err != nil {
855                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
856                 }
857         }
858         return prefix, nil
859 }
860
861 func (x IP4Prefix) ToIPNet() *net.IPNet {
862         mask := net.CIDRMask(int(x.Len), 32)
863         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
864         return ipnet
865 }
866
867 func (x IP4Prefix) String() string {
868         ip := x.Address.String()
869         return ip + "/" + strconv.Itoa(int(x.Len))
870 }
871
872 func (x *IP4Prefix) MarshalText() ([]byte, error) {
873         return []byte(x.String()), nil
874 }
875
876 func (x *IP4Prefix) UnmarshalText(text []byte) error {
877         prefix, err := ParseIP4Prefix(string(text))
878         if err != nil {
879                 return err
880         }
881         *x = prefix
882         return nil
883 }
884
885 // IP6Prefix defines type 'ip6_prefix'.
886 type IP6Prefix struct {
887         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
888         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
889 }
890
891 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
892         hasPrefix := strings.Contains(s, "/")
893         if hasPrefix {
894                 ip, network, err := net.ParseCIDR(s)
895                 if err != nil {
896                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
897                 }
898                 maskSize, _ := network.Mask.Size()
899                 prefix.Len = byte(maskSize)
900                 prefix.Address, err = ParseIP6Address(ip.String())
901                 if err != nil {
902                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
903                 }
904         } else {
905                 ip := net.ParseIP(s)
906                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
907                 if ip.To4() == nil {
908                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
909                 }
910                 prefix.Len = byte(defaultMaskSize)
911                 prefix.Address, err = ParseIP6Address(ip.String())
912                 if err != nil {
913                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
914                 }
915         }
916         return prefix, nil
917 }
918
919 func (x IP6Prefix) ToIPNet() *net.IPNet {
920         mask := net.CIDRMask(int(x.Len), 128)
921         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
922         return ipnet
923 }
924
925 func (x IP6Prefix) String() string {
926         ip := x.Address.String()
927         return ip + "/" + strconv.Itoa(int(x.Len))
928 }
929
930 func (x *IP6Prefix) MarshalText() ([]byte, error) {
931         return []byte(x.String()), nil
932 }
933
934 func (x *IP6Prefix) UnmarshalText(text []byte) error {
935         prefix, err := ParseIP6Prefix(string(text))
936         if err != nil {
937                 return err
938         }
939         *x = prefix
940         return nil
941 }
942
943 // MplsRoute defines type 'mpls_route'.
944 type MplsRoute struct {
945         MrTableID     uint32    `binapi:"u32,name=mr_table_id" json:"mr_table_id,omitempty"`
946         MrLabel       uint32    `binapi:"u32,name=mr_label" json:"mr_label,omitempty"`
947         MrEos         uint8     `binapi:"u8,name=mr_eos" json:"mr_eos,omitempty"`
948         MrEosProto    uint8     `binapi:"u8,name=mr_eos_proto" json:"mr_eos_proto,omitempty"`
949         MrIsMulticast bool      `binapi:"bool,name=mr_is_multicast" json:"mr_is_multicast,omitempty"`
950         MrNPaths      uint8     `binapi:"u8,name=mr_n_paths" json:"-"`
951         MrPaths       []FibPath `binapi:"fib_path[mr_n_paths],name=mr_paths" json:"mr_paths,omitempty"`
952 }
953
954 // MplsTable defines type 'mpls_table'.
955 type MplsTable struct {
956         MtTableID uint32 `binapi:"u32,name=mt_table_id" json:"mt_table_id,omitempty"`
957         MtName    string `binapi:"string[64],name=mt_name" json:"mt_name,omitempty"`
958 }
959
960 // MplsTunnel defines type 'mpls_tunnel'.
961 type MplsTunnel struct {
962         MtSwIfIndex   InterfaceIndex `binapi:"interface_index,name=mt_sw_if_index" json:"mt_sw_if_index,omitempty"`
963         MtTunnelIndex uint32         `binapi:"u32,name=mt_tunnel_index" json:"mt_tunnel_index,omitempty"`
964         MtL2Only      bool           `binapi:"bool,name=mt_l2_only" json:"mt_l2_only,omitempty"`
965         MtIsMulticast bool           `binapi:"bool,name=mt_is_multicast" json:"mt_is_multicast,omitempty"`
966         MtNPaths      uint8          `binapi:"u8,name=mt_n_paths" json:"-"`
967         MtPaths       []FibPath      `binapi:"fib_path[mt_n_paths],name=mt_paths" json:"mt_paths,omitempty"`
968 }
969
970 // Mprefix defines type 'mprefix'.
971 type Mprefix struct {
972         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
973         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
974         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
975         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
976 }
977
978 // Prefix defines type 'prefix'.
979 type Prefix struct {
980         Address Address `binapi:"address,name=address" json:"address,omitempty"`
981         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
982 }
983
984 func ParsePrefix(ip string) (prefix Prefix, err error) {
985         hasPrefix := strings.Contains(ip, "/")
986         if hasPrefix {
987                 netIP, network, err := net.ParseCIDR(ip)
988                 if err != nil {
989                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
990                 }
991                 maskSize, _ := network.Mask.Size()
992                 prefix.Len = byte(maskSize)
993                 prefix.Address, err = ParseAddress(netIP.String())
994                 if err != nil {
995                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
996                 }
997         } else {
998                 netIP := net.ParseIP(ip)
999                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
1000                 if netIP.To4() == nil {
1001                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
1002                 }
1003                 prefix.Len = byte(defaultMaskSize)
1004                 prefix.Address, err = ParseAddress(netIP.String())
1005                 if err != nil {
1006                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
1007                 }
1008         }
1009         return prefix, nil
1010 }
1011
1012 func (x Prefix) ToIPNet() *net.IPNet {
1013         var mask net.IPMask
1014         if x.Address.Af == ADDRESS_IP4 {
1015                 mask = net.CIDRMask(int(x.Len), 32)
1016         } else {
1017                 mask = net.CIDRMask(int(x.Len), 128)
1018         }
1019         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1020         return ipnet
1021 }
1022
1023 func (x Prefix) String() string {
1024         ip := x.Address.String()
1025         return ip + "/" + strconv.Itoa(int(x.Len))
1026 }
1027
1028 func (x *Prefix) MarshalText() ([]byte, error) {
1029         return []byte(x.String()), nil
1030 }
1031
1032 func (x *Prefix) UnmarshalText(text []byte) error {
1033         prefix, err := ParsePrefix(string(text))
1034         if err != nil {
1035                 return err
1036         }
1037         *x = prefix
1038         return nil
1039 }
1040
1041 // PrefixMatcher defines type 'prefix_matcher'.
1042 type PrefixMatcher struct {
1043         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1044         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1045 }
1046
1047 // AddressUnion defines union 'address_union'.
1048 type AddressUnion struct {
1049         // AddressUnion can be one of:
1050         // - IP4 *IP4Address
1051         // - IP6 *IP6Address
1052         XXX_UnionData [16]byte
1053 }
1054
1055 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1056         u.SetIP4(a)
1057         return
1058 }
1059 func (u *AddressUnion) SetIP4(a IP4Address) {
1060         buf := codec.NewBuffer(u.XXX_UnionData[:])
1061         buf.EncodeBytes(a[:], 4)
1062 }
1063 func (u *AddressUnion) GetIP4() (a IP4Address) {
1064         buf := codec.NewBuffer(u.XXX_UnionData[:])
1065         copy(a[:], buf.DecodeBytes(4))
1066         return
1067 }
1068
1069 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1070         u.SetIP6(a)
1071         return
1072 }
1073 func (u *AddressUnion) SetIP6(a IP6Address) {
1074         buf := codec.NewBuffer(u.XXX_UnionData[:])
1075         buf.EncodeBytes(a[:], 16)
1076 }
1077 func (u *AddressUnion) GetIP6() (a IP6Address) {
1078         buf := codec.NewBuffer(u.XXX_UnionData[:])
1079         copy(a[:], buf.DecodeBytes(16))
1080         return
1081 }
1082
1083 // MplsIPBindUnbind defines message 'mpls_ip_bind_unbind'.
1084 type MplsIPBindUnbind struct {
1085         MbMplsTableID uint32 `binapi:"u32,name=mb_mpls_table_id" json:"mb_mpls_table_id,omitempty"`
1086         MbLabel       uint32 `binapi:"u32,name=mb_label" json:"mb_label,omitempty"`
1087         MbIPTableID   uint32 `binapi:"u32,name=mb_ip_table_id" json:"mb_ip_table_id,omitempty"`
1088         MbIsBind      bool   `binapi:"bool,name=mb_is_bind" json:"mb_is_bind,omitempty"`
1089         MbPrefix      Prefix `binapi:"prefix,name=mb_prefix" json:"mb_prefix,omitempty"`
1090 }
1091
1092 func (m *MplsIPBindUnbind) Reset()               { *m = MplsIPBindUnbind{} }
1093 func (*MplsIPBindUnbind) GetMessageName() string { return "mpls_ip_bind_unbind" }
1094 func (*MplsIPBindUnbind) GetCrcString() string   { return "48249a27" }
1095 func (*MplsIPBindUnbind) GetMessageType() api.MessageType {
1096         return api.RequestMessage
1097 }
1098
1099 func (m *MplsIPBindUnbind) Size() (size int) {
1100         if m == nil {
1101                 return 0
1102         }
1103         size += 4      // m.MbMplsTableID
1104         size += 4      // m.MbLabel
1105         size += 4      // m.MbIPTableID
1106         size += 1      // m.MbIsBind
1107         size += 4      // m.MbPrefix.Address.Af
1108         size += 1 * 16 // m.MbPrefix.Address.Un
1109         size += 1      // m.MbPrefix.Len
1110         return size
1111 }
1112 func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) {
1113         if b == nil {
1114                 b = make([]byte, m.Size())
1115         }
1116         buf := codec.NewBuffer(b)
1117         buf.EncodeUint32(m.MbMplsTableID)
1118         buf.EncodeUint32(m.MbLabel)
1119         buf.EncodeUint32(m.MbIPTableID)
1120         buf.EncodeBool(m.MbIsBind)
1121         buf.EncodeUint32(uint32(m.MbPrefix.Address.Af))
1122         buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 16)
1123         buf.EncodeUint8(m.MbPrefix.Len)
1124         return buf.Bytes(), nil
1125 }
1126 func (m *MplsIPBindUnbind) Unmarshal(b []byte) error {
1127         buf := codec.NewBuffer(b)
1128         m.MbMplsTableID = buf.DecodeUint32()
1129         m.MbLabel = buf.DecodeUint32()
1130         m.MbIPTableID = buf.DecodeUint32()
1131         m.MbIsBind = buf.DecodeBool()
1132         m.MbPrefix.Address.Af = AddressFamily(buf.DecodeUint32())
1133         copy(m.MbPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1134         m.MbPrefix.Len = buf.DecodeUint8()
1135         return nil
1136 }
1137
1138 // MplsIPBindUnbindReply defines message 'mpls_ip_bind_unbind_reply'.
1139 type MplsIPBindUnbindReply struct {
1140         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1141 }
1142
1143 func (m *MplsIPBindUnbindReply) Reset()               { *m = MplsIPBindUnbindReply{} }
1144 func (*MplsIPBindUnbindReply) GetMessageName() string { return "mpls_ip_bind_unbind_reply" }
1145 func (*MplsIPBindUnbindReply) GetCrcString() string   { return "e8d4e804" }
1146 func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType {
1147         return api.ReplyMessage
1148 }
1149
1150 func (m *MplsIPBindUnbindReply) Size() (size int) {
1151         if m == nil {
1152                 return 0
1153         }
1154         size += 4 // m.Retval
1155         return size
1156 }
1157 func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) {
1158         if b == nil {
1159                 b = make([]byte, m.Size())
1160         }
1161         buf := codec.NewBuffer(b)
1162         buf.EncodeInt32(m.Retval)
1163         return buf.Bytes(), nil
1164 }
1165 func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error {
1166         buf := codec.NewBuffer(b)
1167         m.Retval = buf.DecodeInt32()
1168         return nil
1169 }
1170
1171 // MplsRouteAddDel defines message 'mpls_route_add_del'.
1172 type MplsRouteAddDel struct {
1173         MrIsAdd       bool      `binapi:"bool,name=mr_is_add" json:"mr_is_add,omitempty"`
1174         MrIsMultipath bool      `binapi:"bool,name=mr_is_multipath" json:"mr_is_multipath,omitempty"`
1175         MrRoute       MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1176 }
1177
1178 func (m *MplsRouteAddDel) Reset()               { *m = MplsRouteAddDel{} }
1179 func (*MplsRouteAddDel) GetMessageName() string { return "mpls_route_add_del" }
1180 func (*MplsRouteAddDel) GetCrcString() string   { return "343cff54" }
1181 func (*MplsRouteAddDel) GetMessageType() api.MessageType {
1182         return api.RequestMessage
1183 }
1184
1185 func (m *MplsRouteAddDel) Size() (size int) {
1186         if m == nil {
1187                 return 0
1188         }
1189         size += 1 // m.MrIsAdd
1190         size += 1 // m.MrIsMultipath
1191         size += 4 // m.MrRoute.MrTableID
1192         size += 4 // m.MrRoute.MrLabel
1193         size += 1 // m.MrRoute.MrEos
1194         size += 1 // m.MrRoute.MrEosProto
1195         size += 1 // m.MrRoute.MrIsMulticast
1196         size += 1 // m.MrRoute.MrNPaths
1197         for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1198                 var s2 FibPath
1199                 _ = s2
1200                 if j2 < len(m.MrRoute.MrPaths) {
1201                         s2 = m.MrRoute.MrPaths[j2]
1202                 }
1203                 size += 4      // s2.SwIfIndex
1204                 size += 4      // s2.TableID
1205                 size += 4      // s2.RpfID
1206                 size += 1      // s2.Weight
1207                 size += 1      // s2.Preference
1208                 size += 4      // s2.Type
1209                 size += 4      // s2.Flags
1210                 size += 4      // s2.Proto
1211                 size += 1 * 16 // s2.Nh.Address
1212                 size += 4      // s2.Nh.ViaLabel
1213                 size += 4      // s2.Nh.ObjID
1214                 size += 4      // s2.Nh.ClassifyTableIndex
1215                 size += 1      // s2.NLabels
1216                 for j3 := 0; j3 < 16; j3++ {
1217                         size += 1 // s2.LabelStack[j3].IsUniform
1218                         size += 4 // s2.LabelStack[j3].Label
1219                         size += 1 // s2.LabelStack[j3].TTL
1220                         size += 1 // s2.LabelStack[j3].Exp
1221                 }
1222         }
1223         return size
1224 }
1225 func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) {
1226         if b == nil {
1227                 b = make([]byte, m.Size())
1228         }
1229         buf := codec.NewBuffer(b)
1230         buf.EncodeBool(m.MrIsAdd)
1231         buf.EncodeBool(m.MrIsMultipath)
1232         buf.EncodeUint32(m.MrRoute.MrTableID)
1233         buf.EncodeUint32(m.MrRoute.MrLabel)
1234         buf.EncodeUint8(m.MrRoute.MrEos)
1235         buf.EncodeUint8(m.MrRoute.MrEosProto)
1236         buf.EncodeBool(m.MrRoute.MrIsMulticast)
1237         buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1238         for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1239                 var v1 FibPath // MrPaths
1240                 if j1 < len(m.MrRoute.MrPaths) {
1241                         v1 = m.MrRoute.MrPaths[j1]
1242                 }
1243                 buf.EncodeUint32(v1.SwIfIndex)
1244                 buf.EncodeUint32(v1.TableID)
1245                 buf.EncodeUint32(v1.RpfID)
1246                 buf.EncodeUint8(v1.Weight)
1247                 buf.EncodeUint8(v1.Preference)
1248                 buf.EncodeUint32(uint32(v1.Type))
1249                 buf.EncodeUint32(uint32(v1.Flags))
1250                 buf.EncodeUint32(uint32(v1.Proto))
1251                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1252                 buf.EncodeUint32(v1.Nh.ViaLabel)
1253                 buf.EncodeUint32(v1.Nh.ObjID)
1254                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1255                 buf.EncodeUint8(v1.NLabels)
1256                 for j2 := 0; j2 < 16; j2++ {
1257                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1258                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1259                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1260                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1261                 }
1262         }
1263         return buf.Bytes(), nil
1264 }
1265 func (m *MplsRouteAddDel) Unmarshal(b []byte) error {
1266         buf := codec.NewBuffer(b)
1267         m.MrIsAdd = buf.DecodeBool()
1268         m.MrIsMultipath = buf.DecodeBool()
1269         m.MrRoute.MrTableID = buf.DecodeUint32()
1270         m.MrRoute.MrLabel = buf.DecodeUint32()
1271         m.MrRoute.MrEos = buf.DecodeUint8()
1272         m.MrRoute.MrEosProto = buf.DecodeUint8()
1273         m.MrRoute.MrIsMulticast = buf.DecodeBool()
1274         m.MrRoute.MrNPaths = buf.DecodeUint8()
1275         m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1276         for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1277                 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1278                 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1279                 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1280                 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1281                 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1282                 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1283                 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1284                 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1285                 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1286                 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1287                 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1288                 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1289                 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1290                 for j2 := 0; j2 < 16; j2++ {
1291                         m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1292                         m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1293                         m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1294                         m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1295                 }
1296         }
1297         return nil
1298 }
1299
1300 // MplsRouteAddDelReply defines message 'mpls_route_add_del_reply'.
1301 type MplsRouteAddDelReply struct {
1302         Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
1303         StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"`
1304 }
1305
1306 func (m *MplsRouteAddDelReply) Reset()               { *m = MplsRouteAddDelReply{} }
1307 func (*MplsRouteAddDelReply) GetMessageName() string { return "mpls_route_add_del_reply" }
1308 func (*MplsRouteAddDelReply) GetCrcString() string   { return "1992deab" }
1309 func (*MplsRouteAddDelReply) GetMessageType() api.MessageType {
1310         return api.ReplyMessage
1311 }
1312
1313 func (m *MplsRouteAddDelReply) Size() (size int) {
1314         if m == nil {
1315                 return 0
1316         }
1317         size += 4 // m.Retval
1318         size += 4 // m.StatsIndex
1319         return size
1320 }
1321 func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
1322         if b == nil {
1323                 b = make([]byte, m.Size())
1324         }
1325         buf := codec.NewBuffer(b)
1326         buf.EncodeInt32(m.Retval)
1327         buf.EncodeUint32(m.StatsIndex)
1328         return buf.Bytes(), nil
1329 }
1330 func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error {
1331         buf := codec.NewBuffer(b)
1332         m.Retval = buf.DecodeInt32()
1333         m.StatsIndex = buf.DecodeUint32()
1334         return nil
1335 }
1336
1337 // MplsRouteDetails defines message 'mpls_route_details'.
1338 type MplsRouteDetails struct {
1339         MrRoute MplsRoute `binapi:"mpls_route,name=mr_route" json:"mr_route,omitempty"`
1340 }
1341
1342 func (m *MplsRouteDetails) Reset()               { *m = MplsRouteDetails{} }
1343 func (*MplsRouteDetails) GetMessageName() string { return "mpls_route_details" }
1344 func (*MplsRouteDetails) GetCrcString() string   { return "d0ac384c" }
1345 func (*MplsRouteDetails) GetMessageType() api.MessageType {
1346         return api.ReplyMessage
1347 }
1348
1349 func (m *MplsRouteDetails) Size() (size int) {
1350         if m == nil {
1351                 return 0
1352         }
1353         size += 4 // m.MrRoute.MrTableID
1354         size += 4 // m.MrRoute.MrLabel
1355         size += 1 // m.MrRoute.MrEos
1356         size += 1 // m.MrRoute.MrEosProto
1357         size += 1 // m.MrRoute.MrIsMulticast
1358         size += 1 // m.MrRoute.MrNPaths
1359         for j2 := 0; j2 < len(m.MrRoute.MrPaths); j2++ {
1360                 var s2 FibPath
1361                 _ = s2
1362                 if j2 < len(m.MrRoute.MrPaths) {
1363                         s2 = m.MrRoute.MrPaths[j2]
1364                 }
1365                 size += 4      // s2.SwIfIndex
1366                 size += 4      // s2.TableID
1367                 size += 4      // s2.RpfID
1368                 size += 1      // s2.Weight
1369                 size += 1      // s2.Preference
1370                 size += 4      // s2.Type
1371                 size += 4      // s2.Flags
1372                 size += 4      // s2.Proto
1373                 size += 1 * 16 // s2.Nh.Address
1374                 size += 4      // s2.Nh.ViaLabel
1375                 size += 4      // s2.Nh.ObjID
1376                 size += 4      // s2.Nh.ClassifyTableIndex
1377                 size += 1      // s2.NLabels
1378                 for j3 := 0; j3 < 16; j3++ {
1379                         size += 1 // s2.LabelStack[j3].IsUniform
1380                         size += 4 // s2.LabelStack[j3].Label
1381                         size += 1 // s2.LabelStack[j3].TTL
1382                         size += 1 // s2.LabelStack[j3].Exp
1383                 }
1384         }
1385         return size
1386 }
1387 func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) {
1388         if b == nil {
1389                 b = make([]byte, m.Size())
1390         }
1391         buf := codec.NewBuffer(b)
1392         buf.EncodeUint32(m.MrRoute.MrTableID)
1393         buf.EncodeUint32(m.MrRoute.MrLabel)
1394         buf.EncodeUint8(m.MrRoute.MrEos)
1395         buf.EncodeUint8(m.MrRoute.MrEosProto)
1396         buf.EncodeBool(m.MrRoute.MrIsMulticast)
1397         buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
1398         for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1399                 var v1 FibPath // MrPaths
1400                 if j1 < len(m.MrRoute.MrPaths) {
1401                         v1 = m.MrRoute.MrPaths[j1]
1402                 }
1403                 buf.EncodeUint32(v1.SwIfIndex)
1404                 buf.EncodeUint32(v1.TableID)
1405                 buf.EncodeUint32(v1.RpfID)
1406                 buf.EncodeUint8(v1.Weight)
1407                 buf.EncodeUint8(v1.Preference)
1408                 buf.EncodeUint32(uint32(v1.Type))
1409                 buf.EncodeUint32(uint32(v1.Flags))
1410                 buf.EncodeUint32(uint32(v1.Proto))
1411                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1412                 buf.EncodeUint32(v1.Nh.ViaLabel)
1413                 buf.EncodeUint32(v1.Nh.ObjID)
1414                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1415                 buf.EncodeUint8(v1.NLabels)
1416                 for j2 := 0; j2 < 16; j2++ {
1417                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1418                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1419                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1420                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1421                 }
1422         }
1423         return buf.Bytes(), nil
1424 }
1425 func (m *MplsRouteDetails) Unmarshal(b []byte) error {
1426         buf := codec.NewBuffer(b)
1427         m.MrRoute.MrTableID = buf.DecodeUint32()
1428         m.MrRoute.MrLabel = buf.DecodeUint32()
1429         m.MrRoute.MrEos = buf.DecodeUint8()
1430         m.MrRoute.MrEosProto = buf.DecodeUint8()
1431         m.MrRoute.MrIsMulticast = buf.DecodeBool()
1432         m.MrRoute.MrNPaths = buf.DecodeUint8()
1433         m.MrRoute.MrPaths = make([]FibPath, m.MrRoute.MrNPaths)
1434         for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
1435                 m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
1436                 m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
1437                 m.MrRoute.MrPaths[j1].RpfID = buf.DecodeUint32()
1438                 m.MrRoute.MrPaths[j1].Weight = buf.DecodeUint8()
1439                 m.MrRoute.MrPaths[j1].Preference = buf.DecodeUint8()
1440                 m.MrRoute.MrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1441                 m.MrRoute.MrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1442                 m.MrRoute.MrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1443                 copy(m.MrRoute.MrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1444                 m.MrRoute.MrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1445                 m.MrRoute.MrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1446                 m.MrRoute.MrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1447                 m.MrRoute.MrPaths[j1].NLabels = buf.DecodeUint8()
1448                 for j2 := 0; j2 < 16; j2++ {
1449                         m.MrRoute.MrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1450                         m.MrRoute.MrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1451                         m.MrRoute.MrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1452                         m.MrRoute.MrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1453                 }
1454         }
1455         return nil
1456 }
1457
1458 // MplsRouteDump defines message 'mpls_route_dump'.
1459 type MplsRouteDump struct {
1460         Table MplsTable `binapi:"mpls_table,name=table" json:"table,omitempty"`
1461 }
1462
1463 func (m *MplsRouteDump) Reset()               { *m = MplsRouteDump{} }
1464 func (*MplsRouteDump) GetMessageName() string { return "mpls_route_dump" }
1465 func (*MplsRouteDump) GetCrcString() string   { return "935fdefa" }
1466 func (*MplsRouteDump) GetMessageType() api.MessageType {
1467         return api.RequestMessage
1468 }
1469
1470 func (m *MplsRouteDump) Size() (size int) {
1471         if m == nil {
1472                 return 0
1473         }
1474         size += 4  // m.Table.MtTableID
1475         size += 64 // m.Table.MtName
1476         return size
1477 }
1478 func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) {
1479         if b == nil {
1480                 b = make([]byte, m.Size())
1481         }
1482         buf := codec.NewBuffer(b)
1483         buf.EncodeUint32(m.Table.MtTableID)
1484         buf.EncodeString(m.Table.MtName, 64)
1485         return buf.Bytes(), nil
1486 }
1487 func (m *MplsRouteDump) Unmarshal(b []byte) error {
1488         buf := codec.NewBuffer(b)
1489         m.Table.MtTableID = buf.DecodeUint32()
1490         m.Table.MtName = buf.DecodeString(64)
1491         return nil
1492 }
1493
1494 // MplsTableAddDel defines message 'mpls_table_add_del'.
1495 type MplsTableAddDel struct {
1496         MtIsAdd bool      `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1497         MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1498 }
1499
1500 func (m *MplsTableAddDel) Reset()               { *m = MplsTableAddDel{} }
1501 func (*MplsTableAddDel) GetMessageName() string { return "mpls_table_add_del" }
1502 func (*MplsTableAddDel) GetCrcString() string   { return "57817512" }
1503 func (*MplsTableAddDel) GetMessageType() api.MessageType {
1504         return api.RequestMessage
1505 }
1506
1507 func (m *MplsTableAddDel) Size() (size int) {
1508         if m == nil {
1509                 return 0
1510         }
1511         size += 1  // m.MtIsAdd
1512         size += 4  // m.MtTable.MtTableID
1513         size += 64 // m.MtTable.MtName
1514         return size
1515 }
1516 func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) {
1517         if b == nil {
1518                 b = make([]byte, m.Size())
1519         }
1520         buf := codec.NewBuffer(b)
1521         buf.EncodeBool(m.MtIsAdd)
1522         buf.EncodeUint32(m.MtTable.MtTableID)
1523         buf.EncodeString(m.MtTable.MtName, 64)
1524         return buf.Bytes(), nil
1525 }
1526 func (m *MplsTableAddDel) Unmarshal(b []byte) error {
1527         buf := codec.NewBuffer(b)
1528         m.MtIsAdd = buf.DecodeBool()
1529         m.MtTable.MtTableID = buf.DecodeUint32()
1530         m.MtTable.MtName = buf.DecodeString(64)
1531         return nil
1532 }
1533
1534 // MplsTableAddDelReply defines message 'mpls_table_add_del_reply'.
1535 type MplsTableAddDelReply struct {
1536         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1537 }
1538
1539 func (m *MplsTableAddDelReply) Reset()               { *m = MplsTableAddDelReply{} }
1540 func (*MplsTableAddDelReply) GetMessageName() string { return "mpls_table_add_del_reply" }
1541 func (*MplsTableAddDelReply) GetCrcString() string   { return "e8d4e804" }
1542 func (*MplsTableAddDelReply) GetMessageType() api.MessageType {
1543         return api.ReplyMessage
1544 }
1545
1546 func (m *MplsTableAddDelReply) Size() (size int) {
1547         if m == nil {
1548                 return 0
1549         }
1550         size += 4 // m.Retval
1551         return size
1552 }
1553 func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1554         if b == nil {
1555                 b = make([]byte, m.Size())
1556         }
1557         buf := codec.NewBuffer(b)
1558         buf.EncodeInt32(m.Retval)
1559         return buf.Bytes(), nil
1560 }
1561 func (m *MplsTableAddDelReply) Unmarshal(b []byte) error {
1562         buf := codec.NewBuffer(b)
1563         m.Retval = buf.DecodeInt32()
1564         return nil
1565 }
1566
1567 // MplsTableDetails defines message 'mpls_table_details'.
1568 type MplsTableDetails struct {
1569         MtTable MplsTable `binapi:"mpls_table,name=mt_table" json:"mt_table,omitempty"`
1570 }
1571
1572 func (m *MplsTableDetails) Reset()               { *m = MplsTableDetails{} }
1573 func (*MplsTableDetails) GetMessageName() string { return "mpls_table_details" }
1574 func (*MplsTableDetails) GetCrcString() string   { return "f03ecdc8" }
1575 func (*MplsTableDetails) GetMessageType() api.MessageType {
1576         return api.ReplyMessage
1577 }
1578
1579 func (m *MplsTableDetails) Size() (size int) {
1580         if m == nil {
1581                 return 0
1582         }
1583         size += 4  // m.MtTable.MtTableID
1584         size += 64 // m.MtTable.MtName
1585         return size
1586 }
1587 func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) {
1588         if b == nil {
1589                 b = make([]byte, m.Size())
1590         }
1591         buf := codec.NewBuffer(b)
1592         buf.EncodeUint32(m.MtTable.MtTableID)
1593         buf.EncodeString(m.MtTable.MtName, 64)
1594         return buf.Bytes(), nil
1595 }
1596 func (m *MplsTableDetails) Unmarshal(b []byte) error {
1597         buf := codec.NewBuffer(b)
1598         m.MtTable.MtTableID = buf.DecodeUint32()
1599         m.MtTable.MtName = buf.DecodeString(64)
1600         return nil
1601 }
1602
1603 // MplsTableDump defines message 'mpls_table_dump'.
1604 type MplsTableDump struct{}
1605
1606 func (m *MplsTableDump) Reset()               { *m = MplsTableDump{} }
1607 func (*MplsTableDump) GetMessageName() string { return "mpls_table_dump" }
1608 func (*MplsTableDump) GetCrcString() string   { return "51077d14" }
1609 func (*MplsTableDump) GetMessageType() api.MessageType {
1610         return api.RequestMessage
1611 }
1612
1613 func (m *MplsTableDump) Size() (size int) {
1614         if m == nil {
1615                 return 0
1616         }
1617         return size
1618 }
1619 func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) {
1620         if b == nil {
1621                 b = make([]byte, m.Size())
1622         }
1623         buf := codec.NewBuffer(b)
1624         return buf.Bytes(), nil
1625 }
1626 func (m *MplsTableDump) Unmarshal(b []byte) error {
1627         return nil
1628 }
1629
1630 // MplsTunnelAddDel defines message 'mpls_tunnel_add_del'.
1631 type MplsTunnelAddDel struct {
1632         MtIsAdd  bool       `binapi:"bool,name=mt_is_add,default=true" json:"mt_is_add,omitempty"`
1633         MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1634 }
1635
1636 func (m *MplsTunnelAddDel) Reset()               { *m = MplsTunnelAddDel{} }
1637 func (*MplsTunnelAddDel) GetMessageName() string { return "mpls_tunnel_add_del" }
1638 func (*MplsTunnelAddDel) GetCrcString() string   { return "0de2478e" }
1639 func (*MplsTunnelAddDel) GetMessageType() api.MessageType {
1640         return api.RequestMessage
1641 }
1642
1643 func (m *MplsTunnelAddDel) Size() (size int) {
1644         if m == nil {
1645                 return 0
1646         }
1647         size += 1 // m.MtIsAdd
1648         size += 4 // m.MtTunnel.MtSwIfIndex
1649         size += 4 // m.MtTunnel.MtTunnelIndex
1650         size += 1 // m.MtTunnel.MtL2Only
1651         size += 1 // m.MtTunnel.MtIsMulticast
1652         size += 1 // m.MtTunnel.MtNPaths
1653         for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1654                 var s2 FibPath
1655                 _ = s2
1656                 if j2 < len(m.MtTunnel.MtPaths) {
1657                         s2 = m.MtTunnel.MtPaths[j2]
1658                 }
1659                 size += 4      // s2.SwIfIndex
1660                 size += 4      // s2.TableID
1661                 size += 4      // s2.RpfID
1662                 size += 1      // s2.Weight
1663                 size += 1      // s2.Preference
1664                 size += 4      // s2.Type
1665                 size += 4      // s2.Flags
1666                 size += 4      // s2.Proto
1667                 size += 1 * 16 // s2.Nh.Address
1668                 size += 4      // s2.Nh.ViaLabel
1669                 size += 4      // s2.Nh.ObjID
1670                 size += 4      // s2.Nh.ClassifyTableIndex
1671                 size += 1      // s2.NLabels
1672                 for j3 := 0; j3 < 16; j3++ {
1673                         size += 1 // s2.LabelStack[j3].IsUniform
1674                         size += 4 // s2.LabelStack[j3].Label
1675                         size += 1 // s2.LabelStack[j3].TTL
1676                         size += 1 // s2.LabelStack[j3].Exp
1677                 }
1678         }
1679         return size
1680 }
1681 func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) {
1682         if b == nil {
1683                 b = make([]byte, m.Size())
1684         }
1685         buf := codec.NewBuffer(b)
1686         buf.EncodeBool(m.MtIsAdd)
1687         buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1688         buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1689         buf.EncodeBool(m.MtTunnel.MtL2Only)
1690         buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1691         buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1692         for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1693                 var v1 FibPath // MtPaths
1694                 if j1 < len(m.MtTunnel.MtPaths) {
1695                         v1 = m.MtTunnel.MtPaths[j1]
1696                 }
1697                 buf.EncodeUint32(v1.SwIfIndex)
1698                 buf.EncodeUint32(v1.TableID)
1699                 buf.EncodeUint32(v1.RpfID)
1700                 buf.EncodeUint8(v1.Weight)
1701                 buf.EncodeUint8(v1.Preference)
1702                 buf.EncodeUint32(uint32(v1.Type))
1703                 buf.EncodeUint32(uint32(v1.Flags))
1704                 buf.EncodeUint32(uint32(v1.Proto))
1705                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1706                 buf.EncodeUint32(v1.Nh.ViaLabel)
1707                 buf.EncodeUint32(v1.Nh.ObjID)
1708                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1709                 buf.EncodeUint8(v1.NLabels)
1710                 for j2 := 0; j2 < 16; j2++ {
1711                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1712                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1713                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1714                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1715                 }
1716         }
1717         return buf.Bytes(), nil
1718 }
1719 func (m *MplsTunnelAddDel) Unmarshal(b []byte) error {
1720         buf := codec.NewBuffer(b)
1721         m.MtIsAdd = buf.DecodeBool()
1722         m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1723         m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1724         m.MtTunnel.MtL2Only = buf.DecodeBool()
1725         m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1726         m.MtTunnel.MtNPaths = buf.DecodeUint8()
1727         m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1728         for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1729                 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1730                 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1731                 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1732                 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1733                 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1734                 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1735                 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1736                 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1737                 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1738                 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1739                 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1740                 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1741                 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1742                 for j2 := 0; j2 < 16; j2++ {
1743                         m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1744                         m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1745                         m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1746                         m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1747                 }
1748         }
1749         return nil
1750 }
1751
1752 // MplsTunnelAddDelReply defines message 'mpls_tunnel_add_del_reply'.
1753 type MplsTunnelAddDelReply struct {
1754         Retval      int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
1755         SwIfIndex   InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1756         TunnelIndex uint32         `binapi:"u32,name=tunnel_index" json:"tunnel_index,omitempty"`
1757 }
1758
1759 func (m *MplsTunnelAddDelReply) Reset()               { *m = MplsTunnelAddDelReply{} }
1760 func (*MplsTunnelAddDelReply) GetMessageName() string { return "mpls_tunnel_add_del_reply" }
1761 func (*MplsTunnelAddDelReply) GetCrcString() string   { return "afb01472" }
1762 func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType {
1763         return api.ReplyMessage
1764 }
1765
1766 func (m *MplsTunnelAddDelReply) Size() (size int) {
1767         if m == nil {
1768                 return 0
1769         }
1770         size += 4 // m.Retval
1771         size += 4 // m.SwIfIndex
1772         size += 4 // m.TunnelIndex
1773         return size
1774 }
1775 func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
1776         if b == nil {
1777                 b = make([]byte, m.Size())
1778         }
1779         buf := codec.NewBuffer(b)
1780         buf.EncodeInt32(m.Retval)
1781         buf.EncodeUint32(uint32(m.SwIfIndex))
1782         buf.EncodeUint32(m.TunnelIndex)
1783         return buf.Bytes(), nil
1784 }
1785 func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error {
1786         buf := codec.NewBuffer(b)
1787         m.Retval = buf.DecodeInt32()
1788         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1789         m.TunnelIndex = buf.DecodeUint32()
1790         return nil
1791 }
1792
1793 // MplsTunnelDetails defines message 'mpls_tunnel_details'.
1794 type MplsTunnelDetails struct {
1795         MtTunnel MplsTunnel `binapi:"mpls_tunnel,name=mt_tunnel" json:"mt_tunnel,omitempty"`
1796 }
1797
1798 func (m *MplsTunnelDetails) Reset()               { *m = MplsTunnelDetails{} }
1799 func (*MplsTunnelDetails) GetMessageName() string { return "mpls_tunnel_details" }
1800 func (*MplsTunnelDetails) GetCrcString() string   { return "bdc55cce" }
1801 func (*MplsTunnelDetails) GetMessageType() api.MessageType {
1802         return api.ReplyMessage
1803 }
1804
1805 func (m *MplsTunnelDetails) Size() (size int) {
1806         if m == nil {
1807                 return 0
1808         }
1809         size += 4 // m.MtTunnel.MtSwIfIndex
1810         size += 4 // m.MtTunnel.MtTunnelIndex
1811         size += 1 // m.MtTunnel.MtL2Only
1812         size += 1 // m.MtTunnel.MtIsMulticast
1813         size += 1 // m.MtTunnel.MtNPaths
1814         for j2 := 0; j2 < len(m.MtTunnel.MtPaths); j2++ {
1815                 var s2 FibPath
1816                 _ = s2
1817                 if j2 < len(m.MtTunnel.MtPaths) {
1818                         s2 = m.MtTunnel.MtPaths[j2]
1819                 }
1820                 size += 4      // s2.SwIfIndex
1821                 size += 4      // s2.TableID
1822                 size += 4      // s2.RpfID
1823                 size += 1      // s2.Weight
1824                 size += 1      // s2.Preference
1825                 size += 4      // s2.Type
1826                 size += 4      // s2.Flags
1827                 size += 4      // s2.Proto
1828                 size += 1 * 16 // s2.Nh.Address
1829                 size += 4      // s2.Nh.ViaLabel
1830                 size += 4      // s2.Nh.ObjID
1831                 size += 4      // s2.Nh.ClassifyTableIndex
1832                 size += 1      // s2.NLabels
1833                 for j3 := 0; j3 < 16; j3++ {
1834                         size += 1 // s2.LabelStack[j3].IsUniform
1835                         size += 4 // s2.LabelStack[j3].Label
1836                         size += 1 // s2.LabelStack[j3].TTL
1837                         size += 1 // s2.LabelStack[j3].Exp
1838                 }
1839         }
1840         return size
1841 }
1842 func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) {
1843         if b == nil {
1844                 b = make([]byte, m.Size())
1845         }
1846         buf := codec.NewBuffer(b)
1847         buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
1848         buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
1849         buf.EncodeBool(m.MtTunnel.MtL2Only)
1850         buf.EncodeBool(m.MtTunnel.MtIsMulticast)
1851         buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
1852         for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1853                 var v1 FibPath // MtPaths
1854                 if j1 < len(m.MtTunnel.MtPaths) {
1855                         v1 = m.MtTunnel.MtPaths[j1]
1856                 }
1857                 buf.EncodeUint32(v1.SwIfIndex)
1858                 buf.EncodeUint32(v1.TableID)
1859                 buf.EncodeUint32(v1.RpfID)
1860                 buf.EncodeUint8(v1.Weight)
1861                 buf.EncodeUint8(v1.Preference)
1862                 buf.EncodeUint32(uint32(v1.Type))
1863                 buf.EncodeUint32(uint32(v1.Flags))
1864                 buf.EncodeUint32(uint32(v1.Proto))
1865                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1866                 buf.EncodeUint32(v1.Nh.ViaLabel)
1867                 buf.EncodeUint32(v1.Nh.ObjID)
1868                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1869                 buf.EncodeUint8(v1.NLabels)
1870                 for j2 := 0; j2 < 16; j2++ {
1871                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1872                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1873                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1874                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1875                 }
1876         }
1877         return buf.Bytes(), nil
1878 }
1879 func (m *MplsTunnelDetails) Unmarshal(b []byte) error {
1880         buf := codec.NewBuffer(b)
1881         m.MtTunnel.MtSwIfIndex = InterfaceIndex(buf.DecodeUint32())
1882         m.MtTunnel.MtTunnelIndex = buf.DecodeUint32()
1883         m.MtTunnel.MtL2Only = buf.DecodeBool()
1884         m.MtTunnel.MtIsMulticast = buf.DecodeBool()
1885         m.MtTunnel.MtNPaths = buf.DecodeUint8()
1886         m.MtTunnel.MtPaths = make([]FibPath, m.MtTunnel.MtNPaths)
1887         for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
1888                 m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
1889                 m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
1890                 m.MtTunnel.MtPaths[j1].RpfID = buf.DecodeUint32()
1891                 m.MtTunnel.MtPaths[j1].Weight = buf.DecodeUint8()
1892                 m.MtTunnel.MtPaths[j1].Preference = buf.DecodeUint8()
1893                 m.MtTunnel.MtPaths[j1].Type = FibPathType(buf.DecodeUint32())
1894                 m.MtTunnel.MtPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1895                 m.MtTunnel.MtPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1896                 copy(m.MtTunnel.MtPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1897                 m.MtTunnel.MtPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1898                 m.MtTunnel.MtPaths[j1].Nh.ObjID = buf.DecodeUint32()
1899                 m.MtTunnel.MtPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1900                 m.MtTunnel.MtPaths[j1].NLabels = buf.DecodeUint8()
1901                 for j2 := 0; j2 < 16; j2++ {
1902                         m.MtTunnel.MtPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1903                         m.MtTunnel.MtPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1904                         m.MtTunnel.MtPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1905                         m.MtTunnel.MtPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1906                 }
1907         }
1908         return nil
1909 }
1910
1911 // MplsTunnelDump defines message 'mpls_tunnel_dump'.
1912 type MplsTunnelDump struct {
1913         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1914 }
1915
1916 func (m *MplsTunnelDump) Reset()               { *m = MplsTunnelDump{} }
1917 func (*MplsTunnelDump) GetMessageName() string { return "mpls_tunnel_dump" }
1918 func (*MplsTunnelDump) GetCrcString() string   { return "f9e6675e" }
1919 func (*MplsTunnelDump) GetMessageType() api.MessageType {
1920         return api.RequestMessage
1921 }
1922
1923 func (m *MplsTunnelDump) Size() (size int) {
1924         if m == nil {
1925                 return 0
1926         }
1927         size += 4 // m.SwIfIndex
1928         return size
1929 }
1930 func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) {
1931         if b == nil {
1932                 b = make([]byte, m.Size())
1933         }
1934         buf := codec.NewBuffer(b)
1935         buf.EncodeUint32(uint32(m.SwIfIndex))
1936         return buf.Bytes(), nil
1937 }
1938 func (m *MplsTunnelDump) Unmarshal(b []byte) error {
1939         buf := codec.NewBuffer(b)
1940         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1941         return nil
1942 }
1943
1944 // SwInterfaceSetMplsEnable defines message 'sw_interface_set_mpls_enable'.
1945 type SwInterfaceSetMplsEnable struct {
1946         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1947         Enable    bool           `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1948 }
1949
1950 func (m *SwInterfaceSetMplsEnable) Reset()               { *m = SwInterfaceSetMplsEnable{} }
1951 func (*SwInterfaceSetMplsEnable) GetMessageName() string { return "sw_interface_set_mpls_enable" }
1952 func (*SwInterfaceSetMplsEnable) GetCrcString() string   { return "ae6cfcfb" }
1953 func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType {
1954         return api.RequestMessage
1955 }
1956
1957 func (m *SwInterfaceSetMplsEnable) Size() (size int) {
1958         if m == nil {
1959                 return 0
1960         }
1961         size += 4 // m.SwIfIndex
1962         size += 1 // m.Enable
1963         return size
1964 }
1965 func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) {
1966         if b == nil {
1967                 b = make([]byte, m.Size())
1968         }
1969         buf := codec.NewBuffer(b)
1970         buf.EncodeUint32(uint32(m.SwIfIndex))
1971         buf.EncodeBool(m.Enable)
1972         return buf.Bytes(), nil
1973 }
1974 func (m *SwInterfaceSetMplsEnable) Unmarshal(b []byte) error {
1975         buf := codec.NewBuffer(b)
1976         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1977         m.Enable = buf.DecodeBool()
1978         return nil
1979 }
1980
1981 // SwInterfaceSetMplsEnableReply defines message 'sw_interface_set_mpls_enable_reply'.
1982 type SwInterfaceSetMplsEnableReply struct {
1983         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1984 }
1985
1986 func (m *SwInterfaceSetMplsEnableReply) Reset() { *m = SwInterfaceSetMplsEnableReply{} }
1987 func (*SwInterfaceSetMplsEnableReply) GetMessageName() string {
1988         return "sw_interface_set_mpls_enable_reply"
1989 }
1990 func (*SwInterfaceSetMplsEnableReply) GetCrcString() string { return "e8d4e804" }
1991 func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType {
1992         return api.ReplyMessage
1993 }
1994
1995 func (m *SwInterfaceSetMplsEnableReply) Size() (size int) {
1996         if m == nil {
1997                 return 0
1998         }
1999         size += 4 // m.Retval
2000         return size
2001 }
2002 func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) {
2003         if b == nil {
2004                 b = make([]byte, m.Size())
2005         }
2006         buf := codec.NewBuffer(b)
2007         buf.EncodeInt32(m.Retval)
2008         return buf.Bytes(), nil
2009 }
2010 func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error {
2011         buf := codec.NewBuffer(b)
2012         m.Retval = buf.DecodeInt32()
2013         return nil
2014 }
2015
2016 func init() { file_mpls_binapi_init() }
2017 func file_mpls_binapi_init() {
2018         api.RegisterMessage((*MplsIPBindUnbind)(nil), "mpls_ip_bind_unbind_48249a27")
2019         api.RegisterMessage((*MplsIPBindUnbindReply)(nil), "mpls_ip_bind_unbind_reply_e8d4e804")
2020         api.RegisterMessage((*MplsRouteAddDel)(nil), "mpls_route_add_del_343cff54")
2021         api.RegisterMessage((*MplsRouteAddDelReply)(nil), "mpls_route_add_del_reply_1992deab")
2022         api.RegisterMessage((*MplsRouteDetails)(nil), "mpls_route_details_d0ac384c")
2023         api.RegisterMessage((*MplsRouteDump)(nil), "mpls_route_dump_935fdefa")
2024         api.RegisterMessage((*MplsTableAddDel)(nil), "mpls_table_add_del_57817512")
2025         api.RegisterMessage((*MplsTableAddDelReply)(nil), "mpls_table_add_del_reply_e8d4e804")
2026         api.RegisterMessage((*MplsTableDetails)(nil), "mpls_table_details_f03ecdc8")
2027         api.RegisterMessage((*MplsTableDump)(nil), "mpls_table_dump_51077d14")
2028         api.RegisterMessage((*MplsTunnelAddDel)(nil), "mpls_tunnel_add_del_0de2478e")
2029         api.RegisterMessage((*MplsTunnelAddDelReply)(nil), "mpls_tunnel_add_del_reply_afb01472")
2030         api.RegisterMessage((*MplsTunnelDetails)(nil), "mpls_tunnel_details_bdc55cce")
2031         api.RegisterMessage((*MplsTunnelDump)(nil), "mpls_tunnel_dump_f9e6675e")
2032         api.RegisterMessage((*SwInterfaceSetMplsEnable)(nil), "sw_interface_set_mpls_enable_ae6cfcfb")
2033         api.RegisterMessage((*SwInterfaceSetMplsEnableReply)(nil), "sw_interface_set_mpls_enable_reply_e8d4e804")
2034 }
2035
2036 // Messages returns list of all messages in this module.
2037 func AllMessages() []api.Message {
2038         return []api.Message{
2039                 (*MplsIPBindUnbind)(nil),
2040                 (*MplsIPBindUnbindReply)(nil),
2041                 (*MplsRouteAddDel)(nil),
2042                 (*MplsRouteAddDelReply)(nil),
2043                 (*MplsRouteDetails)(nil),
2044                 (*MplsRouteDump)(nil),
2045                 (*MplsTableAddDel)(nil),
2046                 (*MplsTableAddDelReply)(nil),
2047                 (*MplsTableDetails)(nil),
2048                 (*MplsTableDump)(nil),
2049                 (*MplsTunnelAddDel)(nil),
2050                 (*MplsTunnelAddDelReply)(nil),
2051                 (*MplsTunnelDetails)(nil),
2052                 (*MplsTunnelDump)(nil),
2053                 (*SwInterfaceSetMplsEnable)(nil),
2054                 (*SwInterfaceSetMplsEnableReply)(nil),
2055         }
2056 }