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