Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / l3xc / l3xc.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/plugins/l3xc.api.json
6
7 // Package l3xc contains generated bindings for API file l3xc.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  13 enums
12 //  10 structs
13 //   1 union
14 //   8 messages
15 //
16 package l3xc
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    = "l3xc"
36         APIVersion = "1.0.1"
37         VersionCrc = 0x80b00c99
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 // L3xc defines type 'l3xc'.
944 type L3xc struct {
945         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
946         IsIP6     bool           `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"`
947         NPaths    uint8          `binapi:"u8,name=n_paths" json:"-"`
948         Paths     []FibPath      `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
949 }
950
951 // Mprefix defines type 'mprefix'.
952 type Mprefix struct {
953         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
954         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
955         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
956         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
957 }
958
959 // Prefix defines type 'prefix'.
960 type Prefix struct {
961         Address Address `binapi:"address,name=address" json:"address,omitempty"`
962         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
963 }
964
965 func ParsePrefix(ip string) (prefix Prefix, err error) {
966         hasPrefix := strings.Contains(ip, "/")
967         if hasPrefix {
968                 netIP, network, err := net.ParseCIDR(ip)
969                 if err != nil {
970                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
971                 }
972                 maskSize, _ := network.Mask.Size()
973                 prefix.Len = byte(maskSize)
974                 prefix.Address, err = ParseAddress(netIP.String())
975                 if err != nil {
976                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
977                 }
978         } else {
979                 netIP := net.ParseIP(ip)
980                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
981                 if netIP.To4() == nil {
982                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
983                 }
984                 prefix.Len = byte(defaultMaskSize)
985                 prefix.Address, err = ParseAddress(netIP.String())
986                 if err != nil {
987                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
988                 }
989         }
990         return prefix, nil
991 }
992
993 func (x Prefix) ToIPNet() *net.IPNet {
994         var mask net.IPMask
995         if x.Address.Af == ADDRESS_IP4 {
996                 mask = net.CIDRMask(int(x.Len), 32)
997         } else {
998                 mask = net.CIDRMask(int(x.Len), 128)
999         }
1000         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1001         return ipnet
1002 }
1003
1004 func (x Prefix) String() string {
1005         ip := x.Address.String()
1006         return ip + "/" + strconv.Itoa(int(x.Len))
1007 }
1008
1009 func (x *Prefix) MarshalText() ([]byte, error) {
1010         return []byte(x.String()), nil
1011 }
1012
1013 func (x *Prefix) UnmarshalText(text []byte) error {
1014         prefix, err := ParsePrefix(string(text))
1015         if err != nil {
1016                 return err
1017         }
1018         *x = prefix
1019         return nil
1020 }
1021
1022 // PrefixMatcher defines type 'prefix_matcher'.
1023 type PrefixMatcher struct {
1024         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1025         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1026 }
1027
1028 // AddressUnion defines union 'address_union'.
1029 type AddressUnion struct {
1030         // AddressUnion can be one of:
1031         // - IP4 *IP4Address
1032         // - IP6 *IP6Address
1033         XXX_UnionData [16]byte
1034 }
1035
1036 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1037         u.SetIP4(a)
1038         return
1039 }
1040 func (u *AddressUnion) SetIP4(a IP4Address) {
1041         buf := codec.NewBuffer(u.XXX_UnionData[:])
1042         buf.EncodeBytes(a[:], 4)
1043 }
1044 func (u *AddressUnion) GetIP4() (a IP4Address) {
1045         buf := codec.NewBuffer(u.XXX_UnionData[:])
1046         copy(a[:], buf.DecodeBytes(4))
1047         return
1048 }
1049
1050 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1051         u.SetIP6(a)
1052         return
1053 }
1054 func (u *AddressUnion) SetIP6(a IP6Address) {
1055         buf := codec.NewBuffer(u.XXX_UnionData[:])
1056         buf.EncodeBytes(a[:], 16)
1057 }
1058 func (u *AddressUnion) GetIP6() (a IP6Address) {
1059         buf := codec.NewBuffer(u.XXX_UnionData[:])
1060         copy(a[:], buf.DecodeBytes(16))
1061         return
1062 }
1063
1064 // L3xcDel defines message 'l3xc_del'.
1065 type L3xcDel struct {
1066         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1067         IsIP6     bool           `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"`
1068 }
1069
1070 func (m *L3xcDel) Reset()               { *m = L3xcDel{} }
1071 func (*L3xcDel) GetMessageName() string { return "l3xc_del" }
1072 func (*L3xcDel) GetCrcString() string   { return "e7dbef91" }
1073 func (*L3xcDel) GetMessageType() api.MessageType {
1074         return api.RequestMessage
1075 }
1076
1077 func (m *L3xcDel) Size() (size int) {
1078         if m == nil {
1079                 return 0
1080         }
1081         size += 4 // m.SwIfIndex
1082         size += 1 // m.IsIP6
1083         return size
1084 }
1085 func (m *L3xcDel) Marshal(b []byte) ([]byte, error) {
1086         if b == nil {
1087                 b = make([]byte, m.Size())
1088         }
1089         buf := codec.NewBuffer(b)
1090         buf.EncodeUint32(uint32(m.SwIfIndex))
1091         buf.EncodeBool(m.IsIP6)
1092         return buf.Bytes(), nil
1093 }
1094 func (m *L3xcDel) Unmarshal(b []byte) error {
1095         buf := codec.NewBuffer(b)
1096         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1097         m.IsIP6 = buf.DecodeBool()
1098         return nil
1099 }
1100
1101 // L3xcDelReply defines message 'l3xc_del_reply'.
1102 type L3xcDelReply struct {
1103         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1104 }
1105
1106 func (m *L3xcDelReply) Reset()               { *m = L3xcDelReply{} }
1107 func (*L3xcDelReply) GetMessageName() string { return "l3xc_del_reply" }
1108 func (*L3xcDelReply) GetCrcString() string   { return "e8d4e804" }
1109 func (*L3xcDelReply) GetMessageType() api.MessageType {
1110         return api.ReplyMessage
1111 }
1112
1113 func (m *L3xcDelReply) Size() (size int) {
1114         if m == nil {
1115                 return 0
1116         }
1117         size += 4 // m.Retval
1118         return size
1119 }
1120 func (m *L3xcDelReply) Marshal(b []byte) ([]byte, error) {
1121         if b == nil {
1122                 b = make([]byte, m.Size())
1123         }
1124         buf := codec.NewBuffer(b)
1125         buf.EncodeInt32(m.Retval)
1126         return buf.Bytes(), nil
1127 }
1128 func (m *L3xcDelReply) Unmarshal(b []byte) error {
1129         buf := codec.NewBuffer(b)
1130         m.Retval = buf.DecodeInt32()
1131         return nil
1132 }
1133
1134 // L3xcDetails defines message 'l3xc_details'.
1135 type L3xcDetails struct {
1136         L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"`
1137 }
1138
1139 func (m *L3xcDetails) Reset()               { *m = L3xcDetails{} }
1140 func (*L3xcDetails) GetMessageName() string { return "l3xc_details" }
1141 func (*L3xcDetails) GetCrcString() string   { return "d4f69627" }
1142 func (*L3xcDetails) GetMessageType() api.MessageType {
1143         return api.ReplyMessage
1144 }
1145
1146 func (m *L3xcDetails) Size() (size int) {
1147         if m == nil {
1148                 return 0
1149         }
1150         size += 4 // m.L3xc.SwIfIndex
1151         size += 1 // m.L3xc.IsIP6
1152         size += 1 // m.L3xc.NPaths
1153         for j2 := 0; j2 < len(m.L3xc.Paths); j2++ {
1154                 var s2 FibPath
1155                 _ = s2
1156                 if j2 < len(m.L3xc.Paths) {
1157                         s2 = m.L3xc.Paths[j2]
1158                 }
1159                 size += 4      // s2.SwIfIndex
1160                 size += 4      // s2.TableID
1161                 size += 4      // s2.RpfID
1162                 size += 1      // s2.Weight
1163                 size += 1      // s2.Preference
1164                 size += 4      // s2.Type
1165                 size += 4      // s2.Flags
1166                 size += 4      // s2.Proto
1167                 size += 1 * 16 // s2.Nh.Address
1168                 size += 4      // s2.Nh.ViaLabel
1169                 size += 4      // s2.Nh.ObjID
1170                 size += 4      // s2.Nh.ClassifyTableIndex
1171                 size += 1      // s2.NLabels
1172                 for j3 := 0; j3 < 16; j3++ {
1173                         size += 1 // s2.LabelStack[j3].IsUniform
1174                         size += 4 // s2.LabelStack[j3].Label
1175                         size += 1 // s2.LabelStack[j3].TTL
1176                         size += 1 // s2.LabelStack[j3].Exp
1177                 }
1178         }
1179         return size
1180 }
1181 func (m *L3xcDetails) Marshal(b []byte) ([]byte, error) {
1182         if b == nil {
1183                 b = make([]byte, m.Size())
1184         }
1185         buf := codec.NewBuffer(b)
1186         buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
1187         buf.EncodeBool(m.L3xc.IsIP6)
1188         buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
1189         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
1190                 var v1 FibPath // Paths
1191                 if j1 < len(m.L3xc.Paths) {
1192                         v1 = m.L3xc.Paths[j1]
1193                 }
1194                 buf.EncodeUint32(v1.SwIfIndex)
1195                 buf.EncodeUint32(v1.TableID)
1196                 buf.EncodeUint32(v1.RpfID)
1197                 buf.EncodeUint8(v1.Weight)
1198                 buf.EncodeUint8(v1.Preference)
1199                 buf.EncodeUint32(uint32(v1.Type))
1200                 buf.EncodeUint32(uint32(v1.Flags))
1201                 buf.EncodeUint32(uint32(v1.Proto))
1202                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1203                 buf.EncodeUint32(v1.Nh.ViaLabel)
1204                 buf.EncodeUint32(v1.Nh.ObjID)
1205                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1206                 buf.EncodeUint8(v1.NLabels)
1207                 for j2 := 0; j2 < 16; j2++ {
1208                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1209                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1210                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1211                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1212                 }
1213         }
1214         return buf.Bytes(), nil
1215 }
1216 func (m *L3xcDetails) Unmarshal(b []byte) error {
1217         buf := codec.NewBuffer(b)
1218         m.L3xc.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1219         m.L3xc.IsIP6 = buf.DecodeBool()
1220         m.L3xc.NPaths = buf.DecodeUint8()
1221         m.L3xc.Paths = make([]FibPath, m.L3xc.NPaths)
1222         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
1223                 m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
1224                 m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
1225                 m.L3xc.Paths[j1].RpfID = buf.DecodeUint32()
1226                 m.L3xc.Paths[j1].Weight = buf.DecodeUint8()
1227                 m.L3xc.Paths[j1].Preference = buf.DecodeUint8()
1228                 m.L3xc.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1229                 m.L3xc.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1230                 m.L3xc.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1231                 copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1232                 m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1233                 m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1234                 m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1235                 m.L3xc.Paths[j1].NLabels = buf.DecodeUint8()
1236                 for j2 := 0; j2 < 16; j2++ {
1237                         m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1238                         m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1239                         m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1240                         m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1241                 }
1242         }
1243         return nil
1244 }
1245
1246 // L3xcDump defines message 'l3xc_dump'.
1247 type L3xcDump struct {
1248         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1249 }
1250
1251 func (m *L3xcDump) Reset()               { *m = L3xcDump{} }
1252 func (*L3xcDump) GetMessageName() string { return "l3xc_dump" }
1253 func (*L3xcDump) GetCrcString() string   { return "f9e6675e" }
1254 func (*L3xcDump) GetMessageType() api.MessageType {
1255         return api.RequestMessage
1256 }
1257
1258 func (m *L3xcDump) Size() (size int) {
1259         if m == nil {
1260                 return 0
1261         }
1262         size += 4 // m.SwIfIndex
1263         return size
1264 }
1265 func (m *L3xcDump) Marshal(b []byte) ([]byte, error) {
1266         if b == nil {
1267                 b = make([]byte, m.Size())
1268         }
1269         buf := codec.NewBuffer(b)
1270         buf.EncodeUint32(uint32(m.SwIfIndex))
1271         return buf.Bytes(), nil
1272 }
1273 func (m *L3xcDump) Unmarshal(b []byte) error {
1274         buf := codec.NewBuffer(b)
1275         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1276         return nil
1277 }
1278
1279 // L3xcPluginGetVersion defines message 'l3xc_plugin_get_version'.
1280 type L3xcPluginGetVersion struct{}
1281
1282 func (m *L3xcPluginGetVersion) Reset()               { *m = L3xcPluginGetVersion{} }
1283 func (*L3xcPluginGetVersion) GetMessageName() string { return "l3xc_plugin_get_version" }
1284 func (*L3xcPluginGetVersion) GetCrcString() string   { return "51077d14" }
1285 func (*L3xcPluginGetVersion) GetMessageType() api.MessageType {
1286         return api.RequestMessage
1287 }
1288
1289 func (m *L3xcPluginGetVersion) Size() (size int) {
1290         if m == nil {
1291                 return 0
1292         }
1293         return size
1294 }
1295 func (m *L3xcPluginGetVersion) Marshal(b []byte) ([]byte, error) {
1296         if b == nil {
1297                 b = make([]byte, m.Size())
1298         }
1299         buf := codec.NewBuffer(b)
1300         return buf.Bytes(), nil
1301 }
1302 func (m *L3xcPluginGetVersion) Unmarshal(b []byte) error {
1303         return nil
1304 }
1305
1306 // L3xcPluginGetVersionReply defines message 'l3xc_plugin_get_version_reply'.
1307 type L3xcPluginGetVersionReply struct {
1308         Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1309         Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1310 }
1311
1312 func (m *L3xcPluginGetVersionReply) Reset()               { *m = L3xcPluginGetVersionReply{} }
1313 func (*L3xcPluginGetVersionReply) GetMessageName() string { return "l3xc_plugin_get_version_reply" }
1314 func (*L3xcPluginGetVersionReply) GetCrcString() string   { return "9b32cf86" }
1315 func (*L3xcPluginGetVersionReply) GetMessageType() api.MessageType {
1316         return api.ReplyMessage
1317 }
1318
1319 func (m *L3xcPluginGetVersionReply) Size() (size int) {
1320         if m == nil {
1321                 return 0
1322         }
1323         size += 4 // m.Major
1324         size += 4 // m.Minor
1325         return size
1326 }
1327 func (m *L3xcPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1328         if b == nil {
1329                 b = make([]byte, m.Size())
1330         }
1331         buf := codec.NewBuffer(b)
1332         buf.EncodeUint32(m.Major)
1333         buf.EncodeUint32(m.Minor)
1334         return buf.Bytes(), nil
1335 }
1336 func (m *L3xcPluginGetVersionReply) Unmarshal(b []byte) error {
1337         buf := codec.NewBuffer(b)
1338         m.Major = buf.DecodeUint32()
1339         m.Minor = buf.DecodeUint32()
1340         return nil
1341 }
1342
1343 // L3xcUpdate defines message 'l3xc_update'.
1344 type L3xcUpdate struct {
1345         L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"`
1346 }
1347
1348 func (m *L3xcUpdate) Reset()               { *m = L3xcUpdate{} }
1349 func (*L3xcUpdate) GetMessageName() string { return "l3xc_update" }
1350 func (*L3xcUpdate) GetCrcString() string   { return "0787b1d3" }
1351 func (*L3xcUpdate) GetMessageType() api.MessageType {
1352         return api.RequestMessage
1353 }
1354
1355 func (m *L3xcUpdate) Size() (size int) {
1356         if m == nil {
1357                 return 0
1358         }
1359         size += 4 // m.L3xc.SwIfIndex
1360         size += 1 // m.L3xc.IsIP6
1361         size += 1 // m.L3xc.NPaths
1362         for j2 := 0; j2 < len(m.L3xc.Paths); j2++ {
1363                 var s2 FibPath
1364                 _ = s2
1365                 if j2 < len(m.L3xc.Paths) {
1366                         s2 = m.L3xc.Paths[j2]
1367                 }
1368                 size += 4      // s2.SwIfIndex
1369                 size += 4      // s2.TableID
1370                 size += 4      // s2.RpfID
1371                 size += 1      // s2.Weight
1372                 size += 1      // s2.Preference
1373                 size += 4      // s2.Type
1374                 size += 4      // s2.Flags
1375                 size += 4      // s2.Proto
1376                 size += 1 * 16 // s2.Nh.Address
1377                 size += 4      // s2.Nh.ViaLabel
1378                 size += 4      // s2.Nh.ObjID
1379                 size += 4      // s2.Nh.ClassifyTableIndex
1380                 size += 1      // s2.NLabels
1381                 for j3 := 0; j3 < 16; j3++ {
1382                         size += 1 // s2.LabelStack[j3].IsUniform
1383                         size += 4 // s2.LabelStack[j3].Label
1384                         size += 1 // s2.LabelStack[j3].TTL
1385                         size += 1 // s2.LabelStack[j3].Exp
1386                 }
1387         }
1388         return size
1389 }
1390 func (m *L3xcUpdate) Marshal(b []byte) ([]byte, error) {
1391         if b == nil {
1392                 b = make([]byte, m.Size())
1393         }
1394         buf := codec.NewBuffer(b)
1395         buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
1396         buf.EncodeBool(m.L3xc.IsIP6)
1397         buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
1398         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
1399                 var v1 FibPath // Paths
1400                 if j1 < len(m.L3xc.Paths) {
1401                         v1 = m.L3xc.Paths[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 *L3xcUpdate) Unmarshal(b []byte) error {
1426         buf := codec.NewBuffer(b)
1427         m.L3xc.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1428         m.L3xc.IsIP6 = buf.DecodeBool()
1429         m.L3xc.NPaths = buf.DecodeUint8()
1430         m.L3xc.Paths = make([]FibPath, m.L3xc.NPaths)
1431         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
1432                 m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
1433                 m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
1434                 m.L3xc.Paths[j1].RpfID = buf.DecodeUint32()
1435                 m.L3xc.Paths[j1].Weight = buf.DecodeUint8()
1436                 m.L3xc.Paths[j1].Preference = buf.DecodeUint8()
1437                 m.L3xc.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1438                 m.L3xc.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1439                 m.L3xc.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1440                 copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1441                 m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1442                 m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1443                 m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1444                 m.L3xc.Paths[j1].NLabels = buf.DecodeUint8()
1445                 for j2 := 0; j2 < 16; j2++ {
1446                         m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1447                         m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1448                         m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1449                         m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1450                 }
1451         }
1452         return nil
1453 }
1454
1455 // L3xcUpdateReply defines message 'l3xc_update_reply'.
1456 type L3xcUpdateReply struct {
1457         Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
1458         StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"`
1459 }
1460
1461 func (m *L3xcUpdateReply) Reset()               { *m = L3xcUpdateReply{} }
1462 func (*L3xcUpdateReply) GetMessageName() string { return "l3xc_update_reply" }
1463 func (*L3xcUpdateReply) GetCrcString() string   { return "1992deab" }
1464 func (*L3xcUpdateReply) GetMessageType() api.MessageType {
1465         return api.ReplyMessage
1466 }
1467
1468 func (m *L3xcUpdateReply) Size() (size int) {
1469         if m == nil {
1470                 return 0
1471         }
1472         size += 4 // m.Retval
1473         size += 4 // m.StatsIndex
1474         return size
1475 }
1476 func (m *L3xcUpdateReply) Marshal(b []byte) ([]byte, error) {
1477         if b == nil {
1478                 b = make([]byte, m.Size())
1479         }
1480         buf := codec.NewBuffer(b)
1481         buf.EncodeInt32(m.Retval)
1482         buf.EncodeUint32(m.StatsIndex)
1483         return buf.Bytes(), nil
1484 }
1485 func (m *L3xcUpdateReply) Unmarshal(b []byte) error {
1486         buf := codec.NewBuffer(b)
1487         m.Retval = buf.DecodeInt32()
1488         m.StatsIndex = buf.DecodeUint32()
1489         return nil
1490 }
1491
1492 func init() { file_l3xc_binapi_init() }
1493 func file_l3xc_binapi_init() {
1494         api.RegisterMessage((*L3xcDel)(nil), "l3xc_del_e7dbef91")
1495         api.RegisterMessage((*L3xcDelReply)(nil), "l3xc_del_reply_e8d4e804")
1496         api.RegisterMessage((*L3xcDetails)(nil), "l3xc_details_d4f69627")
1497         api.RegisterMessage((*L3xcDump)(nil), "l3xc_dump_f9e6675e")
1498         api.RegisterMessage((*L3xcPluginGetVersion)(nil), "l3xc_plugin_get_version_51077d14")
1499         api.RegisterMessage((*L3xcPluginGetVersionReply)(nil), "l3xc_plugin_get_version_reply_9b32cf86")
1500         api.RegisterMessage((*L3xcUpdate)(nil), "l3xc_update_0787b1d3")
1501         api.RegisterMessage((*L3xcUpdateReply)(nil), "l3xc_update_reply_1992deab")
1502 }
1503
1504 // Messages returns list of all messages in this module.
1505 func AllMessages() []api.Message {
1506         return []api.Message{
1507                 (*L3xcDel)(nil),
1508                 (*L3xcDelReply)(nil),
1509                 (*L3xcDetails)(nil),
1510                 (*L3xcDump)(nil),
1511                 (*L3xcPluginGetVersion)(nil),
1512                 (*L3xcPluginGetVersionReply)(nil),
1513                 (*L3xcUpdate)(nil),
1514                 (*L3xcUpdateReply)(nil),
1515         }
1516 }