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