Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / abf / abf.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/abf.api.json
6
7 // Package abf contains generated bindings for API file abf.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  13 enums
12 //  11 structs
13 //   1 union
14 //  10 messages
15 //
16 package abf
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    = "abf"
36         APIVersion = "1.0.0"
37         VersionCrc = 0xc2e5c644
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 // AbfItfAttach defines type 'abf_itf_attach'.
740 type AbfItfAttach struct {
741         PolicyID  uint32         `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
742         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
743         Priority  uint32         `binapi:"u32,name=priority" json:"priority,omitempty"`
744         IsIPv6    bool           `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
745 }
746
747 // AbfPolicy defines type 'abf_policy'.
748 type AbfPolicy struct {
749         PolicyID uint32    `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
750         ACLIndex uint32    `binapi:"u32,name=acl_index" json:"acl_index,omitempty"`
751         NPaths   uint8     `binapi:"u8,name=n_paths" json:"-"`
752         Paths    []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
753 }
754
755 // Address defines type 'address'.
756 type Address struct {
757         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
758         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
759 }
760
761 func ParseAddress(s string) (Address, error) {
762         ip := net.ParseIP(s)
763         if ip == nil {
764                 return Address{}, fmt.Errorf("invalid address: %s", s)
765         }
766         return AddressFromIP(ip), nil
767 }
768
769 func AddressFromIP(ip net.IP) Address {
770         var addr Address
771         if ip.To4() == nil {
772                 addr.Af = ADDRESS_IP6
773                 var ip6 IP6Address
774                 copy(ip6[:], ip.To16())
775                 addr.Un.SetIP6(ip6)
776         } else {
777                 addr.Af = ADDRESS_IP4
778                 var ip4 IP4Address
779                 copy(ip4[:], ip.To4())
780                 addr.Un.SetIP4(ip4)
781         }
782         return addr
783 }
784
785 func (x Address) ToIP() net.IP {
786         if x.Af == ADDRESS_IP6 {
787                 ip6 := x.Un.GetIP6()
788                 return net.IP(ip6[:]).To16()
789         } else {
790                 ip4 := x.Un.GetIP4()
791                 return net.IP(ip4[:]).To4()
792         }
793 }
794
795 func (x Address) String() string {
796         return x.ToIP().String()
797 }
798
799 func (x *Address) MarshalText() ([]byte, error) {
800         return []byte(x.String()), nil
801 }
802
803 func (x *Address) UnmarshalText(text []byte) error {
804         addr, err := ParseAddress(string(text))
805         if err != nil {
806                 return err
807         }
808         *x = addr
809         return nil
810 }
811
812 // FibMplsLabel defines type 'fib_mpls_label'.
813 type FibMplsLabel struct {
814         IsUniform uint8  `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
815         Label     uint32 `binapi:"u32,name=label" json:"label,omitempty"`
816         TTL       uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
817         Exp       uint8  `binapi:"u8,name=exp" json:"exp,omitempty"`
818 }
819
820 // FibPath defines type 'fib_path'.
821 type FibPath struct {
822         SwIfIndex  uint32           `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
823         TableID    uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
824         RpfID      uint32           `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
825         Weight     uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
826         Preference uint8            `binapi:"u8,name=preference" json:"preference,omitempty"`
827         Type       FibPathType      `binapi:"fib_path_type,name=type" json:"type,omitempty"`
828         Flags      FibPathFlags     `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
829         Proto      FibPathNhProto   `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
830         Nh         FibPathNh        `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
831         NLabels    uint8            `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
832         LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
833 }
834
835 // FibPathNh defines type 'fib_path_nh'.
836 type FibPathNh struct {
837         Address            AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
838         ViaLabel           uint32       `binapi:"u32,name=via_label" json:"via_label,omitempty"`
839         ObjID              uint32       `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
840         ClassifyTableIndex uint32       `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
841 }
842
843 // IP4Prefix defines type 'ip4_prefix'.
844 type IP4Prefix struct {
845         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
846         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
847 }
848
849 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
850         hasPrefix := strings.Contains(s, "/")
851         if hasPrefix {
852                 ip, network, err := net.ParseCIDR(s)
853                 if err != nil {
854                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
855                 }
856                 maskSize, _ := network.Mask.Size()
857                 prefix.Len = byte(maskSize)
858                 prefix.Address, err = ParseIP4Address(ip.String())
859                 if err != nil {
860                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
861                 }
862         } else {
863                 ip := net.ParseIP(s)
864                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
865                 if ip.To4() == nil {
866                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
867                 }
868                 prefix.Len = byte(defaultMaskSize)
869                 prefix.Address, err = ParseIP4Address(ip.String())
870                 if err != nil {
871                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
872                 }
873         }
874         return prefix, nil
875 }
876
877 func (x IP4Prefix) ToIPNet() *net.IPNet {
878         mask := net.CIDRMask(int(x.Len), 32)
879         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
880         return ipnet
881 }
882
883 func (x IP4Prefix) String() string {
884         ip := x.Address.String()
885         return ip + "/" + strconv.Itoa(int(x.Len))
886 }
887
888 func (x *IP4Prefix) MarshalText() ([]byte, error) {
889         return []byte(x.String()), nil
890 }
891
892 func (x *IP4Prefix) UnmarshalText(text []byte) error {
893         prefix, err := ParseIP4Prefix(string(text))
894         if err != nil {
895                 return err
896         }
897         *x = prefix
898         return nil
899 }
900
901 // IP6Prefix defines type 'ip6_prefix'.
902 type IP6Prefix struct {
903         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
904         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
905 }
906
907 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
908         hasPrefix := strings.Contains(s, "/")
909         if hasPrefix {
910                 ip, network, err := net.ParseCIDR(s)
911                 if err != nil {
912                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
913                 }
914                 maskSize, _ := network.Mask.Size()
915                 prefix.Len = byte(maskSize)
916                 prefix.Address, err = ParseIP6Address(ip.String())
917                 if err != nil {
918                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
919                 }
920         } else {
921                 ip := net.ParseIP(s)
922                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
923                 if ip.To4() == nil {
924                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
925                 }
926                 prefix.Len = byte(defaultMaskSize)
927                 prefix.Address, err = ParseIP6Address(ip.String())
928                 if err != nil {
929                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
930                 }
931         }
932         return prefix, nil
933 }
934
935 func (x IP6Prefix) ToIPNet() *net.IPNet {
936         mask := net.CIDRMask(int(x.Len), 128)
937         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
938         return ipnet
939 }
940
941 func (x IP6Prefix) String() string {
942         ip := x.Address.String()
943         return ip + "/" + strconv.Itoa(int(x.Len))
944 }
945
946 func (x *IP6Prefix) MarshalText() ([]byte, error) {
947         return []byte(x.String()), nil
948 }
949
950 func (x *IP6Prefix) UnmarshalText(text []byte) error {
951         prefix, err := ParseIP6Prefix(string(text))
952         if err != nil {
953                 return err
954         }
955         *x = prefix
956         return nil
957 }
958
959 // Mprefix defines type 'mprefix'.
960 type Mprefix struct {
961         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
962         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
963         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
964         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
965 }
966
967 // Prefix defines type 'prefix'.
968 type Prefix struct {
969         Address Address `binapi:"address,name=address" json:"address,omitempty"`
970         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
971 }
972
973 func ParsePrefix(ip string) (prefix Prefix, err error) {
974         hasPrefix := strings.Contains(ip, "/")
975         if hasPrefix {
976                 netIP, network, err := net.ParseCIDR(ip)
977                 if err != nil {
978                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
979                 }
980                 maskSize, _ := network.Mask.Size()
981                 prefix.Len = byte(maskSize)
982                 prefix.Address, err = ParseAddress(netIP.String())
983                 if err != nil {
984                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
985                 }
986         } else {
987                 netIP := net.ParseIP(ip)
988                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
989                 if netIP.To4() == nil {
990                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
991                 }
992                 prefix.Len = byte(defaultMaskSize)
993                 prefix.Address, err = ParseAddress(netIP.String())
994                 if err != nil {
995                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
996                 }
997         }
998         return prefix, nil
999 }
1000
1001 func (x Prefix) ToIPNet() *net.IPNet {
1002         var mask net.IPMask
1003         if x.Address.Af == ADDRESS_IP4 {
1004                 mask = net.CIDRMask(int(x.Len), 32)
1005         } else {
1006                 mask = net.CIDRMask(int(x.Len), 128)
1007         }
1008         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
1009         return ipnet
1010 }
1011
1012 func (x Prefix) String() string {
1013         ip := x.Address.String()
1014         return ip + "/" + strconv.Itoa(int(x.Len))
1015 }
1016
1017 func (x *Prefix) MarshalText() ([]byte, error) {
1018         return []byte(x.String()), nil
1019 }
1020
1021 func (x *Prefix) UnmarshalText(text []byte) error {
1022         prefix, err := ParsePrefix(string(text))
1023         if err != nil {
1024                 return err
1025         }
1026         *x = prefix
1027         return nil
1028 }
1029
1030 // PrefixMatcher defines type 'prefix_matcher'.
1031 type PrefixMatcher struct {
1032         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1033         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1034 }
1035
1036 // AddressUnion defines union 'address_union'.
1037 type AddressUnion struct {
1038         // AddressUnion can be one of:
1039         // - IP4 *IP4Address
1040         // - IP6 *IP6Address
1041         XXX_UnionData [16]byte
1042 }
1043
1044 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1045         u.SetIP4(a)
1046         return
1047 }
1048 func (u *AddressUnion) SetIP4(a IP4Address) {
1049         buf := codec.NewBuffer(u.XXX_UnionData[:])
1050         buf.EncodeBytes(a[:], 4)
1051 }
1052 func (u *AddressUnion) GetIP4() (a IP4Address) {
1053         buf := codec.NewBuffer(u.XXX_UnionData[:])
1054         copy(a[:], buf.DecodeBytes(4))
1055         return
1056 }
1057
1058 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1059         u.SetIP6(a)
1060         return
1061 }
1062 func (u *AddressUnion) SetIP6(a IP6Address) {
1063         buf := codec.NewBuffer(u.XXX_UnionData[:])
1064         buf.EncodeBytes(a[:], 16)
1065 }
1066 func (u *AddressUnion) GetIP6() (a IP6Address) {
1067         buf := codec.NewBuffer(u.XXX_UnionData[:])
1068         copy(a[:], buf.DecodeBytes(16))
1069         return
1070 }
1071
1072 // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'.
1073 type AbfItfAttachAddDel struct {
1074         IsAdd  bool         `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1075         Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1076 }
1077
1078 func (m *AbfItfAttachAddDel) Reset()               { *m = AbfItfAttachAddDel{} }
1079 func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" }
1080 func (*AbfItfAttachAddDel) GetCrcString() string   { return "25c8621b" }
1081 func (*AbfItfAttachAddDel) GetMessageType() api.MessageType {
1082         return api.RequestMessage
1083 }
1084
1085 func (m *AbfItfAttachAddDel) Size() (size int) {
1086         if m == nil {
1087                 return 0
1088         }
1089         size += 1 // m.IsAdd
1090         size += 4 // m.Attach.PolicyID
1091         size += 4 // m.Attach.SwIfIndex
1092         size += 4 // m.Attach.Priority
1093         size += 1 // m.Attach.IsIPv6
1094         return size
1095 }
1096 func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) {
1097         if b == nil {
1098                 b = make([]byte, m.Size())
1099         }
1100         buf := codec.NewBuffer(b)
1101         buf.EncodeBool(m.IsAdd)
1102         buf.EncodeUint32(m.Attach.PolicyID)
1103         buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1104         buf.EncodeUint32(m.Attach.Priority)
1105         buf.EncodeBool(m.Attach.IsIPv6)
1106         return buf.Bytes(), nil
1107 }
1108 func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error {
1109         buf := codec.NewBuffer(b)
1110         m.IsAdd = buf.DecodeBool()
1111         m.Attach.PolicyID = buf.DecodeUint32()
1112         m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1113         m.Attach.Priority = buf.DecodeUint32()
1114         m.Attach.IsIPv6 = buf.DecodeBool()
1115         return nil
1116 }
1117
1118 // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'.
1119 type AbfItfAttachAddDelReply struct {
1120         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1121 }
1122
1123 func (m *AbfItfAttachAddDelReply) Reset()               { *m = AbfItfAttachAddDelReply{} }
1124 func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" }
1125 func (*AbfItfAttachAddDelReply) GetCrcString() string   { return "e8d4e804" }
1126 func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType {
1127         return api.ReplyMessage
1128 }
1129
1130 func (m *AbfItfAttachAddDelReply) Size() (size int) {
1131         if m == nil {
1132                 return 0
1133         }
1134         size += 4 // m.Retval
1135         return size
1136 }
1137 func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) {
1138         if b == nil {
1139                 b = make([]byte, m.Size())
1140         }
1141         buf := codec.NewBuffer(b)
1142         buf.EncodeInt32(m.Retval)
1143         return buf.Bytes(), nil
1144 }
1145 func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error {
1146         buf := codec.NewBuffer(b)
1147         m.Retval = buf.DecodeInt32()
1148         return nil
1149 }
1150
1151 // AbfItfAttachDetails defines message 'abf_itf_attach_details'.
1152 type AbfItfAttachDetails struct {
1153         Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1154 }
1155
1156 func (m *AbfItfAttachDetails) Reset()               { *m = AbfItfAttachDetails{} }
1157 func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" }
1158 func (*AbfItfAttachDetails) GetCrcString() string   { return "7819523e" }
1159 func (*AbfItfAttachDetails) GetMessageType() api.MessageType {
1160         return api.ReplyMessage
1161 }
1162
1163 func (m *AbfItfAttachDetails) Size() (size int) {
1164         if m == nil {
1165                 return 0
1166         }
1167         size += 4 // m.Attach.PolicyID
1168         size += 4 // m.Attach.SwIfIndex
1169         size += 4 // m.Attach.Priority
1170         size += 1 // m.Attach.IsIPv6
1171         return size
1172 }
1173 func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) {
1174         if b == nil {
1175                 b = make([]byte, m.Size())
1176         }
1177         buf := codec.NewBuffer(b)
1178         buf.EncodeUint32(m.Attach.PolicyID)
1179         buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1180         buf.EncodeUint32(m.Attach.Priority)
1181         buf.EncodeBool(m.Attach.IsIPv6)
1182         return buf.Bytes(), nil
1183 }
1184 func (m *AbfItfAttachDetails) Unmarshal(b []byte) error {
1185         buf := codec.NewBuffer(b)
1186         m.Attach.PolicyID = buf.DecodeUint32()
1187         m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1188         m.Attach.Priority = buf.DecodeUint32()
1189         m.Attach.IsIPv6 = buf.DecodeBool()
1190         return nil
1191 }
1192
1193 // AbfItfAttachDump defines message 'abf_itf_attach_dump'.
1194 type AbfItfAttachDump struct{}
1195
1196 func (m *AbfItfAttachDump) Reset()               { *m = AbfItfAttachDump{} }
1197 func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" }
1198 func (*AbfItfAttachDump) GetCrcString() string   { return "51077d14" }
1199 func (*AbfItfAttachDump) GetMessageType() api.MessageType {
1200         return api.RequestMessage
1201 }
1202
1203 func (m *AbfItfAttachDump) Size() (size int) {
1204         if m == nil {
1205                 return 0
1206         }
1207         return size
1208 }
1209 func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) {
1210         if b == nil {
1211                 b = make([]byte, m.Size())
1212         }
1213         buf := codec.NewBuffer(b)
1214         return buf.Bytes(), nil
1215 }
1216 func (m *AbfItfAttachDump) Unmarshal(b []byte) error {
1217         return nil
1218 }
1219
1220 // AbfPluginGetVersion defines message 'abf_plugin_get_version'.
1221 type AbfPluginGetVersion struct{}
1222
1223 func (m *AbfPluginGetVersion) Reset()               { *m = AbfPluginGetVersion{} }
1224 func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" }
1225 func (*AbfPluginGetVersion) GetCrcString() string   { return "51077d14" }
1226 func (*AbfPluginGetVersion) GetMessageType() api.MessageType {
1227         return api.RequestMessage
1228 }
1229
1230 func (m *AbfPluginGetVersion) Size() (size int) {
1231         if m == nil {
1232                 return 0
1233         }
1234         return size
1235 }
1236 func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) {
1237         if b == nil {
1238                 b = make([]byte, m.Size())
1239         }
1240         buf := codec.NewBuffer(b)
1241         return buf.Bytes(), nil
1242 }
1243 func (m *AbfPluginGetVersion) Unmarshal(b []byte) error {
1244         return nil
1245 }
1246
1247 // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'.
1248 type AbfPluginGetVersionReply struct {
1249         Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1250         Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1251 }
1252
1253 func (m *AbfPluginGetVersionReply) Reset()               { *m = AbfPluginGetVersionReply{} }
1254 func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" }
1255 func (*AbfPluginGetVersionReply) GetCrcString() string   { return "9b32cf86" }
1256 func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType {
1257         return api.ReplyMessage
1258 }
1259
1260 func (m *AbfPluginGetVersionReply) Size() (size int) {
1261         if m == nil {
1262                 return 0
1263         }
1264         size += 4 // m.Major
1265         size += 4 // m.Minor
1266         return size
1267 }
1268 func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1269         if b == nil {
1270                 b = make([]byte, m.Size())
1271         }
1272         buf := codec.NewBuffer(b)
1273         buf.EncodeUint32(m.Major)
1274         buf.EncodeUint32(m.Minor)
1275         return buf.Bytes(), nil
1276 }
1277 func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error {
1278         buf := codec.NewBuffer(b)
1279         m.Major = buf.DecodeUint32()
1280         m.Minor = buf.DecodeUint32()
1281         return nil
1282 }
1283
1284 // AbfPolicyAddDel defines message 'abf_policy_add_del'.
1285 type AbfPolicyAddDel struct {
1286         IsAdd  bool      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1287         Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1288 }
1289
1290 func (m *AbfPolicyAddDel) Reset()               { *m = AbfPolicyAddDel{} }
1291 func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" }
1292 func (*AbfPolicyAddDel) GetCrcString() string   { return "ee66f93e" }
1293 func (*AbfPolicyAddDel) GetMessageType() api.MessageType {
1294         return api.RequestMessage
1295 }
1296
1297 func (m *AbfPolicyAddDel) Size() (size int) {
1298         if m == nil {
1299                 return 0
1300         }
1301         size += 1 // m.IsAdd
1302         size += 4 // m.Policy.PolicyID
1303         size += 4 // m.Policy.ACLIndex
1304         size += 1 // m.Policy.NPaths
1305         for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1306                 var s2 FibPath
1307                 _ = s2
1308                 if j2 < len(m.Policy.Paths) {
1309                         s2 = m.Policy.Paths[j2]
1310                 }
1311                 size += 4      // s2.SwIfIndex
1312                 size += 4      // s2.TableID
1313                 size += 4      // s2.RpfID
1314                 size += 1      // s2.Weight
1315                 size += 1      // s2.Preference
1316                 size += 4      // s2.Type
1317                 size += 4      // s2.Flags
1318                 size += 4      // s2.Proto
1319                 size += 1 * 16 // s2.Nh.Address
1320                 size += 4      // s2.Nh.ViaLabel
1321                 size += 4      // s2.Nh.ObjID
1322                 size += 4      // s2.Nh.ClassifyTableIndex
1323                 size += 1      // s2.NLabels
1324                 for j3 := 0; j3 < 16; j3++ {
1325                         size += 1 // s2.LabelStack[j3].IsUniform
1326                         size += 4 // s2.LabelStack[j3].Label
1327                         size += 1 // s2.LabelStack[j3].TTL
1328                         size += 1 // s2.LabelStack[j3].Exp
1329                 }
1330         }
1331         return size
1332 }
1333 func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) {
1334         if b == nil {
1335                 b = make([]byte, m.Size())
1336         }
1337         buf := codec.NewBuffer(b)
1338         buf.EncodeBool(m.IsAdd)
1339         buf.EncodeUint32(m.Policy.PolicyID)
1340         buf.EncodeUint32(m.Policy.ACLIndex)
1341         buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1342         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1343                 var v1 FibPath // Paths
1344                 if j1 < len(m.Policy.Paths) {
1345                         v1 = m.Policy.Paths[j1]
1346                 }
1347                 buf.EncodeUint32(v1.SwIfIndex)
1348                 buf.EncodeUint32(v1.TableID)
1349                 buf.EncodeUint32(v1.RpfID)
1350                 buf.EncodeUint8(v1.Weight)
1351                 buf.EncodeUint8(v1.Preference)
1352                 buf.EncodeUint32(uint32(v1.Type))
1353                 buf.EncodeUint32(uint32(v1.Flags))
1354                 buf.EncodeUint32(uint32(v1.Proto))
1355                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1356                 buf.EncodeUint32(v1.Nh.ViaLabel)
1357                 buf.EncodeUint32(v1.Nh.ObjID)
1358                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1359                 buf.EncodeUint8(v1.NLabels)
1360                 for j2 := 0; j2 < 16; j2++ {
1361                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1362                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1363                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1364                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1365                 }
1366         }
1367         return buf.Bytes(), nil
1368 }
1369 func (m *AbfPolicyAddDel) Unmarshal(b []byte) error {
1370         buf := codec.NewBuffer(b)
1371         m.IsAdd = buf.DecodeBool()
1372         m.Policy.PolicyID = buf.DecodeUint32()
1373         m.Policy.ACLIndex = buf.DecodeUint32()
1374         m.Policy.NPaths = buf.DecodeUint8()
1375         m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1376         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1377                 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1378                 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1379                 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1380                 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1381                 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1382                 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1383                 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1384                 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1385                 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1386                 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1387                 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1388                 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1389                 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1390                 for j2 := 0; j2 < 16; j2++ {
1391                         m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1392                         m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1393                         m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1394                         m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1395                 }
1396         }
1397         return nil
1398 }
1399
1400 // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'.
1401 type AbfPolicyAddDelReply struct {
1402         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1403 }
1404
1405 func (m *AbfPolicyAddDelReply) Reset()               { *m = AbfPolicyAddDelReply{} }
1406 func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" }
1407 func (*AbfPolicyAddDelReply) GetCrcString() string   { return "e8d4e804" }
1408 func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType {
1409         return api.ReplyMessage
1410 }
1411
1412 func (m *AbfPolicyAddDelReply) Size() (size int) {
1413         if m == nil {
1414                 return 0
1415         }
1416         size += 4 // m.Retval
1417         return size
1418 }
1419 func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) {
1420         if b == nil {
1421                 b = make([]byte, m.Size())
1422         }
1423         buf := codec.NewBuffer(b)
1424         buf.EncodeInt32(m.Retval)
1425         return buf.Bytes(), nil
1426 }
1427 func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error {
1428         buf := codec.NewBuffer(b)
1429         m.Retval = buf.DecodeInt32()
1430         return nil
1431 }
1432
1433 // AbfPolicyDetails defines message 'abf_policy_details'.
1434 type AbfPolicyDetails struct {
1435         Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1436 }
1437
1438 func (m *AbfPolicyDetails) Reset()               { *m = AbfPolicyDetails{} }
1439 func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" }
1440 func (*AbfPolicyDetails) GetCrcString() string   { return "6769e504" }
1441 func (*AbfPolicyDetails) GetMessageType() api.MessageType {
1442         return api.ReplyMessage
1443 }
1444
1445 func (m *AbfPolicyDetails) Size() (size int) {
1446         if m == nil {
1447                 return 0
1448         }
1449         size += 4 // m.Policy.PolicyID
1450         size += 4 // m.Policy.ACLIndex
1451         size += 1 // m.Policy.NPaths
1452         for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1453                 var s2 FibPath
1454                 _ = s2
1455                 if j2 < len(m.Policy.Paths) {
1456                         s2 = m.Policy.Paths[j2]
1457                 }
1458                 size += 4      // s2.SwIfIndex
1459                 size += 4      // s2.TableID
1460                 size += 4      // s2.RpfID
1461                 size += 1      // s2.Weight
1462                 size += 1      // s2.Preference
1463                 size += 4      // s2.Type
1464                 size += 4      // s2.Flags
1465                 size += 4      // s2.Proto
1466                 size += 1 * 16 // s2.Nh.Address
1467                 size += 4      // s2.Nh.ViaLabel
1468                 size += 4      // s2.Nh.ObjID
1469                 size += 4      // s2.Nh.ClassifyTableIndex
1470                 size += 1      // s2.NLabels
1471                 for j3 := 0; j3 < 16; j3++ {
1472                         size += 1 // s2.LabelStack[j3].IsUniform
1473                         size += 4 // s2.LabelStack[j3].Label
1474                         size += 1 // s2.LabelStack[j3].TTL
1475                         size += 1 // s2.LabelStack[j3].Exp
1476                 }
1477         }
1478         return size
1479 }
1480 func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) {
1481         if b == nil {
1482                 b = make([]byte, m.Size())
1483         }
1484         buf := codec.NewBuffer(b)
1485         buf.EncodeUint32(m.Policy.PolicyID)
1486         buf.EncodeUint32(m.Policy.ACLIndex)
1487         buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1488         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1489                 var v1 FibPath // Paths
1490                 if j1 < len(m.Policy.Paths) {
1491                         v1 = m.Policy.Paths[j1]
1492                 }
1493                 buf.EncodeUint32(v1.SwIfIndex)
1494                 buf.EncodeUint32(v1.TableID)
1495                 buf.EncodeUint32(v1.RpfID)
1496                 buf.EncodeUint8(v1.Weight)
1497                 buf.EncodeUint8(v1.Preference)
1498                 buf.EncodeUint32(uint32(v1.Type))
1499                 buf.EncodeUint32(uint32(v1.Flags))
1500                 buf.EncodeUint32(uint32(v1.Proto))
1501                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1502                 buf.EncodeUint32(v1.Nh.ViaLabel)
1503                 buf.EncodeUint32(v1.Nh.ObjID)
1504                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1505                 buf.EncodeUint8(v1.NLabels)
1506                 for j2 := 0; j2 < 16; j2++ {
1507                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1508                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1509                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1510                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1511                 }
1512         }
1513         return buf.Bytes(), nil
1514 }
1515 func (m *AbfPolicyDetails) Unmarshal(b []byte) error {
1516         buf := codec.NewBuffer(b)
1517         m.Policy.PolicyID = buf.DecodeUint32()
1518         m.Policy.ACLIndex = buf.DecodeUint32()
1519         m.Policy.NPaths = buf.DecodeUint8()
1520         m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1521         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1522                 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1523                 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1524                 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1525                 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1526                 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1527                 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1528                 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1529                 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1530                 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1531                 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1532                 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1533                 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1534                 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1535                 for j2 := 0; j2 < 16; j2++ {
1536                         m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1537                         m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1538                         m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1539                         m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1540                 }
1541         }
1542         return nil
1543 }
1544
1545 // AbfPolicyDump defines message 'abf_policy_dump'.
1546 type AbfPolicyDump struct{}
1547
1548 func (m *AbfPolicyDump) Reset()               { *m = AbfPolicyDump{} }
1549 func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" }
1550 func (*AbfPolicyDump) GetCrcString() string   { return "51077d14" }
1551 func (*AbfPolicyDump) GetMessageType() api.MessageType {
1552         return api.RequestMessage
1553 }
1554
1555 func (m *AbfPolicyDump) Size() (size int) {
1556         if m == nil {
1557                 return 0
1558         }
1559         return size
1560 }
1561 func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) {
1562         if b == nil {
1563                 b = make([]byte, m.Size())
1564         }
1565         buf := codec.NewBuffer(b)
1566         return buf.Bytes(), nil
1567 }
1568 func (m *AbfPolicyDump) Unmarshal(b []byte) error {
1569         return nil
1570 }
1571
1572 func init() { file_abf_binapi_init() }
1573 func file_abf_binapi_init() {
1574         api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b")
1575         api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804")
1576         api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e")
1577         api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14")
1578         api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14")
1579         api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86")
1580         api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e")
1581         api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804")
1582         api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504")
1583         api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14")
1584 }
1585
1586 // Messages returns list of all messages in this module.
1587 func AllMessages() []api.Message {
1588         return []api.Message{
1589                 (*AbfItfAttachAddDel)(nil),
1590                 (*AbfItfAttachAddDelReply)(nil),
1591                 (*AbfItfAttachDetails)(nil),
1592                 (*AbfItfAttachDump)(nil),
1593                 (*AbfPluginGetVersion)(nil),
1594                 (*AbfPluginGetVersionReply)(nil),
1595                 (*AbfPolicyAddDel)(nil),
1596                 (*AbfPolicyAddDelReply)(nil),
1597                 (*AbfPolicyDetails)(nil),
1598                 (*AbfPolicyDump)(nil),
1599         }
1600 }