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