Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / bier / bier.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/core/bier.api.json
6
7 // Package bier contains generated bindings for API file bier.api.
8 //
9 // Contents:
10 //   5 aliases
11 //   7 enums
12 //  11 structs
13 //   1 union
14 //  22 messages
15 //
16 package bier
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    = "bier"
36         APIVersion = "1.2.1"
37         VersionCrc = 0x27c878c4
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 // IPDscp defines enum 'ip_dscp'.
210 type IPDscp uint8
211
212 const (
213         IP_API_DSCP_CS0  IPDscp = 0
214         IP_API_DSCP_CS1  IPDscp = 8
215         IP_API_DSCP_AF11 IPDscp = 10
216         IP_API_DSCP_AF12 IPDscp = 12
217         IP_API_DSCP_AF13 IPDscp = 14
218         IP_API_DSCP_CS2  IPDscp = 16
219         IP_API_DSCP_AF21 IPDscp = 18
220         IP_API_DSCP_AF22 IPDscp = 20
221         IP_API_DSCP_AF23 IPDscp = 22
222         IP_API_DSCP_CS3  IPDscp = 24
223         IP_API_DSCP_AF31 IPDscp = 26
224         IP_API_DSCP_AF32 IPDscp = 28
225         IP_API_DSCP_AF33 IPDscp = 30
226         IP_API_DSCP_CS4  IPDscp = 32
227         IP_API_DSCP_AF41 IPDscp = 34
228         IP_API_DSCP_AF42 IPDscp = 36
229         IP_API_DSCP_AF43 IPDscp = 38
230         IP_API_DSCP_CS5  IPDscp = 40
231         IP_API_DSCP_EF   IPDscp = 46
232         IP_API_DSCP_CS6  IPDscp = 48
233         IP_API_DSCP_CS7  IPDscp = 50
234 )
235
236 var (
237         IPDscp_name = map[uint8]string{
238                 0:  "IP_API_DSCP_CS0",
239                 8:  "IP_API_DSCP_CS1",
240                 10: "IP_API_DSCP_AF11",
241                 12: "IP_API_DSCP_AF12",
242                 14: "IP_API_DSCP_AF13",
243                 16: "IP_API_DSCP_CS2",
244                 18: "IP_API_DSCP_AF21",
245                 20: "IP_API_DSCP_AF22",
246                 22: "IP_API_DSCP_AF23",
247                 24: "IP_API_DSCP_CS3",
248                 26: "IP_API_DSCP_AF31",
249                 28: "IP_API_DSCP_AF32",
250                 30: "IP_API_DSCP_AF33",
251                 32: "IP_API_DSCP_CS4",
252                 34: "IP_API_DSCP_AF41",
253                 36: "IP_API_DSCP_AF42",
254                 38: "IP_API_DSCP_AF43",
255                 40: "IP_API_DSCP_CS5",
256                 46: "IP_API_DSCP_EF",
257                 48: "IP_API_DSCP_CS6",
258                 50: "IP_API_DSCP_CS7",
259         }
260         IPDscp_value = map[string]uint8{
261                 "IP_API_DSCP_CS0":  0,
262                 "IP_API_DSCP_CS1":  8,
263                 "IP_API_DSCP_AF11": 10,
264                 "IP_API_DSCP_AF12": 12,
265                 "IP_API_DSCP_AF13": 14,
266                 "IP_API_DSCP_CS2":  16,
267                 "IP_API_DSCP_AF21": 18,
268                 "IP_API_DSCP_AF22": 20,
269                 "IP_API_DSCP_AF23": 22,
270                 "IP_API_DSCP_CS3":  24,
271                 "IP_API_DSCP_AF31": 26,
272                 "IP_API_DSCP_AF32": 28,
273                 "IP_API_DSCP_AF33": 30,
274                 "IP_API_DSCP_CS4":  32,
275                 "IP_API_DSCP_AF41": 34,
276                 "IP_API_DSCP_AF42": 36,
277                 "IP_API_DSCP_AF43": 38,
278                 "IP_API_DSCP_CS5":  40,
279                 "IP_API_DSCP_EF":   46,
280                 "IP_API_DSCP_CS6":  48,
281                 "IP_API_DSCP_CS7":  50,
282         }
283 )
284
285 func (x IPDscp) String() string {
286         s, ok := IPDscp_name[uint8(x)]
287         if ok {
288                 return s
289         }
290         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
291 }
292
293 // IPEcn defines enum 'ip_ecn'.
294 type IPEcn uint8
295
296 const (
297         IP_API_ECN_NONE IPEcn = 0
298         IP_API_ECN_ECT0 IPEcn = 1
299         IP_API_ECN_ECT1 IPEcn = 2
300         IP_API_ECN_CE   IPEcn = 3
301 )
302
303 var (
304         IPEcn_name = map[uint8]string{
305                 0: "IP_API_ECN_NONE",
306                 1: "IP_API_ECN_ECT0",
307                 2: "IP_API_ECN_ECT1",
308                 3: "IP_API_ECN_CE",
309         }
310         IPEcn_value = map[string]uint8{
311                 "IP_API_ECN_NONE": 0,
312                 "IP_API_ECN_ECT0": 1,
313                 "IP_API_ECN_ECT1": 2,
314                 "IP_API_ECN_CE":   3,
315         }
316 )
317
318 func (x IPEcn) String() string {
319         s, ok := IPEcn_name[uint8(x)]
320         if ok {
321                 return s
322         }
323         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
324 }
325
326 // IPProto defines enum 'ip_proto'.
327 type IPProto uint32
328
329 const (
330         IP_API_PROTO_HOPOPT   IPProto = 0
331         IP_API_PROTO_ICMP     IPProto = 1
332         IP_API_PROTO_IGMP     IPProto = 2
333         IP_API_PROTO_TCP      IPProto = 6
334         IP_API_PROTO_UDP      IPProto = 17
335         IP_API_PROTO_GRE      IPProto = 47
336         IP_API_PROTO_AH       IPProto = 50
337         IP_API_PROTO_ESP      IPProto = 51
338         IP_API_PROTO_EIGRP    IPProto = 88
339         IP_API_PROTO_OSPF     IPProto = 89
340         IP_API_PROTO_SCTP     IPProto = 132
341         IP_API_PROTO_RESERVED IPProto = 255
342 )
343
344 var (
345         IPProto_name = map[uint32]string{
346                 0:   "IP_API_PROTO_HOPOPT",
347                 1:   "IP_API_PROTO_ICMP",
348                 2:   "IP_API_PROTO_IGMP",
349                 6:   "IP_API_PROTO_TCP",
350                 17:  "IP_API_PROTO_UDP",
351                 47:  "IP_API_PROTO_GRE",
352                 50:  "IP_API_PROTO_AH",
353                 51:  "IP_API_PROTO_ESP",
354                 88:  "IP_API_PROTO_EIGRP",
355                 89:  "IP_API_PROTO_OSPF",
356                 132: "IP_API_PROTO_SCTP",
357                 255: "IP_API_PROTO_RESERVED",
358         }
359         IPProto_value = map[string]uint32{
360                 "IP_API_PROTO_HOPOPT":   0,
361                 "IP_API_PROTO_ICMP":     1,
362                 "IP_API_PROTO_IGMP":     2,
363                 "IP_API_PROTO_TCP":      6,
364                 "IP_API_PROTO_UDP":      17,
365                 "IP_API_PROTO_GRE":      47,
366                 "IP_API_PROTO_AH":       50,
367                 "IP_API_PROTO_ESP":      51,
368                 "IP_API_PROTO_EIGRP":    88,
369                 "IP_API_PROTO_OSPF":     89,
370                 "IP_API_PROTO_SCTP":     132,
371                 "IP_API_PROTO_RESERVED": 255,
372         }
373 )
374
375 func (x IPProto) String() string {
376         s, ok := IPProto_name[uint32(x)]
377         if ok {
378                 return s
379         }
380         return "IPProto(" + strconv.Itoa(int(x)) + ")"
381 }
382
383 // AddressWithPrefix defines alias 'address_with_prefix'.
384 type AddressWithPrefix Prefix
385
386 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
387         prefix, err := ParsePrefix(s)
388         if err != nil {
389                 return AddressWithPrefix{}, err
390         }
391         return AddressWithPrefix(prefix), nil
392 }
393
394 func (x AddressWithPrefix) String() string {
395         return Prefix(x).String()
396 }
397
398 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
399         return []byte(x.String()), nil
400 }
401
402 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
403         prefix, err := ParseAddressWithPrefix(string(text))
404         if err != nil {
405                 return err
406         }
407         *x = prefix
408         return nil
409 }
410
411 // IP4Address defines alias 'ip4_address'.
412 type IP4Address [4]uint8
413
414 func ParseIP4Address(s string) (IP4Address, error) {
415         ip := net.ParseIP(s).To4()
416         if ip == nil {
417                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
418         }
419         var ipaddr IP4Address
420         copy(ipaddr[:], ip.To4())
421         return ipaddr, nil
422 }
423
424 func (x IP4Address) ToIP() net.IP {
425         return net.IP(x[:]).To4()
426 }
427
428 func (x IP4Address) String() string {
429         return x.ToIP().String()
430 }
431
432 func (x *IP4Address) MarshalText() ([]byte, error) {
433         return []byte(x.String()), nil
434 }
435
436 func (x *IP4Address) UnmarshalText(text []byte) error {
437         ipaddr, err := ParseIP4Address(string(text))
438         if err != nil {
439                 return err
440         }
441         *x = ipaddr
442         return nil
443 }
444
445 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
446 type IP4AddressWithPrefix IP4Prefix
447
448 // IP6Address defines alias 'ip6_address'.
449 type IP6Address [16]uint8
450
451 func ParseIP6Address(s string) (IP6Address, error) {
452         ip := net.ParseIP(s).To16()
453         if ip == nil {
454                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
455         }
456         var ipaddr IP6Address
457         copy(ipaddr[:], ip.To16())
458         return ipaddr, nil
459 }
460
461 func (x IP6Address) ToIP() net.IP {
462         return net.IP(x[:]).To16()
463 }
464
465 func (x IP6Address) String() string {
466         return x.ToIP().String()
467 }
468
469 func (x *IP6Address) MarshalText() ([]byte, error) {
470         return []byte(x.String()), nil
471 }
472
473 func (x *IP6Address) UnmarshalText(text []byte) error {
474         ipaddr, err := ParseIP6Address(string(text))
475         if err != nil {
476                 return err
477         }
478         *x = ipaddr
479         return nil
480 }
481
482 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
483 type IP6AddressWithPrefix IP6Prefix
484
485 // Address defines type 'address'.
486 type Address struct {
487         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
488         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
489 }
490
491 func ParseAddress(s string) (Address, error) {
492         ip := net.ParseIP(s)
493         if ip == nil {
494                 return Address{}, fmt.Errorf("invalid address: %s", s)
495         }
496         return AddressFromIP(ip), nil
497 }
498
499 func AddressFromIP(ip net.IP) Address {
500         var addr Address
501         if ip.To4() == nil {
502                 addr.Af = ADDRESS_IP6
503                 var ip6 IP6Address
504                 copy(ip6[:], ip.To16())
505                 addr.Un.SetIP6(ip6)
506         } else {
507                 addr.Af = ADDRESS_IP4
508                 var ip4 IP4Address
509                 copy(ip4[:], ip.To4())
510                 addr.Un.SetIP4(ip4)
511         }
512         return addr
513 }
514
515 func (x Address) ToIP() net.IP {
516         if x.Af == ADDRESS_IP6 {
517                 ip6 := x.Un.GetIP6()
518                 return net.IP(ip6[:]).To16()
519         } else {
520                 ip4 := x.Un.GetIP4()
521                 return net.IP(ip4[:]).To4()
522         }
523 }
524
525 func (x Address) String() string {
526         return x.ToIP().String()
527 }
528
529 func (x *Address) MarshalText() ([]byte, error) {
530         return []byte(x.String()), nil
531 }
532
533 func (x *Address) UnmarshalText(text []byte) error {
534         addr, err := ParseAddress(string(text))
535         if err != nil {
536                 return err
537         }
538         *x = addr
539         return nil
540 }
541
542 // BierRoute defines type 'bier_route'.
543 type BierRoute struct {
544         BrBp     uint32      `binapi:"u32,name=br_bp" json:"br_bp,omitempty"`
545         BrTblID  BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"`
546         BrNPaths uint8       `binapi:"u8,name=br_n_paths" json:"-"`
547         BrPaths  []FibPath   `binapi:"fib_path[br_n_paths],name=br_paths" json:"br_paths,omitempty"`
548 }
549
550 // BierTableID defines type 'bier_table_id'.
551 type BierTableID struct {
552         BtSet       uint8 `binapi:"u8,name=bt_set" json:"bt_set,omitempty"`
553         BtSubDomain uint8 `binapi:"u8,name=bt_sub_domain" json:"bt_sub_domain,omitempty"`
554         BtHdrLenID  uint8 `binapi:"u8,name=bt_hdr_len_id" json:"bt_hdr_len_id,omitempty"`
555 }
556
557 // FibMplsLabel defines type 'fib_mpls_label'.
558 type FibMplsLabel struct {
559         IsUniform uint8  `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
560         Label     uint32 `binapi:"u32,name=label" json:"label,omitempty"`
561         TTL       uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
562         Exp       uint8  `binapi:"u8,name=exp" json:"exp,omitempty"`
563 }
564
565 // FibPath defines type 'fib_path'.
566 type FibPath struct {
567         SwIfIndex  uint32           `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
568         TableID    uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
569         RpfID      uint32           `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
570         Weight     uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
571         Preference uint8            `binapi:"u8,name=preference" json:"preference,omitempty"`
572         Type       FibPathType      `binapi:"fib_path_type,name=type" json:"type,omitempty"`
573         Flags      FibPathFlags     `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
574         Proto      FibPathNhProto   `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
575         Nh         FibPathNh        `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
576         NLabels    uint8            `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
577         LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty"`
578 }
579
580 // FibPathNh defines type 'fib_path_nh'.
581 type FibPathNh struct {
582         Address            AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
583         ViaLabel           uint32       `binapi:"u32,name=via_label" json:"via_label,omitempty"`
584         ObjID              uint32       `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
585         ClassifyTableIndex uint32       `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
586 }
587
588 // IP4Prefix defines type 'ip4_prefix'.
589 type IP4Prefix struct {
590         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
591         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
592 }
593
594 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
595         hasPrefix := strings.Contains(s, "/")
596         if hasPrefix {
597                 ip, network, err := net.ParseCIDR(s)
598                 if err != nil {
599                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
600                 }
601                 maskSize, _ := network.Mask.Size()
602                 prefix.Len = byte(maskSize)
603                 prefix.Address, err = ParseIP4Address(ip.String())
604                 if err != nil {
605                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
606                 }
607         } else {
608                 ip := net.ParseIP(s)
609                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
610                 if ip.To4() == nil {
611                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
612                 }
613                 prefix.Len = byte(defaultMaskSize)
614                 prefix.Address, err = ParseIP4Address(ip.String())
615                 if err != nil {
616                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
617                 }
618         }
619         return prefix, nil
620 }
621
622 func (x IP4Prefix) ToIPNet() *net.IPNet {
623         mask := net.CIDRMask(int(x.Len), 32)
624         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
625         return ipnet
626 }
627
628 func (x IP4Prefix) String() string {
629         ip := x.Address.String()
630         return ip + "/" + strconv.Itoa(int(x.Len))
631 }
632
633 func (x *IP4Prefix) MarshalText() ([]byte, error) {
634         return []byte(x.String()), nil
635 }
636
637 func (x *IP4Prefix) UnmarshalText(text []byte) error {
638         prefix, err := ParseIP4Prefix(string(text))
639         if err != nil {
640                 return err
641         }
642         *x = prefix
643         return nil
644 }
645
646 // IP6Prefix defines type 'ip6_prefix'.
647 type IP6Prefix struct {
648         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
649         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
650 }
651
652 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
653         hasPrefix := strings.Contains(s, "/")
654         if hasPrefix {
655                 ip, network, err := net.ParseCIDR(s)
656                 if err != nil {
657                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
658                 }
659                 maskSize, _ := network.Mask.Size()
660                 prefix.Len = byte(maskSize)
661                 prefix.Address, err = ParseIP6Address(ip.String())
662                 if err != nil {
663                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
664                 }
665         } else {
666                 ip := net.ParseIP(s)
667                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
668                 if ip.To4() == nil {
669                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
670                 }
671                 prefix.Len = byte(defaultMaskSize)
672                 prefix.Address, err = ParseIP6Address(ip.String())
673                 if err != nil {
674                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
675                 }
676         }
677         return prefix, nil
678 }
679
680 func (x IP6Prefix) ToIPNet() *net.IPNet {
681         mask := net.CIDRMask(int(x.Len), 128)
682         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
683         return ipnet
684 }
685
686 func (x IP6Prefix) String() string {
687         ip := x.Address.String()
688         return ip + "/" + strconv.Itoa(int(x.Len))
689 }
690
691 func (x *IP6Prefix) MarshalText() ([]byte, error) {
692         return []byte(x.String()), nil
693 }
694
695 func (x *IP6Prefix) UnmarshalText(text []byte) error {
696         prefix, err := ParseIP6Prefix(string(text))
697         if err != nil {
698                 return err
699         }
700         *x = prefix
701         return nil
702 }
703
704 // Mprefix defines type 'mprefix'.
705 type Mprefix struct {
706         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
707         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
708         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
709         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
710 }
711
712 // Prefix defines type 'prefix'.
713 type Prefix struct {
714         Address Address `binapi:"address,name=address" json:"address,omitempty"`
715         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
716 }
717
718 func ParsePrefix(ip string) (prefix Prefix, err error) {
719         hasPrefix := strings.Contains(ip, "/")
720         if hasPrefix {
721                 netIP, network, err := net.ParseCIDR(ip)
722                 if err != nil {
723                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
724                 }
725                 maskSize, _ := network.Mask.Size()
726                 prefix.Len = byte(maskSize)
727                 prefix.Address, err = ParseAddress(netIP.String())
728                 if err != nil {
729                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
730                 }
731         } else {
732                 netIP := net.ParseIP(ip)
733                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
734                 if netIP.To4() == nil {
735                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
736                 }
737                 prefix.Len = byte(defaultMaskSize)
738                 prefix.Address, err = ParseAddress(netIP.String())
739                 if err != nil {
740                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
741                 }
742         }
743         return prefix, nil
744 }
745
746 func (x Prefix) ToIPNet() *net.IPNet {
747         var mask net.IPMask
748         if x.Address.Af == ADDRESS_IP4 {
749                 mask = net.CIDRMask(int(x.Len), 32)
750         } else {
751                 mask = net.CIDRMask(int(x.Len), 128)
752         }
753         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
754         return ipnet
755 }
756
757 func (x Prefix) String() string {
758         ip := x.Address.String()
759         return ip + "/" + strconv.Itoa(int(x.Len))
760 }
761
762 func (x *Prefix) MarshalText() ([]byte, error) {
763         return []byte(x.String()), nil
764 }
765
766 func (x *Prefix) UnmarshalText(text []byte) error {
767         prefix, err := ParsePrefix(string(text))
768         if err != nil {
769                 return err
770         }
771         *x = prefix
772         return nil
773 }
774
775 // PrefixMatcher defines type 'prefix_matcher'.
776 type PrefixMatcher struct {
777         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
778         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
779 }
780
781 // AddressUnion defines union 'address_union'.
782 type AddressUnion struct {
783         // AddressUnion can be one of:
784         // - IP4 *IP4Address
785         // - IP6 *IP6Address
786         XXX_UnionData [16]byte
787 }
788
789 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
790         u.SetIP4(a)
791         return
792 }
793 func (u *AddressUnion) SetIP4(a IP4Address) {
794         buf := codec.NewBuffer(u.XXX_UnionData[:])
795         buf.EncodeBytes(a[:], 4)
796 }
797 func (u *AddressUnion) GetIP4() (a IP4Address) {
798         buf := codec.NewBuffer(u.XXX_UnionData[:])
799         copy(a[:], buf.DecodeBytes(4))
800         return
801 }
802
803 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
804         u.SetIP6(a)
805         return
806 }
807 func (u *AddressUnion) SetIP6(a IP6Address) {
808         buf := codec.NewBuffer(u.XXX_UnionData[:])
809         buf.EncodeBytes(a[:], 16)
810 }
811 func (u *AddressUnion) GetIP6() (a IP6Address) {
812         buf := codec.NewBuffer(u.XXX_UnionData[:])
813         copy(a[:], buf.DecodeBytes(16))
814         return
815 }
816
817 // BierDispEntryAddDel defines message 'bier_disp_entry_add_del'.
818 type BierDispEntryAddDel struct {
819         BdeBp           uint16    `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"`
820         BdeTblID        uint32    `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"`
821         BdeIsAdd        bool      `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"`
822         BdePayloadProto uint8     `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"`
823         BdeNPaths       uint8     `binapi:"u8,name=bde_n_paths" json:"-"`
824         BdePaths        []FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"`
825 }
826
827 func (m *BierDispEntryAddDel) Reset()               { *m = BierDispEntryAddDel{} }
828 func (*BierDispEntryAddDel) GetMessageName() string { return "bier_disp_entry_add_del" }
829 func (*BierDispEntryAddDel) GetCrcString() string   { return "648323eb" }
830 func (*BierDispEntryAddDel) GetMessageType() api.MessageType {
831         return api.RequestMessage
832 }
833
834 func (m *BierDispEntryAddDel) Size() (size int) {
835         if m == nil {
836                 return 0
837         }
838         size += 2 // m.BdeBp
839         size += 4 // m.BdeTblID
840         size += 1 // m.BdeIsAdd
841         size += 1 // m.BdePayloadProto
842         size += 1 // m.BdeNPaths
843         for j1 := 0; j1 < len(m.BdePaths); j1++ {
844                 var s1 FibPath
845                 _ = s1
846                 if j1 < len(m.BdePaths) {
847                         s1 = m.BdePaths[j1]
848                 }
849                 size += 4      // s1.SwIfIndex
850                 size += 4      // s1.TableID
851                 size += 4      // s1.RpfID
852                 size += 1      // s1.Weight
853                 size += 1      // s1.Preference
854                 size += 4      // s1.Type
855                 size += 4      // s1.Flags
856                 size += 4      // s1.Proto
857                 size += 1 * 16 // s1.Nh.Address
858                 size += 4      // s1.Nh.ViaLabel
859                 size += 4      // s1.Nh.ObjID
860                 size += 4      // s1.Nh.ClassifyTableIndex
861                 size += 1      // s1.NLabels
862                 for j2 := 0; j2 < 16; j2++ {
863                         size += 1 // s1.LabelStack[j2].IsUniform
864                         size += 4 // s1.LabelStack[j2].Label
865                         size += 1 // s1.LabelStack[j2].TTL
866                         size += 1 // s1.LabelStack[j2].Exp
867                 }
868         }
869         return size
870 }
871 func (m *BierDispEntryAddDel) Marshal(b []byte) ([]byte, error) {
872         if b == nil {
873                 b = make([]byte, m.Size())
874         }
875         buf := codec.NewBuffer(b)
876         buf.EncodeUint16(m.BdeBp)
877         buf.EncodeUint32(m.BdeTblID)
878         buf.EncodeBool(m.BdeIsAdd)
879         buf.EncodeUint8(m.BdePayloadProto)
880         buf.EncodeUint8(uint8(len(m.BdePaths)))
881         for j0 := 0; j0 < len(m.BdePaths); j0++ {
882                 var v0 FibPath // BdePaths
883                 if j0 < len(m.BdePaths) {
884                         v0 = m.BdePaths[j0]
885                 }
886                 buf.EncodeUint32(v0.SwIfIndex)
887                 buf.EncodeUint32(v0.TableID)
888                 buf.EncodeUint32(v0.RpfID)
889                 buf.EncodeUint8(v0.Weight)
890                 buf.EncodeUint8(v0.Preference)
891                 buf.EncodeUint32(uint32(v0.Type))
892                 buf.EncodeUint32(uint32(v0.Flags))
893                 buf.EncodeUint32(uint32(v0.Proto))
894                 buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 16)
895                 buf.EncodeUint32(v0.Nh.ViaLabel)
896                 buf.EncodeUint32(v0.Nh.ObjID)
897                 buf.EncodeUint32(v0.Nh.ClassifyTableIndex)
898                 buf.EncodeUint8(v0.NLabels)
899                 for j1 := 0; j1 < 16; j1++ {
900                         buf.EncodeUint8(v0.LabelStack[j1].IsUniform)
901                         buf.EncodeUint32(v0.LabelStack[j1].Label)
902                         buf.EncodeUint8(v0.LabelStack[j1].TTL)
903                         buf.EncodeUint8(v0.LabelStack[j1].Exp)
904                 }
905         }
906         return buf.Bytes(), nil
907 }
908 func (m *BierDispEntryAddDel) Unmarshal(b []byte) error {
909         buf := codec.NewBuffer(b)
910         m.BdeBp = buf.DecodeUint16()
911         m.BdeTblID = buf.DecodeUint32()
912         m.BdeIsAdd = buf.DecodeBool()
913         m.BdePayloadProto = buf.DecodeUint8()
914         m.BdeNPaths = buf.DecodeUint8()
915         m.BdePaths = make([]FibPath, m.BdeNPaths)
916         for j0 := 0; j0 < len(m.BdePaths); j0++ {
917                 m.BdePaths[j0].SwIfIndex = buf.DecodeUint32()
918                 m.BdePaths[j0].TableID = buf.DecodeUint32()
919                 m.BdePaths[j0].RpfID = buf.DecodeUint32()
920                 m.BdePaths[j0].Weight = buf.DecodeUint8()
921                 m.BdePaths[j0].Preference = buf.DecodeUint8()
922                 m.BdePaths[j0].Type = FibPathType(buf.DecodeUint32())
923                 m.BdePaths[j0].Flags = FibPathFlags(buf.DecodeUint32())
924                 m.BdePaths[j0].Proto = FibPathNhProto(buf.DecodeUint32())
925                 copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
926                 m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32()
927                 m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32()
928                 m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32()
929                 m.BdePaths[j0].NLabels = buf.DecodeUint8()
930                 for j1 := 0; j1 < 16; j1++ {
931                         m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8()
932                         m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32()
933                         m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8()
934                         m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8()
935                 }
936         }
937         return nil
938 }
939
940 // BierDispEntryAddDelReply defines message 'bier_disp_entry_add_del_reply'.
941 type BierDispEntryAddDelReply struct {
942         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
943 }
944
945 func (m *BierDispEntryAddDelReply) Reset()               { *m = BierDispEntryAddDelReply{} }
946 func (*BierDispEntryAddDelReply) GetMessageName() string { return "bier_disp_entry_add_del_reply" }
947 func (*BierDispEntryAddDelReply) GetCrcString() string   { return "e8d4e804" }
948 func (*BierDispEntryAddDelReply) GetMessageType() api.MessageType {
949         return api.ReplyMessage
950 }
951
952 func (m *BierDispEntryAddDelReply) Size() (size int) {
953         if m == nil {
954                 return 0
955         }
956         size += 4 // m.Retval
957         return size
958 }
959 func (m *BierDispEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
960         if b == nil {
961                 b = make([]byte, m.Size())
962         }
963         buf := codec.NewBuffer(b)
964         buf.EncodeInt32(m.Retval)
965         return buf.Bytes(), nil
966 }
967 func (m *BierDispEntryAddDelReply) Unmarshal(b []byte) error {
968         buf := codec.NewBuffer(b)
969         m.Retval = buf.DecodeInt32()
970         return nil
971 }
972
973 // BierDispEntryDetails defines message 'bier_disp_entry_details'.
974 type BierDispEntryDetails struct {
975         BdeBp           uint16    `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"`
976         BdeTblID        uint32    `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"`
977         BdeIsAdd        bool      `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"`
978         BdePayloadProto uint8     `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"`
979         BdeNPaths       uint8     `binapi:"u8,name=bde_n_paths" json:"-"`
980         BdePaths        []FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"`
981 }
982
983 func (m *BierDispEntryDetails) Reset()               { *m = BierDispEntryDetails{} }
984 func (*BierDispEntryDetails) GetMessageName() string { return "bier_disp_entry_details" }
985 func (*BierDispEntryDetails) GetCrcString() string   { return "e5b039a9" }
986 func (*BierDispEntryDetails) GetMessageType() api.MessageType {
987         return api.ReplyMessage
988 }
989
990 func (m *BierDispEntryDetails) Size() (size int) {
991         if m == nil {
992                 return 0
993         }
994         size += 2 // m.BdeBp
995         size += 4 // m.BdeTblID
996         size += 1 // m.BdeIsAdd
997         size += 1 // m.BdePayloadProto
998         size += 1 // m.BdeNPaths
999         for j1 := 0; j1 < len(m.BdePaths); j1++ {
1000                 var s1 FibPath
1001                 _ = s1
1002                 if j1 < len(m.BdePaths) {
1003                         s1 = m.BdePaths[j1]
1004                 }
1005                 size += 4      // s1.SwIfIndex
1006                 size += 4      // s1.TableID
1007                 size += 4      // s1.RpfID
1008                 size += 1      // s1.Weight
1009                 size += 1      // s1.Preference
1010                 size += 4      // s1.Type
1011                 size += 4      // s1.Flags
1012                 size += 4      // s1.Proto
1013                 size += 1 * 16 // s1.Nh.Address
1014                 size += 4      // s1.Nh.ViaLabel
1015                 size += 4      // s1.Nh.ObjID
1016                 size += 4      // s1.Nh.ClassifyTableIndex
1017                 size += 1      // s1.NLabels
1018                 for j2 := 0; j2 < 16; j2++ {
1019                         size += 1 // s1.LabelStack[j2].IsUniform
1020                         size += 4 // s1.LabelStack[j2].Label
1021                         size += 1 // s1.LabelStack[j2].TTL
1022                         size += 1 // s1.LabelStack[j2].Exp
1023                 }
1024         }
1025         return size
1026 }
1027 func (m *BierDispEntryDetails) Marshal(b []byte) ([]byte, error) {
1028         if b == nil {
1029                 b = make([]byte, m.Size())
1030         }
1031         buf := codec.NewBuffer(b)
1032         buf.EncodeUint16(m.BdeBp)
1033         buf.EncodeUint32(m.BdeTblID)
1034         buf.EncodeBool(m.BdeIsAdd)
1035         buf.EncodeUint8(m.BdePayloadProto)
1036         buf.EncodeUint8(uint8(len(m.BdePaths)))
1037         for j0 := 0; j0 < len(m.BdePaths); j0++ {
1038                 var v0 FibPath // BdePaths
1039                 if j0 < len(m.BdePaths) {
1040                         v0 = m.BdePaths[j0]
1041                 }
1042                 buf.EncodeUint32(v0.SwIfIndex)
1043                 buf.EncodeUint32(v0.TableID)
1044                 buf.EncodeUint32(v0.RpfID)
1045                 buf.EncodeUint8(v0.Weight)
1046                 buf.EncodeUint8(v0.Preference)
1047                 buf.EncodeUint32(uint32(v0.Type))
1048                 buf.EncodeUint32(uint32(v0.Flags))
1049                 buf.EncodeUint32(uint32(v0.Proto))
1050                 buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 16)
1051                 buf.EncodeUint32(v0.Nh.ViaLabel)
1052                 buf.EncodeUint32(v0.Nh.ObjID)
1053                 buf.EncodeUint32(v0.Nh.ClassifyTableIndex)
1054                 buf.EncodeUint8(v0.NLabels)
1055                 for j1 := 0; j1 < 16; j1++ {
1056                         buf.EncodeUint8(v0.LabelStack[j1].IsUniform)
1057                         buf.EncodeUint32(v0.LabelStack[j1].Label)
1058                         buf.EncodeUint8(v0.LabelStack[j1].TTL)
1059                         buf.EncodeUint8(v0.LabelStack[j1].Exp)
1060                 }
1061         }
1062         return buf.Bytes(), nil
1063 }
1064 func (m *BierDispEntryDetails) Unmarshal(b []byte) error {
1065         buf := codec.NewBuffer(b)
1066         m.BdeBp = buf.DecodeUint16()
1067         m.BdeTblID = buf.DecodeUint32()
1068         m.BdeIsAdd = buf.DecodeBool()
1069         m.BdePayloadProto = buf.DecodeUint8()
1070         m.BdeNPaths = buf.DecodeUint8()
1071         m.BdePaths = make([]FibPath, m.BdeNPaths)
1072         for j0 := 0; j0 < len(m.BdePaths); j0++ {
1073                 m.BdePaths[j0].SwIfIndex = buf.DecodeUint32()
1074                 m.BdePaths[j0].TableID = buf.DecodeUint32()
1075                 m.BdePaths[j0].RpfID = buf.DecodeUint32()
1076                 m.BdePaths[j0].Weight = buf.DecodeUint8()
1077                 m.BdePaths[j0].Preference = buf.DecodeUint8()
1078                 m.BdePaths[j0].Type = FibPathType(buf.DecodeUint32())
1079                 m.BdePaths[j0].Flags = FibPathFlags(buf.DecodeUint32())
1080                 m.BdePaths[j0].Proto = FibPathNhProto(buf.DecodeUint32())
1081                 copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1082                 m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32()
1083                 m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32()
1084                 m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32()
1085                 m.BdePaths[j0].NLabels = buf.DecodeUint8()
1086                 for j1 := 0; j1 < 16; j1++ {
1087                         m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8()
1088                         m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32()
1089                         m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8()
1090                         m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8()
1091                 }
1092         }
1093         return nil
1094 }
1095
1096 // BierDispEntryDump defines message 'bier_disp_entry_dump'.
1097 type BierDispEntryDump struct {
1098         BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"`
1099 }
1100
1101 func (m *BierDispEntryDump) Reset()               { *m = BierDispEntryDump{} }
1102 func (*BierDispEntryDump) GetMessageName() string { return "bier_disp_entry_dump" }
1103 func (*BierDispEntryDump) GetCrcString() string   { return "b5fa54ad" }
1104 func (*BierDispEntryDump) GetMessageType() api.MessageType {
1105         return api.RequestMessage
1106 }
1107
1108 func (m *BierDispEntryDump) Size() (size int) {
1109         if m == nil {
1110                 return 0
1111         }
1112         size += 4 // m.BdeTblID
1113         return size
1114 }
1115 func (m *BierDispEntryDump) Marshal(b []byte) ([]byte, error) {
1116         if b == nil {
1117                 b = make([]byte, m.Size())
1118         }
1119         buf := codec.NewBuffer(b)
1120         buf.EncodeUint32(m.BdeTblID)
1121         return buf.Bytes(), nil
1122 }
1123 func (m *BierDispEntryDump) Unmarshal(b []byte) error {
1124         buf := codec.NewBuffer(b)
1125         m.BdeTblID = buf.DecodeUint32()
1126         return nil
1127 }
1128
1129 // BierDispTableAddDel defines message 'bier_disp_table_add_del'.
1130 type BierDispTableAddDel struct {
1131         BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"`
1132         BdtIsAdd bool   `binapi:"bool,name=bdt_is_add" json:"bdt_is_add,omitempty"`
1133 }
1134
1135 func (m *BierDispTableAddDel) Reset()               { *m = BierDispTableAddDel{} }
1136 func (*BierDispTableAddDel) GetMessageName() string { return "bier_disp_table_add_del" }
1137 func (*BierDispTableAddDel) GetCrcString() string   { return "889657ac" }
1138 func (*BierDispTableAddDel) GetMessageType() api.MessageType {
1139         return api.RequestMessage
1140 }
1141
1142 func (m *BierDispTableAddDel) Size() (size int) {
1143         if m == nil {
1144                 return 0
1145         }
1146         size += 4 // m.BdtTblID
1147         size += 1 // m.BdtIsAdd
1148         return size
1149 }
1150 func (m *BierDispTableAddDel) Marshal(b []byte) ([]byte, error) {
1151         if b == nil {
1152                 b = make([]byte, m.Size())
1153         }
1154         buf := codec.NewBuffer(b)
1155         buf.EncodeUint32(m.BdtTblID)
1156         buf.EncodeBool(m.BdtIsAdd)
1157         return buf.Bytes(), nil
1158 }
1159 func (m *BierDispTableAddDel) Unmarshal(b []byte) error {
1160         buf := codec.NewBuffer(b)
1161         m.BdtTblID = buf.DecodeUint32()
1162         m.BdtIsAdd = buf.DecodeBool()
1163         return nil
1164 }
1165
1166 // BierDispTableAddDelReply defines message 'bier_disp_table_add_del_reply'.
1167 type BierDispTableAddDelReply struct {
1168         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1169 }
1170
1171 func (m *BierDispTableAddDelReply) Reset()               { *m = BierDispTableAddDelReply{} }
1172 func (*BierDispTableAddDelReply) GetMessageName() string { return "bier_disp_table_add_del_reply" }
1173 func (*BierDispTableAddDelReply) GetCrcString() string   { return "e8d4e804" }
1174 func (*BierDispTableAddDelReply) GetMessageType() api.MessageType {
1175         return api.ReplyMessage
1176 }
1177
1178 func (m *BierDispTableAddDelReply) Size() (size int) {
1179         if m == nil {
1180                 return 0
1181         }
1182         size += 4 // m.Retval
1183         return size
1184 }
1185 func (m *BierDispTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1186         if b == nil {
1187                 b = make([]byte, m.Size())
1188         }
1189         buf := codec.NewBuffer(b)
1190         buf.EncodeInt32(m.Retval)
1191         return buf.Bytes(), nil
1192 }
1193 func (m *BierDispTableAddDelReply) Unmarshal(b []byte) error {
1194         buf := codec.NewBuffer(b)
1195         m.Retval = buf.DecodeInt32()
1196         return nil
1197 }
1198
1199 // BierDispTableDetails defines message 'bier_disp_table_details'.
1200 type BierDispTableDetails struct {
1201         BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"`
1202 }
1203
1204 func (m *BierDispTableDetails) Reset()               { *m = BierDispTableDetails{} }
1205 func (*BierDispTableDetails) GetMessageName() string { return "bier_disp_table_details" }
1206 func (*BierDispTableDetails) GetCrcString() string   { return "d27942c0" }
1207 func (*BierDispTableDetails) GetMessageType() api.MessageType {
1208         return api.ReplyMessage
1209 }
1210
1211 func (m *BierDispTableDetails) Size() (size int) {
1212         if m == nil {
1213                 return 0
1214         }
1215         size += 4 // m.BdtTblID
1216         return size
1217 }
1218 func (m *BierDispTableDetails) Marshal(b []byte) ([]byte, error) {
1219         if b == nil {
1220                 b = make([]byte, m.Size())
1221         }
1222         buf := codec.NewBuffer(b)
1223         buf.EncodeUint32(m.BdtTblID)
1224         return buf.Bytes(), nil
1225 }
1226 func (m *BierDispTableDetails) Unmarshal(b []byte) error {
1227         buf := codec.NewBuffer(b)
1228         m.BdtTblID = buf.DecodeUint32()
1229         return nil
1230 }
1231
1232 // BierDispTableDump defines message 'bier_disp_table_dump'.
1233 type BierDispTableDump struct{}
1234
1235 func (m *BierDispTableDump) Reset()               { *m = BierDispTableDump{} }
1236 func (*BierDispTableDump) GetMessageName() string { return "bier_disp_table_dump" }
1237 func (*BierDispTableDump) GetCrcString() string   { return "51077d14" }
1238 func (*BierDispTableDump) GetMessageType() api.MessageType {
1239         return api.RequestMessage
1240 }
1241
1242 func (m *BierDispTableDump) Size() (size int) {
1243         if m == nil {
1244                 return 0
1245         }
1246         return size
1247 }
1248 func (m *BierDispTableDump) Marshal(b []byte) ([]byte, error) {
1249         if b == nil {
1250                 b = make([]byte, m.Size())
1251         }
1252         buf := codec.NewBuffer(b)
1253         return buf.Bytes(), nil
1254 }
1255 func (m *BierDispTableDump) Unmarshal(b []byte) error {
1256         return nil
1257 }
1258
1259 // BierImpAdd defines message 'bier_imp_add'.
1260 type BierImpAdd struct {
1261         BiTblID  BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"`
1262         BiSrc    uint16      `binapi:"u16,name=bi_src" json:"bi_src,omitempty"`
1263         BiNBytes uint8       `binapi:"u8,name=bi_n_bytes" json:"-"`
1264         BiBytes  []byte      `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"`
1265 }
1266
1267 func (m *BierImpAdd) Reset()               { *m = BierImpAdd{} }
1268 func (*BierImpAdd) GetMessageName() string { return "bier_imp_add" }
1269 func (*BierImpAdd) GetCrcString() string   { return "3856dc3d" }
1270 func (*BierImpAdd) GetMessageType() api.MessageType {
1271         return api.RequestMessage
1272 }
1273
1274 func (m *BierImpAdd) Size() (size int) {
1275         if m == nil {
1276                 return 0
1277         }
1278         size += 1                  // m.BiTblID.BtSet
1279         size += 1                  // m.BiTblID.BtSubDomain
1280         size += 1                  // m.BiTblID.BtHdrLenID
1281         size += 2                  // m.BiSrc
1282         size += 1                  // m.BiNBytes
1283         size += 1 * len(m.BiBytes) // m.BiBytes
1284         return size
1285 }
1286 func (m *BierImpAdd) Marshal(b []byte) ([]byte, error) {
1287         if b == nil {
1288                 b = make([]byte, m.Size())
1289         }
1290         buf := codec.NewBuffer(b)
1291         buf.EncodeUint8(m.BiTblID.BtSet)
1292         buf.EncodeUint8(m.BiTblID.BtSubDomain)
1293         buf.EncodeUint8(m.BiTblID.BtHdrLenID)
1294         buf.EncodeUint16(m.BiSrc)
1295         buf.EncodeUint8(uint8(len(m.BiBytes)))
1296         buf.EncodeBytes(m.BiBytes, 0)
1297         return buf.Bytes(), nil
1298 }
1299 func (m *BierImpAdd) Unmarshal(b []byte) error {
1300         buf := codec.NewBuffer(b)
1301         m.BiTblID.BtSet = buf.DecodeUint8()
1302         m.BiTblID.BtSubDomain = buf.DecodeUint8()
1303         m.BiTblID.BtHdrLenID = buf.DecodeUint8()
1304         m.BiSrc = buf.DecodeUint16()
1305         m.BiNBytes = buf.DecodeUint8()
1306         m.BiBytes = make([]byte, m.BiNBytes)
1307         copy(m.BiBytes, buf.DecodeBytes(len(m.BiBytes)))
1308         return nil
1309 }
1310
1311 // BierImpAddReply defines message 'bier_imp_add_reply'.
1312 type BierImpAddReply struct {
1313         Retval  int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
1314         BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"`
1315 }
1316
1317 func (m *BierImpAddReply) Reset()               { *m = BierImpAddReply{} }
1318 func (*BierImpAddReply) GetMessageName() string { return "bier_imp_add_reply" }
1319 func (*BierImpAddReply) GetCrcString() string   { return "d49c5793" }
1320 func (*BierImpAddReply) GetMessageType() api.MessageType {
1321         return api.ReplyMessage
1322 }
1323
1324 func (m *BierImpAddReply) Size() (size int) {
1325         if m == nil {
1326                 return 0
1327         }
1328         size += 4 // m.Retval
1329         size += 4 // m.BiIndex
1330         return size
1331 }
1332 func (m *BierImpAddReply) Marshal(b []byte) ([]byte, error) {
1333         if b == nil {
1334                 b = make([]byte, m.Size())
1335         }
1336         buf := codec.NewBuffer(b)
1337         buf.EncodeInt32(m.Retval)
1338         buf.EncodeUint32(m.BiIndex)
1339         return buf.Bytes(), nil
1340 }
1341 func (m *BierImpAddReply) Unmarshal(b []byte) error {
1342         buf := codec.NewBuffer(b)
1343         m.Retval = buf.DecodeInt32()
1344         m.BiIndex = buf.DecodeUint32()
1345         return nil
1346 }
1347
1348 // BierImpDel defines message 'bier_imp_del'.
1349 type BierImpDel struct {
1350         BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"`
1351 }
1352
1353 func (m *BierImpDel) Reset()               { *m = BierImpDel{} }
1354 func (*BierImpDel) GetMessageName() string { return "bier_imp_del" }
1355 func (*BierImpDel) GetCrcString() string   { return "7d45edf6" }
1356 func (*BierImpDel) GetMessageType() api.MessageType {
1357         return api.RequestMessage
1358 }
1359
1360 func (m *BierImpDel) Size() (size int) {
1361         if m == nil {
1362                 return 0
1363         }
1364         size += 4 // m.BiIndex
1365         return size
1366 }
1367 func (m *BierImpDel) Marshal(b []byte) ([]byte, error) {
1368         if b == nil {
1369                 b = make([]byte, m.Size())
1370         }
1371         buf := codec.NewBuffer(b)
1372         buf.EncodeUint32(m.BiIndex)
1373         return buf.Bytes(), nil
1374 }
1375 func (m *BierImpDel) Unmarshal(b []byte) error {
1376         buf := codec.NewBuffer(b)
1377         m.BiIndex = buf.DecodeUint32()
1378         return nil
1379 }
1380
1381 // BierImpDelReply defines message 'bier_imp_del_reply'.
1382 type BierImpDelReply struct {
1383         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1384 }
1385
1386 func (m *BierImpDelReply) Reset()               { *m = BierImpDelReply{} }
1387 func (*BierImpDelReply) GetMessageName() string { return "bier_imp_del_reply" }
1388 func (*BierImpDelReply) GetCrcString() string   { return "e8d4e804" }
1389 func (*BierImpDelReply) GetMessageType() api.MessageType {
1390         return api.ReplyMessage
1391 }
1392
1393 func (m *BierImpDelReply) Size() (size int) {
1394         if m == nil {
1395                 return 0
1396         }
1397         size += 4 // m.Retval
1398         return size
1399 }
1400 func (m *BierImpDelReply) Marshal(b []byte) ([]byte, error) {
1401         if b == nil {
1402                 b = make([]byte, m.Size())
1403         }
1404         buf := codec.NewBuffer(b)
1405         buf.EncodeInt32(m.Retval)
1406         return buf.Bytes(), nil
1407 }
1408 func (m *BierImpDelReply) Unmarshal(b []byte) error {
1409         buf := codec.NewBuffer(b)
1410         m.Retval = buf.DecodeInt32()
1411         return nil
1412 }
1413
1414 // BierImpDetails defines message 'bier_imp_details'.
1415 type BierImpDetails struct {
1416         BiTblID  BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"`
1417         BiSrc    uint16      `binapi:"u16,name=bi_src" json:"bi_src,omitempty"`
1418         BiNBytes uint8       `binapi:"u8,name=bi_n_bytes" json:"-"`
1419         BiBytes  []byte      `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"`
1420 }
1421
1422 func (m *BierImpDetails) Reset()               { *m = BierImpDetails{} }
1423 func (*BierImpDetails) GetMessageName() string { return "bier_imp_details" }
1424 func (*BierImpDetails) GetCrcString() string   { return "b76192df" }
1425 func (*BierImpDetails) GetMessageType() api.MessageType {
1426         return api.ReplyMessage
1427 }
1428
1429 func (m *BierImpDetails) Size() (size int) {
1430         if m == nil {
1431                 return 0
1432         }
1433         size += 1                  // m.BiTblID.BtSet
1434         size += 1                  // m.BiTblID.BtSubDomain
1435         size += 1                  // m.BiTblID.BtHdrLenID
1436         size += 2                  // m.BiSrc
1437         size += 1                  // m.BiNBytes
1438         size += 1 * len(m.BiBytes) // m.BiBytes
1439         return size
1440 }
1441 func (m *BierImpDetails) Marshal(b []byte) ([]byte, error) {
1442         if b == nil {
1443                 b = make([]byte, m.Size())
1444         }
1445         buf := codec.NewBuffer(b)
1446         buf.EncodeUint8(m.BiTblID.BtSet)
1447         buf.EncodeUint8(m.BiTblID.BtSubDomain)
1448         buf.EncodeUint8(m.BiTblID.BtHdrLenID)
1449         buf.EncodeUint16(m.BiSrc)
1450         buf.EncodeUint8(uint8(len(m.BiBytes)))
1451         buf.EncodeBytes(m.BiBytes, 0)
1452         return buf.Bytes(), nil
1453 }
1454 func (m *BierImpDetails) Unmarshal(b []byte) error {
1455         buf := codec.NewBuffer(b)
1456         m.BiTblID.BtSet = buf.DecodeUint8()
1457         m.BiTblID.BtSubDomain = buf.DecodeUint8()
1458         m.BiTblID.BtHdrLenID = buf.DecodeUint8()
1459         m.BiSrc = buf.DecodeUint16()
1460         m.BiNBytes = buf.DecodeUint8()
1461         m.BiBytes = make([]byte, m.BiNBytes)
1462         copy(m.BiBytes, buf.DecodeBytes(len(m.BiBytes)))
1463         return nil
1464 }
1465
1466 // BierImpDump defines message 'bier_imp_dump'.
1467 type BierImpDump struct{}
1468
1469 func (m *BierImpDump) Reset()               { *m = BierImpDump{} }
1470 func (*BierImpDump) GetMessageName() string { return "bier_imp_dump" }
1471 func (*BierImpDump) GetCrcString() string   { return "51077d14" }
1472 func (*BierImpDump) GetMessageType() api.MessageType {
1473         return api.RequestMessage
1474 }
1475
1476 func (m *BierImpDump) Size() (size int) {
1477         if m == nil {
1478                 return 0
1479         }
1480         return size
1481 }
1482 func (m *BierImpDump) Marshal(b []byte) ([]byte, error) {
1483         if b == nil {
1484                 b = make([]byte, m.Size())
1485         }
1486         buf := codec.NewBuffer(b)
1487         return buf.Bytes(), nil
1488 }
1489 func (m *BierImpDump) Unmarshal(b []byte) error {
1490         return nil
1491 }
1492
1493 // BierRouteAddDel defines message 'bier_route_add_del'.
1494 type BierRouteAddDel struct {
1495         BrIsAdd     bool      `binapi:"bool,name=br_is_add" json:"br_is_add,omitempty"`
1496         BrIsReplace bool      `binapi:"bool,name=br_is_replace" json:"br_is_replace,omitempty"`
1497         BrRoute     BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"`
1498 }
1499
1500 func (m *BierRouteAddDel) Reset()               { *m = BierRouteAddDel{} }
1501 func (*BierRouteAddDel) GetMessageName() string { return "bier_route_add_del" }
1502 func (*BierRouteAddDel) GetCrcString() string   { return "f29edca0" }
1503 func (*BierRouteAddDel) GetMessageType() api.MessageType {
1504         return api.RequestMessage
1505 }
1506
1507 func (m *BierRouteAddDel) Size() (size int) {
1508         if m == nil {
1509                 return 0
1510         }
1511         size += 1 // m.BrIsAdd
1512         size += 1 // m.BrIsReplace
1513         size += 4 // m.BrRoute.BrBp
1514         size += 1 // m.BrRoute.BrTblID.BtSet
1515         size += 1 // m.BrRoute.BrTblID.BtSubDomain
1516         size += 1 // m.BrRoute.BrTblID.BtHdrLenID
1517         size += 1 // m.BrRoute.BrNPaths
1518         for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ {
1519                 var s2 FibPath
1520                 _ = s2
1521                 if j2 < len(m.BrRoute.BrPaths) {
1522                         s2 = m.BrRoute.BrPaths[j2]
1523                 }
1524                 size += 4      // s2.SwIfIndex
1525                 size += 4      // s2.TableID
1526                 size += 4      // s2.RpfID
1527                 size += 1      // s2.Weight
1528                 size += 1      // s2.Preference
1529                 size += 4      // s2.Type
1530                 size += 4      // s2.Flags
1531                 size += 4      // s2.Proto
1532                 size += 1 * 16 // s2.Nh.Address
1533                 size += 4      // s2.Nh.ViaLabel
1534                 size += 4      // s2.Nh.ObjID
1535                 size += 4      // s2.Nh.ClassifyTableIndex
1536                 size += 1      // s2.NLabels
1537                 for j3 := 0; j3 < 16; j3++ {
1538                         size += 1 // s2.LabelStack[j3].IsUniform
1539                         size += 4 // s2.LabelStack[j3].Label
1540                         size += 1 // s2.LabelStack[j3].TTL
1541                         size += 1 // s2.LabelStack[j3].Exp
1542                 }
1543         }
1544         return size
1545 }
1546 func (m *BierRouteAddDel) Marshal(b []byte) ([]byte, error) {
1547         if b == nil {
1548                 b = make([]byte, m.Size())
1549         }
1550         buf := codec.NewBuffer(b)
1551         buf.EncodeBool(m.BrIsAdd)
1552         buf.EncodeBool(m.BrIsReplace)
1553         buf.EncodeUint32(m.BrRoute.BrBp)
1554         buf.EncodeUint8(m.BrRoute.BrTblID.BtSet)
1555         buf.EncodeUint8(m.BrRoute.BrTblID.BtSubDomain)
1556         buf.EncodeUint8(m.BrRoute.BrTblID.BtHdrLenID)
1557         buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths)))
1558         for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
1559                 var v1 FibPath // BrPaths
1560                 if j1 < len(m.BrRoute.BrPaths) {
1561                         v1 = m.BrRoute.BrPaths[j1]
1562                 }
1563                 buf.EncodeUint32(v1.SwIfIndex)
1564                 buf.EncodeUint32(v1.TableID)
1565                 buf.EncodeUint32(v1.RpfID)
1566                 buf.EncodeUint8(v1.Weight)
1567                 buf.EncodeUint8(v1.Preference)
1568                 buf.EncodeUint32(uint32(v1.Type))
1569                 buf.EncodeUint32(uint32(v1.Flags))
1570                 buf.EncodeUint32(uint32(v1.Proto))
1571                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1572                 buf.EncodeUint32(v1.Nh.ViaLabel)
1573                 buf.EncodeUint32(v1.Nh.ObjID)
1574                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1575                 buf.EncodeUint8(v1.NLabels)
1576                 for j2 := 0; j2 < 16; j2++ {
1577                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1578                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1579                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1580                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1581                 }
1582         }
1583         return buf.Bytes(), nil
1584 }
1585 func (m *BierRouteAddDel) Unmarshal(b []byte) error {
1586         buf := codec.NewBuffer(b)
1587         m.BrIsAdd = buf.DecodeBool()
1588         m.BrIsReplace = buf.DecodeBool()
1589         m.BrRoute.BrBp = buf.DecodeUint32()
1590         m.BrRoute.BrTblID.BtSet = buf.DecodeUint8()
1591         m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8()
1592         m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8()
1593         m.BrRoute.BrNPaths = buf.DecodeUint8()
1594         m.BrRoute.BrPaths = make([]FibPath, m.BrRoute.BrNPaths)
1595         for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
1596                 m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32()
1597                 m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32()
1598                 m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32()
1599                 m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8()
1600                 m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8()
1601                 m.BrRoute.BrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1602                 m.BrRoute.BrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1603                 m.BrRoute.BrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1604                 copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1605                 m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1606                 m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1607                 m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1608                 m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8()
1609                 for j2 := 0; j2 < 16; j2++ {
1610                         m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1611                         m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1612                         m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1613                         m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1614                 }
1615         }
1616         return nil
1617 }
1618
1619 // BierRouteAddDelReply defines message 'bier_route_add_del_reply'.
1620 type BierRouteAddDelReply struct {
1621         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1622 }
1623
1624 func (m *BierRouteAddDelReply) Reset()               { *m = BierRouteAddDelReply{} }
1625 func (*BierRouteAddDelReply) GetMessageName() string { return "bier_route_add_del_reply" }
1626 func (*BierRouteAddDelReply) GetCrcString() string   { return "e8d4e804" }
1627 func (*BierRouteAddDelReply) GetMessageType() api.MessageType {
1628         return api.ReplyMessage
1629 }
1630
1631 func (m *BierRouteAddDelReply) Size() (size int) {
1632         if m == nil {
1633                 return 0
1634         }
1635         size += 4 // m.Retval
1636         return size
1637 }
1638 func (m *BierRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
1639         if b == nil {
1640                 b = make([]byte, m.Size())
1641         }
1642         buf := codec.NewBuffer(b)
1643         buf.EncodeInt32(m.Retval)
1644         return buf.Bytes(), nil
1645 }
1646 func (m *BierRouteAddDelReply) Unmarshal(b []byte) error {
1647         buf := codec.NewBuffer(b)
1648         m.Retval = buf.DecodeInt32()
1649         return nil
1650 }
1651
1652 // BierRouteDetails defines message 'bier_route_details'.
1653 type BierRouteDetails struct {
1654         BrRoute BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"`
1655 }
1656
1657 func (m *BierRouteDetails) Reset()               { *m = BierRouteDetails{} }
1658 func (*BierRouteDetails) GetMessageName() string { return "bier_route_details" }
1659 func (*BierRouteDetails) GetCrcString() string   { return "39ee6a56" }
1660 func (*BierRouteDetails) GetMessageType() api.MessageType {
1661         return api.ReplyMessage
1662 }
1663
1664 func (m *BierRouteDetails) Size() (size int) {
1665         if m == nil {
1666                 return 0
1667         }
1668         size += 4 // m.BrRoute.BrBp
1669         size += 1 // m.BrRoute.BrTblID.BtSet
1670         size += 1 // m.BrRoute.BrTblID.BtSubDomain
1671         size += 1 // m.BrRoute.BrTblID.BtHdrLenID
1672         size += 1 // m.BrRoute.BrNPaths
1673         for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ {
1674                 var s2 FibPath
1675                 _ = s2
1676                 if j2 < len(m.BrRoute.BrPaths) {
1677                         s2 = m.BrRoute.BrPaths[j2]
1678                 }
1679                 size += 4      // s2.SwIfIndex
1680                 size += 4      // s2.TableID
1681                 size += 4      // s2.RpfID
1682                 size += 1      // s2.Weight
1683                 size += 1      // s2.Preference
1684                 size += 4      // s2.Type
1685                 size += 4      // s2.Flags
1686                 size += 4      // s2.Proto
1687                 size += 1 * 16 // s2.Nh.Address
1688                 size += 4      // s2.Nh.ViaLabel
1689                 size += 4      // s2.Nh.ObjID
1690                 size += 4      // s2.Nh.ClassifyTableIndex
1691                 size += 1      // s2.NLabels
1692                 for j3 := 0; j3 < 16; j3++ {
1693                         size += 1 // s2.LabelStack[j3].IsUniform
1694                         size += 4 // s2.LabelStack[j3].Label
1695                         size += 1 // s2.LabelStack[j3].TTL
1696                         size += 1 // s2.LabelStack[j3].Exp
1697                 }
1698         }
1699         return size
1700 }
1701 func (m *BierRouteDetails) Marshal(b []byte) ([]byte, error) {
1702         if b == nil {
1703                 b = make([]byte, m.Size())
1704         }
1705         buf := codec.NewBuffer(b)
1706         buf.EncodeUint32(m.BrRoute.BrBp)
1707         buf.EncodeUint8(m.BrRoute.BrTblID.BtSet)
1708         buf.EncodeUint8(m.BrRoute.BrTblID.BtSubDomain)
1709         buf.EncodeUint8(m.BrRoute.BrTblID.BtHdrLenID)
1710         buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths)))
1711         for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
1712                 var v1 FibPath // BrPaths
1713                 if j1 < len(m.BrRoute.BrPaths) {
1714                         v1 = m.BrRoute.BrPaths[j1]
1715                 }
1716                 buf.EncodeUint32(v1.SwIfIndex)
1717                 buf.EncodeUint32(v1.TableID)
1718                 buf.EncodeUint32(v1.RpfID)
1719                 buf.EncodeUint8(v1.Weight)
1720                 buf.EncodeUint8(v1.Preference)
1721                 buf.EncodeUint32(uint32(v1.Type))
1722                 buf.EncodeUint32(uint32(v1.Flags))
1723                 buf.EncodeUint32(uint32(v1.Proto))
1724                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
1725                 buf.EncodeUint32(v1.Nh.ViaLabel)
1726                 buf.EncodeUint32(v1.Nh.ObjID)
1727                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
1728                 buf.EncodeUint8(v1.NLabels)
1729                 for j2 := 0; j2 < 16; j2++ {
1730                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
1731                         buf.EncodeUint32(v1.LabelStack[j2].Label)
1732                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
1733                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
1734                 }
1735         }
1736         return buf.Bytes(), nil
1737 }
1738 func (m *BierRouteDetails) Unmarshal(b []byte) error {
1739         buf := codec.NewBuffer(b)
1740         m.BrRoute.BrBp = buf.DecodeUint32()
1741         m.BrRoute.BrTblID.BtSet = buf.DecodeUint8()
1742         m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8()
1743         m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8()
1744         m.BrRoute.BrNPaths = buf.DecodeUint8()
1745         m.BrRoute.BrPaths = make([]FibPath, m.BrRoute.BrNPaths)
1746         for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
1747                 m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32()
1748                 m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32()
1749                 m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32()
1750                 m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8()
1751                 m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8()
1752                 m.BrRoute.BrPaths[j1].Type = FibPathType(buf.DecodeUint32())
1753                 m.BrRoute.BrPaths[j1].Flags = FibPathFlags(buf.DecodeUint32())
1754                 m.BrRoute.BrPaths[j1].Proto = FibPathNhProto(buf.DecodeUint32())
1755                 copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
1756                 m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32()
1757                 m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32()
1758                 m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
1759                 m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8()
1760                 for j2 := 0; j2 < 16; j2++ {
1761                         m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
1762                         m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32()
1763                         m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
1764                         m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
1765                 }
1766         }
1767         return nil
1768 }
1769
1770 // BierRouteDump defines message 'bier_route_dump'.
1771 type BierRouteDump struct {
1772         BrTblID BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"`
1773 }
1774
1775 func (m *BierRouteDump) Reset()               { *m = BierRouteDump{} }
1776 func (*BierRouteDump) GetMessageName() string { return "bier_route_dump" }
1777 func (*BierRouteDump) GetCrcString() string   { return "38339846" }
1778 func (*BierRouteDump) GetMessageType() api.MessageType {
1779         return api.RequestMessage
1780 }
1781
1782 func (m *BierRouteDump) Size() (size int) {
1783         if m == nil {
1784                 return 0
1785         }
1786         size += 1 // m.BrTblID.BtSet
1787         size += 1 // m.BrTblID.BtSubDomain
1788         size += 1 // m.BrTblID.BtHdrLenID
1789         return size
1790 }
1791 func (m *BierRouteDump) Marshal(b []byte) ([]byte, error) {
1792         if b == nil {
1793                 b = make([]byte, m.Size())
1794         }
1795         buf := codec.NewBuffer(b)
1796         buf.EncodeUint8(m.BrTblID.BtSet)
1797         buf.EncodeUint8(m.BrTblID.BtSubDomain)
1798         buf.EncodeUint8(m.BrTblID.BtHdrLenID)
1799         return buf.Bytes(), nil
1800 }
1801 func (m *BierRouteDump) Unmarshal(b []byte) error {
1802         buf := codec.NewBuffer(b)
1803         m.BrTblID.BtSet = buf.DecodeUint8()
1804         m.BrTblID.BtSubDomain = buf.DecodeUint8()
1805         m.BrTblID.BtHdrLenID = buf.DecodeUint8()
1806         return nil
1807 }
1808
1809 // BierTableAddDel defines message 'bier_table_add_del'.
1810 type BierTableAddDel struct {
1811         BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"`
1812         BtLabel uint32      `binapi:"u32,name=bt_label" json:"bt_label,omitempty"`
1813         BtIsAdd bool        `binapi:"bool,name=bt_is_add" json:"bt_is_add,omitempty"`
1814 }
1815
1816 func (m *BierTableAddDel) Reset()               { *m = BierTableAddDel{} }
1817 func (*BierTableAddDel) GetMessageName() string { return "bier_table_add_del" }
1818 func (*BierTableAddDel) GetCrcString() string   { return "35e59209" }
1819 func (*BierTableAddDel) GetMessageType() api.MessageType {
1820         return api.RequestMessage
1821 }
1822
1823 func (m *BierTableAddDel) Size() (size int) {
1824         if m == nil {
1825                 return 0
1826         }
1827         size += 1 // m.BtTblID.BtSet
1828         size += 1 // m.BtTblID.BtSubDomain
1829         size += 1 // m.BtTblID.BtHdrLenID
1830         size += 4 // m.BtLabel
1831         size += 1 // m.BtIsAdd
1832         return size
1833 }
1834 func (m *BierTableAddDel) Marshal(b []byte) ([]byte, error) {
1835         if b == nil {
1836                 b = make([]byte, m.Size())
1837         }
1838         buf := codec.NewBuffer(b)
1839         buf.EncodeUint8(m.BtTblID.BtSet)
1840         buf.EncodeUint8(m.BtTblID.BtSubDomain)
1841         buf.EncodeUint8(m.BtTblID.BtHdrLenID)
1842         buf.EncodeUint32(m.BtLabel)
1843         buf.EncodeBool(m.BtIsAdd)
1844         return buf.Bytes(), nil
1845 }
1846 func (m *BierTableAddDel) Unmarshal(b []byte) error {
1847         buf := codec.NewBuffer(b)
1848         m.BtTblID.BtSet = buf.DecodeUint8()
1849         m.BtTblID.BtSubDomain = buf.DecodeUint8()
1850         m.BtTblID.BtHdrLenID = buf.DecodeUint8()
1851         m.BtLabel = buf.DecodeUint32()
1852         m.BtIsAdd = buf.DecodeBool()
1853         return nil
1854 }
1855
1856 // BierTableAddDelReply defines message 'bier_table_add_del_reply'.
1857 type BierTableAddDelReply struct {
1858         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1859 }
1860
1861 func (m *BierTableAddDelReply) Reset()               { *m = BierTableAddDelReply{} }
1862 func (*BierTableAddDelReply) GetMessageName() string { return "bier_table_add_del_reply" }
1863 func (*BierTableAddDelReply) GetCrcString() string   { return "e8d4e804" }
1864 func (*BierTableAddDelReply) GetMessageType() api.MessageType {
1865         return api.ReplyMessage
1866 }
1867
1868 func (m *BierTableAddDelReply) Size() (size int) {
1869         if m == nil {
1870                 return 0
1871         }
1872         size += 4 // m.Retval
1873         return size
1874 }
1875 func (m *BierTableAddDelReply) Marshal(b []byte) ([]byte, error) {
1876         if b == nil {
1877                 b = make([]byte, m.Size())
1878         }
1879         buf := codec.NewBuffer(b)
1880         buf.EncodeInt32(m.Retval)
1881         return buf.Bytes(), nil
1882 }
1883 func (m *BierTableAddDelReply) Unmarshal(b []byte) error {
1884         buf := codec.NewBuffer(b)
1885         m.Retval = buf.DecodeInt32()
1886         return nil
1887 }
1888
1889 // BierTableDetails defines message 'bier_table_details'.
1890 type BierTableDetails struct {
1891         BtLabel uint32      `binapi:"u32,name=bt_label" json:"bt_label,omitempty"`
1892         BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"`
1893 }
1894
1895 func (m *BierTableDetails) Reset()               { *m = BierTableDetails{} }
1896 func (*BierTableDetails) GetMessageName() string { return "bier_table_details" }
1897 func (*BierTableDetails) GetCrcString() string   { return "fc44a9dd" }
1898 func (*BierTableDetails) GetMessageType() api.MessageType {
1899         return api.ReplyMessage
1900 }
1901
1902 func (m *BierTableDetails) Size() (size int) {
1903         if m == nil {
1904                 return 0
1905         }
1906         size += 4 // m.BtLabel
1907         size += 1 // m.BtTblID.BtSet
1908         size += 1 // m.BtTblID.BtSubDomain
1909         size += 1 // m.BtTblID.BtHdrLenID
1910         return size
1911 }
1912 func (m *BierTableDetails) Marshal(b []byte) ([]byte, error) {
1913         if b == nil {
1914                 b = make([]byte, m.Size())
1915         }
1916         buf := codec.NewBuffer(b)
1917         buf.EncodeUint32(m.BtLabel)
1918         buf.EncodeUint8(m.BtTblID.BtSet)
1919         buf.EncodeUint8(m.BtTblID.BtSubDomain)
1920         buf.EncodeUint8(m.BtTblID.BtHdrLenID)
1921         return buf.Bytes(), nil
1922 }
1923 func (m *BierTableDetails) Unmarshal(b []byte) error {
1924         buf := codec.NewBuffer(b)
1925         m.BtLabel = buf.DecodeUint32()
1926         m.BtTblID.BtSet = buf.DecodeUint8()
1927         m.BtTblID.BtSubDomain = buf.DecodeUint8()
1928         m.BtTblID.BtHdrLenID = buf.DecodeUint8()
1929         return nil
1930 }
1931
1932 // BierTableDump defines message 'bier_table_dump'.
1933 type BierTableDump struct{}
1934
1935 func (m *BierTableDump) Reset()               { *m = BierTableDump{} }
1936 func (*BierTableDump) GetMessageName() string { return "bier_table_dump" }
1937 func (*BierTableDump) GetCrcString() string   { return "51077d14" }
1938 func (*BierTableDump) GetMessageType() api.MessageType {
1939         return api.RequestMessage
1940 }
1941
1942 func (m *BierTableDump) Size() (size int) {
1943         if m == nil {
1944                 return 0
1945         }
1946         return size
1947 }
1948 func (m *BierTableDump) Marshal(b []byte) ([]byte, error) {
1949         if b == nil {
1950                 b = make([]byte, m.Size())
1951         }
1952         buf := codec.NewBuffer(b)
1953         return buf.Bytes(), nil
1954 }
1955 func (m *BierTableDump) Unmarshal(b []byte) error {
1956         return nil
1957 }
1958
1959 func init() { file_bier_binapi_init() }
1960 func file_bier_binapi_init() {
1961         api.RegisterMessage((*BierDispEntryAddDel)(nil), "bier_disp_entry_add_del_648323eb")
1962         api.RegisterMessage((*BierDispEntryAddDelReply)(nil), "bier_disp_entry_add_del_reply_e8d4e804")
1963         api.RegisterMessage((*BierDispEntryDetails)(nil), "bier_disp_entry_details_e5b039a9")
1964         api.RegisterMessage((*BierDispEntryDump)(nil), "bier_disp_entry_dump_b5fa54ad")
1965         api.RegisterMessage((*BierDispTableAddDel)(nil), "bier_disp_table_add_del_889657ac")
1966         api.RegisterMessage((*BierDispTableAddDelReply)(nil), "bier_disp_table_add_del_reply_e8d4e804")
1967         api.RegisterMessage((*BierDispTableDetails)(nil), "bier_disp_table_details_d27942c0")
1968         api.RegisterMessage((*BierDispTableDump)(nil), "bier_disp_table_dump_51077d14")
1969         api.RegisterMessage((*BierImpAdd)(nil), "bier_imp_add_3856dc3d")
1970         api.RegisterMessage((*BierImpAddReply)(nil), "bier_imp_add_reply_d49c5793")
1971         api.RegisterMessage((*BierImpDel)(nil), "bier_imp_del_7d45edf6")
1972         api.RegisterMessage((*BierImpDelReply)(nil), "bier_imp_del_reply_e8d4e804")
1973         api.RegisterMessage((*BierImpDetails)(nil), "bier_imp_details_b76192df")
1974         api.RegisterMessage((*BierImpDump)(nil), "bier_imp_dump_51077d14")
1975         api.RegisterMessage((*BierRouteAddDel)(nil), "bier_route_add_del_f29edca0")
1976         api.RegisterMessage((*BierRouteAddDelReply)(nil), "bier_route_add_del_reply_e8d4e804")
1977         api.RegisterMessage((*BierRouteDetails)(nil), "bier_route_details_39ee6a56")
1978         api.RegisterMessage((*BierRouteDump)(nil), "bier_route_dump_38339846")
1979         api.RegisterMessage((*BierTableAddDel)(nil), "bier_table_add_del_35e59209")
1980         api.RegisterMessage((*BierTableAddDelReply)(nil), "bier_table_add_del_reply_e8d4e804")
1981         api.RegisterMessage((*BierTableDetails)(nil), "bier_table_details_fc44a9dd")
1982         api.RegisterMessage((*BierTableDump)(nil), "bier_table_dump_51077d14")
1983 }
1984
1985 // Messages returns list of all messages in this module.
1986 func AllMessages() []api.Message {
1987         return []api.Message{
1988                 (*BierDispEntryAddDel)(nil),
1989                 (*BierDispEntryAddDelReply)(nil),
1990                 (*BierDispEntryDetails)(nil),
1991                 (*BierDispEntryDump)(nil),
1992                 (*BierDispTableAddDel)(nil),
1993                 (*BierDispTableAddDelReply)(nil),
1994                 (*BierDispTableDetails)(nil),
1995                 (*BierDispTableDump)(nil),
1996                 (*BierImpAdd)(nil),
1997                 (*BierImpAddReply)(nil),
1998                 (*BierImpDel)(nil),
1999                 (*BierImpDelReply)(nil),
2000                 (*BierImpDetails)(nil),
2001                 (*BierImpDump)(nil),
2002                 (*BierRouteAddDel)(nil),
2003                 (*BierRouteAddDelReply)(nil),
2004                 (*BierRouteDetails)(nil),
2005                 (*BierRouteDump)(nil),
2006                 (*BierTableAddDel)(nil),
2007                 (*BierTableAddDelReply)(nil),
2008                 (*BierTableDetails)(nil),
2009                 (*BierTableDump)(nil),
2010         }
2011 }