3e132ada77eb7bc78e0c1bf418405f2c8282fc87
[govpp.git] / internal / testbinapi / binapi2001 / map / map.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/map.api.json
6
7 // Package maps contains generated bindings for API file map.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  10 enums
12 //   6 structs
13 //   1 union
14 //  30 messages
15 //
16 package maps
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    = "map"
35         APIVersion = "4.1.1"
36         VersionCrc = 0x42c84657
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 // MapAddDelRule defines message 'map_add_del_rule'.
853 type MapAddDelRule struct {
854         Index  uint32     `binapi:"u32,name=index" json:"index,omitempty"`
855         IsAdd  bool       `binapi:"bool,name=is_add" json:"is_add,omitempty"`
856         IP6Dst IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"`
857         Psid   uint16     `binapi:"u16,name=psid" json:"psid,omitempty"`
858 }
859
860 func (m *MapAddDelRule) Reset()               { *m = MapAddDelRule{} }
861 func (*MapAddDelRule) GetMessageName() string { return "map_add_del_rule" }
862 func (*MapAddDelRule) GetCrcString() string   { return "c65b32f7" }
863 func (*MapAddDelRule) GetMessageType() api.MessageType {
864         return api.RequestMessage
865 }
866
867 func (m *MapAddDelRule) Size() (size int) {
868         if m == nil {
869                 return 0
870         }
871         size += 4      // m.Index
872         size += 1      // m.IsAdd
873         size += 1 * 16 // m.IP6Dst
874         size += 2      // m.Psid
875         return size
876 }
877 func (m *MapAddDelRule) Marshal(b []byte) ([]byte, error) {
878         if b == nil {
879                 b = make([]byte, m.Size())
880         }
881         buf := codec.NewBuffer(b)
882         buf.EncodeUint32(m.Index)
883         buf.EncodeBool(m.IsAdd)
884         buf.EncodeBytes(m.IP6Dst[:], 16)
885         buf.EncodeUint16(m.Psid)
886         return buf.Bytes(), nil
887 }
888 func (m *MapAddDelRule) Unmarshal(b []byte) error {
889         buf := codec.NewBuffer(b)
890         m.Index = buf.DecodeUint32()
891         m.IsAdd = buf.DecodeBool()
892         copy(m.IP6Dst[:], buf.DecodeBytes(16))
893         m.Psid = buf.DecodeUint16()
894         return nil
895 }
896
897 // MapAddDelRuleReply defines message 'map_add_del_rule_reply'.
898 type MapAddDelRuleReply struct {
899         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
900 }
901
902 func (m *MapAddDelRuleReply) Reset()               { *m = MapAddDelRuleReply{} }
903 func (*MapAddDelRuleReply) GetMessageName() string { return "map_add_del_rule_reply" }
904 func (*MapAddDelRuleReply) GetCrcString() string   { return "e8d4e804" }
905 func (*MapAddDelRuleReply) GetMessageType() api.MessageType {
906         return api.ReplyMessage
907 }
908
909 func (m *MapAddDelRuleReply) Size() (size int) {
910         if m == nil {
911                 return 0
912         }
913         size += 4 // m.Retval
914         return size
915 }
916 func (m *MapAddDelRuleReply) Marshal(b []byte) ([]byte, error) {
917         if b == nil {
918                 b = make([]byte, m.Size())
919         }
920         buf := codec.NewBuffer(b)
921         buf.EncodeInt32(m.Retval)
922         return buf.Bytes(), nil
923 }
924 func (m *MapAddDelRuleReply) Unmarshal(b []byte) error {
925         buf := codec.NewBuffer(b)
926         m.Retval = buf.DecodeInt32()
927         return nil
928 }
929
930 // MapAddDomain defines message 'map_add_domain'.
931 type MapAddDomain struct {
932         IP6Prefix  IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"`
933         IP4Prefix  IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"`
934         IP6Src     IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"`
935         EaBitsLen  uint8     `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"`
936         PsidOffset uint8     `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"`
937         PsidLength uint8     `binapi:"u8,name=psid_length" json:"psid_length,omitempty"`
938         Mtu        uint16    `binapi:"u16,name=mtu" json:"mtu,omitempty"`
939         Tag        string    `binapi:"string[64],name=tag" json:"tag,omitempty"`
940 }
941
942 func (m *MapAddDomain) Reset()               { *m = MapAddDomain{} }
943 func (*MapAddDomain) GetMessageName() string { return "map_add_domain" }
944 func (*MapAddDomain) GetCrcString() string   { return "7a5a18c9" }
945 func (*MapAddDomain) GetMessageType() api.MessageType {
946         return api.RequestMessage
947 }
948
949 func (m *MapAddDomain) Size() (size int) {
950         if m == nil {
951                 return 0
952         }
953         size += 1 * 16 // m.IP6Prefix.Address
954         size += 1      // m.IP6Prefix.Len
955         size += 1 * 4  // m.IP4Prefix.Address
956         size += 1      // m.IP4Prefix.Len
957         size += 1 * 16 // m.IP6Src.Address
958         size += 1      // m.IP6Src.Len
959         size += 1      // m.EaBitsLen
960         size += 1      // m.PsidOffset
961         size += 1      // m.PsidLength
962         size += 2      // m.Mtu
963         size += 64     // m.Tag
964         return size
965 }
966 func (m *MapAddDomain) Marshal(b []byte) ([]byte, error) {
967         if b == nil {
968                 b = make([]byte, m.Size())
969         }
970         buf := codec.NewBuffer(b)
971         buf.EncodeBytes(m.IP6Prefix.Address[:], 16)
972         buf.EncodeUint8(m.IP6Prefix.Len)
973         buf.EncodeBytes(m.IP4Prefix.Address[:], 4)
974         buf.EncodeUint8(m.IP4Prefix.Len)
975         buf.EncodeBytes(m.IP6Src.Address[:], 16)
976         buf.EncodeUint8(m.IP6Src.Len)
977         buf.EncodeUint8(m.EaBitsLen)
978         buf.EncodeUint8(m.PsidOffset)
979         buf.EncodeUint8(m.PsidLength)
980         buf.EncodeUint16(m.Mtu)
981         buf.EncodeString(m.Tag, 64)
982         return buf.Bytes(), nil
983 }
984 func (m *MapAddDomain) Unmarshal(b []byte) error {
985         buf := codec.NewBuffer(b)
986         copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16))
987         m.IP6Prefix.Len = buf.DecodeUint8()
988         copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4))
989         m.IP4Prefix.Len = buf.DecodeUint8()
990         copy(m.IP6Src.Address[:], buf.DecodeBytes(16))
991         m.IP6Src.Len = buf.DecodeUint8()
992         m.EaBitsLen = buf.DecodeUint8()
993         m.PsidOffset = buf.DecodeUint8()
994         m.PsidLength = buf.DecodeUint8()
995         m.Mtu = buf.DecodeUint16()
996         m.Tag = buf.DecodeString(64)
997         return nil
998 }
999
1000 // MapAddDomainReply defines message 'map_add_domain_reply'.
1001 type MapAddDomainReply struct {
1002         Index  uint32 `binapi:"u32,name=index" json:"index,omitempty"`
1003         Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
1004 }
1005
1006 func (m *MapAddDomainReply) Reset()               { *m = MapAddDomainReply{} }
1007 func (*MapAddDomainReply) GetMessageName() string { return "map_add_domain_reply" }
1008 func (*MapAddDomainReply) GetCrcString() string   { return "3e6d4e2c" }
1009 func (*MapAddDomainReply) GetMessageType() api.MessageType {
1010         return api.ReplyMessage
1011 }
1012
1013 func (m *MapAddDomainReply) Size() (size int) {
1014         if m == nil {
1015                 return 0
1016         }
1017         size += 4 // m.Index
1018         size += 4 // m.Retval
1019         return size
1020 }
1021 func (m *MapAddDomainReply) Marshal(b []byte) ([]byte, error) {
1022         if b == nil {
1023                 b = make([]byte, m.Size())
1024         }
1025         buf := codec.NewBuffer(b)
1026         buf.EncodeUint32(m.Index)
1027         buf.EncodeInt32(m.Retval)
1028         return buf.Bytes(), nil
1029 }
1030 func (m *MapAddDomainReply) Unmarshal(b []byte) error {
1031         buf := codec.NewBuffer(b)
1032         m.Index = buf.DecodeUint32()
1033         m.Retval = buf.DecodeInt32()
1034         return nil
1035 }
1036
1037 // MapDelDomain defines message 'map_del_domain'.
1038 type MapDelDomain struct {
1039         Index uint32 `binapi:"u32,name=index" json:"index,omitempty"`
1040 }
1041
1042 func (m *MapDelDomain) Reset()               { *m = MapDelDomain{} }
1043 func (*MapDelDomain) GetMessageName() string { return "map_del_domain" }
1044 func (*MapDelDomain) GetCrcString() string   { return "8ac76db6" }
1045 func (*MapDelDomain) GetMessageType() api.MessageType {
1046         return api.RequestMessage
1047 }
1048
1049 func (m *MapDelDomain) Size() (size int) {
1050         if m == nil {
1051                 return 0
1052         }
1053         size += 4 // m.Index
1054         return size
1055 }
1056 func (m *MapDelDomain) Marshal(b []byte) ([]byte, error) {
1057         if b == nil {
1058                 b = make([]byte, m.Size())
1059         }
1060         buf := codec.NewBuffer(b)
1061         buf.EncodeUint32(m.Index)
1062         return buf.Bytes(), nil
1063 }
1064 func (m *MapDelDomain) Unmarshal(b []byte) error {
1065         buf := codec.NewBuffer(b)
1066         m.Index = buf.DecodeUint32()
1067         return nil
1068 }
1069
1070 // MapDelDomainReply defines message 'map_del_domain_reply'.
1071 type MapDelDomainReply struct {
1072         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1073 }
1074
1075 func (m *MapDelDomainReply) Reset()               { *m = MapDelDomainReply{} }
1076 func (*MapDelDomainReply) GetMessageName() string { return "map_del_domain_reply" }
1077 func (*MapDelDomainReply) GetCrcString() string   { return "e8d4e804" }
1078 func (*MapDelDomainReply) GetMessageType() api.MessageType {
1079         return api.ReplyMessage
1080 }
1081
1082 func (m *MapDelDomainReply) Size() (size int) {
1083         if m == nil {
1084                 return 0
1085         }
1086         size += 4 // m.Retval
1087         return size
1088 }
1089 func (m *MapDelDomainReply) Marshal(b []byte) ([]byte, error) {
1090         if b == nil {
1091                 b = make([]byte, m.Size())
1092         }
1093         buf := codec.NewBuffer(b)
1094         buf.EncodeInt32(m.Retval)
1095         return buf.Bytes(), nil
1096 }
1097 func (m *MapDelDomainReply) Unmarshal(b []byte) error {
1098         buf := codec.NewBuffer(b)
1099         m.Retval = buf.DecodeInt32()
1100         return nil
1101 }
1102
1103 // MapDomainDetails defines message 'map_domain_details'.
1104 type MapDomainDetails struct {
1105         DomainIndex uint32    `binapi:"u32,name=domain_index" json:"domain_index,omitempty"`
1106         IP6Prefix   IP6Prefix `binapi:"ip6_prefix,name=ip6_prefix" json:"ip6_prefix,omitempty"`
1107         IP4Prefix   IP4Prefix `binapi:"ip4_prefix,name=ip4_prefix" json:"ip4_prefix,omitempty"`
1108         IP6Src      IP6Prefix `binapi:"ip6_prefix,name=ip6_src" json:"ip6_src,omitempty"`
1109         EaBitsLen   uint8     `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"`
1110         PsidOffset  uint8     `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"`
1111         PsidLength  uint8     `binapi:"u8,name=psid_length" json:"psid_length,omitempty"`
1112         Flags       uint8     `binapi:"u8,name=flags" json:"flags,omitempty"`
1113         Mtu         uint16    `binapi:"u16,name=mtu" json:"mtu,omitempty"`
1114         Tag         string    `binapi:"string[64],name=tag" json:"tag,omitempty"`
1115 }
1116
1117 func (m *MapDomainDetails) Reset()               { *m = MapDomainDetails{} }
1118 func (*MapDomainDetails) GetMessageName() string { return "map_domain_details" }
1119 func (*MapDomainDetails) GetCrcString() string   { return "fc1859dd" }
1120 func (*MapDomainDetails) GetMessageType() api.MessageType {
1121         return api.ReplyMessage
1122 }
1123
1124 func (m *MapDomainDetails) Size() (size int) {
1125         if m == nil {
1126                 return 0
1127         }
1128         size += 4      // m.DomainIndex
1129         size += 1 * 16 // m.IP6Prefix.Address
1130         size += 1      // m.IP6Prefix.Len
1131         size += 1 * 4  // m.IP4Prefix.Address
1132         size += 1      // m.IP4Prefix.Len
1133         size += 1 * 16 // m.IP6Src.Address
1134         size += 1      // m.IP6Src.Len
1135         size += 1      // m.EaBitsLen
1136         size += 1      // m.PsidOffset
1137         size += 1      // m.PsidLength
1138         size += 1      // m.Flags
1139         size += 2      // m.Mtu
1140         size += 64     // m.Tag
1141         return size
1142 }
1143 func (m *MapDomainDetails) Marshal(b []byte) ([]byte, error) {
1144         if b == nil {
1145                 b = make([]byte, m.Size())
1146         }
1147         buf := codec.NewBuffer(b)
1148         buf.EncodeUint32(m.DomainIndex)
1149         buf.EncodeBytes(m.IP6Prefix.Address[:], 16)
1150         buf.EncodeUint8(m.IP6Prefix.Len)
1151         buf.EncodeBytes(m.IP4Prefix.Address[:], 4)
1152         buf.EncodeUint8(m.IP4Prefix.Len)
1153         buf.EncodeBytes(m.IP6Src.Address[:], 16)
1154         buf.EncodeUint8(m.IP6Src.Len)
1155         buf.EncodeUint8(m.EaBitsLen)
1156         buf.EncodeUint8(m.PsidOffset)
1157         buf.EncodeUint8(m.PsidLength)
1158         buf.EncodeUint8(m.Flags)
1159         buf.EncodeUint16(m.Mtu)
1160         buf.EncodeString(m.Tag, 64)
1161         return buf.Bytes(), nil
1162 }
1163 func (m *MapDomainDetails) Unmarshal(b []byte) error {
1164         buf := codec.NewBuffer(b)
1165         m.DomainIndex = buf.DecodeUint32()
1166         copy(m.IP6Prefix.Address[:], buf.DecodeBytes(16))
1167         m.IP6Prefix.Len = buf.DecodeUint8()
1168         copy(m.IP4Prefix.Address[:], buf.DecodeBytes(4))
1169         m.IP4Prefix.Len = buf.DecodeUint8()
1170         copy(m.IP6Src.Address[:], buf.DecodeBytes(16))
1171         m.IP6Src.Len = buf.DecodeUint8()
1172         m.EaBitsLen = buf.DecodeUint8()
1173         m.PsidOffset = buf.DecodeUint8()
1174         m.PsidLength = buf.DecodeUint8()
1175         m.Flags = buf.DecodeUint8()
1176         m.Mtu = buf.DecodeUint16()
1177         m.Tag = buf.DecodeString(64)
1178         return nil
1179 }
1180
1181 // MapDomainDump defines message 'map_domain_dump'.
1182 type MapDomainDump struct{}
1183
1184 func (m *MapDomainDump) Reset()               { *m = MapDomainDump{} }
1185 func (*MapDomainDump) GetMessageName() string { return "map_domain_dump" }
1186 func (*MapDomainDump) GetCrcString() string   { return "51077d14" }
1187 func (*MapDomainDump) GetMessageType() api.MessageType {
1188         return api.RequestMessage
1189 }
1190
1191 func (m *MapDomainDump) Size() (size int) {
1192         if m == nil {
1193                 return 0
1194         }
1195         return size
1196 }
1197 func (m *MapDomainDump) Marshal(b []byte) ([]byte, error) {
1198         if b == nil {
1199                 b = make([]byte, m.Size())
1200         }
1201         buf := codec.NewBuffer(b)
1202         return buf.Bytes(), nil
1203 }
1204 func (m *MapDomainDump) Unmarshal(b []byte) error {
1205         return nil
1206 }
1207
1208 // MapIfEnableDisable defines message 'map_if_enable_disable'.
1209 type MapIfEnableDisable struct {
1210         SwIfIndex     InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1211         IsEnable      bool           `binapi:"bool,name=is_enable" json:"is_enable,omitempty"`
1212         IsTranslation bool           `binapi:"bool,name=is_translation" json:"is_translation,omitempty"`
1213 }
1214
1215 func (m *MapIfEnableDisable) Reset()               { *m = MapIfEnableDisable{} }
1216 func (*MapIfEnableDisable) GetMessageName() string { return "map_if_enable_disable" }
1217 func (*MapIfEnableDisable) GetCrcString() string   { return "59bb32f4" }
1218 func (*MapIfEnableDisable) GetMessageType() api.MessageType {
1219         return api.RequestMessage
1220 }
1221
1222 func (m *MapIfEnableDisable) Size() (size int) {
1223         if m == nil {
1224                 return 0
1225         }
1226         size += 4 // m.SwIfIndex
1227         size += 1 // m.IsEnable
1228         size += 1 // m.IsTranslation
1229         return size
1230 }
1231 func (m *MapIfEnableDisable) Marshal(b []byte) ([]byte, error) {
1232         if b == nil {
1233                 b = make([]byte, m.Size())
1234         }
1235         buf := codec.NewBuffer(b)
1236         buf.EncodeUint32(uint32(m.SwIfIndex))
1237         buf.EncodeBool(m.IsEnable)
1238         buf.EncodeBool(m.IsTranslation)
1239         return buf.Bytes(), nil
1240 }
1241 func (m *MapIfEnableDisable) Unmarshal(b []byte) error {
1242         buf := codec.NewBuffer(b)
1243         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1244         m.IsEnable = buf.DecodeBool()
1245         m.IsTranslation = buf.DecodeBool()
1246         return nil
1247 }
1248
1249 // MapIfEnableDisableReply defines message 'map_if_enable_disable_reply'.
1250 type MapIfEnableDisableReply struct {
1251         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1252 }
1253
1254 func (m *MapIfEnableDisableReply) Reset()               { *m = MapIfEnableDisableReply{} }
1255 func (*MapIfEnableDisableReply) GetMessageName() string { return "map_if_enable_disable_reply" }
1256 func (*MapIfEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
1257 func (*MapIfEnableDisableReply) GetMessageType() api.MessageType {
1258         return api.ReplyMessage
1259 }
1260
1261 func (m *MapIfEnableDisableReply) Size() (size int) {
1262         if m == nil {
1263                 return 0
1264         }
1265         size += 4 // m.Retval
1266         return size
1267 }
1268 func (m *MapIfEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1269         if b == nil {
1270                 b = make([]byte, m.Size())
1271         }
1272         buf := codec.NewBuffer(b)
1273         buf.EncodeInt32(m.Retval)
1274         return buf.Bytes(), nil
1275 }
1276 func (m *MapIfEnableDisableReply) Unmarshal(b []byte) error {
1277         buf := codec.NewBuffer(b)
1278         m.Retval = buf.DecodeInt32()
1279         return nil
1280 }
1281
1282 // MapParamAddDelPreResolve defines message 'map_param_add_del_pre_resolve'.
1283 type MapParamAddDelPreResolve struct {
1284         IsAdd        bool       `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1285         IP4NhAddress IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"`
1286         IP6NhAddress IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"`
1287 }
1288
1289 func (m *MapParamAddDelPreResolve) Reset()               { *m = MapParamAddDelPreResolve{} }
1290 func (*MapParamAddDelPreResolve) GetMessageName() string { return "map_param_add_del_pre_resolve" }
1291 func (*MapParamAddDelPreResolve) GetCrcString() string   { return "17008c66" }
1292 func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType {
1293         return api.RequestMessage
1294 }
1295
1296 func (m *MapParamAddDelPreResolve) Size() (size int) {
1297         if m == nil {
1298                 return 0
1299         }
1300         size += 1      // m.IsAdd
1301         size += 1 * 4  // m.IP4NhAddress
1302         size += 1 * 16 // m.IP6NhAddress
1303         return size
1304 }
1305 func (m *MapParamAddDelPreResolve) Marshal(b []byte) ([]byte, error) {
1306         if b == nil {
1307                 b = make([]byte, m.Size())
1308         }
1309         buf := codec.NewBuffer(b)
1310         buf.EncodeBool(m.IsAdd)
1311         buf.EncodeBytes(m.IP4NhAddress[:], 4)
1312         buf.EncodeBytes(m.IP6NhAddress[:], 16)
1313         return buf.Bytes(), nil
1314 }
1315 func (m *MapParamAddDelPreResolve) Unmarshal(b []byte) error {
1316         buf := codec.NewBuffer(b)
1317         m.IsAdd = buf.DecodeBool()
1318         copy(m.IP4NhAddress[:], buf.DecodeBytes(4))
1319         copy(m.IP6NhAddress[:], buf.DecodeBytes(16))
1320         return nil
1321 }
1322
1323 // MapParamAddDelPreResolveReply defines message 'map_param_add_del_pre_resolve_reply'.
1324 type MapParamAddDelPreResolveReply struct {
1325         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1326 }
1327
1328 func (m *MapParamAddDelPreResolveReply) Reset() { *m = MapParamAddDelPreResolveReply{} }
1329 func (*MapParamAddDelPreResolveReply) GetMessageName() string {
1330         return "map_param_add_del_pre_resolve_reply"
1331 }
1332 func (*MapParamAddDelPreResolveReply) GetCrcString() string { return "e8d4e804" }
1333 func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType {
1334         return api.ReplyMessage
1335 }
1336
1337 func (m *MapParamAddDelPreResolveReply) Size() (size int) {
1338         if m == nil {
1339                 return 0
1340         }
1341         size += 4 // m.Retval
1342         return size
1343 }
1344 func (m *MapParamAddDelPreResolveReply) Marshal(b []byte) ([]byte, error) {
1345         if b == nil {
1346                 b = make([]byte, m.Size())
1347         }
1348         buf := codec.NewBuffer(b)
1349         buf.EncodeInt32(m.Retval)
1350         return buf.Bytes(), nil
1351 }
1352 func (m *MapParamAddDelPreResolveReply) Unmarshal(b []byte) error {
1353         buf := codec.NewBuffer(b)
1354         m.Retval = buf.DecodeInt32()
1355         return nil
1356 }
1357
1358 // MapParamGet defines message 'map_param_get'.
1359 type MapParamGet struct{}
1360
1361 func (m *MapParamGet) Reset()               { *m = MapParamGet{} }
1362 func (*MapParamGet) GetMessageName() string { return "map_param_get" }
1363 func (*MapParamGet) GetCrcString() string   { return "51077d14" }
1364 func (*MapParamGet) GetMessageType() api.MessageType {
1365         return api.RequestMessage
1366 }
1367
1368 func (m *MapParamGet) Size() (size int) {
1369         if m == nil {
1370                 return 0
1371         }
1372         return size
1373 }
1374 func (m *MapParamGet) Marshal(b []byte) ([]byte, error) {
1375         if b == nil {
1376                 b = make([]byte, m.Size())
1377         }
1378         buf := codec.NewBuffer(b)
1379         return buf.Bytes(), nil
1380 }
1381 func (m *MapParamGet) Unmarshal(b []byte) error {
1382         return nil
1383 }
1384
1385 // MapParamGetReply defines message 'map_param_get_reply'.
1386 type MapParamGetReply struct {
1387         Retval                 int32      `binapi:"i32,name=retval" json:"retval,omitempty"`
1388         FragInner              uint8      `binapi:"u8,name=frag_inner" json:"frag_inner,omitempty"`
1389         FragIgnoreDf           uint8      `binapi:"u8,name=frag_ignore_df" json:"frag_ignore_df,omitempty"`
1390         ICMPIP4ErrRelaySrc     IP4Address `binapi:"ip4_address,name=icmp_ip4_err_relay_src" json:"icmp_ip4_err_relay_src,omitempty"`
1391         ICMP6EnableUnreachable bool       `binapi:"bool,name=icmp6_enable_unreachable" json:"icmp6_enable_unreachable,omitempty"`
1392         IP4NhAddress           IP4Address `binapi:"ip4_address,name=ip4_nh_address" json:"ip4_nh_address,omitempty"`
1393         IP6NhAddress           IP6Address `binapi:"ip6_address,name=ip6_nh_address" json:"ip6_nh_address,omitempty"`
1394         IP4LifetimeMs          uint16     `binapi:"u16,name=ip4_lifetime_ms" json:"ip4_lifetime_ms,omitempty"`
1395         IP4PoolSize            uint16     `binapi:"u16,name=ip4_pool_size" json:"ip4_pool_size,omitempty"`
1396         IP4Buffers             uint32     `binapi:"u32,name=ip4_buffers" json:"ip4_buffers,omitempty"`
1397         IP4HtRatio             float64    `binapi:"f64,name=ip4_ht_ratio" json:"ip4_ht_ratio,omitempty"`
1398         SecCheckEnable         bool       `binapi:"bool,name=sec_check_enable" json:"sec_check_enable,omitempty"`
1399         SecCheckFragments      bool       `binapi:"bool,name=sec_check_fragments" json:"sec_check_fragments,omitempty"`
1400         TcCopy                 bool       `binapi:"bool,name=tc_copy" json:"tc_copy,omitempty"`
1401         TcClass                uint8      `binapi:"u8,name=tc_class" json:"tc_class,omitempty"`
1402 }
1403
1404 func (m *MapParamGetReply) Reset()               { *m = MapParamGetReply{} }
1405 func (*MapParamGetReply) GetMessageName() string { return "map_param_get_reply" }
1406 func (*MapParamGetReply) GetCrcString() string   { return "28092156" }
1407 func (*MapParamGetReply) GetMessageType() api.MessageType {
1408         return api.ReplyMessage
1409 }
1410
1411 func (m *MapParamGetReply) Size() (size int) {
1412         if m == nil {
1413                 return 0
1414         }
1415         size += 4      // m.Retval
1416         size += 1      // m.FragInner
1417         size += 1      // m.FragIgnoreDf
1418         size += 1 * 4  // m.ICMPIP4ErrRelaySrc
1419         size += 1      // m.ICMP6EnableUnreachable
1420         size += 1 * 4  // m.IP4NhAddress
1421         size += 1 * 16 // m.IP6NhAddress
1422         size += 2      // m.IP4LifetimeMs
1423         size += 2      // m.IP4PoolSize
1424         size += 4      // m.IP4Buffers
1425         size += 8      // m.IP4HtRatio
1426         size += 1      // m.SecCheckEnable
1427         size += 1      // m.SecCheckFragments
1428         size += 1      // m.TcCopy
1429         size += 1      // m.TcClass
1430         return size
1431 }
1432 func (m *MapParamGetReply) Marshal(b []byte) ([]byte, error) {
1433         if b == nil {
1434                 b = make([]byte, m.Size())
1435         }
1436         buf := codec.NewBuffer(b)
1437         buf.EncodeInt32(m.Retval)
1438         buf.EncodeUint8(m.FragInner)
1439         buf.EncodeUint8(m.FragIgnoreDf)
1440         buf.EncodeBytes(m.ICMPIP4ErrRelaySrc[:], 4)
1441         buf.EncodeBool(m.ICMP6EnableUnreachable)
1442         buf.EncodeBytes(m.IP4NhAddress[:], 4)
1443         buf.EncodeBytes(m.IP6NhAddress[:], 16)
1444         buf.EncodeUint16(m.IP4LifetimeMs)
1445         buf.EncodeUint16(m.IP4PoolSize)
1446         buf.EncodeUint32(m.IP4Buffers)
1447         buf.EncodeFloat64(m.IP4HtRatio)
1448         buf.EncodeBool(m.SecCheckEnable)
1449         buf.EncodeBool(m.SecCheckFragments)
1450         buf.EncodeBool(m.TcCopy)
1451         buf.EncodeUint8(m.TcClass)
1452         return buf.Bytes(), nil
1453 }
1454 func (m *MapParamGetReply) Unmarshal(b []byte) error {
1455         buf := codec.NewBuffer(b)
1456         m.Retval = buf.DecodeInt32()
1457         m.FragInner = buf.DecodeUint8()
1458         m.FragIgnoreDf = buf.DecodeUint8()
1459         copy(m.ICMPIP4ErrRelaySrc[:], buf.DecodeBytes(4))
1460         m.ICMP6EnableUnreachable = buf.DecodeBool()
1461         copy(m.IP4NhAddress[:], buf.DecodeBytes(4))
1462         copy(m.IP6NhAddress[:], buf.DecodeBytes(16))
1463         m.IP4LifetimeMs = buf.DecodeUint16()
1464         m.IP4PoolSize = buf.DecodeUint16()
1465         m.IP4Buffers = buf.DecodeUint32()
1466         m.IP4HtRatio = buf.DecodeFloat64()
1467         m.SecCheckEnable = buf.DecodeBool()
1468         m.SecCheckFragments = buf.DecodeBool()
1469         m.TcCopy = buf.DecodeBool()
1470         m.TcClass = buf.DecodeUint8()
1471         return nil
1472 }
1473
1474 // MapParamSetFragmentation defines message 'map_param_set_fragmentation'.
1475 type MapParamSetFragmentation struct {
1476         Inner    bool `binapi:"bool,name=inner" json:"inner,omitempty"`
1477         IgnoreDf bool `binapi:"bool,name=ignore_df" json:"ignore_df,omitempty"`
1478 }
1479
1480 func (m *MapParamSetFragmentation) Reset()               { *m = MapParamSetFragmentation{} }
1481 func (*MapParamSetFragmentation) GetMessageName() string { return "map_param_set_fragmentation" }
1482 func (*MapParamSetFragmentation) GetCrcString() string   { return "9ff54d90" }
1483 func (*MapParamSetFragmentation) GetMessageType() api.MessageType {
1484         return api.RequestMessage
1485 }
1486
1487 func (m *MapParamSetFragmentation) Size() (size int) {
1488         if m == nil {
1489                 return 0
1490         }
1491         size += 1 // m.Inner
1492         size += 1 // m.IgnoreDf
1493         return size
1494 }
1495 func (m *MapParamSetFragmentation) Marshal(b []byte) ([]byte, error) {
1496         if b == nil {
1497                 b = make([]byte, m.Size())
1498         }
1499         buf := codec.NewBuffer(b)
1500         buf.EncodeBool(m.Inner)
1501         buf.EncodeBool(m.IgnoreDf)
1502         return buf.Bytes(), nil
1503 }
1504 func (m *MapParamSetFragmentation) Unmarshal(b []byte) error {
1505         buf := codec.NewBuffer(b)
1506         m.Inner = buf.DecodeBool()
1507         m.IgnoreDf = buf.DecodeBool()
1508         return nil
1509 }
1510
1511 // MapParamSetFragmentationReply defines message 'map_param_set_fragmentation_reply'.
1512 type MapParamSetFragmentationReply struct {
1513         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1514 }
1515
1516 func (m *MapParamSetFragmentationReply) Reset() { *m = MapParamSetFragmentationReply{} }
1517 func (*MapParamSetFragmentationReply) GetMessageName() string {
1518         return "map_param_set_fragmentation_reply"
1519 }
1520 func (*MapParamSetFragmentationReply) GetCrcString() string { return "e8d4e804" }
1521 func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType {
1522         return api.ReplyMessage
1523 }
1524
1525 func (m *MapParamSetFragmentationReply) Size() (size int) {
1526         if m == nil {
1527                 return 0
1528         }
1529         size += 4 // m.Retval
1530         return size
1531 }
1532 func (m *MapParamSetFragmentationReply) Marshal(b []byte) ([]byte, error) {
1533         if b == nil {
1534                 b = make([]byte, m.Size())
1535         }
1536         buf := codec.NewBuffer(b)
1537         buf.EncodeInt32(m.Retval)
1538         return buf.Bytes(), nil
1539 }
1540 func (m *MapParamSetFragmentationReply) Unmarshal(b []byte) error {
1541         buf := codec.NewBuffer(b)
1542         m.Retval = buf.DecodeInt32()
1543         return nil
1544 }
1545
1546 // MapParamSetICMP defines message 'map_param_set_icmp'.
1547 type MapParamSetICMP struct {
1548         IP4ErrRelaySrc IP4Address `binapi:"ip4_address,name=ip4_err_relay_src" json:"ip4_err_relay_src,omitempty"`
1549 }
1550
1551 func (m *MapParamSetICMP) Reset()               { *m = MapParamSetICMP{} }
1552 func (*MapParamSetICMP) GetMessageName() string { return "map_param_set_icmp" }
1553 func (*MapParamSetICMP) GetCrcString() string   { return "58210cbf" }
1554 func (*MapParamSetICMP) GetMessageType() api.MessageType {
1555         return api.RequestMessage
1556 }
1557
1558 func (m *MapParamSetICMP) Size() (size int) {
1559         if m == nil {
1560                 return 0
1561         }
1562         size += 1 * 4 // m.IP4ErrRelaySrc
1563         return size
1564 }
1565 func (m *MapParamSetICMP) Marshal(b []byte) ([]byte, error) {
1566         if b == nil {
1567                 b = make([]byte, m.Size())
1568         }
1569         buf := codec.NewBuffer(b)
1570         buf.EncodeBytes(m.IP4ErrRelaySrc[:], 4)
1571         return buf.Bytes(), nil
1572 }
1573 func (m *MapParamSetICMP) Unmarshal(b []byte) error {
1574         buf := codec.NewBuffer(b)
1575         copy(m.IP4ErrRelaySrc[:], buf.DecodeBytes(4))
1576         return nil
1577 }
1578
1579 // MapParamSetICMP6 defines message 'map_param_set_icmp6'.
1580 type MapParamSetICMP6 struct {
1581         EnableUnreachable bool `binapi:"bool,name=enable_unreachable" json:"enable_unreachable,omitempty"`
1582 }
1583
1584 func (m *MapParamSetICMP6) Reset()               { *m = MapParamSetICMP6{} }
1585 func (*MapParamSetICMP6) GetMessageName() string { return "map_param_set_icmp6" }
1586 func (*MapParamSetICMP6) GetCrcString() string   { return "5d01f8c1" }
1587 func (*MapParamSetICMP6) GetMessageType() api.MessageType {
1588         return api.RequestMessage
1589 }
1590
1591 func (m *MapParamSetICMP6) Size() (size int) {
1592         if m == nil {
1593                 return 0
1594         }
1595         size += 1 // m.EnableUnreachable
1596         return size
1597 }
1598 func (m *MapParamSetICMP6) Marshal(b []byte) ([]byte, error) {
1599         if b == nil {
1600                 b = make([]byte, m.Size())
1601         }
1602         buf := codec.NewBuffer(b)
1603         buf.EncodeBool(m.EnableUnreachable)
1604         return buf.Bytes(), nil
1605 }
1606 func (m *MapParamSetICMP6) Unmarshal(b []byte) error {
1607         buf := codec.NewBuffer(b)
1608         m.EnableUnreachable = buf.DecodeBool()
1609         return nil
1610 }
1611
1612 // MapParamSetICMP6Reply defines message 'map_param_set_icmp6_reply'.
1613 type MapParamSetICMP6Reply struct {
1614         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1615 }
1616
1617 func (m *MapParamSetICMP6Reply) Reset()               { *m = MapParamSetICMP6Reply{} }
1618 func (*MapParamSetICMP6Reply) GetMessageName() string { return "map_param_set_icmp6_reply" }
1619 func (*MapParamSetICMP6Reply) GetCrcString() string   { return "e8d4e804" }
1620 func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType {
1621         return api.ReplyMessage
1622 }
1623
1624 func (m *MapParamSetICMP6Reply) Size() (size int) {
1625         if m == nil {
1626                 return 0
1627         }
1628         size += 4 // m.Retval
1629         return size
1630 }
1631 func (m *MapParamSetICMP6Reply) Marshal(b []byte) ([]byte, error) {
1632         if b == nil {
1633                 b = make([]byte, m.Size())
1634         }
1635         buf := codec.NewBuffer(b)
1636         buf.EncodeInt32(m.Retval)
1637         return buf.Bytes(), nil
1638 }
1639 func (m *MapParamSetICMP6Reply) Unmarshal(b []byte) error {
1640         buf := codec.NewBuffer(b)
1641         m.Retval = buf.DecodeInt32()
1642         return nil
1643 }
1644
1645 // MapParamSetICMPReply defines message 'map_param_set_icmp_reply'.
1646 type MapParamSetICMPReply struct {
1647         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1648 }
1649
1650 func (m *MapParamSetICMPReply) Reset()               { *m = MapParamSetICMPReply{} }
1651 func (*MapParamSetICMPReply) GetMessageName() string { return "map_param_set_icmp_reply" }
1652 func (*MapParamSetICMPReply) GetCrcString() string   { return "e8d4e804" }
1653 func (*MapParamSetICMPReply) GetMessageType() api.MessageType {
1654         return api.ReplyMessage
1655 }
1656
1657 func (m *MapParamSetICMPReply) Size() (size int) {
1658         if m == nil {
1659                 return 0
1660         }
1661         size += 4 // m.Retval
1662         return size
1663 }
1664 func (m *MapParamSetICMPReply) Marshal(b []byte) ([]byte, error) {
1665         if b == nil {
1666                 b = make([]byte, m.Size())
1667         }
1668         buf := codec.NewBuffer(b)
1669         buf.EncodeInt32(m.Retval)
1670         return buf.Bytes(), nil
1671 }
1672 func (m *MapParamSetICMPReply) Unmarshal(b []byte) error {
1673         buf := codec.NewBuffer(b)
1674         m.Retval = buf.DecodeInt32()
1675         return nil
1676 }
1677
1678 // MapParamSetSecurityCheck defines message 'map_param_set_security_check'.
1679 type MapParamSetSecurityCheck struct {
1680         Enable    bool `binapi:"bool,name=enable" json:"enable,omitempty"`
1681         Fragments bool `binapi:"bool,name=fragments" json:"fragments,omitempty"`
1682 }
1683
1684 func (m *MapParamSetSecurityCheck) Reset()               { *m = MapParamSetSecurityCheck{} }
1685 func (*MapParamSetSecurityCheck) GetMessageName() string { return "map_param_set_security_check" }
1686 func (*MapParamSetSecurityCheck) GetCrcString() string   { return "6abe9836" }
1687 func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType {
1688         return api.RequestMessage
1689 }
1690
1691 func (m *MapParamSetSecurityCheck) Size() (size int) {
1692         if m == nil {
1693                 return 0
1694         }
1695         size += 1 // m.Enable
1696         size += 1 // m.Fragments
1697         return size
1698 }
1699 func (m *MapParamSetSecurityCheck) Marshal(b []byte) ([]byte, error) {
1700         if b == nil {
1701                 b = make([]byte, m.Size())
1702         }
1703         buf := codec.NewBuffer(b)
1704         buf.EncodeBool(m.Enable)
1705         buf.EncodeBool(m.Fragments)
1706         return buf.Bytes(), nil
1707 }
1708 func (m *MapParamSetSecurityCheck) Unmarshal(b []byte) error {
1709         buf := codec.NewBuffer(b)
1710         m.Enable = buf.DecodeBool()
1711         m.Fragments = buf.DecodeBool()
1712         return nil
1713 }
1714
1715 // MapParamSetSecurityCheckReply defines message 'map_param_set_security_check_reply'.
1716 type MapParamSetSecurityCheckReply struct {
1717         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1718 }
1719
1720 func (m *MapParamSetSecurityCheckReply) Reset() { *m = MapParamSetSecurityCheckReply{} }
1721 func (*MapParamSetSecurityCheckReply) GetMessageName() string {
1722         return "map_param_set_security_check_reply"
1723 }
1724 func (*MapParamSetSecurityCheckReply) GetCrcString() string { return "e8d4e804" }
1725 func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType {
1726         return api.ReplyMessage
1727 }
1728
1729 func (m *MapParamSetSecurityCheckReply) Size() (size int) {
1730         if m == nil {
1731                 return 0
1732         }
1733         size += 4 // m.Retval
1734         return size
1735 }
1736 func (m *MapParamSetSecurityCheckReply) Marshal(b []byte) ([]byte, error) {
1737         if b == nil {
1738                 b = make([]byte, m.Size())
1739         }
1740         buf := codec.NewBuffer(b)
1741         buf.EncodeInt32(m.Retval)
1742         return buf.Bytes(), nil
1743 }
1744 func (m *MapParamSetSecurityCheckReply) Unmarshal(b []byte) error {
1745         buf := codec.NewBuffer(b)
1746         m.Retval = buf.DecodeInt32()
1747         return nil
1748 }
1749
1750 // MapParamSetTCP defines message 'map_param_set_tcp'.
1751 type MapParamSetTCP struct {
1752         TCPMss uint16 `binapi:"u16,name=tcp_mss" json:"tcp_mss,omitempty"`
1753 }
1754
1755 func (m *MapParamSetTCP) Reset()               { *m = MapParamSetTCP{} }
1756 func (*MapParamSetTCP) GetMessageName() string { return "map_param_set_tcp" }
1757 func (*MapParamSetTCP) GetCrcString() string   { return "87a825d9" }
1758 func (*MapParamSetTCP) GetMessageType() api.MessageType {
1759         return api.RequestMessage
1760 }
1761
1762 func (m *MapParamSetTCP) Size() (size int) {
1763         if m == nil {
1764                 return 0
1765         }
1766         size += 2 // m.TCPMss
1767         return size
1768 }
1769 func (m *MapParamSetTCP) Marshal(b []byte) ([]byte, error) {
1770         if b == nil {
1771                 b = make([]byte, m.Size())
1772         }
1773         buf := codec.NewBuffer(b)
1774         buf.EncodeUint16(m.TCPMss)
1775         return buf.Bytes(), nil
1776 }
1777 func (m *MapParamSetTCP) Unmarshal(b []byte) error {
1778         buf := codec.NewBuffer(b)
1779         m.TCPMss = buf.DecodeUint16()
1780         return nil
1781 }
1782
1783 // MapParamSetTCPReply defines message 'map_param_set_tcp_reply'.
1784 type MapParamSetTCPReply struct {
1785         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1786 }
1787
1788 func (m *MapParamSetTCPReply) Reset()               { *m = MapParamSetTCPReply{} }
1789 func (*MapParamSetTCPReply) GetMessageName() string { return "map_param_set_tcp_reply" }
1790 func (*MapParamSetTCPReply) GetCrcString() string   { return "e8d4e804" }
1791 func (*MapParamSetTCPReply) GetMessageType() api.MessageType {
1792         return api.ReplyMessage
1793 }
1794
1795 func (m *MapParamSetTCPReply) Size() (size int) {
1796         if m == nil {
1797                 return 0
1798         }
1799         size += 4 // m.Retval
1800         return size
1801 }
1802 func (m *MapParamSetTCPReply) Marshal(b []byte) ([]byte, error) {
1803         if b == nil {
1804                 b = make([]byte, m.Size())
1805         }
1806         buf := codec.NewBuffer(b)
1807         buf.EncodeInt32(m.Retval)
1808         return buf.Bytes(), nil
1809 }
1810 func (m *MapParamSetTCPReply) Unmarshal(b []byte) error {
1811         buf := codec.NewBuffer(b)
1812         m.Retval = buf.DecodeInt32()
1813         return nil
1814 }
1815
1816 // MapParamSetTrafficClass defines message 'map_param_set_traffic_class'.
1817 type MapParamSetTrafficClass struct {
1818         Copy    bool  `binapi:"bool,name=copy" json:"copy,omitempty"`
1819         TcClass uint8 `binapi:"u8,name=tc_class" json:"tc_class,omitempty"`
1820 }
1821
1822 func (m *MapParamSetTrafficClass) Reset()               { *m = MapParamSetTrafficClass{} }
1823 func (*MapParamSetTrafficClass) GetMessageName() string { return "map_param_set_traffic_class" }
1824 func (*MapParamSetTrafficClass) GetCrcString() string   { return "9cac455c" }
1825 func (*MapParamSetTrafficClass) GetMessageType() api.MessageType {
1826         return api.RequestMessage
1827 }
1828
1829 func (m *MapParamSetTrafficClass) Size() (size int) {
1830         if m == nil {
1831                 return 0
1832         }
1833         size += 1 // m.Copy
1834         size += 1 // m.TcClass
1835         return size
1836 }
1837 func (m *MapParamSetTrafficClass) Marshal(b []byte) ([]byte, error) {
1838         if b == nil {
1839                 b = make([]byte, m.Size())
1840         }
1841         buf := codec.NewBuffer(b)
1842         buf.EncodeBool(m.Copy)
1843         buf.EncodeUint8(m.TcClass)
1844         return buf.Bytes(), nil
1845 }
1846 func (m *MapParamSetTrafficClass) Unmarshal(b []byte) error {
1847         buf := codec.NewBuffer(b)
1848         m.Copy = buf.DecodeBool()
1849         m.TcClass = buf.DecodeUint8()
1850         return nil
1851 }
1852
1853 // MapParamSetTrafficClassReply defines message 'map_param_set_traffic_class_reply'.
1854 type MapParamSetTrafficClassReply struct {
1855         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1856 }
1857
1858 func (m *MapParamSetTrafficClassReply) Reset() { *m = MapParamSetTrafficClassReply{} }
1859 func (*MapParamSetTrafficClassReply) GetMessageName() string {
1860         return "map_param_set_traffic_class_reply"
1861 }
1862 func (*MapParamSetTrafficClassReply) GetCrcString() string { return "e8d4e804" }
1863 func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType {
1864         return api.ReplyMessage
1865 }
1866
1867 func (m *MapParamSetTrafficClassReply) Size() (size int) {
1868         if m == nil {
1869                 return 0
1870         }
1871         size += 4 // m.Retval
1872         return size
1873 }
1874 func (m *MapParamSetTrafficClassReply) Marshal(b []byte) ([]byte, error) {
1875         if b == nil {
1876                 b = make([]byte, m.Size())
1877         }
1878         buf := codec.NewBuffer(b)
1879         buf.EncodeInt32(m.Retval)
1880         return buf.Bytes(), nil
1881 }
1882 func (m *MapParamSetTrafficClassReply) Unmarshal(b []byte) error {
1883         buf := codec.NewBuffer(b)
1884         m.Retval = buf.DecodeInt32()
1885         return nil
1886 }
1887
1888 // MapRuleDetails defines message 'map_rule_details'.
1889 type MapRuleDetails struct {
1890         IP6Dst IP6Address `binapi:"ip6_address,name=ip6_dst" json:"ip6_dst,omitempty"`
1891         Psid   uint16     `binapi:"u16,name=psid" json:"psid,omitempty"`
1892 }
1893
1894 func (m *MapRuleDetails) Reset()               { *m = MapRuleDetails{} }
1895 func (*MapRuleDetails) GetMessageName() string { return "map_rule_details" }
1896 func (*MapRuleDetails) GetCrcString() string   { return "c7cbeea5" }
1897 func (*MapRuleDetails) GetMessageType() api.MessageType {
1898         return api.ReplyMessage
1899 }
1900
1901 func (m *MapRuleDetails) Size() (size int) {
1902         if m == nil {
1903                 return 0
1904         }
1905         size += 1 * 16 // m.IP6Dst
1906         size += 2      // m.Psid
1907         return size
1908 }
1909 func (m *MapRuleDetails) Marshal(b []byte) ([]byte, error) {
1910         if b == nil {
1911                 b = make([]byte, m.Size())
1912         }
1913         buf := codec.NewBuffer(b)
1914         buf.EncodeBytes(m.IP6Dst[:], 16)
1915         buf.EncodeUint16(m.Psid)
1916         return buf.Bytes(), nil
1917 }
1918 func (m *MapRuleDetails) Unmarshal(b []byte) error {
1919         buf := codec.NewBuffer(b)
1920         copy(m.IP6Dst[:], buf.DecodeBytes(16))
1921         m.Psid = buf.DecodeUint16()
1922         return nil
1923 }
1924
1925 // MapRuleDump defines message 'map_rule_dump'.
1926 type MapRuleDump struct {
1927         DomainIndex uint32 `binapi:"u32,name=domain_index" json:"domain_index,omitempty"`
1928 }
1929
1930 func (m *MapRuleDump) Reset()               { *m = MapRuleDump{} }
1931 func (*MapRuleDump) GetMessageName() string { return "map_rule_dump" }
1932 func (*MapRuleDump) GetCrcString() string   { return "e43e6ff6" }
1933 func (*MapRuleDump) GetMessageType() api.MessageType {
1934         return api.RequestMessage
1935 }
1936
1937 func (m *MapRuleDump) Size() (size int) {
1938         if m == nil {
1939                 return 0
1940         }
1941         size += 4 // m.DomainIndex
1942         return size
1943 }
1944 func (m *MapRuleDump) Marshal(b []byte) ([]byte, error) {
1945         if b == nil {
1946                 b = make([]byte, m.Size())
1947         }
1948         buf := codec.NewBuffer(b)
1949         buf.EncodeUint32(m.DomainIndex)
1950         return buf.Bytes(), nil
1951 }
1952 func (m *MapRuleDump) Unmarshal(b []byte) error {
1953         buf := codec.NewBuffer(b)
1954         m.DomainIndex = buf.DecodeUint32()
1955         return nil
1956 }
1957
1958 // MapSummaryStats defines message 'map_summary_stats'.
1959 type MapSummaryStats struct{}
1960
1961 func (m *MapSummaryStats) Reset()               { *m = MapSummaryStats{} }
1962 func (*MapSummaryStats) GetMessageName() string { return "map_summary_stats" }
1963 func (*MapSummaryStats) GetCrcString() string   { return "51077d14" }
1964 func (*MapSummaryStats) GetMessageType() api.MessageType {
1965         return api.RequestMessage
1966 }
1967
1968 func (m *MapSummaryStats) Size() (size int) {
1969         if m == nil {
1970                 return 0
1971         }
1972         return size
1973 }
1974 func (m *MapSummaryStats) Marshal(b []byte) ([]byte, error) {
1975         if b == nil {
1976                 b = make([]byte, m.Size())
1977         }
1978         buf := codec.NewBuffer(b)
1979         return buf.Bytes(), nil
1980 }
1981 func (m *MapSummaryStats) Unmarshal(b []byte) error {
1982         return nil
1983 }
1984
1985 // MapSummaryStatsReply defines message 'map_summary_stats_reply'.
1986 type MapSummaryStatsReply struct {
1987         Retval             int32    `binapi:"i32,name=retval" json:"retval,omitempty"`
1988         TotalBindings      uint64   `binapi:"u64,name=total_bindings" json:"total_bindings,omitempty"`
1989         TotalPkts          []uint64 `binapi:"u64[2],name=total_pkts" json:"total_pkts,omitempty"`
1990         TotalBytes         []uint64 `binapi:"u64[2],name=total_bytes" json:"total_bytes,omitempty"`
1991         TotalIP4Fragments  uint64   `binapi:"u64,name=total_ip4_fragments" json:"total_ip4_fragments,omitempty"`
1992         TotalSecurityCheck []uint64 `binapi:"u64[2],name=total_security_check" json:"total_security_check,omitempty"`
1993 }
1994
1995 func (m *MapSummaryStatsReply) Reset()               { *m = MapSummaryStatsReply{} }
1996 func (*MapSummaryStatsReply) GetMessageName() string { return "map_summary_stats_reply" }
1997 func (*MapSummaryStatsReply) GetCrcString() string   { return "0e4ace0e" }
1998 func (*MapSummaryStatsReply) GetMessageType() api.MessageType {
1999         return api.ReplyMessage
2000 }
2001
2002 func (m *MapSummaryStatsReply) Size() (size int) {
2003         if m == nil {
2004                 return 0
2005         }
2006         size += 4     // m.Retval
2007         size += 8     // m.TotalBindings
2008         size += 8 * 2 // m.TotalPkts
2009         size += 8 * 2 // m.TotalBytes
2010         size += 8     // m.TotalIP4Fragments
2011         size += 8 * 2 // m.TotalSecurityCheck
2012         return size
2013 }
2014 func (m *MapSummaryStatsReply) Marshal(b []byte) ([]byte, error) {
2015         if b == nil {
2016                 b = make([]byte, m.Size())
2017         }
2018         buf := codec.NewBuffer(b)
2019         buf.EncodeInt32(m.Retval)
2020         buf.EncodeUint64(m.TotalBindings)
2021         for i := 0; i < 2; i++ {
2022                 var x uint64
2023                 if i < len(m.TotalPkts) {
2024                         x = uint64(m.TotalPkts[i])
2025                 }
2026                 buf.EncodeUint64(x)
2027         }
2028         for i := 0; i < 2; i++ {
2029                 var x uint64
2030                 if i < len(m.TotalBytes) {
2031                         x = uint64(m.TotalBytes[i])
2032                 }
2033                 buf.EncodeUint64(x)
2034         }
2035         buf.EncodeUint64(m.TotalIP4Fragments)
2036         for i := 0; i < 2; i++ {
2037                 var x uint64
2038                 if i < len(m.TotalSecurityCheck) {
2039                         x = uint64(m.TotalSecurityCheck[i])
2040                 }
2041                 buf.EncodeUint64(x)
2042         }
2043         return buf.Bytes(), nil
2044 }
2045 func (m *MapSummaryStatsReply) Unmarshal(b []byte) error {
2046         buf := codec.NewBuffer(b)
2047         m.Retval = buf.DecodeInt32()
2048         m.TotalBindings = buf.DecodeUint64()
2049         m.TotalPkts = make([]uint64, 2)
2050         for i := 0; i < len(m.TotalPkts); i++ {
2051                 m.TotalPkts[i] = buf.DecodeUint64()
2052         }
2053         m.TotalBytes = make([]uint64, 2)
2054         for i := 0; i < len(m.TotalBytes); i++ {
2055                 m.TotalBytes[i] = buf.DecodeUint64()
2056         }
2057         m.TotalIP4Fragments = buf.DecodeUint64()
2058         m.TotalSecurityCheck = make([]uint64, 2)
2059         for i := 0; i < len(m.TotalSecurityCheck); i++ {
2060                 m.TotalSecurityCheck[i] = buf.DecodeUint64()
2061         }
2062         return nil
2063 }
2064
2065 func init() { file_maps_binapi_init() }
2066 func file_maps_binapi_init() {
2067         api.RegisterMessage((*MapAddDelRule)(nil), "map_add_del_rule_c65b32f7")
2068         api.RegisterMessage((*MapAddDelRuleReply)(nil), "map_add_del_rule_reply_e8d4e804")
2069         api.RegisterMessage((*MapAddDomain)(nil), "map_add_domain_7a5a18c9")
2070         api.RegisterMessage((*MapAddDomainReply)(nil), "map_add_domain_reply_3e6d4e2c")
2071         api.RegisterMessage((*MapDelDomain)(nil), "map_del_domain_8ac76db6")
2072         api.RegisterMessage((*MapDelDomainReply)(nil), "map_del_domain_reply_e8d4e804")
2073         api.RegisterMessage((*MapDomainDetails)(nil), "map_domain_details_fc1859dd")
2074         api.RegisterMessage((*MapDomainDump)(nil), "map_domain_dump_51077d14")
2075         api.RegisterMessage((*MapIfEnableDisable)(nil), "map_if_enable_disable_59bb32f4")
2076         api.RegisterMessage((*MapIfEnableDisableReply)(nil), "map_if_enable_disable_reply_e8d4e804")
2077         api.RegisterMessage((*MapParamAddDelPreResolve)(nil), "map_param_add_del_pre_resolve_17008c66")
2078         api.RegisterMessage((*MapParamAddDelPreResolveReply)(nil), "map_param_add_del_pre_resolve_reply_e8d4e804")
2079         api.RegisterMessage((*MapParamGet)(nil), "map_param_get_51077d14")
2080         api.RegisterMessage((*MapParamGetReply)(nil), "map_param_get_reply_28092156")
2081         api.RegisterMessage((*MapParamSetFragmentation)(nil), "map_param_set_fragmentation_9ff54d90")
2082         api.RegisterMessage((*MapParamSetFragmentationReply)(nil), "map_param_set_fragmentation_reply_e8d4e804")
2083         api.RegisterMessage((*MapParamSetICMP)(nil), "map_param_set_icmp_58210cbf")
2084         api.RegisterMessage((*MapParamSetICMP6)(nil), "map_param_set_icmp6_5d01f8c1")
2085         api.RegisterMessage((*MapParamSetICMP6Reply)(nil), "map_param_set_icmp6_reply_e8d4e804")
2086         api.RegisterMessage((*MapParamSetICMPReply)(nil), "map_param_set_icmp_reply_e8d4e804")
2087         api.RegisterMessage((*MapParamSetSecurityCheck)(nil), "map_param_set_security_check_6abe9836")
2088         api.RegisterMessage((*MapParamSetSecurityCheckReply)(nil), "map_param_set_security_check_reply_e8d4e804")
2089         api.RegisterMessage((*MapParamSetTCP)(nil), "map_param_set_tcp_87a825d9")
2090         api.RegisterMessage((*MapParamSetTCPReply)(nil), "map_param_set_tcp_reply_e8d4e804")
2091         api.RegisterMessage((*MapParamSetTrafficClass)(nil), "map_param_set_traffic_class_9cac455c")
2092         api.RegisterMessage((*MapParamSetTrafficClassReply)(nil), "map_param_set_traffic_class_reply_e8d4e804")
2093         api.RegisterMessage((*MapRuleDetails)(nil), "map_rule_details_c7cbeea5")
2094         api.RegisterMessage((*MapRuleDump)(nil), "map_rule_dump_e43e6ff6")
2095         api.RegisterMessage((*MapSummaryStats)(nil), "map_summary_stats_51077d14")
2096         api.RegisterMessage((*MapSummaryStatsReply)(nil), "map_summary_stats_reply_0e4ace0e")
2097 }
2098
2099 // Messages returns list of all messages in this module.
2100 func AllMessages() []api.Message {
2101         return []api.Message{
2102                 (*MapAddDelRule)(nil),
2103                 (*MapAddDelRuleReply)(nil),
2104                 (*MapAddDomain)(nil),
2105                 (*MapAddDomainReply)(nil),
2106                 (*MapDelDomain)(nil),
2107                 (*MapDelDomainReply)(nil),
2108                 (*MapDomainDetails)(nil),
2109                 (*MapDomainDump)(nil),
2110                 (*MapIfEnableDisable)(nil),
2111                 (*MapIfEnableDisableReply)(nil),
2112                 (*MapParamAddDelPreResolve)(nil),
2113                 (*MapParamAddDelPreResolveReply)(nil),
2114                 (*MapParamGet)(nil),
2115                 (*MapParamGetReply)(nil),
2116                 (*MapParamSetFragmentation)(nil),
2117                 (*MapParamSetFragmentationReply)(nil),
2118                 (*MapParamSetICMP)(nil),
2119                 (*MapParamSetICMP6)(nil),
2120                 (*MapParamSetICMP6Reply)(nil),
2121                 (*MapParamSetICMPReply)(nil),
2122                 (*MapParamSetSecurityCheck)(nil),
2123                 (*MapParamSetSecurityCheckReply)(nil),
2124                 (*MapParamSetTCP)(nil),
2125                 (*MapParamSetTCPReply)(nil),
2126                 (*MapParamSetTrafficClass)(nil),
2127                 (*MapParamSetTrafficClassReply)(nil),
2128                 (*MapRuleDetails)(nil),
2129                 (*MapRuleDump)(nil),
2130                 (*MapSummaryStats)(nil),
2131                 (*MapSummaryStatsReply)(nil),
2132         }
2133 }