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