Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / l2tp / l2tp.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/l2tp.api.json
6
7 // Package l2tp contains generated bindings for API file l2tp.api.
8 //
9 // Contents:
10 //   7 aliases
11 //  11 enums
12 //   6 structs
13 //   1 union
14 //  10 messages
15 //
16 package l2tp
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    = "l2tp"
36         APIVersion = "2.0.0"
37         VersionCrc = 0x1ecf7730
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 // L2tLookupKey defines enum 'l2t_lookup_key'.
321 type L2tLookupKey uint8
322
323 const (
324         L2T_LOOKUP_KEY_API_SRC_ADDR   L2tLookupKey = 0
325         L2T_LOOKUP_KEY_API_DST_ADDR   L2tLookupKey = 1
326         L2T_LOOKUP_KEY_API_SESSION_ID L2tLookupKey = 2
327 )
328
329 var (
330         L2tLookupKey_name = map[uint8]string{
331                 0: "L2T_LOOKUP_KEY_API_SRC_ADDR",
332                 1: "L2T_LOOKUP_KEY_API_DST_ADDR",
333                 2: "L2T_LOOKUP_KEY_API_SESSION_ID",
334         }
335         L2tLookupKey_value = map[string]uint8{
336                 "L2T_LOOKUP_KEY_API_SRC_ADDR":   0,
337                 "L2T_LOOKUP_KEY_API_DST_ADDR":   1,
338                 "L2T_LOOKUP_KEY_API_SESSION_ID": 2,
339         }
340 )
341
342 func (x L2tLookupKey) String() string {
343         s, ok := L2tLookupKey_name[uint8(x)]
344         if ok {
345                 return s
346         }
347         return "L2tLookupKey(" + strconv.Itoa(int(x)) + ")"
348 }
349
350 // LinkDuplex defines enum 'link_duplex'.
351 type LinkDuplex uint32
352
353 const (
354         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
355         LINK_DUPLEX_API_HALF    LinkDuplex = 1
356         LINK_DUPLEX_API_FULL    LinkDuplex = 2
357 )
358
359 var (
360         LinkDuplex_name = map[uint32]string{
361                 0: "LINK_DUPLEX_API_UNKNOWN",
362                 1: "LINK_DUPLEX_API_HALF",
363                 2: "LINK_DUPLEX_API_FULL",
364         }
365         LinkDuplex_value = map[string]uint32{
366                 "LINK_DUPLEX_API_UNKNOWN": 0,
367                 "LINK_DUPLEX_API_HALF":    1,
368                 "LINK_DUPLEX_API_FULL":    2,
369         }
370 )
371
372 func (x LinkDuplex) String() string {
373         s, ok := LinkDuplex_name[uint32(x)]
374         if ok {
375                 return s
376         }
377         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
378 }
379
380 // MtuProto defines enum 'mtu_proto'.
381 type MtuProto uint32
382
383 const (
384         MTU_PROTO_API_L3   MtuProto = 1
385         MTU_PROTO_API_IP4  MtuProto = 2
386         MTU_PROTO_API_IP6  MtuProto = 3
387         MTU_PROTO_API_MPLS MtuProto = 4
388         MTU_PROTO_API_N    MtuProto = 5
389 )
390
391 var (
392         MtuProto_name = map[uint32]string{
393                 1: "MTU_PROTO_API_L3",
394                 2: "MTU_PROTO_API_IP4",
395                 3: "MTU_PROTO_API_IP6",
396                 4: "MTU_PROTO_API_MPLS",
397                 5: "MTU_PROTO_API_N",
398         }
399         MtuProto_value = map[string]uint32{
400                 "MTU_PROTO_API_L3":   1,
401                 "MTU_PROTO_API_IP4":  2,
402                 "MTU_PROTO_API_IP6":  3,
403                 "MTU_PROTO_API_MPLS": 4,
404                 "MTU_PROTO_API_N":    5,
405         }
406 )
407
408 func (x MtuProto) String() string {
409         s, ok := MtuProto_name[uint32(x)]
410         if ok {
411                 return s
412         }
413         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
414 }
415
416 // RxMode defines enum 'rx_mode'.
417 type RxMode uint32
418
419 const (
420         RX_MODE_API_UNKNOWN   RxMode = 0
421         RX_MODE_API_POLLING   RxMode = 1
422         RX_MODE_API_INTERRUPT RxMode = 2
423         RX_MODE_API_ADAPTIVE  RxMode = 3
424         RX_MODE_API_DEFAULT   RxMode = 4
425 )
426
427 var (
428         RxMode_name = map[uint32]string{
429                 0: "RX_MODE_API_UNKNOWN",
430                 1: "RX_MODE_API_POLLING",
431                 2: "RX_MODE_API_INTERRUPT",
432                 3: "RX_MODE_API_ADAPTIVE",
433                 4: "RX_MODE_API_DEFAULT",
434         }
435         RxMode_value = map[string]uint32{
436                 "RX_MODE_API_UNKNOWN":   0,
437                 "RX_MODE_API_POLLING":   1,
438                 "RX_MODE_API_INTERRUPT": 2,
439                 "RX_MODE_API_ADAPTIVE":  3,
440                 "RX_MODE_API_DEFAULT":   4,
441         }
442 )
443
444 func (x RxMode) String() string {
445         s, ok := RxMode_name[uint32(x)]
446         if ok {
447                 return s
448         }
449         return "RxMode(" + strconv.Itoa(int(x)) + ")"
450 }
451
452 // SubIfFlags defines enum 'sub_if_flags'.
453 type SubIfFlags uint32
454
455 const (
456         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
457         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
458         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
459         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
460         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
461         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
462         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
463         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
464         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
465         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
466 )
467
468 var (
469         SubIfFlags_name = map[uint32]string{
470                 1:   "SUB_IF_API_FLAG_NO_TAGS",
471                 2:   "SUB_IF_API_FLAG_ONE_TAG",
472                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
473                 8:   "SUB_IF_API_FLAG_DOT1AD",
474                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
475                 32:  "SUB_IF_API_FLAG_DEFAULT",
476                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
477                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
478                 254: "SUB_IF_API_FLAG_MASK_VNET",
479                 256: "SUB_IF_API_FLAG_DOT1AH",
480         }
481         SubIfFlags_value = map[string]uint32{
482                 "SUB_IF_API_FLAG_NO_TAGS":           1,
483                 "SUB_IF_API_FLAG_ONE_TAG":           2,
484                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
485                 "SUB_IF_API_FLAG_DOT1AD":            8,
486                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
487                 "SUB_IF_API_FLAG_DEFAULT":           32,
488                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
489                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
490                 "SUB_IF_API_FLAG_MASK_VNET":         254,
491                 "SUB_IF_API_FLAG_DOT1AH":            256,
492         }
493 )
494
495 func (x SubIfFlags) String() string {
496         s, ok := SubIfFlags_name[uint32(x)]
497         if ok {
498                 return s
499         }
500         str := func(n uint32) string {
501                 s, ok := SubIfFlags_name[uint32(n)]
502                 if ok {
503                         return s
504                 }
505                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
506         }
507         for i := uint32(0); i <= 32; i++ {
508                 val := uint32(x)
509                 if val&(1<<i) != 0 {
510                         if s != "" {
511                                 s += "|"
512                         }
513                         s += str(1 << i)
514                 }
515         }
516         if s == "" {
517                 return str(uint32(x))
518         }
519         return s
520 }
521
522 // AddressWithPrefix defines alias 'address_with_prefix'.
523 type AddressWithPrefix Prefix
524
525 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
526         prefix, err := ParsePrefix(s)
527         if err != nil {
528                 return AddressWithPrefix{}, err
529         }
530         return AddressWithPrefix(prefix), nil
531 }
532
533 func (x AddressWithPrefix) String() string {
534         return Prefix(x).String()
535 }
536
537 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
538         return []byte(x.String()), nil
539 }
540
541 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
542         prefix, err := ParseAddressWithPrefix(string(text))
543         if err != nil {
544                 return err
545         }
546         *x = prefix
547         return nil
548 }
549
550 // InterfaceIndex defines alias 'interface_index'.
551 type InterfaceIndex uint32
552
553 // IP4Address defines alias 'ip4_address'.
554 type IP4Address [4]uint8
555
556 func ParseIP4Address(s string) (IP4Address, error) {
557         ip := net.ParseIP(s).To4()
558         if ip == nil {
559                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
560         }
561         var ipaddr IP4Address
562         copy(ipaddr[:], ip.To4())
563         return ipaddr, nil
564 }
565
566 func (x IP4Address) ToIP() net.IP {
567         return net.IP(x[:]).To4()
568 }
569
570 func (x IP4Address) String() string {
571         return x.ToIP().String()
572 }
573
574 func (x *IP4Address) MarshalText() ([]byte, error) {
575         return []byte(x.String()), nil
576 }
577
578 func (x *IP4Address) UnmarshalText(text []byte) error {
579         ipaddr, err := ParseIP4Address(string(text))
580         if err != nil {
581                 return err
582         }
583         *x = ipaddr
584         return nil
585 }
586
587 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
588 type IP4AddressWithPrefix IP4Prefix
589
590 // IP6Address defines alias 'ip6_address'.
591 type IP6Address [16]uint8
592
593 func ParseIP6Address(s string) (IP6Address, error) {
594         ip := net.ParseIP(s).To16()
595         if ip == nil {
596                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
597         }
598         var ipaddr IP6Address
599         copy(ipaddr[:], ip.To16())
600         return ipaddr, nil
601 }
602
603 func (x IP6Address) ToIP() net.IP {
604         return net.IP(x[:]).To16()
605 }
606
607 func (x IP6Address) String() string {
608         return x.ToIP().String()
609 }
610
611 func (x *IP6Address) MarshalText() ([]byte, error) {
612         return []byte(x.String()), nil
613 }
614
615 func (x *IP6Address) UnmarshalText(text []byte) error {
616         ipaddr, err := ParseIP6Address(string(text))
617         if err != nil {
618                 return err
619         }
620         *x = ipaddr
621         return nil
622 }
623
624 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
625 type IP6AddressWithPrefix IP6Prefix
626
627 // MacAddress defines alias 'mac_address'.
628 type MacAddress [6]uint8
629
630 func ParseMacAddress(s string) (MacAddress, error) {
631         var macaddr MacAddress
632         mac, err := net.ParseMAC(s)
633         if err != nil {
634                 return macaddr, err
635         }
636         copy(macaddr[:], mac[:])
637         return macaddr, nil
638 }
639
640 func (x MacAddress) ToMAC() net.HardwareAddr {
641         return net.HardwareAddr(x[:])
642 }
643
644 func (x MacAddress) String() string {
645         return x.ToMAC().String()
646 }
647
648 func (x *MacAddress) MarshalText() ([]byte, error) {
649         return []byte(x.String()), nil
650 }
651
652 func (x *MacAddress) UnmarshalText(text []byte) error {
653         mac, err := ParseMacAddress(string(text))
654         if err != nil {
655                 return err
656         }
657         *x = mac
658         return nil
659 }
660
661 // Address defines type 'address'.
662 type Address struct {
663         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
664         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
665 }
666
667 func ParseAddress(s string) (Address, error) {
668         ip := net.ParseIP(s)
669         if ip == nil {
670                 return Address{}, fmt.Errorf("invalid address: %s", s)
671         }
672         return AddressFromIP(ip), nil
673 }
674
675 func AddressFromIP(ip net.IP) Address {
676         var addr Address
677         if ip.To4() == nil {
678                 addr.Af = ADDRESS_IP6
679                 var ip6 IP6Address
680                 copy(ip6[:], ip.To16())
681                 addr.Un.SetIP6(ip6)
682         } else {
683                 addr.Af = ADDRESS_IP4
684                 var ip4 IP4Address
685                 copy(ip4[:], ip.To4())
686                 addr.Un.SetIP4(ip4)
687         }
688         return addr
689 }
690
691 func (x Address) ToIP() net.IP {
692         if x.Af == ADDRESS_IP6 {
693                 ip6 := x.Un.GetIP6()
694                 return net.IP(ip6[:]).To16()
695         } else {
696                 ip4 := x.Un.GetIP4()
697                 return net.IP(ip4[:]).To4()
698         }
699 }
700
701 func (x Address) String() string {
702         return x.ToIP().String()
703 }
704
705 func (x *Address) MarshalText() ([]byte, error) {
706         return []byte(x.String()), nil
707 }
708
709 func (x *Address) UnmarshalText(text []byte) error {
710         addr, err := ParseAddress(string(text))
711         if err != nil {
712                 return err
713         }
714         *x = addr
715         return nil
716 }
717
718 // IP4Prefix defines type 'ip4_prefix'.
719 type IP4Prefix struct {
720         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
721         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
722 }
723
724 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
725         hasPrefix := strings.Contains(s, "/")
726         if hasPrefix {
727                 ip, network, err := net.ParseCIDR(s)
728                 if err != nil {
729                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
730                 }
731                 maskSize, _ := network.Mask.Size()
732                 prefix.Len = byte(maskSize)
733                 prefix.Address, err = ParseIP4Address(ip.String())
734                 if err != nil {
735                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
736                 }
737         } else {
738                 ip := net.ParseIP(s)
739                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
740                 if ip.To4() == nil {
741                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
742                 }
743                 prefix.Len = byte(defaultMaskSize)
744                 prefix.Address, err = ParseIP4Address(ip.String())
745                 if err != nil {
746                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
747                 }
748         }
749         return prefix, nil
750 }
751
752 func (x IP4Prefix) ToIPNet() *net.IPNet {
753         mask := net.CIDRMask(int(x.Len), 32)
754         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
755         return ipnet
756 }
757
758 func (x IP4Prefix) String() string {
759         ip := x.Address.String()
760         return ip + "/" + strconv.Itoa(int(x.Len))
761 }
762
763 func (x *IP4Prefix) MarshalText() ([]byte, error) {
764         return []byte(x.String()), nil
765 }
766
767 func (x *IP4Prefix) UnmarshalText(text []byte) error {
768         prefix, err := ParseIP4Prefix(string(text))
769         if err != nil {
770                 return err
771         }
772         *x = prefix
773         return nil
774 }
775
776 // IP6Prefix defines type 'ip6_prefix'.
777 type IP6Prefix struct {
778         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
779         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
780 }
781
782 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
783         hasPrefix := strings.Contains(s, "/")
784         if hasPrefix {
785                 ip, network, err := net.ParseCIDR(s)
786                 if err != nil {
787                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
788                 }
789                 maskSize, _ := network.Mask.Size()
790                 prefix.Len = byte(maskSize)
791                 prefix.Address, err = ParseIP6Address(ip.String())
792                 if err != nil {
793                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
794                 }
795         } else {
796                 ip := net.ParseIP(s)
797                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
798                 if ip.To4() == nil {
799                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
800                 }
801                 prefix.Len = byte(defaultMaskSize)
802                 prefix.Address, err = ParseIP6Address(ip.String())
803                 if err != nil {
804                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
805                 }
806         }
807         return prefix, nil
808 }
809
810 func (x IP6Prefix) ToIPNet() *net.IPNet {
811         mask := net.CIDRMask(int(x.Len), 128)
812         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
813         return ipnet
814 }
815
816 func (x IP6Prefix) String() string {
817         ip := x.Address.String()
818         return ip + "/" + strconv.Itoa(int(x.Len))
819 }
820
821 func (x *IP6Prefix) MarshalText() ([]byte, error) {
822         return []byte(x.String()), nil
823 }
824
825 func (x *IP6Prefix) UnmarshalText(text []byte) error {
826         prefix, err := ParseIP6Prefix(string(text))
827         if err != nil {
828                 return err
829         }
830         *x = prefix
831         return nil
832 }
833
834 // Mprefix defines type 'mprefix'.
835 type Mprefix struct {
836         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
837         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
838         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
839         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
840 }
841
842 // Prefix defines type 'prefix'.
843 type Prefix struct {
844         Address Address `binapi:"address,name=address" json:"address,omitempty"`
845         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
846 }
847
848 func ParsePrefix(ip string) (prefix Prefix, err error) {
849         hasPrefix := strings.Contains(ip, "/")
850         if hasPrefix {
851                 netIP, network, err := net.ParseCIDR(ip)
852                 if err != nil {
853                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
854                 }
855                 maskSize, _ := network.Mask.Size()
856                 prefix.Len = byte(maskSize)
857                 prefix.Address, err = ParseAddress(netIP.String())
858                 if err != nil {
859                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
860                 }
861         } else {
862                 netIP := net.ParseIP(ip)
863                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
864                 if netIP.To4() == nil {
865                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
866                 }
867                 prefix.Len = byte(defaultMaskSize)
868                 prefix.Address, err = ParseAddress(netIP.String())
869                 if err != nil {
870                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
871                 }
872         }
873         return prefix, nil
874 }
875
876 func (x Prefix) ToIPNet() *net.IPNet {
877         var mask net.IPMask
878         if x.Address.Af == ADDRESS_IP4 {
879                 mask = net.CIDRMask(int(x.Len), 32)
880         } else {
881                 mask = net.CIDRMask(int(x.Len), 128)
882         }
883         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
884         return ipnet
885 }
886
887 func (x Prefix) String() string {
888         ip := x.Address.String()
889         return ip + "/" + strconv.Itoa(int(x.Len))
890 }
891
892 func (x *Prefix) MarshalText() ([]byte, error) {
893         return []byte(x.String()), nil
894 }
895
896 func (x *Prefix) UnmarshalText(text []byte) error {
897         prefix, err := ParsePrefix(string(text))
898         if err != nil {
899                 return err
900         }
901         *x = prefix
902         return nil
903 }
904
905 // PrefixMatcher defines type 'prefix_matcher'.
906 type PrefixMatcher struct {
907         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
908         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
909 }
910
911 // AddressUnion defines union 'address_union'.
912 type AddressUnion struct {
913         // AddressUnion can be one of:
914         // - IP4 *IP4Address
915         // - IP6 *IP6Address
916         XXX_UnionData [16]byte
917 }
918
919 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
920         u.SetIP4(a)
921         return
922 }
923 func (u *AddressUnion) SetIP4(a IP4Address) {
924         buf := codec.NewBuffer(u.XXX_UnionData[:])
925         buf.EncodeBytes(a[:], 4)
926 }
927 func (u *AddressUnion) GetIP4() (a IP4Address) {
928         buf := codec.NewBuffer(u.XXX_UnionData[:])
929         copy(a[:], buf.DecodeBytes(4))
930         return
931 }
932
933 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
934         u.SetIP6(a)
935         return
936 }
937 func (u *AddressUnion) SetIP6(a IP6Address) {
938         buf := codec.NewBuffer(u.XXX_UnionData[:])
939         buf.EncodeBytes(a[:], 16)
940 }
941 func (u *AddressUnion) GetIP6() (a IP6Address) {
942         buf := codec.NewBuffer(u.XXX_UnionData[:])
943         copy(a[:], buf.DecodeBytes(16))
944         return
945 }
946
947 // L2tpv3CreateTunnel defines message 'l2tpv3_create_tunnel'.
948 type L2tpv3CreateTunnel struct {
949         ClientAddress     Address `binapi:"address,name=client_address" json:"client_address,omitempty"`
950         OurAddress        Address `binapi:"address,name=our_address" json:"our_address,omitempty"`
951         LocalSessionID    uint32  `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"`
952         RemoteSessionID   uint32  `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"`
953         LocalCookie       uint64  `binapi:"u64,name=local_cookie" json:"local_cookie,omitempty"`
954         RemoteCookie      uint64  `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"`
955         L2SublayerPresent bool    `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"`
956         EncapVrfID        uint32  `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
957 }
958
959 func (m *L2tpv3CreateTunnel) Reset()               { *m = L2tpv3CreateTunnel{} }
960 func (*L2tpv3CreateTunnel) GetMessageName() string { return "l2tpv3_create_tunnel" }
961 func (*L2tpv3CreateTunnel) GetCrcString() string   { return "596892cb" }
962 func (*L2tpv3CreateTunnel) GetMessageType() api.MessageType {
963         return api.RequestMessage
964 }
965
966 func (m *L2tpv3CreateTunnel) Size() (size int) {
967         if m == nil {
968                 return 0
969         }
970         size += 4      // m.ClientAddress.Af
971         size += 1 * 16 // m.ClientAddress.Un
972         size += 4      // m.OurAddress.Af
973         size += 1 * 16 // m.OurAddress.Un
974         size += 4      // m.LocalSessionID
975         size += 4      // m.RemoteSessionID
976         size += 8      // m.LocalCookie
977         size += 8      // m.RemoteCookie
978         size += 1      // m.L2SublayerPresent
979         size += 4      // m.EncapVrfID
980         return size
981 }
982 func (m *L2tpv3CreateTunnel) Marshal(b []byte) ([]byte, error) {
983         if b == nil {
984                 b = make([]byte, m.Size())
985         }
986         buf := codec.NewBuffer(b)
987         buf.EncodeUint32(uint32(m.ClientAddress.Af))
988         buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
989         buf.EncodeUint32(uint32(m.OurAddress.Af))
990         buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
991         buf.EncodeUint32(m.LocalSessionID)
992         buf.EncodeUint32(m.RemoteSessionID)
993         buf.EncodeUint64(m.LocalCookie)
994         buf.EncodeUint64(m.RemoteCookie)
995         buf.EncodeBool(m.L2SublayerPresent)
996         buf.EncodeUint32(m.EncapVrfID)
997         return buf.Bytes(), nil
998 }
999 func (m *L2tpv3CreateTunnel) Unmarshal(b []byte) error {
1000         buf := codec.NewBuffer(b)
1001         m.ClientAddress.Af = AddressFamily(buf.DecodeUint32())
1002         copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1003         m.OurAddress.Af = AddressFamily(buf.DecodeUint32())
1004         copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1005         m.LocalSessionID = buf.DecodeUint32()
1006         m.RemoteSessionID = buf.DecodeUint32()
1007         m.LocalCookie = buf.DecodeUint64()
1008         m.RemoteCookie = buf.DecodeUint64()
1009         m.L2SublayerPresent = buf.DecodeBool()
1010         m.EncapVrfID = buf.DecodeUint32()
1011         return nil
1012 }
1013
1014 // L2tpv3CreateTunnelReply defines message 'l2tpv3_create_tunnel_reply'.
1015 type L2tpv3CreateTunnelReply struct {
1016         Retval    int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
1017         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1018 }
1019
1020 func (m *L2tpv3CreateTunnelReply) Reset()               { *m = L2tpv3CreateTunnelReply{} }
1021 func (*L2tpv3CreateTunnelReply) GetMessageName() string { return "l2tpv3_create_tunnel_reply" }
1022 func (*L2tpv3CreateTunnelReply) GetCrcString() string   { return "5383d31f" }
1023 func (*L2tpv3CreateTunnelReply) GetMessageType() api.MessageType {
1024         return api.ReplyMessage
1025 }
1026
1027 func (m *L2tpv3CreateTunnelReply) Size() (size int) {
1028         if m == nil {
1029                 return 0
1030         }
1031         size += 4 // m.Retval
1032         size += 4 // m.SwIfIndex
1033         return size
1034 }
1035 func (m *L2tpv3CreateTunnelReply) Marshal(b []byte) ([]byte, error) {
1036         if b == nil {
1037                 b = make([]byte, m.Size())
1038         }
1039         buf := codec.NewBuffer(b)
1040         buf.EncodeInt32(m.Retval)
1041         buf.EncodeUint32(uint32(m.SwIfIndex))
1042         return buf.Bytes(), nil
1043 }
1044 func (m *L2tpv3CreateTunnelReply) Unmarshal(b []byte) error {
1045         buf := codec.NewBuffer(b)
1046         m.Retval = buf.DecodeInt32()
1047         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1048         return nil
1049 }
1050
1051 // L2tpv3InterfaceEnableDisable defines message 'l2tpv3_interface_enable_disable'.
1052 type L2tpv3InterfaceEnableDisable struct {
1053         EnableDisable bool           `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
1054         SwIfIndex     InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1055 }
1056
1057 func (m *L2tpv3InterfaceEnableDisable) Reset() { *m = L2tpv3InterfaceEnableDisable{} }
1058 func (*L2tpv3InterfaceEnableDisable) GetMessageName() string {
1059         return "l2tpv3_interface_enable_disable"
1060 }
1061 func (*L2tpv3InterfaceEnableDisable) GetCrcString() string { return "3865946c" }
1062 func (*L2tpv3InterfaceEnableDisable) GetMessageType() api.MessageType {
1063         return api.RequestMessage
1064 }
1065
1066 func (m *L2tpv3InterfaceEnableDisable) Size() (size int) {
1067         if m == nil {
1068                 return 0
1069         }
1070         size += 1 // m.EnableDisable
1071         size += 4 // m.SwIfIndex
1072         return size
1073 }
1074 func (m *L2tpv3InterfaceEnableDisable) Marshal(b []byte) ([]byte, error) {
1075         if b == nil {
1076                 b = make([]byte, m.Size())
1077         }
1078         buf := codec.NewBuffer(b)
1079         buf.EncodeBool(m.EnableDisable)
1080         buf.EncodeUint32(uint32(m.SwIfIndex))
1081         return buf.Bytes(), nil
1082 }
1083 func (m *L2tpv3InterfaceEnableDisable) Unmarshal(b []byte) error {
1084         buf := codec.NewBuffer(b)
1085         m.EnableDisable = buf.DecodeBool()
1086         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1087         return nil
1088 }
1089
1090 // L2tpv3InterfaceEnableDisableReply defines message 'l2tpv3_interface_enable_disable_reply'.
1091 type L2tpv3InterfaceEnableDisableReply struct {
1092         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1093 }
1094
1095 func (m *L2tpv3InterfaceEnableDisableReply) Reset() { *m = L2tpv3InterfaceEnableDisableReply{} }
1096 func (*L2tpv3InterfaceEnableDisableReply) GetMessageName() string {
1097         return "l2tpv3_interface_enable_disable_reply"
1098 }
1099 func (*L2tpv3InterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" }
1100 func (*L2tpv3InterfaceEnableDisableReply) GetMessageType() api.MessageType {
1101         return api.ReplyMessage
1102 }
1103
1104 func (m *L2tpv3InterfaceEnableDisableReply) Size() (size int) {
1105         if m == nil {
1106                 return 0
1107         }
1108         size += 4 // m.Retval
1109         return size
1110 }
1111 func (m *L2tpv3InterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1112         if b == nil {
1113                 b = make([]byte, m.Size())
1114         }
1115         buf := codec.NewBuffer(b)
1116         buf.EncodeInt32(m.Retval)
1117         return buf.Bytes(), nil
1118 }
1119 func (m *L2tpv3InterfaceEnableDisableReply) Unmarshal(b []byte) error {
1120         buf := codec.NewBuffer(b)
1121         m.Retval = buf.DecodeInt32()
1122         return nil
1123 }
1124
1125 // L2tpv3SetLookupKey defines message 'l2tpv3_set_lookup_key'.
1126 type L2tpv3SetLookupKey struct {
1127         Key L2tLookupKey `binapi:"l2t_lookup_key,name=key" json:"key,omitempty"`
1128 }
1129
1130 func (m *L2tpv3SetLookupKey) Reset()               { *m = L2tpv3SetLookupKey{} }
1131 func (*L2tpv3SetLookupKey) GetMessageName() string { return "l2tpv3_set_lookup_key" }
1132 func (*L2tpv3SetLookupKey) GetCrcString() string   { return "c9892c86" }
1133 func (*L2tpv3SetLookupKey) GetMessageType() api.MessageType {
1134         return api.RequestMessage
1135 }
1136
1137 func (m *L2tpv3SetLookupKey) Size() (size int) {
1138         if m == nil {
1139                 return 0
1140         }
1141         size += 1 // m.Key
1142         return size
1143 }
1144 func (m *L2tpv3SetLookupKey) Marshal(b []byte) ([]byte, error) {
1145         if b == nil {
1146                 b = make([]byte, m.Size())
1147         }
1148         buf := codec.NewBuffer(b)
1149         buf.EncodeUint8(uint8(m.Key))
1150         return buf.Bytes(), nil
1151 }
1152 func (m *L2tpv3SetLookupKey) Unmarshal(b []byte) error {
1153         buf := codec.NewBuffer(b)
1154         m.Key = L2tLookupKey(buf.DecodeUint8())
1155         return nil
1156 }
1157
1158 // L2tpv3SetLookupKeyReply defines message 'l2tpv3_set_lookup_key_reply'.
1159 type L2tpv3SetLookupKeyReply struct {
1160         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1161 }
1162
1163 func (m *L2tpv3SetLookupKeyReply) Reset()               { *m = L2tpv3SetLookupKeyReply{} }
1164 func (*L2tpv3SetLookupKeyReply) GetMessageName() string { return "l2tpv3_set_lookup_key_reply" }
1165 func (*L2tpv3SetLookupKeyReply) GetCrcString() string   { return "e8d4e804" }
1166 func (*L2tpv3SetLookupKeyReply) GetMessageType() api.MessageType {
1167         return api.ReplyMessage
1168 }
1169
1170 func (m *L2tpv3SetLookupKeyReply) Size() (size int) {
1171         if m == nil {
1172                 return 0
1173         }
1174         size += 4 // m.Retval
1175         return size
1176 }
1177 func (m *L2tpv3SetLookupKeyReply) Marshal(b []byte) ([]byte, error) {
1178         if b == nil {
1179                 b = make([]byte, m.Size())
1180         }
1181         buf := codec.NewBuffer(b)
1182         buf.EncodeInt32(m.Retval)
1183         return buf.Bytes(), nil
1184 }
1185 func (m *L2tpv3SetLookupKeyReply) Unmarshal(b []byte) error {
1186         buf := codec.NewBuffer(b)
1187         m.Retval = buf.DecodeInt32()
1188         return nil
1189 }
1190
1191 // L2tpv3SetTunnelCookies defines message 'l2tpv3_set_tunnel_cookies'.
1192 type L2tpv3SetTunnelCookies struct {
1193         SwIfIndex       InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1194         NewLocalCookie  uint64         `binapi:"u64,name=new_local_cookie" json:"new_local_cookie,omitempty"`
1195         NewRemoteCookie uint64         `binapi:"u64,name=new_remote_cookie" json:"new_remote_cookie,omitempty"`
1196 }
1197
1198 func (m *L2tpv3SetTunnelCookies) Reset()               { *m = L2tpv3SetTunnelCookies{} }
1199 func (*L2tpv3SetTunnelCookies) GetMessageName() string { return "l2tpv3_set_tunnel_cookies" }
1200 func (*L2tpv3SetTunnelCookies) GetCrcString() string   { return "b3f4faf7" }
1201 func (*L2tpv3SetTunnelCookies) GetMessageType() api.MessageType {
1202         return api.RequestMessage
1203 }
1204
1205 func (m *L2tpv3SetTunnelCookies) Size() (size int) {
1206         if m == nil {
1207                 return 0
1208         }
1209         size += 4 // m.SwIfIndex
1210         size += 8 // m.NewLocalCookie
1211         size += 8 // m.NewRemoteCookie
1212         return size
1213 }
1214 func (m *L2tpv3SetTunnelCookies) Marshal(b []byte) ([]byte, error) {
1215         if b == nil {
1216                 b = make([]byte, m.Size())
1217         }
1218         buf := codec.NewBuffer(b)
1219         buf.EncodeUint32(uint32(m.SwIfIndex))
1220         buf.EncodeUint64(m.NewLocalCookie)
1221         buf.EncodeUint64(m.NewRemoteCookie)
1222         return buf.Bytes(), nil
1223 }
1224 func (m *L2tpv3SetTunnelCookies) Unmarshal(b []byte) error {
1225         buf := codec.NewBuffer(b)
1226         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1227         m.NewLocalCookie = buf.DecodeUint64()
1228         m.NewRemoteCookie = buf.DecodeUint64()
1229         return nil
1230 }
1231
1232 // L2tpv3SetTunnelCookiesReply defines message 'l2tpv3_set_tunnel_cookies_reply'.
1233 type L2tpv3SetTunnelCookiesReply struct {
1234         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1235 }
1236
1237 func (m *L2tpv3SetTunnelCookiesReply) Reset()               { *m = L2tpv3SetTunnelCookiesReply{} }
1238 func (*L2tpv3SetTunnelCookiesReply) GetMessageName() string { return "l2tpv3_set_tunnel_cookies_reply" }
1239 func (*L2tpv3SetTunnelCookiesReply) GetCrcString() string   { return "e8d4e804" }
1240 func (*L2tpv3SetTunnelCookiesReply) GetMessageType() api.MessageType {
1241         return api.ReplyMessage
1242 }
1243
1244 func (m *L2tpv3SetTunnelCookiesReply) Size() (size int) {
1245         if m == nil {
1246                 return 0
1247         }
1248         size += 4 // m.Retval
1249         return size
1250 }
1251 func (m *L2tpv3SetTunnelCookiesReply) Marshal(b []byte) ([]byte, error) {
1252         if b == nil {
1253                 b = make([]byte, m.Size())
1254         }
1255         buf := codec.NewBuffer(b)
1256         buf.EncodeInt32(m.Retval)
1257         return buf.Bytes(), nil
1258 }
1259 func (m *L2tpv3SetTunnelCookiesReply) Unmarshal(b []byte) error {
1260         buf := codec.NewBuffer(b)
1261         m.Retval = buf.DecodeInt32()
1262         return nil
1263 }
1264
1265 // SwIfL2tpv3TunnelDetails defines message 'sw_if_l2tpv3_tunnel_details'.
1266 type SwIfL2tpv3TunnelDetails struct {
1267         SwIfIndex         InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1268         InterfaceName     string         `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"`
1269         ClientAddress     Address        `binapi:"address,name=client_address" json:"client_address,omitempty"`
1270         OurAddress        Address        `binapi:"address,name=our_address" json:"our_address,omitempty"`
1271         LocalSessionID    uint32         `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"`
1272         RemoteSessionID   uint32         `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"`
1273         LocalCookie       []uint64       `binapi:"u64[2],name=local_cookie" json:"local_cookie,omitempty"`
1274         RemoteCookie      uint64         `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"`
1275         L2SublayerPresent bool           `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"`
1276 }
1277
1278 func (m *SwIfL2tpv3TunnelDetails) Reset()               { *m = SwIfL2tpv3TunnelDetails{} }
1279 func (*SwIfL2tpv3TunnelDetails) GetMessageName() string { return "sw_if_l2tpv3_tunnel_details" }
1280 func (*SwIfL2tpv3TunnelDetails) GetCrcString() string   { return "1dab5c7e" }
1281 func (*SwIfL2tpv3TunnelDetails) GetMessageType() api.MessageType {
1282         return api.ReplyMessage
1283 }
1284
1285 func (m *SwIfL2tpv3TunnelDetails) Size() (size int) {
1286         if m == nil {
1287                 return 0
1288         }
1289         size += 4      // m.SwIfIndex
1290         size += 64     // m.InterfaceName
1291         size += 4      // m.ClientAddress.Af
1292         size += 1 * 16 // m.ClientAddress.Un
1293         size += 4      // m.OurAddress.Af
1294         size += 1 * 16 // m.OurAddress.Un
1295         size += 4      // m.LocalSessionID
1296         size += 4      // m.RemoteSessionID
1297         size += 8 * 2  // m.LocalCookie
1298         size += 8      // m.RemoteCookie
1299         size += 1      // m.L2SublayerPresent
1300         return size
1301 }
1302 func (m *SwIfL2tpv3TunnelDetails) Marshal(b []byte) ([]byte, error) {
1303         if b == nil {
1304                 b = make([]byte, m.Size())
1305         }
1306         buf := codec.NewBuffer(b)
1307         buf.EncodeUint32(uint32(m.SwIfIndex))
1308         buf.EncodeString(m.InterfaceName, 64)
1309         buf.EncodeUint32(uint32(m.ClientAddress.Af))
1310         buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
1311         buf.EncodeUint32(uint32(m.OurAddress.Af))
1312         buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
1313         buf.EncodeUint32(m.LocalSessionID)
1314         buf.EncodeUint32(m.RemoteSessionID)
1315         for i := 0; i < 2; i++ {
1316                 var x uint64
1317                 if i < len(m.LocalCookie) {
1318                         x = uint64(m.LocalCookie[i])
1319                 }
1320                 buf.EncodeUint64(x)
1321         }
1322         buf.EncodeUint64(m.RemoteCookie)
1323         buf.EncodeBool(m.L2SublayerPresent)
1324         return buf.Bytes(), nil
1325 }
1326 func (m *SwIfL2tpv3TunnelDetails) Unmarshal(b []byte) error {
1327         buf := codec.NewBuffer(b)
1328         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1329         m.InterfaceName = buf.DecodeString(64)
1330         m.ClientAddress.Af = AddressFamily(buf.DecodeUint32())
1331         copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1332         m.OurAddress.Af = AddressFamily(buf.DecodeUint32())
1333         copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1334         m.LocalSessionID = buf.DecodeUint32()
1335         m.RemoteSessionID = buf.DecodeUint32()
1336         m.LocalCookie = make([]uint64, 2)
1337         for i := 0; i < len(m.LocalCookie); i++ {
1338                 m.LocalCookie[i] = buf.DecodeUint64()
1339         }
1340         m.RemoteCookie = buf.DecodeUint64()
1341         m.L2SublayerPresent = buf.DecodeBool()
1342         return nil
1343 }
1344
1345 // SwIfL2tpv3TunnelDump defines message 'sw_if_l2tpv3_tunnel_dump'.
1346 type SwIfL2tpv3TunnelDump struct{}
1347
1348 func (m *SwIfL2tpv3TunnelDump) Reset()               { *m = SwIfL2tpv3TunnelDump{} }
1349 func (*SwIfL2tpv3TunnelDump) GetMessageName() string { return "sw_if_l2tpv3_tunnel_dump" }
1350 func (*SwIfL2tpv3TunnelDump) GetCrcString() string   { return "51077d14" }
1351 func (*SwIfL2tpv3TunnelDump) GetMessageType() api.MessageType {
1352         return api.RequestMessage
1353 }
1354
1355 func (m *SwIfL2tpv3TunnelDump) Size() (size int) {
1356         if m == nil {
1357                 return 0
1358         }
1359         return size
1360 }
1361 func (m *SwIfL2tpv3TunnelDump) Marshal(b []byte) ([]byte, error) {
1362         if b == nil {
1363                 b = make([]byte, m.Size())
1364         }
1365         buf := codec.NewBuffer(b)
1366         return buf.Bytes(), nil
1367 }
1368 func (m *SwIfL2tpv3TunnelDump) Unmarshal(b []byte) error {
1369         return nil
1370 }
1371
1372 func init() { file_l2tp_binapi_init() }
1373 func file_l2tp_binapi_init() {
1374         api.RegisterMessage((*L2tpv3CreateTunnel)(nil), "l2tpv3_create_tunnel_596892cb")
1375         api.RegisterMessage((*L2tpv3CreateTunnelReply)(nil), "l2tpv3_create_tunnel_reply_5383d31f")
1376         api.RegisterMessage((*L2tpv3InterfaceEnableDisable)(nil), "l2tpv3_interface_enable_disable_3865946c")
1377         api.RegisterMessage((*L2tpv3InterfaceEnableDisableReply)(nil), "l2tpv3_interface_enable_disable_reply_e8d4e804")
1378         api.RegisterMessage((*L2tpv3SetLookupKey)(nil), "l2tpv3_set_lookup_key_c9892c86")
1379         api.RegisterMessage((*L2tpv3SetLookupKeyReply)(nil), "l2tpv3_set_lookup_key_reply_e8d4e804")
1380         api.RegisterMessage((*L2tpv3SetTunnelCookies)(nil), "l2tpv3_set_tunnel_cookies_b3f4faf7")
1381         api.RegisterMessage((*L2tpv3SetTunnelCookiesReply)(nil), "l2tpv3_set_tunnel_cookies_reply_e8d4e804")
1382         api.RegisterMessage((*SwIfL2tpv3TunnelDetails)(nil), "sw_if_l2tpv3_tunnel_details_1dab5c7e")
1383         api.RegisterMessage((*SwIfL2tpv3TunnelDump)(nil), "sw_if_l2tpv3_tunnel_dump_51077d14")
1384 }
1385
1386 // Messages returns list of all messages in this module.
1387 func AllMessages() []api.Message {
1388         return []api.Message{
1389                 (*L2tpv3CreateTunnel)(nil),
1390                 (*L2tpv3CreateTunnelReply)(nil),
1391                 (*L2tpv3InterfaceEnableDisable)(nil),
1392                 (*L2tpv3InterfaceEnableDisableReply)(nil),
1393                 (*L2tpv3SetLookupKey)(nil),
1394                 (*L2tpv3SetLookupKeyReply)(nil),
1395                 (*L2tpv3SetTunnelCookies)(nil),
1396                 (*L2tpv3SetTunnelCookiesReply)(nil),
1397                 (*SwIfL2tpv3TunnelDetails)(nil),
1398                 (*SwIfL2tpv3TunnelDump)(nil),
1399         }
1400 }