a7b67bdd097a233f681b49b988a19ff0adbd7e49
[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.4.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         api "git.fd.io/govpp.git/api"
21         codec "git.fd.io/govpp.git/codec"
22         "net"
23         "strconv"
24         "strings"
25 )
26
27 // This is a compile-time assertion to ensure that this generated file
28 // is compatible with the GoVPP api package it is being compiled against.
29 // A compilation error at this line likely means your copy of the
30 // GoVPP api package needs to be updated.
31 const _ = api.GoVppAPIPackageIsVersion2
32
33 const (
34         APIFile    = "abf"
35         APIVersion = "1.0.0"
36         VersionCrc = 0xc2e5c644
37 )
38
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
41
42 const (
43         ADDRESS_IP4 AddressFamily = 0
44         ADDRESS_IP6 AddressFamily = 1
45 )
46
47 var (
48         AddressFamily_name = map[uint32]string{
49                 0: "ADDRESS_IP4",
50                 1: "ADDRESS_IP6",
51         }
52         AddressFamily_value = map[string]uint32{
53                 "ADDRESS_IP4": 0,
54                 "ADDRESS_IP6": 1,
55         }
56 )
57
58 func (x AddressFamily) String() string {
59         s, ok := AddressFamily_name[uint32(x)]
60         if ok {
61                 return s
62         }
63         return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
64 }
65
66 // FibPathFlags defines enum 'fib_path_flags'.
67 type FibPathFlags uint32
68
69 const (
70         FIB_API_PATH_FLAG_NONE                 FibPathFlags = 0
71         FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
72         FIB_API_PATH_FLAG_RESOLVE_VIA_HOST     FibPathFlags = 2
73         FIB_API_PATH_FLAG_POP_PW_CW            FibPathFlags = 4
74 )
75
76 var (
77         FibPathFlags_name = map[uint32]string{
78                 0: "FIB_API_PATH_FLAG_NONE",
79                 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
80                 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
81                 4: "FIB_API_PATH_FLAG_POP_PW_CW",
82         }
83         FibPathFlags_value = map[string]uint32{
84                 "FIB_API_PATH_FLAG_NONE":                 0,
85                 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
86                 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST":     2,
87                 "FIB_API_PATH_FLAG_POP_PW_CW":            4,
88         }
89 )
90
91 func (x FibPathFlags) String() string {
92         s, ok := FibPathFlags_name[uint32(x)]
93         if ok {
94                 return s
95         }
96         str := func(n uint32) string {
97                 s, ok := FibPathFlags_name[uint32(n)]
98                 if ok {
99                         return s
100                 }
101                 return "FibPathFlags(" + strconv.Itoa(int(n)) + ")"
102         }
103         for i := uint32(0); i <= 32; i++ {
104                 val := uint32(x)
105                 if val&(1<<i) != 0 {
106                         if s != "" {
107                                 s += "|"
108                         }
109                         s += str(1 << i)
110                 }
111         }
112         if s == "" {
113                 return str(uint32(x))
114         }
115         return s
116 }
117
118 // FibPathNhProto defines enum 'fib_path_nh_proto'.
119 type FibPathNhProto uint32
120
121 const (
122         FIB_API_PATH_NH_PROTO_IP4      FibPathNhProto = 0
123         FIB_API_PATH_NH_PROTO_IP6      FibPathNhProto = 1
124         FIB_API_PATH_NH_PROTO_MPLS     FibPathNhProto = 2
125         FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
126         FIB_API_PATH_NH_PROTO_BIER     FibPathNhProto = 4
127 )
128
129 var (
130         FibPathNhProto_name = map[uint32]string{
131                 0: "FIB_API_PATH_NH_PROTO_IP4",
132                 1: "FIB_API_PATH_NH_PROTO_IP6",
133                 2: "FIB_API_PATH_NH_PROTO_MPLS",
134                 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
135                 4: "FIB_API_PATH_NH_PROTO_BIER",
136         }
137         FibPathNhProto_value = map[string]uint32{
138                 "FIB_API_PATH_NH_PROTO_IP4":      0,
139                 "FIB_API_PATH_NH_PROTO_IP6":      1,
140                 "FIB_API_PATH_NH_PROTO_MPLS":     2,
141                 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
142                 "FIB_API_PATH_NH_PROTO_BIER":     4,
143         }
144 )
145
146 func (x FibPathNhProto) String() string {
147         s, ok := FibPathNhProto_name[uint32(x)]
148         if ok {
149                 return s
150         }
151         return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
152 }
153
154 // FibPathType defines enum 'fib_path_type'.
155 type FibPathType uint32
156
157 const (
158         FIB_API_PATH_TYPE_NORMAL        FibPathType = 0
159         FIB_API_PATH_TYPE_LOCAL         FibPathType = 1
160         FIB_API_PATH_TYPE_DROP          FibPathType = 2
161         FIB_API_PATH_TYPE_UDP_ENCAP     FibPathType = 3
162         FIB_API_PATH_TYPE_BIER_IMP      FibPathType = 4
163         FIB_API_PATH_TYPE_ICMP_UNREACH  FibPathType = 5
164         FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
165         FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
166         FIB_API_PATH_TYPE_DVR           FibPathType = 8
167         FIB_API_PATH_TYPE_INTERFACE_RX  FibPathType = 9
168         FIB_API_PATH_TYPE_CLASSIFY      FibPathType = 10
169 )
170
171 var (
172         FibPathType_name = map[uint32]string{
173                 0:  "FIB_API_PATH_TYPE_NORMAL",
174                 1:  "FIB_API_PATH_TYPE_LOCAL",
175                 2:  "FIB_API_PATH_TYPE_DROP",
176                 3:  "FIB_API_PATH_TYPE_UDP_ENCAP",
177                 4:  "FIB_API_PATH_TYPE_BIER_IMP",
178                 5:  "FIB_API_PATH_TYPE_ICMP_UNREACH",
179                 6:  "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
180                 7:  "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
181                 8:  "FIB_API_PATH_TYPE_DVR",
182                 9:  "FIB_API_PATH_TYPE_INTERFACE_RX",
183                 10: "FIB_API_PATH_TYPE_CLASSIFY",
184         }
185         FibPathType_value = map[string]uint32{
186                 "FIB_API_PATH_TYPE_NORMAL":        0,
187                 "FIB_API_PATH_TYPE_LOCAL":         1,
188                 "FIB_API_PATH_TYPE_DROP":          2,
189                 "FIB_API_PATH_TYPE_UDP_ENCAP":     3,
190                 "FIB_API_PATH_TYPE_BIER_IMP":      4,
191                 "FIB_API_PATH_TYPE_ICMP_UNREACH":  5,
192                 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
193                 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
194                 "FIB_API_PATH_TYPE_DVR":           8,
195                 "FIB_API_PATH_TYPE_INTERFACE_RX":  9,
196                 "FIB_API_PATH_TYPE_CLASSIFY":      10,
197         }
198 )
199
200 func (x FibPathType) String() string {
201         s, ok := FibPathType_name[uint32(x)]
202         if ok {
203                 return s
204         }
205         return "FibPathType(" + strconv.Itoa(int(x)) + ")"
206 }
207
208 // IfStatusFlags defines enum 'if_status_flags'.
209 type IfStatusFlags uint32
210
211 const (
212         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
213         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
214 )
215
216 var (
217         IfStatusFlags_name = map[uint32]string{
218                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
219                 2: "IF_STATUS_API_FLAG_LINK_UP",
220         }
221         IfStatusFlags_value = map[string]uint32{
222                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
223                 "IF_STATUS_API_FLAG_LINK_UP":  2,
224         }
225 )
226
227 func (x IfStatusFlags) String() string {
228         s, ok := IfStatusFlags_name[uint32(x)]
229         if ok {
230                 return s
231         }
232         str := func(n uint32) string {
233                 s, ok := IfStatusFlags_name[uint32(n)]
234                 if ok {
235                         return s
236                 }
237                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
238         }
239         for i := uint32(0); i <= 32; i++ {
240                 val := uint32(x)
241                 if val&(1<<i) != 0 {
242                         if s != "" {
243                                 s += "|"
244                         }
245                         s += str(1 << i)
246                 }
247         }
248         if s == "" {
249                 return str(uint32(x))
250         }
251         return s
252 }
253
254 // IfType defines enum 'if_type'.
255 type IfType uint32
256
257 const (
258         IF_API_TYPE_HARDWARE IfType = 1
259         IF_API_TYPE_SUB      IfType = 2
260         IF_API_TYPE_P2P      IfType = 3
261         IF_API_TYPE_PIPE     IfType = 4
262 )
263
264 var (
265         IfType_name = map[uint32]string{
266                 1: "IF_API_TYPE_HARDWARE",
267                 2: "IF_API_TYPE_SUB",
268                 3: "IF_API_TYPE_P2P",
269                 4: "IF_API_TYPE_PIPE",
270         }
271         IfType_value = map[string]uint32{
272                 "IF_API_TYPE_HARDWARE": 1,
273                 "IF_API_TYPE_SUB":      2,
274                 "IF_API_TYPE_P2P":      3,
275                 "IF_API_TYPE_PIPE":     4,
276         }
277 )
278
279 func (x IfType) String() string {
280         s, ok := IfType_name[uint32(x)]
281         if ok {
282                 return s
283         }
284         return "IfType(" + strconv.Itoa(int(x)) + ")"
285 }
286
287 // IPDscp defines enum 'ip_dscp'.
288 type IPDscp uint8
289
290 const (
291         IP_API_DSCP_CS0  IPDscp = 0
292         IP_API_DSCP_CS1  IPDscp = 8
293         IP_API_DSCP_AF11 IPDscp = 10
294         IP_API_DSCP_AF12 IPDscp = 12
295         IP_API_DSCP_AF13 IPDscp = 14
296         IP_API_DSCP_CS2  IPDscp = 16
297         IP_API_DSCP_AF21 IPDscp = 18
298         IP_API_DSCP_AF22 IPDscp = 20
299         IP_API_DSCP_AF23 IPDscp = 22
300         IP_API_DSCP_CS3  IPDscp = 24
301         IP_API_DSCP_AF31 IPDscp = 26
302         IP_API_DSCP_AF32 IPDscp = 28
303         IP_API_DSCP_AF33 IPDscp = 30
304         IP_API_DSCP_CS4  IPDscp = 32
305         IP_API_DSCP_AF41 IPDscp = 34
306         IP_API_DSCP_AF42 IPDscp = 36
307         IP_API_DSCP_AF43 IPDscp = 38
308         IP_API_DSCP_CS5  IPDscp = 40
309         IP_API_DSCP_EF   IPDscp = 46
310         IP_API_DSCP_CS6  IPDscp = 48
311         IP_API_DSCP_CS7  IPDscp = 50
312 )
313
314 var (
315         IPDscp_name = map[uint8]string{
316                 0:  "IP_API_DSCP_CS0",
317                 8:  "IP_API_DSCP_CS1",
318                 10: "IP_API_DSCP_AF11",
319                 12: "IP_API_DSCP_AF12",
320                 14: "IP_API_DSCP_AF13",
321                 16: "IP_API_DSCP_CS2",
322                 18: "IP_API_DSCP_AF21",
323                 20: "IP_API_DSCP_AF22",
324                 22: "IP_API_DSCP_AF23",
325                 24: "IP_API_DSCP_CS3",
326                 26: "IP_API_DSCP_AF31",
327                 28: "IP_API_DSCP_AF32",
328                 30: "IP_API_DSCP_AF33",
329                 32: "IP_API_DSCP_CS4",
330                 34: "IP_API_DSCP_AF41",
331                 36: "IP_API_DSCP_AF42",
332                 38: "IP_API_DSCP_AF43",
333                 40: "IP_API_DSCP_CS5",
334                 46: "IP_API_DSCP_EF",
335                 48: "IP_API_DSCP_CS6",
336                 50: "IP_API_DSCP_CS7",
337         }
338         IPDscp_value = map[string]uint8{
339                 "IP_API_DSCP_CS0":  0,
340                 "IP_API_DSCP_CS1":  8,
341                 "IP_API_DSCP_AF11": 10,
342                 "IP_API_DSCP_AF12": 12,
343                 "IP_API_DSCP_AF13": 14,
344                 "IP_API_DSCP_CS2":  16,
345                 "IP_API_DSCP_AF21": 18,
346                 "IP_API_DSCP_AF22": 20,
347                 "IP_API_DSCP_AF23": 22,
348                 "IP_API_DSCP_CS3":  24,
349                 "IP_API_DSCP_AF31": 26,
350                 "IP_API_DSCP_AF32": 28,
351                 "IP_API_DSCP_AF33": 30,
352                 "IP_API_DSCP_CS4":  32,
353                 "IP_API_DSCP_AF41": 34,
354                 "IP_API_DSCP_AF42": 36,
355                 "IP_API_DSCP_AF43": 38,
356                 "IP_API_DSCP_CS5":  40,
357                 "IP_API_DSCP_EF":   46,
358                 "IP_API_DSCP_CS6":  48,
359                 "IP_API_DSCP_CS7":  50,
360         }
361 )
362
363 func (x IPDscp) String() string {
364         s, ok := IPDscp_name[uint8(x)]
365         if ok {
366                 return s
367         }
368         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
369 }
370
371 // IPEcn defines enum 'ip_ecn'.
372 type IPEcn uint8
373
374 const (
375         IP_API_ECN_NONE IPEcn = 0
376         IP_API_ECN_ECT0 IPEcn = 1
377         IP_API_ECN_ECT1 IPEcn = 2
378         IP_API_ECN_CE   IPEcn = 3
379 )
380
381 var (
382         IPEcn_name = map[uint8]string{
383                 0: "IP_API_ECN_NONE",
384                 1: "IP_API_ECN_ECT0",
385                 2: "IP_API_ECN_ECT1",
386                 3: "IP_API_ECN_CE",
387         }
388         IPEcn_value = map[string]uint8{
389                 "IP_API_ECN_NONE": 0,
390                 "IP_API_ECN_ECT0": 1,
391                 "IP_API_ECN_ECT1": 2,
392                 "IP_API_ECN_CE":   3,
393         }
394 )
395
396 func (x IPEcn) String() string {
397         s, ok := IPEcn_name[uint8(x)]
398         if ok {
399                 return s
400         }
401         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
402 }
403
404 // IPProto defines enum 'ip_proto'.
405 type IPProto uint32
406
407 const (
408         IP_API_PROTO_HOPOPT   IPProto = 0
409         IP_API_PROTO_ICMP     IPProto = 1
410         IP_API_PROTO_IGMP     IPProto = 2
411         IP_API_PROTO_TCP      IPProto = 6
412         IP_API_PROTO_UDP      IPProto = 17
413         IP_API_PROTO_GRE      IPProto = 47
414         IP_API_PROTO_AH       IPProto = 50
415         IP_API_PROTO_ESP      IPProto = 51
416         IP_API_PROTO_EIGRP    IPProto = 88
417         IP_API_PROTO_OSPF     IPProto = 89
418         IP_API_PROTO_SCTP     IPProto = 132
419         IP_API_PROTO_RESERVED IPProto = 255
420 )
421
422 var (
423         IPProto_name = map[uint32]string{
424                 0:   "IP_API_PROTO_HOPOPT",
425                 1:   "IP_API_PROTO_ICMP",
426                 2:   "IP_API_PROTO_IGMP",
427                 6:   "IP_API_PROTO_TCP",
428                 17:  "IP_API_PROTO_UDP",
429                 47:  "IP_API_PROTO_GRE",
430                 50:  "IP_API_PROTO_AH",
431                 51:  "IP_API_PROTO_ESP",
432                 88:  "IP_API_PROTO_EIGRP",
433                 89:  "IP_API_PROTO_OSPF",
434                 132: "IP_API_PROTO_SCTP",
435                 255: "IP_API_PROTO_RESERVED",
436         }
437         IPProto_value = map[string]uint32{
438                 "IP_API_PROTO_HOPOPT":   0,
439                 "IP_API_PROTO_ICMP":     1,
440                 "IP_API_PROTO_IGMP":     2,
441                 "IP_API_PROTO_TCP":      6,
442                 "IP_API_PROTO_UDP":      17,
443                 "IP_API_PROTO_GRE":      47,
444                 "IP_API_PROTO_AH":       50,
445                 "IP_API_PROTO_ESP":      51,
446                 "IP_API_PROTO_EIGRP":    88,
447                 "IP_API_PROTO_OSPF":     89,
448                 "IP_API_PROTO_SCTP":     132,
449                 "IP_API_PROTO_RESERVED": 255,
450         }
451 )
452
453 func (x IPProto) String() string {
454         s, ok := IPProto_name[uint32(x)]
455         if ok {
456                 return s
457         }
458         return "IPProto(" + strconv.Itoa(int(x)) + ")"
459 }
460
461 // LinkDuplex defines enum 'link_duplex'.
462 type LinkDuplex uint32
463
464 const (
465         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
466         LINK_DUPLEX_API_HALF    LinkDuplex = 1
467         LINK_DUPLEX_API_FULL    LinkDuplex = 2
468 )
469
470 var (
471         LinkDuplex_name = map[uint32]string{
472                 0: "LINK_DUPLEX_API_UNKNOWN",
473                 1: "LINK_DUPLEX_API_HALF",
474                 2: "LINK_DUPLEX_API_FULL",
475         }
476         LinkDuplex_value = map[string]uint32{
477                 "LINK_DUPLEX_API_UNKNOWN": 0,
478                 "LINK_DUPLEX_API_HALF":    1,
479                 "LINK_DUPLEX_API_FULL":    2,
480         }
481 )
482
483 func (x LinkDuplex) String() string {
484         s, ok := LinkDuplex_name[uint32(x)]
485         if ok {
486                 return s
487         }
488         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
489 }
490
491 // MtuProto defines enum 'mtu_proto'.
492 type MtuProto uint32
493
494 const (
495         MTU_PROTO_API_L3   MtuProto = 1
496         MTU_PROTO_API_IP4  MtuProto = 2
497         MTU_PROTO_API_IP6  MtuProto = 3
498         MTU_PROTO_API_MPLS MtuProto = 4
499         MTU_PROTO_API_N    MtuProto = 5
500 )
501
502 var (
503         MtuProto_name = map[uint32]string{
504                 1: "MTU_PROTO_API_L3",
505                 2: "MTU_PROTO_API_IP4",
506                 3: "MTU_PROTO_API_IP6",
507                 4: "MTU_PROTO_API_MPLS",
508                 5: "MTU_PROTO_API_N",
509         }
510         MtuProto_value = map[string]uint32{
511                 "MTU_PROTO_API_L3":   1,
512                 "MTU_PROTO_API_IP4":  2,
513                 "MTU_PROTO_API_IP6":  3,
514                 "MTU_PROTO_API_MPLS": 4,
515                 "MTU_PROTO_API_N":    5,
516         }
517 )
518
519 func (x MtuProto) String() string {
520         s, ok := MtuProto_name[uint32(x)]
521         if ok {
522                 return s
523         }
524         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
525 }
526
527 // RxMode defines enum 'rx_mode'.
528 type RxMode uint32
529
530 const (
531         RX_MODE_API_UNKNOWN   RxMode = 0
532         RX_MODE_API_POLLING   RxMode = 1
533         RX_MODE_API_INTERRUPT RxMode = 2
534         RX_MODE_API_ADAPTIVE  RxMode = 3
535         RX_MODE_API_DEFAULT   RxMode = 4
536 )
537
538 var (
539         RxMode_name = map[uint32]string{
540                 0: "RX_MODE_API_UNKNOWN",
541                 1: "RX_MODE_API_POLLING",
542                 2: "RX_MODE_API_INTERRUPT",
543                 3: "RX_MODE_API_ADAPTIVE",
544                 4: "RX_MODE_API_DEFAULT",
545         }
546         RxMode_value = map[string]uint32{
547                 "RX_MODE_API_UNKNOWN":   0,
548                 "RX_MODE_API_POLLING":   1,
549                 "RX_MODE_API_INTERRUPT": 2,
550                 "RX_MODE_API_ADAPTIVE":  3,
551                 "RX_MODE_API_DEFAULT":   4,
552         }
553 )
554
555 func (x RxMode) String() string {
556         s, ok := RxMode_name[uint32(x)]
557         if ok {
558                 return s
559         }
560         return "RxMode(" + strconv.Itoa(int(x)) + ")"
561 }
562
563 // SubIfFlags defines enum 'sub_if_flags'.
564 type SubIfFlags uint32
565
566 const (
567         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
568         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
569         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
570         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
571         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
572         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
573         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
574         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
575         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
576         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
577 )
578
579 var (
580         SubIfFlags_name = map[uint32]string{
581                 1:   "SUB_IF_API_FLAG_NO_TAGS",
582                 2:   "SUB_IF_API_FLAG_ONE_TAG",
583                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
584                 8:   "SUB_IF_API_FLAG_DOT1AD",
585                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
586                 32:  "SUB_IF_API_FLAG_DEFAULT",
587                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
588                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
589                 254: "SUB_IF_API_FLAG_MASK_VNET",
590                 256: "SUB_IF_API_FLAG_DOT1AH",
591         }
592         SubIfFlags_value = map[string]uint32{
593                 "SUB_IF_API_FLAG_NO_TAGS":           1,
594                 "SUB_IF_API_FLAG_ONE_TAG":           2,
595                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
596                 "SUB_IF_API_FLAG_DOT1AD":            8,
597                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
598                 "SUB_IF_API_FLAG_DEFAULT":           32,
599                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
600                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
601                 "SUB_IF_API_FLAG_MASK_VNET":         254,
602                 "SUB_IF_API_FLAG_DOT1AH":            256,
603         }
604 )
605
606 func (x SubIfFlags) String() string {
607         s, ok := SubIfFlags_name[uint32(x)]
608         if ok {
609                 return s
610         }
611         str := func(n uint32) string {
612                 s, ok := SubIfFlags_name[uint32(n)]
613                 if ok {
614                         return s
615                 }
616                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
617         }
618         for i := uint32(0); i <= 32; i++ {
619                 val := uint32(x)
620                 if val&(1<<i) != 0 {
621                         if s != "" {
622                                 s += "|"
623                         }
624                         s += str(1 << i)
625                 }
626         }
627         if s == "" {
628                 return str(uint32(x))
629         }
630         return s
631 }
632
633 // AddressWithPrefix defines alias 'address_with_prefix'.
634 type AddressWithPrefix Prefix
635
636 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
637         prefix, err := ParsePrefix(s)
638         if err != nil {
639                 return AddressWithPrefix{}, err
640         }
641         return AddressWithPrefix(prefix), nil
642 }
643 func (x AddressWithPrefix) String() string {
644         return Prefix(x).String()
645 }
646 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
647         return []byte(x.String()), nil
648 }
649 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
650         prefix, err := ParseAddressWithPrefix(string(text))
651         if err != nil {
652                 return err
653         }
654         *x = prefix
655         return nil
656 }
657
658 // InterfaceIndex defines alias 'interface_index'.
659 type InterfaceIndex uint32
660
661 // IP4Address defines alias 'ip4_address'.
662 type IP4Address [4]uint8
663
664 func ParseIP4Address(s string) (IP4Address, error) {
665         ip := net.ParseIP(s).To4()
666         if ip == nil {
667                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
668         }
669         var ipaddr IP4Address
670         copy(ipaddr[:], ip.To4())
671         return ipaddr, nil
672 }
673
674 func (x IP4Address) ToIP() net.IP {
675         return net.IP(x[:]).To4()
676 }
677 func (x IP4Address) String() string {
678         return x.ToIP().String()
679 }
680 func (x *IP4Address) MarshalText() ([]byte, error) {
681         return []byte(x.String()), nil
682 }
683 func (x *IP4Address) UnmarshalText(text []byte) error {
684         ipaddr, err := ParseIP4Address(string(text))
685         if err != nil {
686                 return err
687         }
688         *x = ipaddr
689         return nil
690 }
691
692 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
693 type IP4AddressWithPrefix IP4Prefix
694
695 // IP6Address defines alias 'ip6_address'.
696 type IP6Address [16]uint8
697
698 func ParseIP6Address(s string) (IP6Address, error) {
699         ip := net.ParseIP(s).To16()
700         if ip == nil {
701                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
702         }
703         var ipaddr IP6Address
704         copy(ipaddr[:], ip.To16())
705         return ipaddr, nil
706 }
707
708 func (x IP6Address) ToIP() net.IP {
709         return net.IP(x[:]).To16()
710 }
711 func (x IP6Address) String() string {
712         return x.ToIP().String()
713 }
714 func (x *IP6Address) MarshalText() ([]byte, error) {
715         return []byte(x.String()), nil
716 }
717 func (x *IP6Address) UnmarshalText(text []byte) error {
718         ipaddr, err := ParseIP6Address(string(text))
719         if err != nil {
720                 return err
721         }
722         *x = ipaddr
723         return nil
724 }
725
726 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
727 type IP6AddressWithPrefix IP6Prefix
728
729 // AbfItfAttach defines type 'abf_itf_attach'.
730 type AbfItfAttach struct {
731         PolicyID  uint32         `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
732         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
733         Priority  uint32         `binapi:"u32,name=priority" json:"priority,omitempty"`
734         IsIPv6    bool           `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
735 }
736
737 // AbfPolicy defines type 'abf_policy'.
738 type AbfPolicy struct {
739         PolicyID uint32    `binapi:"u32,name=policy_id" json:"policy_id,omitempty"`
740         ACLIndex uint32    `binapi:"u32,name=acl_index" json:"acl_index,omitempty"`
741         NPaths   uint8     `binapi:"u8,name=n_paths" json:"-"`
742         Paths    []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
743 }
744
745 // Address defines type 'address'.
746 type Address struct {
747         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
748         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
749 }
750
751 func ParseAddress(s string) (Address, error) {
752         ip := net.ParseIP(s)
753         if ip == nil {
754                 return Address{}, fmt.Errorf("invalid address: %s", s)
755         }
756         var addr Address
757         if ip.To4() == nil {
758                 addr.Af = ADDRESS_IP6
759                 var ip6 IP6Address
760                 copy(ip6[:], ip.To16())
761                 addr.Un.SetIP6(ip6)
762         } else {
763                 addr.Af = ADDRESS_IP4
764                 var ip4 IP4Address
765                 copy(ip4[:], ip.To4())
766                 addr.Un.SetIP4(ip4)
767         }
768         return addr, nil
769 }
770 func (x Address) ToIP() net.IP {
771         if x.Af == ADDRESS_IP6 {
772                 ip6 := x.Un.GetIP6()
773                 return net.IP(ip6[:]).To16()
774         } else {
775                 ip4 := x.Un.GetIP4()
776                 return net.IP(ip4[:]).To4()
777         }
778 }
779 func (x Address) String() string {
780         return x.ToIP().String()
781 }
782 func (x *Address) MarshalText() ([]byte, error) {
783         return []byte(x.String()), nil
784 }
785 func (x *Address) UnmarshalText(text []byte) error {
786         addr, err := ParseAddress(string(text))
787         if err != nil {
788                 return err
789         }
790         *x = addr
791         return nil
792 }
793
794 // FibMplsLabel defines type 'fib_mpls_label'.
795 type FibMplsLabel struct {
796         IsUniform uint8  `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
797         Label     uint32 `binapi:"u32,name=label" json:"label,omitempty"`
798         TTL       uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
799         Exp       uint8  `binapi:"u8,name=exp" json:"exp,omitempty"`
800 }
801
802 // FibPath defines type 'fib_path'.
803 type FibPath struct {
804         SwIfIndex  uint32           `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
805         TableID    uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
806         RpfID      uint32           `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
807         Weight     uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
808         Preference uint8            `binapi:"u8,name=preference" json:"preference,omitempty"`
809         Type       FibPathType      `binapi:"fib_path_type,name=type" json:"type,omitempty"`
810         Flags      FibPathFlags     `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
811         Proto      FibPathNhProto   `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
812         Nh         FibPathNh        `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
813         NLabels    uint8            `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
814         LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
815 }
816
817 // FibPathNh defines type 'fib_path_nh'.
818 type FibPathNh struct {
819         Address            AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
820         ViaLabel           uint32       `binapi:"u32,name=via_label" json:"via_label,omitempty"`
821         ObjID              uint32       `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
822         ClassifyTableIndex uint32       `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
823 }
824
825 // IP4Prefix defines type 'ip4_prefix'.
826 type IP4Prefix struct {
827         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
828         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
829 }
830
831 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
832         hasPrefix := strings.Contains(s, "/")
833         if hasPrefix {
834                 ip, network, err := net.ParseCIDR(s)
835                 if err != nil {
836                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
837                 }
838                 maskSize, _ := network.Mask.Size()
839                 prefix.Len = byte(maskSize)
840                 prefix.Address, err = ParseIP4Address(ip.String())
841                 if err != nil {
842                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
843                 }
844         } else {
845                 ip := net.ParseIP(s)
846                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
847                 if ip.To4() == nil {
848                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
849                 }
850                 prefix.Len = byte(defaultMaskSize)
851                 prefix.Address, err = ParseIP4Address(ip.String())
852                 if err != nil {
853                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
854                 }
855         }
856         return prefix, nil
857 }
858 func (x IP4Prefix) ToIPNet() *net.IPNet {
859         mask := net.CIDRMask(int(x.Len), 32)
860         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
861         return ipnet
862 }
863 func (x IP4Prefix) String() string {
864         ip := x.Address.String()
865         return ip + "/" + strconv.Itoa(int(x.Len))
866 }
867 func (x *IP4Prefix) MarshalText() ([]byte, error) {
868         return []byte(x.String()), nil
869 }
870 func (x *IP4Prefix) UnmarshalText(text []byte) error {
871         prefix, err := ParseIP4Prefix(string(text))
872         if err != nil {
873                 return err
874         }
875         *x = prefix
876         return nil
877 }
878
879 // IP6Prefix defines type 'ip6_prefix'.
880 type IP6Prefix struct {
881         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
882         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
883 }
884
885 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
886         hasPrefix := strings.Contains(s, "/")
887         if hasPrefix {
888                 ip, network, err := net.ParseCIDR(s)
889                 if err != nil {
890                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
891                 }
892                 maskSize, _ := network.Mask.Size()
893                 prefix.Len = byte(maskSize)
894                 prefix.Address, err = ParseIP6Address(ip.String())
895                 if err != nil {
896                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
897                 }
898         } else {
899                 ip := net.ParseIP(s)
900                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
901                 if ip.To4() == nil {
902                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
903                 }
904                 prefix.Len = byte(defaultMaskSize)
905                 prefix.Address, err = ParseIP6Address(ip.String())
906                 if err != nil {
907                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
908                 }
909         }
910         return prefix, nil
911 }
912 func (x IP6Prefix) ToIPNet() *net.IPNet {
913         mask := net.CIDRMask(int(x.Len), 128)
914         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
915         return ipnet
916 }
917 func (x IP6Prefix) String() string {
918         ip := x.Address.String()
919         return ip + "/" + strconv.Itoa(int(x.Len))
920 }
921 func (x *IP6Prefix) MarshalText() ([]byte, error) {
922         return []byte(x.String()), nil
923 }
924 func (x *IP6Prefix) UnmarshalText(text []byte) error {
925         prefix, err := ParseIP6Prefix(string(text))
926         if err != nil {
927                 return err
928         }
929         *x = prefix
930         return nil
931 }
932
933 // Mprefix defines type 'mprefix'.
934 type Mprefix struct {
935         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
936         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
937         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
938         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
939 }
940
941 // Prefix defines type 'prefix'.
942 type Prefix struct {
943         Address Address `binapi:"address,name=address" json:"address,omitempty"`
944         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
945 }
946
947 func ParsePrefix(ip string) (prefix Prefix, err error) {
948         hasPrefix := strings.Contains(ip, "/")
949         if hasPrefix {
950                 netIP, network, err := net.ParseCIDR(ip)
951                 if err != nil {
952                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
953                 }
954                 maskSize, _ := network.Mask.Size()
955                 prefix.Len = byte(maskSize)
956                 prefix.Address, err = ParseAddress(netIP.String())
957                 if err != nil {
958                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
959                 }
960         } else {
961                 netIP := net.ParseIP(ip)
962                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
963                 if netIP.To4() == nil {
964                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
965                 }
966                 prefix.Len = byte(defaultMaskSize)
967                 prefix.Address, err = ParseAddress(netIP.String())
968                 if err != nil {
969                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
970                 }
971         }
972         return prefix, nil
973 }
974 func (x Prefix) ToIPNet() *net.IPNet {
975         var mask net.IPMask
976         if x.Address.Af == ADDRESS_IP4 {
977                 mask = net.CIDRMask(int(x.Len), 32)
978         } else {
979                 mask = net.CIDRMask(int(x.Len), 128)
980         }
981         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
982         return ipnet
983 }
984 func (x Prefix) String() string {
985         ip := x.Address.String()
986         return ip + "/" + strconv.Itoa(int(x.Len))
987 }
988 func (x *Prefix) MarshalText() ([]byte, error) {
989         return []byte(x.String()), nil
990 }
991 func (x *Prefix) UnmarshalText(text []byte) error {
992         prefix, err := ParsePrefix(string(text))
993         if err != nil {
994                 return err
995         }
996         *x = prefix
997         return nil
998 }
999
1000 // PrefixMatcher defines type 'prefix_matcher'.
1001 type PrefixMatcher struct {
1002         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
1003         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
1004 }
1005
1006 // AddressUnion defines union 'address_union'.
1007 type AddressUnion struct {
1008         // IP4 *IP4Address
1009         // IP6 *IP6Address
1010         XXX_UnionData [16]byte
1011 }
1012
1013 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
1014         u.SetIP4(a)
1015         return
1016 }
1017 func (u *AddressUnion) SetIP4(a IP4Address) {
1018         buf := codec.NewBuffer(u.XXX_UnionData[:])
1019         buf.EncodeBytes(a[:], 4)
1020 }
1021 func (u *AddressUnion) GetIP4() (a IP4Address) {
1022         buf := codec.NewBuffer(u.XXX_UnionData[:])
1023         copy(a[:], buf.DecodeBytes(4))
1024         return
1025 }
1026
1027 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
1028         u.SetIP6(a)
1029         return
1030 }
1031 func (u *AddressUnion) SetIP6(a IP6Address) {
1032         buf := codec.NewBuffer(u.XXX_UnionData[:])
1033         buf.EncodeBytes(a[:], 16)
1034 }
1035 func (u *AddressUnion) GetIP6() (a IP6Address) {
1036         buf := codec.NewBuffer(u.XXX_UnionData[:])
1037         copy(a[:], buf.DecodeBytes(16))
1038         return
1039 }
1040
1041 // AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'.
1042 type AbfItfAttachAddDel struct {
1043         IsAdd  bool         `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1044         Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1045 }
1046
1047 func (m *AbfItfAttachAddDel) Reset()               { *m = AbfItfAttachAddDel{} }
1048 func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" }
1049 func (*AbfItfAttachAddDel) GetCrcString() string   { return "25c8621b" }
1050 func (*AbfItfAttachAddDel) GetMessageType() api.MessageType {
1051         return api.RequestMessage
1052 }
1053
1054 func (m *AbfItfAttachAddDel) Size() (size int) {
1055         if m == nil {
1056                 return 0
1057         }
1058         size += 1 // m.IsAdd
1059         size += 4 // m.Attach.PolicyID
1060         size += 4 // m.Attach.SwIfIndex
1061         size += 4 // m.Attach.Priority
1062         size += 1 // m.Attach.IsIPv6
1063         return size
1064 }
1065 func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) {
1066         if b == nil {
1067                 b = make([]byte, m.Size())
1068         }
1069         buf := codec.NewBuffer(b)
1070         buf.EncodeBool(m.IsAdd)
1071         buf.EncodeUint32(m.Attach.PolicyID)
1072         buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1073         buf.EncodeUint32(m.Attach.Priority)
1074         buf.EncodeBool(m.Attach.IsIPv6)
1075         return buf.Bytes(), nil
1076 }
1077 func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error {
1078         buf := codec.NewBuffer(b)
1079         m.IsAdd = buf.DecodeBool()
1080         m.Attach.PolicyID = buf.DecodeUint32()
1081         m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1082         m.Attach.Priority = buf.DecodeUint32()
1083         m.Attach.IsIPv6 = buf.DecodeBool()
1084         return nil
1085 }
1086
1087 // AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'.
1088 type AbfItfAttachAddDelReply struct {
1089         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1090 }
1091
1092 func (m *AbfItfAttachAddDelReply) Reset()               { *m = AbfItfAttachAddDelReply{} }
1093 func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" }
1094 func (*AbfItfAttachAddDelReply) GetCrcString() string   { return "e8d4e804" }
1095 func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType {
1096         return api.ReplyMessage
1097 }
1098
1099 func (m *AbfItfAttachAddDelReply) Size() (size int) {
1100         if m == nil {
1101                 return 0
1102         }
1103         size += 4 // m.Retval
1104         return size
1105 }
1106 func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) {
1107         if b == nil {
1108                 b = make([]byte, m.Size())
1109         }
1110         buf := codec.NewBuffer(b)
1111         buf.EncodeInt32(m.Retval)
1112         return buf.Bytes(), nil
1113 }
1114 func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error {
1115         buf := codec.NewBuffer(b)
1116         m.Retval = buf.DecodeInt32()
1117         return nil
1118 }
1119
1120 // AbfItfAttachDetails defines message 'abf_itf_attach_details'.
1121 type AbfItfAttachDetails struct {
1122         Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"`
1123 }
1124
1125 func (m *AbfItfAttachDetails) Reset()               { *m = AbfItfAttachDetails{} }
1126 func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" }
1127 func (*AbfItfAttachDetails) GetCrcString() string   { return "7819523e" }
1128 func (*AbfItfAttachDetails) GetMessageType() api.MessageType {
1129         return api.ReplyMessage
1130 }
1131
1132 func (m *AbfItfAttachDetails) Size() (size int) {
1133         if m == nil {
1134                 return 0
1135         }
1136         size += 4 // m.Attach.PolicyID
1137         size += 4 // m.Attach.SwIfIndex
1138         size += 4 // m.Attach.Priority
1139         size += 1 // m.Attach.IsIPv6
1140         return size
1141 }
1142 func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) {
1143         if b == nil {
1144                 b = make([]byte, m.Size())
1145         }
1146         buf := codec.NewBuffer(b)
1147         buf.EncodeUint32(m.Attach.PolicyID)
1148         buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
1149         buf.EncodeUint32(m.Attach.Priority)
1150         buf.EncodeBool(m.Attach.IsIPv6)
1151         return buf.Bytes(), nil
1152 }
1153 func (m *AbfItfAttachDetails) Unmarshal(b []byte) error {
1154         buf := codec.NewBuffer(b)
1155         m.Attach.PolicyID = buf.DecodeUint32()
1156         m.Attach.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1157         m.Attach.Priority = buf.DecodeUint32()
1158         m.Attach.IsIPv6 = buf.DecodeBool()
1159         return nil
1160 }
1161
1162 // AbfItfAttachDump defines message 'abf_itf_attach_dump'.
1163 type AbfItfAttachDump struct{}
1164
1165 func (m *AbfItfAttachDump) Reset()               { *m = AbfItfAttachDump{} }
1166 func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" }
1167 func (*AbfItfAttachDump) GetCrcString() string   { return "51077d14" }
1168 func (*AbfItfAttachDump) GetMessageType() api.MessageType {
1169         return api.RequestMessage
1170 }
1171
1172 func (m *AbfItfAttachDump) Size() (size int) {
1173         if m == nil {
1174                 return 0
1175         }
1176         return size
1177 }
1178 func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) {
1179         if b == nil {
1180                 b = make([]byte, m.Size())
1181         }
1182         buf := codec.NewBuffer(b)
1183         return buf.Bytes(), nil
1184 }
1185 func (m *AbfItfAttachDump) Unmarshal(b []byte) error {
1186         return nil
1187 }
1188
1189 // AbfPluginGetVersion defines message 'abf_plugin_get_version'.
1190 type AbfPluginGetVersion struct{}
1191
1192 func (m *AbfPluginGetVersion) Reset()               { *m = AbfPluginGetVersion{} }
1193 func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" }
1194 func (*AbfPluginGetVersion) GetCrcString() string   { return "51077d14" }
1195 func (*AbfPluginGetVersion) GetMessageType() api.MessageType {
1196         return api.RequestMessage
1197 }
1198
1199 func (m *AbfPluginGetVersion) Size() (size int) {
1200         if m == nil {
1201                 return 0
1202         }
1203         return size
1204 }
1205 func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) {
1206         if b == nil {
1207                 b = make([]byte, m.Size())
1208         }
1209         buf := codec.NewBuffer(b)
1210         return buf.Bytes(), nil
1211 }
1212 func (m *AbfPluginGetVersion) Unmarshal(b []byte) error {
1213         return nil
1214 }
1215
1216 // AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'.
1217 type AbfPluginGetVersionReply struct {
1218         Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1219         Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1220 }
1221
1222 func (m *AbfPluginGetVersionReply) Reset()               { *m = AbfPluginGetVersionReply{} }
1223 func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" }
1224 func (*AbfPluginGetVersionReply) GetCrcString() string   { return "9b32cf86" }
1225 func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType {
1226         return api.ReplyMessage
1227 }
1228
1229 func (m *AbfPluginGetVersionReply) Size() (size int) {
1230         if m == nil {
1231                 return 0
1232         }
1233         size += 4 // m.Major
1234         size += 4 // m.Minor
1235         return size
1236 }
1237 func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1238         if b == nil {
1239                 b = make([]byte, m.Size())
1240         }
1241         buf := codec.NewBuffer(b)
1242         buf.EncodeUint32(m.Major)
1243         buf.EncodeUint32(m.Minor)
1244         return buf.Bytes(), nil
1245 }
1246 func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error {
1247         buf := codec.NewBuffer(b)
1248         m.Major = buf.DecodeUint32()
1249         m.Minor = buf.DecodeUint32()
1250         return nil
1251 }
1252
1253 // AbfPolicyAddDel defines message 'abf_policy_add_del'.
1254 type AbfPolicyAddDel struct {
1255         IsAdd  bool      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1256         Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1257 }
1258
1259 func (m *AbfPolicyAddDel) Reset()               { *m = AbfPolicyAddDel{} }
1260 func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" }
1261 func (*AbfPolicyAddDel) GetCrcString() string   { return "ee66f93e" }
1262 func (*AbfPolicyAddDel) GetMessageType() api.MessageType {
1263         return api.RequestMessage
1264 }
1265
1266 func (m *AbfPolicyAddDel) Size() (size int) {
1267         if m == nil {
1268                 return 0
1269         }
1270         size += 1 // m.IsAdd
1271         size += 4 // m.Policy.PolicyID
1272         size += 4 // m.Policy.ACLIndex
1273         size += 1 // m.Policy.NPaths
1274         for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1275                 var s2 FibPath
1276                 _ = s2
1277                 if j2 < len(m.Policy.Paths) {
1278                         s2 = m.Policy.Paths[j2]
1279                 }
1280                 size += 4      // s2.SwIfIndex
1281                 size += 4      // s2.TableID
1282                 size += 4      // s2.RpfID
1283                 size += 1      // s2.Weight
1284                 size += 1      // s2.Preference
1285                 size += 4      // s2.Type
1286                 size += 4      // s2.Flags
1287                 size += 4      // s2.Proto
1288                 size += 1 * 16 // s2.Nh.Address
1289                 size += 4      // s2.Nh.ViaLabel
1290                 size += 4      // s2.Nh.ObjID
1291                 size += 4      // s2.Nh.ClassifyTableIndex
1292                 size += 1      // s2.NLabels
1293                 for j3 := 0; j3 < 16; j3++ {
1294                         size += 1 // s2.LabelStack[j3].IsUniform
1295                         size += 4 // s2.LabelStack[j3].Label
1296                         size += 1 // s2.LabelStack[j3].TTL
1297                         size += 1 // s2.LabelStack[j3].Exp
1298                 }
1299         }
1300         return size
1301 }
1302 func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) {
1303         if b == nil {
1304                 b = make([]byte, m.Size())
1305         }
1306         buf := codec.NewBuffer(b)
1307         buf.EncodeBool(m.IsAdd)
1308         buf.EncodeUint32(m.Policy.PolicyID)
1309         buf.EncodeUint32(m.Policy.ACLIndex)
1310         buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1311         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1312                 var v1 FibPath // Paths
1313                 if j1 < len(m.Policy.Paths) {
1314                         v1 = m.Policy.Paths[j1]
1315                 }
1316                 buf.EncodeUint32(v1.SwIfIndex)
1317                 buf.EncodeUint32(v1.TableID)
1318                 buf.EncodeUint32(v1.RpfID)
1319                 buf.EncodeUint8(v1.Weight)
1320                 buf.EncodeUint8(v1.Preference)
1321                 buf.EncodeUint32(uint32(v1.Type))
1322                 buf.EncodeUint32(uint32(v1.Flags))
1323                 buf.EncodeUint32(uint32(v1.Proto))
1324                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1325                 buf.EncodeUint32(v1.Nh.ViaLabel)
1326                 buf.EncodeUint32(v1.Nh.ObjID)
1327                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1328                 buf.EncodeUint8(v1.NLabels)
1329                 for j2 := 0; j2 < 16; j2++ {
1330                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1331                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1332                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1333                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1334                 }
1335         }
1336         return buf.Bytes(), nil
1337 }
1338 func (m *AbfPolicyAddDel) Unmarshal(b []byte) error {
1339         buf := codec.NewBuffer(b)
1340         m.IsAdd = buf.DecodeBool()
1341         m.Policy.PolicyID = buf.DecodeUint32()
1342         m.Policy.ACLIndex = buf.DecodeUint32()
1343         m.Policy.NPaths = buf.DecodeUint8()
1344         m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1345         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1346                 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1347                 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1348                 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1349                 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1350                 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1351                 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1352                 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1353                 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1354                 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1355                 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1356                 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1357                 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1358                 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1359                 for j2 := 0; j2 < 16; j2++ {
1360                         m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1361                         m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1362                         m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1363                         m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1364                 }
1365         }
1366         return nil
1367 }
1368
1369 // AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'.
1370 type AbfPolicyAddDelReply struct {
1371         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1372 }
1373
1374 func (m *AbfPolicyAddDelReply) Reset()               { *m = AbfPolicyAddDelReply{} }
1375 func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" }
1376 func (*AbfPolicyAddDelReply) GetCrcString() string   { return "e8d4e804" }
1377 func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType {
1378         return api.ReplyMessage
1379 }
1380
1381 func (m *AbfPolicyAddDelReply) Size() (size int) {
1382         if m == nil {
1383                 return 0
1384         }
1385         size += 4 // m.Retval
1386         return size
1387 }
1388 func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) {
1389         if b == nil {
1390                 b = make([]byte, m.Size())
1391         }
1392         buf := codec.NewBuffer(b)
1393         buf.EncodeInt32(m.Retval)
1394         return buf.Bytes(), nil
1395 }
1396 func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error {
1397         buf := codec.NewBuffer(b)
1398         m.Retval = buf.DecodeInt32()
1399         return nil
1400 }
1401
1402 // AbfPolicyDetails defines message 'abf_policy_details'.
1403 type AbfPolicyDetails struct {
1404         Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"`
1405 }
1406
1407 func (m *AbfPolicyDetails) Reset()               { *m = AbfPolicyDetails{} }
1408 func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" }
1409 func (*AbfPolicyDetails) GetCrcString() string   { return "6769e504" }
1410 func (*AbfPolicyDetails) GetMessageType() api.MessageType {
1411         return api.ReplyMessage
1412 }
1413
1414 func (m *AbfPolicyDetails) Size() (size int) {
1415         if m == nil {
1416                 return 0
1417         }
1418         size += 4 // m.Policy.PolicyID
1419         size += 4 // m.Policy.ACLIndex
1420         size += 1 // m.Policy.NPaths
1421         for j2 := 0; j2 < len(m.Policy.Paths); j2++ {
1422                 var s2 FibPath
1423                 _ = s2
1424                 if j2 < len(m.Policy.Paths) {
1425                         s2 = m.Policy.Paths[j2]
1426                 }
1427                 size += 4      // s2.SwIfIndex
1428                 size += 4      // s2.TableID
1429                 size += 4      // s2.RpfID
1430                 size += 1      // s2.Weight
1431                 size += 1      // s2.Preference
1432                 size += 4      // s2.Type
1433                 size += 4      // s2.Flags
1434                 size += 4      // s2.Proto
1435                 size += 1 * 16 // s2.Nh.Address
1436                 size += 4      // s2.Nh.ViaLabel
1437                 size += 4      // s2.Nh.ObjID
1438                 size += 4      // s2.Nh.ClassifyTableIndex
1439                 size += 1      // s2.NLabels
1440                 for j3 := 0; j3 < 16; j3++ {
1441                         size += 1 // s2.LabelStack[j3].IsUniform
1442                         size += 4 // s2.LabelStack[j3].Label
1443                         size += 1 // s2.LabelStack[j3].TTL
1444                         size += 1 // s2.LabelStack[j3].Exp
1445                 }
1446         }
1447         return size
1448 }
1449 func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) {
1450         if b == nil {
1451                 b = make([]byte, m.Size())
1452         }
1453         buf := codec.NewBuffer(b)
1454         buf.EncodeUint32(m.Policy.PolicyID)
1455         buf.EncodeUint32(m.Policy.ACLIndex)
1456         buf.EncodeUint8(uint8(len(m.Policy.Paths)))
1457         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1458                 var v1 FibPath // Paths
1459                 if j1 < len(m.Policy.Paths) {
1460                         v1 = m.Policy.Paths[j1]
1461                 }
1462                 buf.EncodeUint32(v1.SwIfIndex)
1463                 buf.EncodeUint32(v1.TableID)
1464                 buf.EncodeUint32(v1.RpfID)
1465                 buf.EncodeUint8(v1.Weight)
1466                 buf.EncodeUint8(v1.Preference)
1467                 buf.EncodeUint32(uint32(v1.Type))
1468                 buf.EncodeUint32(uint32(v1.Flags))
1469                 buf.EncodeUint32(uint32(v1.Proto))
1470                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1471                 buf.EncodeUint32(v1.Nh.ViaLabel)
1472                 buf.EncodeUint32(v1.Nh.ObjID)
1473                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1474                 buf.EncodeUint8(v1.NLabels)
1475                 for j2 := 0; j2 < 16; j2++ {
1476                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1477                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1478                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1479                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1480                 }
1481         }
1482         return buf.Bytes(), nil
1483 }
1484 func (m *AbfPolicyDetails) Unmarshal(b []byte) error {
1485         buf := codec.NewBuffer(b)
1486         m.Policy.PolicyID = buf.DecodeUint32()
1487         m.Policy.ACLIndex = buf.DecodeUint32()
1488         m.Policy.NPaths = buf.DecodeUint8()
1489         m.Policy.Paths = make([]FibPath, m.Policy.NPaths)
1490         for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
1491                 m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
1492                 m.Policy.Paths[j1].TableID = buf.DecodeUint32()
1493                 m.Policy.Paths[j1].RpfID = buf.DecodeUint32()
1494                 m.Policy.Paths[j1].Weight = buf.DecodeUint8()
1495                 m.Policy.Paths[j1].Preference = buf.DecodeUint8()
1496                 m.Policy.Paths[j1].Type = FibPathType(buf.DecodeUint32())
1497                 m.Policy.Paths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1498                 m.Policy.Paths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1499                 copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1500                 m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
1501                 m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32()
1502                 m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1503                 m.Policy.Paths[j1].NLabels = buf.DecodeUint8()
1504                 for j2 := 0; j2 < 16; j2++ {
1505                         m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1506                         m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1507                         m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1508                         m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1509                 }
1510         }
1511         return nil
1512 }
1513
1514 // AbfPolicyDump defines message 'abf_policy_dump'.
1515 type AbfPolicyDump struct{}
1516
1517 func (m *AbfPolicyDump) Reset()               { *m = AbfPolicyDump{} }
1518 func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" }
1519 func (*AbfPolicyDump) GetCrcString() string   { return "51077d14" }
1520 func (*AbfPolicyDump) GetMessageType() api.MessageType {
1521         return api.RequestMessage
1522 }
1523
1524 func (m *AbfPolicyDump) Size() (size int) {
1525         if m == nil {
1526                 return 0
1527         }
1528         return size
1529 }
1530 func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) {
1531         if b == nil {
1532                 b = make([]byte, m.Size())
1533         }
1534         buf := codec.NewBuffer(b)
1535         return buf.Bytes(), nil
1536 }
1537 func (m *AbfPolicyDump) Unmarshal(b []byte) error {
1538         return nil
1539 }
1540
1541 func init() { file_abf_binapi_init() }
1542 func file_abf_binapi_init() {
1543         api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b")
1544         api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804")
1545         api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e")
1546         api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14")
1547         api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14")
1548         api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86")
1549         api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e")
1550         api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804")
1551         api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504")
1552         api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14")
1553 }
1554
1555 // Messages returns list of all messages in this module.
1556 func AllMessages() []api.Message {
1557         return []api.Message{
1558                 (*AbfItfAttachAddDel)(nil),
1559                 (*AbfItfAttachAddDelReply)(nil),
1560                 (*AbfItfAttachDetails)(nil),
1561                 (*AbfItfAttachDump)(nil),
1562                 (*AbfPluginGetVersion)(nil),
1563                 (*AbfPluginGetVersionReply)(nil),
1564                 (*AbfPolicyAddDel)(nil),
1565                 (*AbfPolicyAddDelReply)(nil),
1566                 (*AbfPolicyDetails)(nil),
1567                 (*AbfPolicyDump)(nil),
1568         }
1569 }