f7ad3c82b3be87a298747ba42a5787addfcec7fe
[govpp.git] / internal / testbinapi / binapi2001 / ikev2 / ikev2.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/plugins/ikev2.api.json
6
7 // Package ikev2 contains generated bindings for API file ikev2.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  10 enums
12 //   6 structs
13 //   1 union
14 //  28 messages
15 //
16 package ikev2
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    = "ikev2"
35         APIVersion = "1.0.1"
36         VersionCrc = 0x4eab5d22
37 )
38
39 // AddressFamily defines enum 'address_family'.
40 type AddressFamily uint32
41
42 const (
43         ADDRESS_IP4 AddressFamily = 0
44         ADDRESS_IP6 AddressFamily = 1
45 )
46
47 var (
48         AddressFamily_name = map[uint32]string{
49                 0: "ADDRESS_IP4",
50                 1: "ADDRESS_IP6",
51         }
52         AddressFamily_value = map[string]uint32{
53                 "ADDRESS_IP4": 0,
54                 "ADDRESS_IP6": 1,
55         }
56 )
57
58 func (x AddressFamily) String() string {
59         s, ok := AddressFamily_name[uint32(x)]
60         if ok {
61                 return s
62         }
63         return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
64 }
65
66 // IfStatusFlags defines enum 'if_status_flags'.
67 type IfStatusFlags uint32
68
69 const (
70         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
71         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
72 )
73
74 var (
75         IfStatusFlags_name = map[uint32]string{
76                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
77                 2: "IF_STATUS_API_FLAG_LINK_UP",
78         }
79         IfStatusFlags_value = map[string]uint32{
80                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
81                 "IF_STATUS_API_FLAG_LINK_UP":  2,
82         }
83 )
84
85 func (x IfStatusFlags) String() string {
86         s, ok := IfStatusFlags_name[uint32(x)]
87         if ok {
88                 return s
89         }
90         str := func(n uint32) string {
91                 s, ok := IfStatusFlags_name[uint32(n)]
92                 if ok {
93                         return s
94                 }
95                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
96         }
97         for i := uint32(0); i <= 32; i++ {
98                 val := uint32(x)
99                 if val&(1<<i) != 0 {
100                         if s != "" {
101                                 s += "|"
102                         }
103                         s += str(1 << i)
104                 }
105         }
106         if s == "" {
107                 return str(uint32(x))
108         }
109         return s
110 }
111
112 // IfType defines enum 'if_type'.
113 type IfType uint32
114
115 const (
116         IF_API_TYPE_HARDWARE IfType = 1
117         IF_API_TYPE_SUB      IfType = 2
118         IF_API_TYPE_P2P      IfType = 3
119         IF_API_TYPE_PIPE     IfType = 4
120 )
121
122 var (
123         IfType_name = map[uint32]string{
124                 1: "IF_API_TYPE_HARDWARE",
125                 2: "IF_API_TYPE_SUB",
126                 3: "IF_API_TYPE_P2P",
127                 4: "IF_API_TYPE_PIPE",
128         }
129         IfType_value = map[string]uint32{
130                 "IF_API_TYPE_HARDWARE": 1,
131                 "IF_API_TYPE_SUB":      2,
132                 "IF_API_TYPE_P2P":      3,
133                 "IF_API_TYPE_PIPE":     4,
134         }
135 )
136
137 func (x IfType) String() string {
138         s, ok := IfType_name[uint32(x)]
139         if ok {
140                 return s
141         }
142         return "IfType(" + strconv.Itoa(int(x)) + ")"
143 }
144
145 // IPDscp defines enum 'ip_dscp'.
146 type IPDscp uint8
147
148 const (
149         IP_API_DSCP_CS0  IPDscp = 0
150         IP_API_DSCP_CS1  IPDscp = 8
151         IP_API_DSCP_AF11 IPDscp = 10
152         IP_API_DSCP_AF12 IPDscp = 12
153         IP_API_DSCP_AF13 IPDscp = 14
154         IP_API_DSCP_CS2  IPDscp = 16
155         IP_API_DSCP_AF21 IPDscp = 18
156         IP_API_DSCP_AF22 IPDscp = 20
157         IP_API_DSCP_AF23 IPDscp = 22
158         IP_API_DSCP_CS3  IPDscp = 24
159         IP_API_DSCP_AF31 IPDscp = 26
160         IP_API_DSCP_AF32 IPDscp = 28
161         IP_API_DSCP_AF33 IPDscp = 30
162         IP_API_DSCP_CS4  IPDscp = 32
163         IP_API_DSCP_AF41 IPDscp = 34
164         IP_API_DSCP_AF42 IPDscp = 36
165         IP_API_DSCP_AF43 IPDscp = 38
166         IP_API_DSCP_CS5  IPDscp = 40
167         IP_API_DSCP_EF   IPDscp = 46
168         IP_API_DSCP_CS6  IPDscp = 48
169         IP_API_DSCP_CS7  IPDscp = 50
170 )
171
172 var (
173         IPDscp_name = map[uint8]string{
174                 0:  "IP_API_DSCP_CS0",
175                 8:  "IP_API_DSCP_CS1",
176                 10: "IP_API_DSCP_AF11",
177                 12: "IP_API_DSCP_AF12",
178                 14: "IP_API_DSCP_AF13",
179                 16: "IP_API_DSCP_CS2",
180                 18: "IP_API_DSCP_AF21",
181                 20: "IP_API_DSCP_AF22",
182                 22: "IP_API_DSCP_AF23",
183                 24: "IP_API_DSCP_CS3",
184                 26: "IP_API_DSCP_AF31",
185                 28: "IP_API_DSCP_AF32",
186                 30: "IP_API_DSCP_AF33",
187                 32: "IP_API_DSCP_CS4",
188                 34: "IP_API_DSCP_AF41",
189                 36: "IP_API_DSCP_AF42",
190                 38: "IP_API_DSCP_AF43",
191                 40: "IP_API_DSCP_CS5",
192                 46: "IP_API_DSCP_EF",
193                 48: "IP_API_DSCP_CS6",
194                 50: "IP_API_DSCP_CS7",
195         }
196         IPDscp_value = map[string]uint8{
197                 "IP_API_DSCP_CS0":  0,
198                 "IP_API_DSCP_CS1":  8,
199                 "IP_API_DSCP_AF11": 10,
200                 "IP_API_DSCP_AF12": 12,
201                 "IP_API_DSCP_AF13": 14,
202                 "IP_API_DSCP_CS2":  16,
203                 "IP_API_DSCP_AF21": 18,
204                 "IP_API_DSCP_AF22": 20,
205                 "IP_API_DSCP_AF23": 22,
206                 "IP_API_DSCP_CS3":  24,
207                 "IP_API_DSCP_AF31": 26,
208                 "IP_API_DSCP_AF32": 28,
209                 "IP_API_DSCP_AF33": 30,
210                 "IP_API_DSCP_CS4":  32,
211                 "IP_API_DSCP_AF41": 34,
212                 "IP_API_DSCP_AF42": 36,
213                 "IP_API_DSCP_AF43": 38,
214                 "IP_API_DSCP_CS5":  40,
215                 "IP_API_DSCP_EF":   46,
216                 "IP_API_DSCP_CS6":  48,
217                 "IP_API_DSCP_CS7":  50,
218         }
219 )
220
221 func (x IPDscp) String() string {
222         s, ok := IPDscp_name[uint8(x)]
223         if ok {
224                 return s
225         }
226         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
227 }
228
229 // IPEcn defines enum 'ip_ecn'.
230 type IPEcn uint8
231
232 const (
233         IP_API_ECN_NONE IPEcn = 0
234         IP_API_ECN_ECT0 IPEcn = 1
235         IP_API_ECN_ECT1 IPEcn = 2
236         IP_API_ECN_CE   IPEcn = 3
237 )
238
239 var (
240         IPEcn_name = map[uint8]string{
241                 0: "IP_API_ECN_NONE",
242                 1: "IP_API_ECN_ECT0",
243                 2: "IP_API_ECN_ECT1",
244                 3: "IP_API_ECN_CE",
245         }
246         IPEcn_value = map[string]uint8{
247                 "IP_API_ECN_NONE": 0,
248                 "IP_API_ECN_ECT0": 1,
249                 "IP_API_ECN_ECT1": 2,
250                 "IP_API_ECN_CE":   3,
251         }
252 )
253
254 func (x IPEcn) String() string {
255         s, ok := IPEcn_name[uint8(x)]
256         if ok {
257                 return s
258         }
259         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
260 }
261
262 // IPProto defines enum 'ip_proto'.
263 type IPProto uint32
264
265 const (
266         IP_API_PROTO_HOPOPT   IPProto = 0
267         IP_API_PROTO_ICMP     IPProto = 1
268         IP_API_PROTO_IGMP     IPProto = 2
269         IP_API_PROTO_TCP      IPProto = 6
270         IP_API_PROTO_UDP      IPProto = 17
271         IP_API_PROTO_GRE      IPProto = 47
272         IP_API_PROTO_AH       IPProto = 50
273         IP_API_PROTO_ESP      IPProto = 51
274         IP_API_PROTO_EIGRP    IPProto = 88
275         IP_API_PROTO_OSPF     IPProto = 89
276         IP_API_PROTO_SCTP     IPProto = 132
277         IP_API_PROTO_RESERVED IPProto = 255
278 )
279
280 var (
281         IPProto_name = map[uint32]string{
282                 0:   "IP_API_PROTO_HOPOPT",
283                 1:   "IP_API_PROTO_ICMP",
284                 2:   "IP_API_PROTO_IGMP",
285                 6:   "IP_API_PROTO_TCP",
286                 17:  "IP_API_PROTO_UDP",
287                 47:  "IP_API_PROTO_GRE",
288                 50:  "IP_API_PROTO_AH",
289                 51:  "IP_API_PROTO_ESP",
290                 88:  "IP_API_PROTO_EIGRP",
291                 89:  "IP_API_PROTO_OSPF",
292                 132: "IP_API_PROTO_SCTP",
293                 255: "IP_API_PROTO_RESERVED",
294         }
295         IPProto_value = map[string]uint32{
296                 "IP_API_PROTO_HOPOPT":   0,
297                 "IP_API_PROTO_ICMP":     1,
298                 "IP_API_PROTO_IGMP":     2,
299                 "IP_API_PROTO_TCP":      6,
300                 "IP_API_PROTO_UDP":      17,
301                 "IP_API_PROTO_GRE":      47,
302                 "IP_API_PROTO_AH":       50,
303                 "IP_API_PROTO_ESP":      51,
304                 "IP_API_PROTO_EIGRP":    88,
305                 "IP_API_PROTO_OSPF":     89,
306                 "IP_API_PROTO_SCTP":     132,
307                 "IP_API_PROTO_RESERVED": 255,
308         }
309 )
310
311 func (x IPProto) String() string {
312         s, ok := IPProto_name[uint32(x)]
313         if ok {
314                 return s
315         }
316         return "IPProto(" + strconv.Itoa(int(x)) + ")"
317 }
318
319 // LinkDuplex defines enum 'link_duplex'.
320 type LinkDuplex uint32
321
322 const (
323         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
324         LINK_DUPLEX_API_HALF    LinkDuplex = 1
325         LINK_DUPLEX_API_FULL    LinkDuplex = 2
326 )
327
328 var (
329         LinkDuplex_name = map[uint32]string{
330                 0: "LINK_DUPLEX_API_UNKNOWN",
331                 1: "LINK_DUPLEX_API_HALF",
332                 2: "LINK_DUPLEX_API_FULL",
333         }
334         LinkDuplex_value = map[string]uint32{
335                 "LINK_DUPLEX_API_UNKNOWN": 0,
336                 "LINK_DUPLEX_API_HALF":    1,
337                 "LINK_DUPLEX_API_FULL":    2,
338         }
339 )
340
341 func (x LinkDuplex) String() string {
342         s, ok := LinkDuplex_name[uint32(x)]
343         if ok {
344                 return s
345         }
346         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
347 }
348
349 // MtuProto defines enum 'mtu_proto'.
350 type MtuProto uint32
351
352 const (
353         MTU_PROTO_API_L3   MtuProto = 1
354         MTU_PROTO_API_IP4  MtuProto = 2
355         MTU_PROTO_API_IP6  MtuProto = 3
356         MTU_PROTO_API_MPLS MtuProto = 4
357         MTU_PROTO_API_N    MtuProto = 5
358 )
359
360 var (
361         MtuProto_name = map[uint32]string{
362                 1: "MTU_PROTO_API_L3",
363                 2: "MTU_PROTO_API_IP4",
364                 3: "MTU_PROTO_API_IP6",
365                 4: "MTU_PROTO_API_MPLS",
366                 5: "MTU_PROTO_API_N",
367         }
368         MtuProto_value = map[string]uint32{
369                 "MTU_PROTO_API_L3":   1,
370                 "MTU_PROTO_API_IP4":  2,
371                 "MTU_PROTO_API_IP6":  3,
372                 "MTU_PROTO_API_MPLS": 4,
373                 "MTU_PROTO_API_N":    5,
374         }
375 )
376
377 func (x MtuProto) String() string {
378         s, ok := MtuProto_name[uint32(x)]
379         if ok {
380                 return s
381         }
382         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
383 }
384
385 // RxMode defines enum 'rx_mode'.
386 type RxMode uint32
387
388 const (
389         RX_MODE_API_UNKNOWN   RxMode = 0
390         RX_MODE_API_POLLING   RxMode = 1
391         RX_MODE_API_INTERRUPT RxMode = 2
392         RX_MODE_API_ADAPTIVE  RxMode = 3
393         RX_MODE_API_DEFAULT   RxMode = 4
394 )
395
396 var (
397         RxMode_name = map[uint32]string{
398                 0: "RX_MODE_API_UNKNOWN",
399                 1: "RX_MODE_API_POLLING",
400                 2: "RX_MODE_API_INTERRUPT",
401                 3: "RX_MODE_API_ADAPTIVE",
402                 4: "RX_MODE_API_DEFAULT",
403         }
404         RxMode_value = map[string]uint32{
405                 "RX_MODE_API_UNKNOWN":   0,
406                 "RX_MODE_API_POLLING":   1,
407                 "RX_MODE_API_INTERRUPT": 2,
408                 "RX_MODE_API_ADAPTIVE":  3,
409                 "RX_MODE_API_DEFAULT":   4,
410         }
411 )
412
413 func (x RxMode) String() string {
414         s, ok := RxMode_name[uint32(x)]
415         if ok {
416                 return s
417         }
418         return "RxMode(" + strconv.Itoa(int(x)) + ")"
419 }
420
421 // SubIfFlags defines enum 'sub_if_flags'.
422 type SubIfFlags uint32
423
424 const (
425         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
426         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
427         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
428         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
429         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
430         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
431         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
432         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
433         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
434         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
435 )
436
437 var (
438         SubIfFlags_name = map[uint32]string{
439                 1:   "SUB_IF_API_FLAG_NO_TAGS",
440                 2:   "SUB_IF_API_FLAG_ONE_TAG",
441                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
442                 8:   "SUB_IF_API_FLAG_DOT1AD",
443                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
444                 32:  "SUB_IF_API_FLAG_DEFAULT",
445                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
446                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
447                 254: "SUB_IF_API_FLAG_MASK_VNET",
448                 256: "SUB_IF_API_FLAG_DOT1AH",
449         }
450         SubIfFlags_value = map[string]uint32{
451                 "SUB_IF_API_FLAG_NO_TAGS":           1,
452                 "SUB_IF_API_FLAG_ONE_TAG":           2,
453                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
454                 "SUB_IF_API_FLAG_DOT1AD":            8,
455                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
456                 "SUB_IF_API_FLAG_DEFAULT":           32,
457                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
458                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
459                 "SUB_IF_API_FLAG_MASK_VNET":         254,
460                 "SUB_IF_API_FLAG_DOT1AH":            256,
461         }
462 )
463
464 func (x SubIfFlags) String() string {
465         s, ok := SubIfFlags_name[uint32(x)]
466         if ok {
467                 return s
468         }
469         str := func(n uint32) string {
470                 s, ok := SubIfFlags_name[uint32(n)]
471                 if ok {
472                         return s
473                 }
474                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
475         }
476         for i := uint32(0); i <= 32; i++ {
477                 val := uint32(x)
478                 if val&(1<<i) != 0 {
479                         if s != "" {
480                                 s += "|"
481                         }
482                         s += str(1 << i)
483                 }
484         }
485         if s == "" {
486                 return str(uint32(x))
487         }
488         return s
489 }
490
491 // AddressWithPrefix defines alias 'address_with_prefix'.
492 type AddressWithPrefix Prefix
493
494 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
495         prefix, err := ParsePrefix(s)
496         if err != nil {
497                 return AddressWithPrefix{}, err
498         }
499         return AddressWithPrefix(prefix), nil
500 }
501 func (x AddressWithPrefix) String() string {
502         return Prefix(x).String()
503 }
504 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
505         return []byte(x.String()), nil
506 }
507 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
508         prefix, err := ParseAddressWithPrefix(string(text))
509         if err != nil {
510                 return err
511         }
512         *x = prefix
513         return nil
514 }
515
516 // InterfaceIndex defines alias 'interface_index'.
517 type InterfaceIndex uint32
518
519 // IP4Address defines alias 'ip4_address'.
520 type IP4Address [4]uint8
521
522 func ParseIP4Address(s string) (IP4Address, error) {
523         ip := net.ParseIP(s).To4()
524         if ip == nil {
525                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
526         }
527         var ipaddr IP4Address
528         copy(ipaddr[:], ip.To4())
529         return ipaddr, nil
530 }
531
532 func (x IP4Address) ToIP() net.IP {
533         return net.IP(x[:]).To4()
534 }
535 func (x IP4Address) String() string {
536         return x.ToIP().String()
537 }
538 func (x *IP4Address) MarshalText() ([]byte, error) {
539         return []byte(x.String()), nil
540 }
541 func (x *IP4Address) UnmarshalText(text []byte) error {
542         ipaddr, err := ParseIP4Address(string(text))
543         if err != nil {
544                 return err
545         }
546         *x = ipaddr
547         return nil
548 }
549
550 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
551 type IP4AddressWithPrefix IP4Prefix
552
553 // IP6Address defines alias 'ip6_address'.
554 type IP6Address [16]uint8
555
556 func ParseIP6Address(s string) (IP6Address, error) {
557         ip := net.ParseIP(s).To16()
558         if ip == nil {
559                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
560         }
561         var ipaddr IP6Address
562         copy(ipaddr[:], ip.To16())
563         return ipaddr, nil
564 }
565
566 func (x IP6Address) ToIP() net.IP {
567         return net.IP(x[:]).To16()
568 }
569 func (x IP6Address) String() string {
570         return x.ToIP().String()
571 }
572 func (x *IP6Address) MarshalText() ([]byte, error) {
573         return []byte(x.String()), nil
574 }
575 func (x *IP6Address) UnmarshalText(text []byte) error {
576         ipaddr, err := ParseIP6Address(string(text))
577         if err != nil {
578                 return err
579         }
580         *x = ipaddr
581         return nil
582 }
583
584 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
585 type IP6AddressWithPrefix IP6Prefix
586
587 // Address defines type 'address'.
588 type Address struct {
589         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
590         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
591 }
592
593 func ParseAddress(s string) (Address, error) {
594         ip := net.ParseIP(s)
595         if ip == nil {
596                 return Address{}, fmt.Errorf("invalid address: %s", s)
597         }
598         var addr Address
599         if ip.To4() == nil {
600                 addr.Af = ADDRESS_IP6
601                 var ip6 IP6Address
602                 copy(ip6[:], ip.To16())
603                 addr.Un.SetIP6(ip6)
604         } else {
605                 addr.Af = ADDRESS_IP4
606                 var ip4 IP4Address
607                 copy(ip4[:], ip.To4())
608                 addr.Un.SetIP4(ip4)
609         }
610         return addr, nil
611 }
612 func (x Address) ToIP() net.IP {
613         if x.Af == ADDRESS_IP6 {
614                 ip6 := x.Un.GetIP6()
615                 return net.IP(ip6[:]).To16()
616         } else {
617                 ip4 := x.Un.GetIP4()
618                 return net.IP(ip4[:]).To4()
619         }
620 }
621 func (x Address) String() string {
622         return x.ToIP().String()
623 }
624 func (x *Address) MarshalText() ([]byte, error) {
625         return []byte(x.String()), nil
626 }
627 func (x *Address) UnmarshalText(text []byte) error {
628         addr, err := ParseAddress(string(text))
629         if err != nil {
630                 return err
631         }
632         *x = addr
633         return nil
634 }
635
636 // IP4Prefix defines type 'ip4_prefix'.
637 type IP4Prefix struct {
638         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
639         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
640 }
641
642 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
643         hasPrefix := strings.Contains(s, "/")
644         if hasPrefix {
645                 ip, network, err := net.ParseCIDR(s)
646                 if err != nil {
647                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
648                 }
649                 maskSize, _ := network.Mask.Size()
650                 prefix.Len = byte(maskSize)
651                 prefix.Address, err = ParseIP4Address(ip.String())
652                 if err != nil {
653                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
654                 }
655         } else {
656                 ip := net.ParseIP(s)
657                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
658                 if ip.To4() == nil {
659                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
660                 }
661                 prefix.Len = byte(defaultMaskSize)
662                 prefix.Address, err = ParseIP4Address(ip.String())
663                 if err != nil {
664                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
665                 }
666         }
667         return prefix, nil
668 }
669 func (x IP4Prefix) ToIPNet() *net.IPNet {
670         mask := net.CIDRMask(int(x.Len), 32)
671         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
672         return ipnet
673 }
674 func (x IP4Prefix) String() string {
675         ip := x.Address.String()
676         return ip + "/" + strconv.Itoa(int(x.Len))
677 }
678 func (x *IP4Prefix) MarshalText() ([]byte, error) {
679         return []byte(x.String()), nil
680 }
681 func (x *IP4Prefix) UnmarshalText(text []byte) error {
682         prefix, err := ParseIP4Prefix(string(text))
683         if err != nil {
684                 return err
685         }
686         *x = prefix
687         return nil
688 }
689
690 // IP6Prefix defines type 'ip6_prefix'.
691 type IP6Prefix struct {
692         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
693         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
694 }
695
696 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
697         hasPrefix := strings.Contains(s, "/")
698         if hasPrefix {
699                 ip, network, err := net.ParseCIDR(s)
700                 if err != nil {
701                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
702                 }
703                 maskSize, _ := network.Mask.Size()
704                 prefix.Len = byte(maskSize)
705                 prefix.Address, err = ParseIP6Address(ip.String())
706                 if err != nil {
707                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
708                 }
709         } else {
710                 ip := net.ParseIP(s)
711                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
712                 if ip.To4() == nil {
713                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
714                 }
715                 prefix.Len = byte(defaultMaskSize)
716                 prefix.Address, err = ParseIP6Address(ip.String())
717                 if err != nil {
718                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
719                 }
720         }
721         return prefix, nil
722 }
723 func (x IP6Prefix) ToIPNet() *net.IPNet {
724         mask := net.CIDRMask(int(x.Len), 128)
725         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
726         return ipnet
727 }
728 func (x IP6Prefix) String() string {
729         ip := x.Address.String()
730         return ip + "/" + strconv.Itoa(int(x.Len))
731 }
732 func (x *IP6Prefix) MarshalText() ([]byte, error) {
733         return []byte(x.String()), nil
734 }
735 func (x *IP6Prefix) UnmarshalText(text []byte) error {
736         prefix, err := ParseIP6Prefix(string(text))
737         if err != nil {
738                 return err
739         }
740         *x = prefix
741         return nil
742 }
743
744 // Mprefix defines type 'mprefix'.
745 type Mprefix struct {
746         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
747         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
748         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
749         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
750 }
751
752 // Prefix defines type 'prefix'.
753 type Prefix struct {
754         Address Address `binapi:"address,name=address" json:"address,omitempty"`
755         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
756 }
757
758 func ParsePrefix(ip string) (prefix Prefix, err error) {
759         hasPrefix := strings.Contains(ip, "/")
760         if hasPrefix {
761                 netIP, network, err := net.ParseCIDR(ip)
762                 if err != nil {
763                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
764                 }
765                 maskSize, _ := network.Mask.Size()
766                 prefix.Len = byte(maskSize)
767                 prefix.Address, err = ParseAddress(netIP.String())
768                 if err != nil {
769                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
770                 }
771         } else {
772                 netIP := net.ParseIP(ip)
773                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
774                 if netIP.To4() == nil {
775                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
776                 }
777                 prefix.Len = byte(defaultMaskSize)
778                 prefix.Address, err = ParseAddress(netIP.String())
779                 if err != nil {
780                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
781                 }
782         }
783         return prefix, nil
784 }
785 func (x Prefix) ToIPNet() *net.IPNet {
786         var mask net.IPMask
787         if x.Address.Af == ADDRESS_IP4 {
788                 mask = net.CIDRMask(int(x.Len), 32)
789         } else {
790                 mask = net.CIDRMask(int(x.Len), 128)
791         }
792         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
793         return ipnet
794 }
795 func (x Prefix) String() string {
796         ip := x.Address.String()
797         return ip + "/" + strconv.Itoa(int(x.Len))
798 }
799 func (x *Prefix) MarshalText() ([]byte, error) {
800         return []byte(x.String()), nil
801 }
802 func (x *Prefix) UnmarshalText(text []byte) error {
803         prefix, err := ParsePrefix(string(text))
804         if err != nil {
805                 return err
806         }
807         *x = prefix
808         return nil
809 }
810
811 // PrefixMatcher defines type 'prefix_matcher'.
812 type PrefixMatcher struct {
813         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
814         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
815 }
816
817 // AddressUnion defines union 'address_union'.
818 type AddressUnion struct {
819         // IP4 *IP4Address
820         // IP6 *IP6Address
821         XXX_UnionData [16]byte
822 }
823
824 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
825         u.SetIP4(a)
826         return
827 }
828 func (u *AddressUnion) SetIP4(a IP4Address) {
829         buf := codec.NewBuffer(u.XXX_UnionData[:])
830         buf.EncodeBytes(a[:], 4)
831 }
832 func (u *AddressUnion) GetIP4() (a IP4Address) {
833         buf := codec.NewBuffer(u.XXX_UnionData[:])
834         copy(a[:], buf.DecodeBytes(4))
835         return
836 }
837
838 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
839         u.SetIP6(a)
840         return
841 }
842 func (u *AddressUnion) SetIP6(a IP6Address) {
843         buf := codec.NewBuffer(u.XXX_UnionData[:])
844         buf.EncodeBytes(a[:], 16)
845 }
846 func (u *AddressUnion) GetIP6() (a IP6Address) {
847         buf := codec.NewBuffer(u.XXX_UnionData[:])
848         copy(a[:], buf.DecodeBytes(16))
849         return
850 }
851
852 // Ikev2InitiateDelChildSa defines message 'ikev2_initiate_del_child_sa'.
853 type Ikev2InitiateDelChildSa struct {
854         Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"`
855 }
856
857 func (m *Ikev2InitiateDelChildSa) Reset()               { *m = Ikev2InitiateDelChildSa{} }
858 func (*Ikev2InitiateDelChildSa) GetMessageName() string { return "ikev2_initiate_del_child_sa" }
859 func (*Ikev2InitiateDelChildSa) GetCrcString() string   { return "7f004d2e" }
860 func (*Ikev2InitiateDelChildSa) GetMessageType() api.MessageType {
861         return api.RequestMessage
862 }
863
864 func (m *Ikev2InitiateDelChildSa) Size() (size int) {
865         if m == nil {
866                 return 0
867         }
868         size += 4 // m.Ispi
869         return size
870 }
871 func (m *Ikev2InitiateDelChildSa) Marshal(b []byte) ([]byte, error) {
872         if b == nil {
873                 b = make([]byte, m.Size())
874         }
875         buf := codec.NewBuffer(b)
876         buf.EncodeUint32(m.Ispi)
877         return buf.Bytes(), nil
878 }
879 func (m *Ikev2InitiateDelChildSa) Unmarshal(b []byte) error {
880         buf := codec.NewBuffer(b)
881         m.Ispi = buf.DecodeUint32()
882         return nil
883 }
884
885 // Ikev2InitiateDelChildSaReply defines message 'ikev2_initiate_del_child_sa_reply'.
886 type Ikev2InitiateDelChildSaReply struct {
887         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
888 }
889
890 func (m *Ikev2InitiateDelChildSaReply) Reset() { *m = Ikev2InitiateDelChildSaReply{} }
891 func (*Ikev2InitiateDelChildSaReply) GetMessageName() string {
892         return "ikev2_initiate_del_child_sa_reply"
893 }
894 func (*Ikev2InitiateDelChildSaReply) GetCrcString() string { return "e8d4e804" }
895 func (*Ikev2InitiateDelChildSaReply) GetMessageType() api.MessageType {
896         return api.ReplyMessage
897 }
898
899 func (m *Ikev2InitiateDelChildSaReply) Size() (size int) {
900         if m == nil {
901                 return 0
902         }
903         size += 4 // m.Retval
904         return size
905 }
906 func (m *Ikev2InitiateDelChildSaReply) Marshal(b []byte) ([]byte, error) {
907         if b == nil {
908                 b = make([]byte, m.Size())
909         }
910         buf := codec.NewBuffer(b)
911         buf.EncodeInt32(m.Retval)
912         return buf.Bytes(), nil
913 }
914 func (m *Ikev2InitiateDelChildSaReply) Unmarshal(b []byte) error {
915         buf := codec.NewBuffer(b)
916         m.Retval = buf.DecodeInt32()
917         return nil
918 }
919
920 // Ikev2InitiateDelIkeSa defines message 'ikev2_initiate_del_ike_sa'.
921 type Ikev2InitiateDelIkeSa struct {
922         Ispi uint64 `binapi:"u64,name=ispi" json:"ispi,omitempty"`
923 }
924
925 func (m *Ikev2InitiateDelIkeSa) Reset()               { *m = Ikev2InitiateDelIkeSa{} }
926 func (*Ikev2InitiateDelIkeSa) GetMessageName() string { return "ikev2_initiate_del_ike_sa" }
927 func (*Ikev2InitiateDelIkeSa) GetCrcString() string   { return "8d125bdd" }
928 func (*Ikev2InitiateDelIkeSa) GetMessageType() api.MessageType {
929         return api.RequestMessage
930 }
931
932 func (m *Ikev2InitiateDelIkeSa) Size() (size int) {
933         if m == nil {
934                 return 0
935         }
936         size += 8 // m.Ispi
937         return size
938 }
939 func (m *Ikev2InitiateDelIkeSa) Marshal(b []byte) ([]byte, error) {
940         if b == nil {
941                 b = make([]byte, m.Size())
942         }
943         buf := codec.NewBuffer(b)
944         buf.EncodeUint64(m.Ispi)
945         return buf.Bytes(), nil
946 }
947 func (m *Ikev2InitiateDelIkeSa) Unmarshal(b []byte) error {
948         buf := codec.NewBuffer(b)
949         m.Ispi = buf.DecodeUint64()
950         return nil
951 }
952
953 // Ikev2InitiateDelIkeSaReply defines message 'ikev2_initiate_del_ike_sa_reply'.
954 type Ikev2InitiateDelIkeSaReply struct {
955         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
956 }
957
958 func (m *Ikev2InitiateDelIkeSaReply) Reset()               { *m = Ikev2InitiateDelIkeSaReply{} }
959 func (*Ikev2InitiateDelIkeSaReply) GetMessageName() string { return "ikev2_initiate_del_ike_sa_reply" }
960 func (*Ikev2InitiateDelIkeSaReply) GetCrcString() string   { return "e8d4e804" }
961 func (*Ikev2InitiateDelIkeSaReply) GetMessageType() api.MessageType {
962         return api.ReplyMessage
963 }
964
965 func (m *Ikev2InitiateDelIkeSaReply) Size() (size int) {
966         if m == nil {
967                 return 0
968         }
969         size += 4 // m.Retval
970         return size
971 }
972 func (m *Ikev2InitiateDelIkeSaReply) Marshal(b []byte) ([]byte, error) {
973         if b == nil {
974                 b = make([]byte, m.Size())
975         }
976         buf := codec.NewBuffer(b)
977         buf.EncodeInt32(m.Retval)
978         return buf.Bytes(), nil
979 }
980 func (m *Ikev2InitiateDelIkeSaReply) Unmarshal(b []byte) error {
981         buf := codec.NewBuffer(b)
982         m.Retval = buf.DecodeInt32()
983         return nil
984 }
985
986 // Ikev2InitiateRekeyChildSa defines message 'ikev2_initiate_rekey_child_sa'.
987 type Ikev2InitiateRekeyChildSa struct {
988         Ispi uint32 `binapi:"u32,name=ispi" json:"ispi,omitempty"`
989 }
990
991 func (m *Ikev2InitiateRekeyChildSa) Reset()               { *m = Ikev2InitiateRekeyChildSa{} }
992 func (*Ikev2InitiateRekeyChildSa) GetMessageName() string { return "ikev2_initiate_rekey_child_sa" }
993 func (*Ikev2InitiateRekeyChildSa) GetCrcString() string   { return "7f004d2e" }
994 func (*Ikev2InitiateRekeyChildSa) GetMessageType() api.MessageType {
995         return api.RequestMessage
996 }
997
998 func (m *Ikev2InitiateRekeyChildSa) Size() (size int) {
999         if m == nil {
1000                 return 0
1001         }
1002         size += 4 // m.Ispi
1003         return size
1004 }
1005 func (m *Ikev2InitiateRekeyChildSa) Marshal(b []byte) ([]byte, error) {
1006         if b == nil {
1007                 b = make([]byte, m.Size())
1008         }
1009         buf := codec.NewBuffer(b)
1010         buf.EncodeUint32(m.Ispi)
1011         return buf.Bytes(), nil
1012 }
1013 func (m *Ikev2InitiateRekeyChildSa) Unmarshal(b []byte) error {
1014         buf := codec.NewBuffer(b)
1015         m.Ispi = buf.DecodeUint32()
1016         return nil
1017 }
1018
1019 // Ikev2InitiateRekeyChildSaReply defines message 'ikev2_initiate_rekey_child_sa_reply'.
1020 type Ikev2InitiateRekeyChildSaReply struct {
1021         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1022 }
1023
1024 func (m *Ikev2InitiateRekeyChildSaReply) Reset() { *m = Ikev2InitiateRekeyChildSaReply{} }
1025 func (*Ikev2InitiateRekeyChildSaReply) GetMessageName() string {
1026         return "ikev2_initiate_rekey_child_sa_reply"
1027 }
1028 func (*Ikev2InitiateRekeyChildSaReply) GetCrcString() string { return "e8d4e804" }
1029 func (*Ikev2InitiateRekeyChildSaReply) GetMessageType() api.MessageType {
1030         return api.ReplyMessage
1031 }
1032
1033 func (m *Ikev2InitiateRekeyChildSaReply) Size() (size int) {
1034         if m == nil {
1035                 return 0
1036         }
1037         size += 4 // m.Retval
1038         return size
1039 }
1040 func (m *Ikev2InitiateRekeyChildSaReply) Marshal(b []byte) ([]byte, error) {
1041         if b == nil {
1042                 b = make([]byte, m.Size())
1043         }
1044         buf := codec.NewBuffer(b)
1045         buf.EncodeInt32(m.Retval)
1046         return buf.Bytes(), nil
1047 }
1048 func (m *Ikev2InitiateRekeyChildSaReply) Unmarshal(b []byte) error {
1049         buf := codec.NewBuffer(b)
1050         m.Retval = buf.DecodeInt32()
1051         return nil
1052 }
1053
1054 // Ikev2InitiateSaInit defines message 'ikev2_initiate_sa_init'.
1055 type Ikev2InitiateSaInit struct {
1056         Name string `binapi:"string[64],name=name" json:"name,omitempty"`
1057 }
1058
1059 func (m *Ikev2InitiateSaInit) Reset()               { *m = Ikev2InitiateSaInit{} }
1060 func (*Ikev2InitiateSaInit) GetMessageName() string { return "ikev2_initiate_sa_init" }
1061 func (*Ikev2InitiateSaInit) GetCrcString() string   { return "ebf79a66" }
1062 func (*Ikev2InitiateSaInit) GetMessageType() api.MessageType {
1063         return api.RequestMessage
1064 }
1065
1066 func (m *Ikev2InitiateSaInit) Size() (size int) {
1067         if m == nil {
1068                 return 0
1069         }
1070         size += 64 // m.Name
1071         return size
1072 }
1073 func (m *Ikev2InitiateSaInit) Marshal(b []byte) ([]byte, error) {
1074         if b == nil {
1075                 b = make([]byte, m.Size())
1076         }
1077         buf := codec.NewBuffer(b)
1078         buf.EncodeString(m.Name, 64)
1079         return buf.Bytes(), nil
1080 }
1081 func (m *Ikev2InitiateSaInit) Unmarshal(b []byte) error {
1082         buf := codec.NewBuffer(b)
1083         m.Name = buf.DecodeString(64)
1084         return nil
1085 }
1086
1087 // Ikev2InitiateSaInitReply defines message 'ikev2_initiate_sa_init_reply'.
1088 type Ikev2InitiateSaInitReply struct {
1089         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1090 }
1091
1092 func (m *Ikev2InitiateSaInitReply) Reset()               { *m = Ikev2InitiateSaInitReply{} }
1093 func (*Ikev2InitiateSaInitReply) GetMessageName() string { return "ikev2_initiate_sa_init_reply" }
1094 func (*Ikev2InitiateSaInitReply) GetCrcString() string   { return "e8d4e804" }
1095 func (*Ikev2InitiateSaInitReply) GetMessageType() api.MessageType {
1096         return api.ReplyMessage
1097 }
1098
1099 func (m *Ikev2InitiateSaInitReply) Size() (size int) {
1100         if m == nil {
1101                 return 0
1102         }
1103         size += 4 // m.Retval
1104         return size
1105 }
1106 func (m *Ikev2InitiateSaInitReply) Marshal(b []byte) ([]byte, error) {
1107         if b == nil {
1108                 b = make([]byte, m.Size())
1109         }
1110         buf := codec.NewBuffer(b)
1111         buf.EncodeInt32(m.Retval)
1112         return buf.Bytes(), nil
1113 }
1114 func (m *Ikev2InitiateSaInitReply) Unmarshal(b []byte) error {
1115         buf := codec.NewBuffer(b)
1116         m.Retval = buf.DecodeInt32()
1117         return nil
1118 }
1119
1120 // Ikev2PluginGetVersion defines message 'ikev2_plugin_get_version'.
1121 type Ikev2PluginGetVersion struct{}
1122
1123 func (m *Ikev2PluginGetVersion) Reset()               { *m = Ikev2PluginGetVersion{} }
1124 func (*Ikev2PluginGetVersion) GetMessageName() string { return "ikev2_plugin_get_version" }
1125 func (*Ikev2PluginGetVersion) GetCrcString() string   { return "51077d14" }
1126 func (*Ikev2PluginGetVersion) GetMessageType() api.MessageType {
1127         return api.RequestMessage
1128 }
1129
1130 func (m *Ikev2PluginGetVersion) Size() (size int) {
1131         if m == nil {
1132                 return 0
1133         }
1134         return size
1135 }
1136 func (m *Ikev2PluginGetVersion) Marshal(b []byte) ([]byte, error) {
1137         if b == nil {
1138                 b = make([]byte, m.Size())
1139         }
1140         buf := codec.NewBuffer(b)
1141         return buf.Bytes(), nil
1142 }
1143 func (m *Ikev2PluginGetVersion) Unmarshal(b []byte) error {
1144         return nil
1145 }
1146
1147 // Ikev2PluginGetVersionReply defines message 'ikev2_plugin_get_version_reply'.
1148 type Ikev2PluginGetVersionReply struct {
1149         Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
1150         Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
1151 }
1152
1153 func (m *Ikev2PluginGetVersionReply) Reset()               { *m = Ikev2PluginGetVersionReply{} }
1154 func (*Ikev2PluginGetVersionReply) GetMessageName() string { return "ikev2_plugin_get_version_reply" }
1155 func (*Ikev2PluginGetVersionReply) GetCrcString() string   { return "9b32cf86" }
1156 func (*Ikev2PluginGetVersionReply) GetMessageType() api.MessageType {
1157         return api.ReplyMessage
1158 }
1159
1160 func (m *Ikev2PluginGetVersionReply) Size() (size int) {
1161         if m == nil {
1162                 return 0
1163         }
1164         size += 4 // m.Major
1165         size += 4 // m.Minor
1166         return size
1167 }
1168 func (m *Ikev2PluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
1169         if b == nil {
1170                 b = make([]byte, m.Size())
1171         }
1172         buf := codec.NewBuffer(b)
1173         buf.EncodeUint32(m.Major)
1174         buf.EncodeUint32(m.Minor)
1175         return buf.Bytes(), nil
1176 }
1177 func (m *Ikev2PluginGetVersionReply) Unmarshal(b []byte) error {
1178         buf := codec.NewBuffer(b)
1179         m.Major = buf.DecodeUint32()
1180         m.Minor = buf.DecodeUint32()
1181         return nil
1182 }
1183
1184 // Ikev2ProfileAddDel defines message 'ikev2_profile_add_del'.
1185 type Ikev2ProfileAddDel struct {
1186         Name  string `binapi:"string[64],name=name" json:"name,omitempty"`
1187         IsAdd bool   `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1188 }
1189
1190 func (m *Ikev2ProfileAddDel) Reset()               { *m = Ikev2ProfileAddDel{} }
1191 func (*Ikev2ProfileAddDel) GetMessageName() string { return "ikev2_profile_add_del" }
1192 func (*Ikev2ProfileAddDel) GetCrcString() string   { return "2c925b55" }
1193 func (*Ikev2ProfileAddDel) GetMessageType() api.MessageType {
1194         return api.RequestMessage
1195 }
1196
1197 func (m *Ikev2ProfileAddDel) Size() (size int) {
1198         if m == nil {
1199                 return 0
1200         }
1201         size += 64 // m.Name
1202         size += 1  // m.IsAdd
1203         return size
1204 }
1205 func (m *Ikev2ProfileAddDel) Marshal(b []byte) ([]byte, error) {
1206         if b == nil {
1207                 b = make([]byte, m.Size())
1208         }
1209         buf := codec.NewBuffer(b)
1210         buf.EncodeString(m.Name, 64)
1211         buf.EncodeBool(m.IsAdd)
1212         return buf.Bytes(), nil
1213 }
1214 func (m *Ikev2ProfileAddDel) Unmarshal(b []byte) error {
1215         buf := codec.NewBuffer(b)
1216         m.Name = buf.DecodeString(64)
1217         m.IsAdd = buf.DecodeBool()
1218         return nil
1219 }
1220
1221 // Ikev2ProfileAddDelReply defines message 'ikev2_profile_add_del_reply'.
1222 type Ikev2ProfileAddDelReply struct {
1223         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1224 }
1225
1226 func (m *Ikev2ProfileAddDelReply) Reset()               { *m = Ikev2ProfileAddDelReply{} }
1227 func (*Ikev2ProfileAddDelReply) GetMessageName() string { return "ikev2_profile_add_del_reply" }
1228 func (*Ikev2ProfileAddDelReply) GetCrcString() string   { return "e8d4e804" }
1229 func (*Ikev2ProfileAddDelReply) GetMessageType() api.MessageType {
1230         return api.ReplyMessage
1231 }
1232
1233 func (m *Ikev2ProfileAddDelReply) Size() (size int) {
1234         if m == nil {
1235                 return 0
1236         }
1237         size += 4 // m.Retval
1238         return size
1239 }
1240 func (m *Ikev2ProfileAddDelReply) Marshal(b []byte) ([]byte, error) {
1241         if b == nil {
1242                 b = make([]byte, m.Size())
1243         }
1244         buf := codec.NewBuffer(b)
1245         buf.EncodeInt32(m.Retval)
1246         return buf.Bytes(), nil
1247 }
1248 func (m *Ikev2ProfileAddDelReply) Unmarshal(b []byte) error {
1249         buf := codec.NewBuffer(b)
1250         m.Retval = buf.DecodeInt32()
1251         return nil
1252 }
1253
1254 // Ikev2ProfileSetAuth defines message 'ikev2_profile_set_auth'.
1255 type Ikev2ProfileSetAuth struct {
1256         Name       string `binapi:"string[64],name=name" json:"name,omitempty"`
1257         AuthMethod uint8  `binapi:"u8,name=auth_method" json:"auth_method,omitempty"`
1258         IsHex      bool   `binapi:"bool,name=is_hex" json:"is_hex,omitempty"`
1259         DataLen    uint32 `binapi:"u32,name=data_len" json:"-"`
1260         Data       []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"`
1261 }
1262
1263 func (m *Ikev2ProfileSetAuth) Reset()               { *m = Ikev2ProfileSetAuth{} }
1264 func (*Ikev2ProfileSetAuth) GetMessageName() string { return "ikev2_profile_set_auth" }
1265 func (*Ikev2ProfileSetAuth) GetCrcString() string   { return "642c97cd" }
1266 func (*Ikev2ProfileSetAuth) GetMessageType() api.MessageType {
1267         return api.RequestMessage
1268 }
1269
1270 func (m *Ikev2ProfileSetAuth) Size() (size int) {
1271         if m == nil {
1272                 return 0
1273         }
1274         size += 64              // m.Name
1275         size += 1               // m.AuthMethod
1276         size += 1               // m.IsHex
1277         size += 4               // m.DataLen
1278         size += 1 * len(m.Data) // m.Data
1279         return size
1280 }
1281 func (m *Ikev2ProfileSetAuth) Marshal(b []byte) ([]byte, error) {
1282         if b == nil {
1283                 b = make([]byte, m.Size())
1284         }
1285         buf := codec.NewBuffer(b)
1286         buf.EncodeString(m.Name, 64)
1287         buf.EncodeUint8(m.AuthMethod)
1288         buf.EncodeBool(m.IsHex)
1289         buf.EncodeUint32(uint32(len(m.Data)))
1290         buf.EncodeBytes(m.Data, 0)
1291         return buf.Bytes(), nil
1292 }
1293 func (m *Ikev2ProfileSetAuth) Unmarshal(b []byte) error {
1294         buf := codec.NewBuffer(b)
1295         m.Name = buf.DecodeString(64)
1296         m.AuthMethod = buf.DecodeUint8()
1297         m.IsHex = buf.DecodeBool()
1298         m.DataLen = buf.DecodeUint32()
1299         m.Data = make([]byte, m.DataLen)
1300         copy(m.Data, buf.DecodeBytes(len(m.Data)))
1301         return nil
1302 }
1303
1304 // Ikev2ProfileSetAuthReply defines message 'ikev2_profile_set_auth_reply'.
1305 type Ikev2ProfileSetAuthReply struct {
1306         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1307 }
1308
1309 func (m *Ikev2ProfileSetAuthReply) Reset()               { *m = Ikev2ProfileSetAuthReply{} }
1310 func (*Ikev2ProfileSetAuthReply) GetMessageName() string { return "ikev2_profile_set_auth_reply" }
1311 func (*Ikev2ProfileSetAuthReply) GetCrcString() string   { return "e8d4e804" }
1312 func (*Ikev2ProfileSetAuthReply) GetMessageType() api.MessageType {
1313         return api.ReplyMessage
1314 }
1315
1316 func (m *Ikev2ProfileSetAuthReply) Size() (size int) {
1317         if m == nil {
1318                 return 0
1319         }
1320         size += 4 // m.Retval
1321         return size
1322 }
1323 func (m *Ikev2ProfileSetAuthReply) Marshal(b []byte) ([]byte, error) {
1324         if b == nil {
1325                 b = make([]byte, m.Size())
1326         }
1327         buf := codec.NewBuffer(b)
1328         buf.EncodeInt32(m.Retval)
1329         return buf.Bytes(), nil
1330 }
1331 func (m *Ikev2ProfileSetAuthReply) Unmarshal(b []byte) error {
1332         buf := codec.NewBuffer(b)
1333         m.Retval = buf.DecodeInt32()
1334         return nil
1335 }
1336
1337 // Ikev2ProfileSetID defines message 'ikev2_profile_set_id'.
1338 type Ikev2ProfileSetID struct {
1339         Name    string `binapi:"string[64],name=name" json:"name,omitempty"`
1340         IsLocal bool   `binapi:"bool,name=is_local" json:"is_local,omitempty"`
1341         IDType  uint8  `binapi:"u8,name=id_type" json:"id_type,omitempty"`
1342         DataLen uint32 `binapi:"u32,name=data_len" json:"-"`
1343         Data    []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"`
1344 }
1345
1346 func (m *Ikev2ProfileSetID) Reset()               { *m = Ikev2ProfileSetID{} }
1347 func (*Ikev2ProfileSetID) GetMessageName() string { return "ikev2_profile_set_id" }
1348 func (*Ikev2ProfileSetID) GetCrcString() string   { return "4d7e2418" }
1349 func (*Ikev2ProfileSetID) GetMessageType() api.MessageType {
1350         return api.RequestMessage
1351 }
1352
1353 func (m *Ikev2ProfileSetID) Size() (size int) {
1354         if m == nil {
1355                 return 0
1356         }
1357         size += 64              // m.Name
1358         size += 1               // m.IsLocal
1359         size += 1               // m.IDType
1360         size += 4               // m.DataLen
1361         size += 1 * len(m.Data) // m.Data
1362         return size
1363 }
1364 func (m *Ikev2ProfileSetID) Marshal(b []byte) ([]byte, error) {
1365         if b == nil {
1366                 b = make([]byte, m.Size())
1367         }
1368         buf := codec.NewBuffer(b)
1369         buf.EncodeString(m.Name, 64)
1370         buf.EncodeBool(m.IsLocal)
1371         buf.EncodeUint8(m.IDType)
1372         buf.EncodeUint32(uint32(len(m.Data)))
1373         buf.EncodeBytes(m.Data, 0)
1374         return buf.Bytes(), nil
1375 }
1376 func (m *Ikev2ProfileSetID) Unmarshal(b []byte) error {
1377         buf := codec.NewBuffer(b)
1378         m.Name = buf.DecodeString(64)
1379         m.IsLocal = buf.DecodeBool()
1380         m.IDType = buf.DecodeUint8()
1381         m.DataLen = buf.DecodeUint32()
1382         m.Data = make([]byte, m.DataLen)
1383         copy(m.Data, buf.DecodeBytes(len(m.Data)))
1384         return nil
1385 }
1386
1387 // Ikev2ProfileSetIDReply defines message 'ikev2_profile_set_id_reply'.
1388 type Ikev2ProfileSetIDReply struct {
1389         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1390 }
1391
1392 func (m *Ikev2ProfileSetIDReply) Reset()               { *m = Ikev2ProfileSetIDReply{} }
1393 func (*Ikev2ProfileSetIDReply) GetMessageName() string { return "ikev2_profile_set_id_reply" }
1394 func (*Ikev2ProfileSetIDReply) GetCrcString() string   { return "e8d4e804" }
1395 func (*Ikev2ProfileSetIDReply) GetMessageType() api.MessageType {
1396         return api.ReplyMessage
1397 }
1398
1399 func (m *Ikev2ProfileSetIDReply) Size() (size int) {
1400         if m == nil {
1401                 return 0
1402         }
1403         size += 4 // m.Retval
1404         return size
1405 }
1406 func (m *Ikev2ProfileSetIDReply) Marshal(b []byte) ([]byte, error) {
1407         if b == nil {
1408                 b = make([]byte, m.Size())
1409         }
1410         buf := codec.NewBuffer(b)
1411         buf.EncodeInt32(m.Retval)
1412         return buf.Bytes(), nil
1413 }
1414 func (m *Ikev2ProfileSetIDReply) Unmarshal(b []byte) error {
1415         buf := codec.NewBuffer(b)
1416         m.Retval = buf.DecodeInt32()
1417         return nil
1418 }
1419
1420 // Ikev2ProfileSetTs defines message 'ikev2_profile_set_ts'.
1421 type Ikev2ProfileSetTs struct {
1422         Name      string `binapi:"string[64],name=name" json:"name,omitempty"`
1423         IsLocal   bool   `binapi:"bool,name=is_local" json:"is_local,omitempty"`
1424         Proto     uint8  `binapi:"u8,name=proto" json:"proto,omitempty"`
1425         StartPort uint16 `binapi:"u16,name=start_port" json:"start_port,omitempty"`
1426         EndPort   uint16 `binapi:"u16,name=end_port" json:"end_port,omitempty"`
1427         StartAddr uint32 `binapi:"u32,name=start_addr" json:"start_addr,omitempty"`
1428         EndAddr   uint32 `binapi:"u32,name=end_addr" json:"end_addr,omitempty"`
1429 }
1430
1431 func (m *Ikev2ProfileSetTs) Reset()               { *m = Ikev2ProfileSetTs{} }
1432 func (*Ikev2ProfileSetTs) GetMessageName() string { return "ikev2_profile_set_ts" }
1433 func (*Ikev2ProfileSetTs) GetCrcString() string   { return "64d55c16" }
1434 func (*Ikev2ProfileSetTs) GetMessageType() api.MessageType {
1435         return api.RequestMessage
1436 }
1437
1438 func (m *Ikev2ProfileSetTs) Size() (size int) {
1439         if m == nil {
1440                 return 0
1441         }
1442         size += 64 // m.Name
1443         size += 1  // m.IsLocal
1444         size += 1  // m.Proto
1445         size += 2  // m.StartPort
1446         size += 2  // m.EndPort
1447         size += 4  // m.StartAddr
1448         size += 4  // m.EndAddr
1449         return size
1450 }
1451 func (m *Ikev2ProfileSetTs) Marshal(b []byte) ([]byte, error) {
1452         if b == nil {
1453                 b = make([]byte, m.Size())
1454         }
1455         buf := codec.NewBuffer(b)
1456         buf.EncodeString(m.Name, 64)
1457         buf.EncodeBool(m.IsLocal)
1458         buf.EncodeUint8(m.Proto)
1459         buf.EncodeUint16(m.StartPort)
1460         buf.EncodeUint16(m.EndPort)
1461         buf.EncodeUint32(m.StartAddr)
1462         buf.EncodeUint32(m.EndAddr)
1463         return buf.Bytes(), nil
1464 }
1465 func (m *Ikev2ProfileSetTs) Unmarshal(b []byte) error {
1466         buf := codec.NewBuffer(b)
1467         m.Name = buf.DecodeString(64)
1468         m.IsLocal = buf.DecodeBool()
1469         m.Proto = buf.DecodeUint8()
1470         m.StartPort = buf.DecodeUint16()
1471         m.EndPort = buf.DecodeUint16()
1472         m.StartAddr = buf.DecodeUint32()
1473         m.EndAddr = buf.DecodeUint32()
1474         return nil
1475 }
1476
1477 // Ikev2ProfileSetTsReply defines message 'ikev2_profile_set_ts_reply'.
1478 type Ikev2ProfileSetTsReply struct {
1479         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1480 }
1481
1482 func (m *Ikev2ProfileSetTsReply) Reset()               { *m = Ikev2ProfileSetTsReply{} }
1483 func (*Ikev2ProfileSetTsReply) GetMessageName() string { return "ikev2_profile_set_ts_reply" }
1484 func (*Ikev2ProfileSetTsReply) GetCrcString() string   { return "e8d4e804" }
1485 func (*Ikev2ProfileSetTsReply) GetMessageType() api.MessageType {
1486         return api.ReplyMessage
1487 }
1488
1489 func (m *Ikev2ProfileSetTsReply) Size() (size int) {
1490         if m == nil {
1491                 return 0
1492         }
1493         size += 4 // m.Retval
1494         return size
1495 }
1496 func (m *Ikev2ProfileSetTsReply) Marshal(b []byte) ([]byte, error) {
1497         if b == nil {
1498                 b = make([]byte, m.Size())
1499         }
1500         buf := codec.NewBuffer(b)
1501         buf.EncodeInt32(m.Retval)
1502         return buf.Bytes(), nil
1503 }
1504 func (m *Ikev2ProfileSetTsReply) Unmarshal(b []byte) error {
1505         buf := codec.NewBuffer(b)
1506         m.Retval = buf.DecodeInt32()
1507         return nil
1508 }
1509
1510 // Ikev2SetEspTransforms defines message 'ikev2_set_esp_transforms'.
1511 type Ikev2SetEspTransforms struct {
1512         Name          string `binapi:"string[64],name=name" json:"name,omitempty"`
1513         CryptoAlg     uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"`
1514         CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"`
1515         IntegAlg      uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"`
1516         DhGroup       uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"`
1517 }
1518
1519 func (m *Ikev2SetEspTransforms) Reset()               { *m = Ikev2SetEspTransforms{} }
1520 func (*Ikev2SetEspTransforms) GetMessageName() string { return "ikev2_set_esp_transforms" }
1521 func (*Ikev2SetEspTransforms) GetCrcString() string   { return "936a1a37" }
1522 func (*Ikev2SetEspTransforms) GetMessageType() api.MessageType {
1523         return api.RequestMessage
1524 }
1525
1526 func (m *Ikev2SetEspTransforms) Size() (size int) {
1527         if m == nil {
1528                 return 0
1529         }
1530         size += 64 // m.Name
1531         size += 4  // m.CryptoAlg
1532         size += 4  // m.CryptoKeySize
1533         size += 4  // m.IntegAlg
1534         size += 4  // m.DhGroup
1535         return size
1536 }
1537 func (m *Ikev2SetEspTransforms) Marshal(b []byte) ([]byte, error) {
1538         if b == nil {
1539                 b = make([]byte, m.Size())
1540         }
1541         buf := codec.NewBuffer(b)
1542         buf.EncodeString(m.Name, 64)
1543         buf.EncodeUint32(m.CryptoAlg)
1544         buf.EncodeUint32(m.CryptoKeySize)
1545         buf.EncodeUint32(m.IntegAlg)
1546         buf.EncodeUint32(m.DhGroup)
1547         return buf.Bytes(), nil
1548 }
1549 func (m *Ikev2SetEspTransforms) Unmarshal(b []byte) error {
1550         buf := codec.NewBuffer(b)
1551         m.Name = buf.DecodeString(64)
1552         m.CryptoAlg = buf.DecodeUint32()
1553         m.CryptoKeySize = buf.DecodeUint32()
1554         m.IntegAlg = buf.DecodeUint32()
1555         m.DhGroup = buf.DecodeUint32()
1556         return nil
1557 }
1558
1559 // Ikev2SetEspTransformsReply defines message 'ikev2_set_esp_transforms_reply'.
1560 type Ikev2SetEspTransformsReply struct {
1561         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1562 }
1563
1564 func (m *Ikev2SetEspTransformsReply) Reset()               { *m = Ikev2SetEspTransformsReply{} }
1565 func (*Ikev2SetEspTransformsReply) GetMessageName() string { return "ikev2_set_esp_transforms_reply" }
1566 func (*Ikev2SetEspTransformsReply) GetCrcString() string   { return "e8d4e804" }
1567 func (*Ikev2SetEspTransformsReply) GetMessageType() api.MessageType {
1568         return api.ReplyMessage
1569 }
1570
1571 func (m *Ikev2SetEspTransformsReply) Size() (size int) {
1572         if m == nil {
1573                 return 0
1574         }
1575         size += 4 // m.Retval
1576         return size
1577 }
1578 func (m *Ikev2SetEspTransformsReply) Marshal(b []byte) ([]byte, error) {
1579         if b == nil {
1580                 b = make([]byte, m.Size())
1581         }
1582         buf := codec.NewBuffer(b)
1583         buf.EncodeInt32(m.Retval)
1584         return buf.Bytes(), nil
1585 }
1586 func (m *Ikev2SetEspTransformsReply) Unmarshal(b []byte) error {
1587         buf := codec.NewBuffer(b)
1588         m.Retval = buf.DecodeInt32()
1589         return nil
1590 }
1591
1592 // Ikev2SetIkeTransforms defines message 'ikev2_set_ike_transforms'.
1593 type Ikev2SetIkeTransforms struct {
1594         Name          string `binapi:"string[64],name=name" json:"name,omitempty"`
1595         CryptoAlg     uint32 `binapi:"u32,name=crypto_alg" json:"crypto_alg,omitempty"`
1596         CryptoKeySize uint32 `binapi:"u32,name=crypto_key_size" json:"crypto_key_size,omitempty"`
1597         IntegAlg      uint32 `binapi:"u32,name=integ_alg" json:"integ_alg,omitempty"`
1598         DhGroup       uint32 `binapi:"u32,name=dh_group" json:"dh_group,omitempty"`
1599 }
1600
1601 func (m *Ikev2SetIkeTransforms) Reset()               { *m = Ikev2SetIkeTransforms{} }
1602 func (*Ikev2SetIkeTransforms) GetMessageName() string { return "ikev2_set_ike_transforms" }
1603 func (*Ikev2SetIkeTransforms) GetCrcString() string   { return "936a1a37" }
1604 func (*Ikev2SetIkeTransforms) GetMessageType() api.MessageType {
1605         return api.RequestMessage
1606 }
1607
1608 func (m *Ikev2SetIkeTransforms) Size() (size int) {
1609         if m == nil {
1610                 return 0
1611         }
1612         size += 64 // m.Name
1613         size += 4  // m.CryptoAlg
1614         size += 4  // m.CryptoKeySize
1615         size += 4  // m.IntegAlg
1616         size += 4  // m.DhGroup
1617         return size
1618 }
1619 func (m *Ikev2SetIkeTransforms) Marshal(b []byte) ([]byte, error) {
1620         if b == nil {
1621                 b = make([]byte, m.Size())
1622         }
1623         buf := codec.NewBuffer(b)
1624         buf.EncodeString(m.Name, 64)
1625         buf.EncodeUint32(m.CryptoAlg)
1626         buf.EncodeUint32(m.CryptoKeySize)
1627         buf.EncodeUint32(m.IntegAlg)
1628         buf.EncodeUint32(m.DhGroup)
1629         return buf.Bytes(), nil
1630 }
1631 func (m *Ikev2SetIkeTransforms) Unmarshal(b []byte) error {
1632         buf := codec.NewBuffer(b)
1633         m.Name = buf.DecodeString(64)
1634         m.CryptoAlg = buf.DecodeUint32()
1635         m.CryptoKeySize = buf.DecodeUint32()
1636         m.IntegAlg = buf.DecodeUint32()
1637         m.DhGroup = buf.DecodeUint32()
1638         return nil
1639 }
1640
1641 // Ikev2SetIkeTransformsReply defines message 'ikev2_set_ike_transforms_reply'.
1642 type Ikev2SetIkeTransformsReply struct {
1643         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1644 }
1645
1646 func (m *Ikev2SetIkeTransformsReply) Reset()               { *m = Ikev2SetIkeTransformsReply{} }
1647 func (*Ikev2SetIkeTransformsReply) GetMessageName() string { return "ikev2_set_ike_transforms_reply" }
1648 func (*Ikev2SetIkeTransformsReply) GetCrcString() string   { return "e8d4e804" }
1649 func (*Ikev2SetIkeTransformsReply) GetMessageType() api.MessageType {
1650         return api.ReplyMessage
1651 }
1652
1653 func (m *Ikev2SetIkeTransformsReply) Size() (size int) {
1654         if m == nil {
1655                 return 0
1656         }
1657         size += 4 // m.Retval
1658         return size
1659 }
1660 func (m *Ikev2SetIkeTransformsReply) Marshal(b []byte) ([]byte, error) {
1661         if b == nil {
1662                 b = make([]byte, m.Size())
1663         }
1664         buf := codec.NewBuffer(b)
1665         buf.EncodeInt32(m.Retval)
1666         return buf.Bytes(), nil
1667 }
1668 func (m *Ikev2SetIkeTransformsReply) Unmarshal(b []byte) error {
1669         buf := codec.NewBuffer(b)
1670         m.Retval = buf.DecodeInt32()
1671         return nil
1672 }
1673
1674 // Ikev2SetLocalKey defines message 'ikev2_set_local_key'.
1675 type Ikev2SetLocalKey struct {
1676         KeyFile []byte `binapi:"u8[256],name=key_file" json:"key_file,omitempty"`
1677 }
1678
1679 func (m *Ikev2SetLocalKey) Reset()               { *m = Ikev2SetLocalKey{} }
1680 func (*Ikev2SetLocalKey) GetMessageName() string { return "ikev2_set_local_key" }
1681 func (*Ikev2SetLocalKey) GetCrcString() string   { return "e4996cd5" }
1682 func (*Ikev2SetLocalKey) GetMessageType() api.MessageType {
1683         return api.RequestMessage
1684 }
1685
1686 func (m *Ikev2SetLocalKey) Size() (size int) {
1687         if m == nil {
1688                 return 0
1689         }
1690         size += 1 * 256 // m.KeyFile
1691         return size
1692 }
1693 func (m *Ikev2SetLocalKey) Marshal(b []byte) ([]byte, error) {
1694         if b == nil {
1695                 b = make([]byte, m.Size())
1696         }
1697         buf := codec.NewBuffer(b)
1698         buf.EncodeBytes(m.KeyFile, 256)
1699         return buf.Bytes(), nil
1700 }
1701 func (m *Ikev2SetLocalKey) Unmarshal(b []byte) error {
1702         buf := codec.NewBuffer(b)
1703         m.KeyFile = make([]byte, 256)
1704         copy(m.KeyFile, buf.DecodeBytes(len(m.KeyFile)))
1705         return nil
1706 }
1707
1708 // Ikev2SetLocalKeyReply defines message 'ikev2_set_local_key_reply'.
1709 type Ikev2SetLocalKeyReply struct {
1710         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1711 }
1712
1713 func (m *Ikev2SetLocalKeyReply) Reset()               { *m = Ikev2SetLocalKeyReply{} }
1714 func (*Ikev2SetLocalKeyReply) GetMessageName() string { return "ikev2_set_local_key_reply" }
1715 func (*Ikev2SetLocalKeyReply) GetCrcString() string   { return "e8d4e804" }
1716 func (*Ikev2SetLocalKeyReply) GetMessageType() api.MessageType {
1717         return api.ReplyMessage
1718 }
1719
1720 func (m *Ikev2SetLocalKeyReply) Size() (size int) {
1721         if m == nil {
1722                 return 0
1723         }
1724         size += 4 // m.Retval
1725         return size
1726 }
1727 func (m *Ikev2SetLocalKeyReply) Marshal(b []byte) ([]byte, error) {
1728         if b == nil {
1729                 b = make([]byte, m.Size())
1730         }
1731         buf := codec.NewBuffer(b)
1732         buf.EncodeInt32(m.Retval)
1733         return buf.Bytes(), nil
1734 }
1735 func (m *Ikev2SetLocalKeyReply) Unmarshal(b []byte) error {
1736         buf := codec.NewBuffer(b)
1737         m.Retval = buf.DecodeInt32()
1738         return nil
1739 }
1740
1741 // Ikev2SetResponder defines message 'ikev2_set_responder'.
1742 type Ikev2SetResponder struct {
1743         Name      string         `binapi:"string[64],name=name" json:"name,omitempty"`
1744         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1745         Address   IP4Address     `binapi:"ip4_address,name=address" json:"address,omitempty"`
1746 }
1747
1748 func (m *Ikev2SetResponder) Reset()               { *m = Ikev2SetResponder{} }
1749 func (*Ikev2SetResponder) GetMessageName() string { return "ikev2_set_responder" }
1750 func (*Ikev2SetResponder) GetCrcString() string   { return "f0d3dc80" }
1751 func (*Ikev2SetResponder) GetMessageType() api.MessageType {
1752         return api.RequestMessage
1753 }
1754
1755 func (m *Ikev2SetResponder) Size() (size int) {
1756         if m == nil {
1757                 return 0
1758         }
1759         size += 64    // m.Name
1760         size += 4     // m.SwIfIndex
1761         size += 1 * 4 // m.Address
1762         return size
1763 }
1764 func (m *Ikev2SetResponder) Marshal(b []byte) ([]byte, error) {
1765         if b == nil {
1766                 b = make([]byte, m.Size())
1767         }
1768         buf := codec.NewBuffer(b)
1769         buf.EncodeString(m.Name, 64)
1770         buf.EncodeUint32(uint32(m.SwIfIndex))
1771         buf.EncodeBytes(m.Address[:], 4)
1772         return buf.Bytes(), nil
1773 }
1774 func (m *Ikev2SetResponder) Unmarshal(b []byte) error {
1775         buf := codec.NewBuffer(b)
1776         m.Name = buf.DecodeString(64)
1777         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1778         copy(m.Address[:], buf.DecodeBytes(4))
1779         return nil
1780 }
1781
1782 // Ikev2SetResponderReply defines message 'ikev2_set_responder_reply'.
1783 type Ikev2SetResponderReply struct {
1784         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1785 }
1786
1787 func (m *Ikev2SetResponderReply) Reset()               { *m = Ikev2SetResponderReply{} }
1788 func (*Ikev2SetResponderReply) GetMessageName() string { return "ikev2_set_responder_reply" }
1789 func (*Ikev2SetResponderReply) GetCrcString() string   { return "e8d4e804" }
1790 func (*Ikev2SetResponderReply) GetMessageType() api.MessageType {
1791         return api.ReplyMessage
1792 }
1793
1794 func (m *Ikev2SetResponderReply) Size() (size int) {
1795         if m == nil {
1796                 return 0
1797         }
1798         size += 4 // m.Retval
1799         return size
1800 }
1801 func (m *Ikev2SetResponderReply) Marshal(b []byte) ([]byte, error) {
1802         if b == nil {
1803                 b = make([]byte, m.Size())
1804         }
1805         buf := codec.NewBuffer(b)
1806         buf.EncodeInt32(m.Retval)
1807         return buf.Bytes(), nil
1808 }
1809 func (m *Ikev2SetResponderReply) Unmarshal(b []byte) error {
1810         buf := codec.NewBuffer(b)
1811         m.Retval = buf.DecodeInt32()
1812         return nil
1813 }
1814
1815 // Ikev2SetSaLifetime defines message 'ikev2_set_sa_lifetime'.
1816 type Ikev2SetSaLifetime struct {
1817         Name            string `binapi:"string[64],name=name" json:"name,omitempty"`
1818         Lifetime        uint64 `binapi:"u64,name=lifetime" json:"lifetime,omitempty"`
1819         LifetimeJitter  uint32 `binapi:"u32,name=lifetime_jitter" json:"lifetime_jitter,omitempty"`
1820         Handover        uint32 `binapi:"u32,name=handover" json:"handover,omitempty"`
1821         LifetimeMaxdata uint64 `binapi:"u64,name=lifetime_maxdata" json:"lifetime_maxdata,omitempty"`
1822 }
1823
1824 func (m *Ikev2SetSaLifetime) Reset()               { *m = Ikev2SetSaLifetime{} }
1825 func (*Ikev2SetSaLifetime) GetMessageName() string { return "ikev2_set_sa_lifetime" }
1826 func (*Ikev2SetSaLifetime) GetCrcString() string   { return "7039feaa" }
1827 func (*Ikev2SetSaLifetime) GetMessageType() api.MessageType {
1828         return api.RequestMessage
1829 }
1830
1831 func (m *Ikev2SetSaLifetime) Size() (size int) {
1832         if m == nil {
1833                 return 0
1834         }
1835         size += 64 // m.Name
1836         size += 8  // m.Lifetime
1837         size += 4  // m.LifetimeJitter
1838         size += 4  // m.Handover
1839         size += 8  // m.LifetimeMaxdata
1840         return size
1841 }
1842 func (m *Ikev2SetSaLifetime) Marshal(b []byte) ([]byte, error) {
1843         if b == nil {
1844                 b = make([]byte, m.Size())
1845         }
1846         buf := codec.NewBuffer(b)
1847         buf.EncodeString(m.Name, 64)
1848         buf.EncodeUint64(m.Lifetime)
1849         buf.EncodeUint32(m.LifetimeJitter)
1850         buf.EncodeUint32(m.Handover)
1851         buf.EncodeUint64(m.LifetimeMaxdata)
1852         return buf.Bytes(), nil
1853 }
1854 func (m *Ikev2SetSaLifetime) Unmarshal(b []byte) error {
1855         buf := codec.NewBuffer(b)
1856         m.Name = buf.DecodeString(64)
1857         m.Lifetime = buf.DecodeUint64()
1858         m.LifetimeJitter = buf.DecodeUint32()
1859         m.Handover = buf.DecodeUint32()
1860         m.LifetimeMaxdata = buf.DecodeUint64()
1861         return nil
1862 }
1863
1864 // Ikev2SetSaLifetimeReply defines message 'ikev2_set_sa_lifetime_reply'.
1865 type Ikev2SetSaLifetimeReply struct {
1866         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1867 }
1868
1869 func (m *Ikev2SetSaLifetimeReply) Reset()               { *m = Ikev2SetSaLifetimeReply{} }
1870 func (*Ikev2SetSaLifetimeReply) GetMessageName() string { return "ikev2_set_sa_lifetime_reply" }
1871 func (*Ikev2SetSaLifetimeReply) GetCrcString() string   { return "e8d4e804" }
1872 func (*Ikev2SetSaLifetimeReply) GetMessageType() api.MessageType {
1873         return api.ReplyMessage
1874 }
1875
1876 func (m *Ikev2SetSaLifetimeReply) Size() (size int) {
1877         if m == nil {
1878                 return 0
1879         }
1880         size += 4 // m.Retval
1881         return size
1882 }
1883 func (m *Ikev2SetSaLifetimeReply) Marshal(b []byte) ([]byte, error) {
1884         if b == nil {
1885                 b = make([]byte, m.Size())
1886         }
1887         buf := codec.NewBuffer(b)
1888         buf.EncodeInt32(m.Retval)
1889         return buf.Bytes(), nil
1890 }
1891 func (m *Ikev2SetSaLifetimeReply) Unmarshal(b []byte) error {
1892         buf := codec.NewBuffer(b)
1893         m.Retval = buf.DecodeInt32()
1894         return nil
1895 }
1896
1897 func init() { file_ikev2_binapi_init() }
1898 func file_ikev2_binapi_init() {
1899         api.RegisterMessage((*Ikev2InitiateDelChildSa)(nil), "ikev2_initiate_del_child_sa_7f004d2e")
1900         api.RegisterMessage((*Ikev2InitiateDelChildSaReply)(nil), "ikev2_initiate_del_child_sa_reply_e8d4e804")
1901         api.RegisterMessage((*Ikev2InitiateDelIkeSa)(nil), "ikev2_initiate_del_ike_sa_8d125bdd")
1902         api.RegisterMessage((*Ikev2InitiateDelIkeSaReply)(nil), "ikev2_initiate_del_ike_sa_reply_e8d4e804")
1903         api.RegisterMessage((*Ikev2InitiateRekeyChildSa)(nil), "ikev2_initiate_rekey_child_sa_7f004d2e")
1904         api.RegisterMessage((*Ikev2InitiateRekeyChildSaReply)(nil), "ikev2_initiate_rekey_child_sa_reply_e8d4e804")
1905         api.RegisterMessage((*Ikev2InitiateSaInit)(nil), "ikev2_initiate_sa_init_ebf79a66")
1906         api.RegisterMessage((*Ikev2InitiateSaInitReply)(nil), "ikev2_initiate_sa_init_reply_e8d4e804")
1907         api.RegisterMessage((*Ikev2PluginGetVersion)(nil), "ikev2_plugin_get_version_51077d14")
1908         api.RegisterMessage((*Ikev2PluginGetVersionReply)(nil), "ikev2_plugin_get_version_reply_9b32cf86")
1909         api.RegisterMessage((*Ikev2ProfileAddDel)(nil), "ikev2_profile_add_del_2c925b55")
1910         api.RegisterMessage((*Ikev2ProfileAddDelReply)(nil), "ikev2_profile_add_del_reply_e8d4e804")
1911         api.RegisterMessage((*Ikev2ProfileSetAuth)(nil), "ikev2_profile_set_auth_642c97cd")
1912         api.RegisterMessage((*Ikev2ProfileSetAuthReply)(nil), "ikev2_profile_set_auth_reply_e8d4e804")
1913         api.RegisterMessage((*Ikev2ProfileSetID)(nil), "ikev2_profile_set_id_4d7e2418")
1914         api.RegisterMessage((*Ikev2ProfileSetIDReply)(nil), "ikev2_profile_set_id_reply_e8d4e804")
1915         api.RegisterMessage((*Ikev2ProfileSetTs)(nil), "ikev2_profile_set_ts_64d55c16")
1916         api.RegisterMessage((*Ikev2ProfileSetTsReply)(nil), "ikev2_profile_set_ts_reply_e8d4e804")
1917         api.RegisterMessage((*Ikev2SetEspTransforms)(nil), "ikev2_set_esp_transforms_936a1a37")
1918         api.RegisterMessage((*Ikev2SetEspTransformsReply)(nil), "ikev2_set_esp_transforms_reply_e8d4e804")
1919         api.RegisterMessage((*Ikev2SetIkeTransforms)(nil), "ikev2_set_ike_transforms_936a1a37")
1920         api.RegisterMessage((*Ikev2SetIkeTransformsReply)(nil), "ikev2_set_ike_transforms_reply_e8d4e804")
1921         api.RegisterMessage((*Ikev2SetLocalKey)(nil), "ikev2_set_local_key_e4996cd5")
1922         api.RegisterMessage((*Ikev2SetLocalKeyReply)(nil), "ikev2_set_local_key_reply_e8d4e804")
1923         api.RegisterMessage((*Ikev2SetResponder)(nil), "ikev2_set_responder_f0d3dc80")
1924         api.RegisterMessage((*Ikev2SetResponderReply)(nil), "ikev2_set_responder_reply_e8d4e804")
1925         api.RegisterMessage((*Ikev2SetSaLifetime)(nil), "ikev2_set_sa_lifetime_7039feaa")
1926         api.RegisterMessage((*Ikev2SetSaLifetimeReply)(nil), "ikev2_set_sa_lifetime_reply_e8d4e804")
1927 }
1928
1929 // Messages returns list of all messages in this module.
1930 func AllMessages() []api.Message {
1931         return []api.Message{
1932                 (*Ikev2InitiateDelChildSa)(nil),
1933                 (*Ikev2InitiateDelChildSaReply)(nil),
1934                 (*Ikev2InitiateDelIkeSa)(nil),
1935                 (*Ikev2InitiateDelIkeSaReply)(nil),
1936                 (*Ikev2InitiateRekeyChildSa)(nil),
1937                 (*Ikev2InitiateRekeyChildSaReply)(nil),
1938                 (*Ikev2InitiateSaInit)(nil),
1939                 (*Ikev2InitiateSaInitReply)(nil),
1940                 (*Ikev2PluginGetVersion)(nil),
1941                 (*Ikev2PluginGetVersionReply)(nil),
1942                 (*Ikev2ProfileAddDel)(nil),
1943                 (*Ikev2ProfileAddDelReply)(nil),
1944                 (*Ikev2ProfileSetAuth)(nil),
1945                 (*Ikev2ProfileSetAuthReply)(nil),
1946                 (*Ikev2ProfileSetID)(nil),
1947                 (*Ikev2ProfileSetIDReply)(nil),
1948                 (*Ikev2ProfileSetTs)(nil),
1949                 (*Ikev2ProfileSetTsReply)(nil),
1950                 (*Ikev2SetEspTransforms)(nil),
1951                 (*Ikev2SetEspTransformsReply)(nil),
1952                 (*Ikev2SetIkeTransforms)(nil),
1953                 (*Ikev2SetIkeTransformsReply)(nil),
1954                 (*Ikev2SetLocalKey)(nil),
1955                 (*Ikev2SetLocalKeyReply)(nil),
1956                 (*Ikev2SetResponder)(nil),
1957                 (*Ikev2SetResponderReply)(nil),
1958                 (*Ikev2SetSaLifetime)(nil),
1959                 (*Ikev2SetSaLifetimeReply)(nil),
1960         }
1961 }