285aaf130ae6c1cf740007abcdc490c0a950ce09
[govpp.git] / internal / testbinapi / binapi2001 / punt / punt.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/core/punt.api.json
6
7 // Package punt contains generated bindings for API file punt.api.
8 //
9 // Contents:
10 //   5 aliases
11 //   5 enums
12 //  11 structs
13 //   2 unions
14 //  10 messages
15 //
16 package punt
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    = "punt"
35         APIVersion = "2.2.1"
36         VersionCrc = 0x51716f7f
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 // IPDscp defines enum 'ip_dscp'.
67 type IPDscp uint8
68
69 const (
70         IP_API_DSCP_CS0  IPDscp = 0
71         IP_API_DSCP_CS1  IPDscp = 8
72         IP_API_DSCP_AF11 IPDscp = 10
73         IP_API_DSCP_AF12 IPDscp = 12
74         IP_API_DSCP_AF13 IPDscp = 14
75         IP_API_DSCP_CS2  IPDscp = 16
76         IP_API_DSCP_AF21 IPDscp = 18
77         IP_API_DSCP_AF22 IPDscp = 20
78         IP_API_DSCP_AF23 IPDscp = 22
79         IP_API_DSCP_CS3  IPDscp = 24
80         IP_API_DSCP_AF31 IPDscp = 26
81         IP_API_DSCP_AF32 IPDscp = 28
82         IP_API_DSCP_AF33 IPDscp = 30
83         IP_API_DSCP_CS4  IPDscp = 32
84         IP_API_DSCP_AF41 IPDscp = 34
85         IP_API_DSCP_AF42 IPDscp = 36
86         IP_API_DSCP_AF43 IPDscp = 38
87         IP_API_DSCP_CS5  IPDscp = 40
88         IP_API_DSCP_EF   IPDscp = 46
89         IP_API_DSCP_CS6  IPDscp = 48
90         IP_API_DSCP_CS7  IPDscp = 50
91 )
92
93 var (
94         IPDscp_name = map[uint8]string{
95                 0:  "IP_API_DSCP_CS0",
96                 8:  "IP_API_DSCP_CS1",
97                 10: "IP_API_DSCP_AF11",
98                 12: "IP_API_DSCP_AF12",
99                 14: "IP_API_DSCP_AF13",
100                 16: "IP_API_DSCP_CS2",
101                 18: "IP_API_DSCP_AF21",
102                 20: "IP_API_DSCP_AF22",
103                 22: "IP_API_DSCP_AF23",
104                 24: "IP_API_DSCP_CS3",
105                 26: "IP_API_DSCP_AF31",
106                 28: "IP_API_DSCP_AF32",
107                 30: "IP_API_DSCP_AF33",
108                 32: "IP_API_DSCP_CS4",
109                 34: "IP_API_DSCP_AF41",
110                 36: "IP_API_DSCP_AF42",
111                 38: "IP_API_DSCP_AF43",
112                 40: "IP_API_DSCP_CS5",
113                 46: "IP_API_DSCP_EF",
114                 48: "IP_API_DSCP_CS6",
115                 50: "IP_API_DSCP_CS7",
116         }
117         IPDscp_value = map[string]uint8{
118                 "IP_API_DSCP_CS0":  0,
119                 "IP_API_DSCP_CS1":  8,
120                 "IP_API_DSCP_AF11": 10,
121                 "IP_API_DSCP_AF12": 12,
122                 "IP_API_DSCP_AF13": 14,
123                 "IP_API_DSCP_CS2":  16,
124                 "IP_API_DSCP_AF21": 18,
125                 "IP_API_DSCP_AF22": 20,
126                 "IP_API_DSCP_AF23": 22,
127                 "IP_API_DSCP_CS3":  24,
128                 "IP_API_DSCP_AF31": 26,
129                 "IP_API_DSCP_AF32": 28,
130                 "IP_API_DSCP_AF33": 30,
131                 "IP_API_DSCP_CS4":  32,
132                 "IP_API_DSCP_AF41": 34,
133                 "IP_API_DSCP_AF42": 36,
134                 "IP_API_DSCP_AF43": 38,
135                 "IP_API_DSCP_CS5":  40,
136                 "IP_API_DSCP_EF":   46,
137                 "IP_API_DSCP_CS6":  48,
138                 "IP_API_DSCP_CS7":  50,
139         }
140 )
141
142 func (x IPDscp) String() string {
143         s, ok := IPDscp_name[uint8(x)]
144         if ok {
145                 return s
146         }
147         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
148 }
149
150 // IPEcn defines enum 'ip_ecn'.
151 type IPEcn uint8
152
153 const (
154         IP_API_ECN_NONE IPEcn = 0
155         IP_API_ECN_ECT0 IPEcn = 1
156         IP_API_ECN_ECT1 IPEcn = 2
157         IP_API_ECN_CE   IPEcn = 3
158 )
159
160 var (
161         IPEcn_name = map[uint8]string{
162                 0: "IP_API_ECN_NONE",
163                 1: "IP_API_ECN_ECT0",
164                 2: "IP_API_ECN_ECT1",
165                 3: "IP_API_ECN_CE",
166         }
167         IPEcn_value = map[string]uint8{
168                 "IP_API_ECN_NONE": 0,
169                 "IP_API_ECN_ECT0": 1,
170                 "IP_API_ECN_ECT1": 2,
171                 "IP_API_ECN_CE":   3,
172         }
173 )
174
175 func (x IPEcn) String() string {
176         s, ok := IPEcn_name[uint8(x)]
177         if ok {
178                 return s
179         }
180         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
181 }
182
183 // IPProto defines enum 'ip_proto'.
184 type IPProto uint32
185
186 const (
187         IP_API_PROTO_HOPOPT   IPProto = 0
188         IP_API_PROTO_ICMP     IPProto = 1
189         IP_API_PROTO_IGMP     IPProto = 2
190         IP_API_PROTO_TCP      IPProto = 6
191         IP_API_PROTO_UDP      IPProto = 17
192         IP_API_PROTO_GRE      IPProto = 47
193         IP_API_PROTO_AH       IPProto = 50
194         IP_API_PROTO_ESP      IPProto = 51
195         IP_API_PROTO_EIGRP    IPProto = 88
196         IP_API_PROTO_OSPF     IPProto = 89
197         IP_API_PROTO_SCTP     IPProto = 132
198         IP_API_PROTO_RESERVED IPProto = 255
199 )
200
201 var (
202         IPProto_name = map[uint32]string{
203                 0:   "IP_API_PROTO_HOPOPT",
204                 1:   "IP_API_PROTO_ICMP",
205                 2:   "IP_API_PROTO_IGMP",
206                 6:   "IP_API_PROTO_TCP",
207                 17:  "IP_API_PROTO_UDP",
208                 47:  "IP_API_PROTO_GRE",
209                 50:  "IP_API_PROTO_AH",
210                 51:  "IP_API_PROTO_ESP",
211                 88:  "IP_API_PROTO_EIGRP",
212                 89:  "IP_API_PROTO_OSPF",
213                 132: "IP_API_PROTO_SCTP",
214                 255: "IP_API_PROTO_RESERVED",
215         }
216         IPProto_value = map[string]uint32{
217                 "IP_API_PROTO_HOPOPT":   0,
218                 "IP_API_PROTO_ICMP":     1,
219                 "IP_API_PROTO_IGMP":     2,
220                 "IP_API_PROTO_TCP":      6,
221                 "IP_API_PROTO_UDP":      17,
222                 "IP_API_PROTO_GRE":      47,
223                 "IP_API_PROTO_AH":       50,
224                 "IP_API_PROTO_ESP":      51,
225                 "IP_API_PROTO_EIGRP":    88,
226                 "IP_API_PROTO_OSPF":     89,
227                 "IP_API_PROTO_SCTP":     132,
228                 "IP_API_PROTO_RESERVED": 255,
229         }
230 )
231
232 func (x IPProto) String() string {
233         s, ok := IPProto_name[uint32(x)]
234         if ok {
235                 return s
236         }
237         return "IPProto(" + strconv.Itoa(int(x)) + ")"
238 }
239
240 // PuntType defines enum 'punt_type'.
241 type PuntType uint32
242
243 const (
244         PUNT_API_TYPE_L4        PuntType = 1
245         PUNT_API_TYPE_IP_PROTO  PuntType = 2
246         PUNT_API_TYPE_EXCEPTION PuntType = 3
247 )
248
249 var (
250         PuntType_name = map[uint32]string{
251                 1: "PUNT_API_TYPE_L4",
252                 2: "PUNT_API_TYPE_IP_PROTO",
253                 3: "PUNT_API_TYPE_EXCEPTION",
254         }
255         PuntType_value = map[string]uint32{
256                 "PUNT_API_TYPE_L4":        1,
257                 "PUNT_API_TYPE_IP_PROTO":  2,
258                 "PUNT_API_TYPE_EXCEPTION": 3,
259         }
260 )
261
262 func (x PuntType) String() string {
263         s, ok := PuntType_name[uint32(x)]
264         if ok {
265                 return s
266         }
267         return "PuntType(" + strconv.Itoa(int(x)) + ")"
268 }
269
270 // AddressWithPrefix defines alias 'address_with_prefix'.
271 type AddressWithPrefix Prefix
272
273 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
274         prefix, err := ParsePrefix(s)
275         if err != nil {
276                 return AddressWithPrefix{}, err
277         }
278         return AddressWithPrefix(prefix), nil
279 }
280 func (x AddressWithPrefix) String() string {
281         return Prefix(x).String()
282 }
283 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
284         return []byte(x.String()), nil
285 }
286 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
287         prefix, err := ParseAddressWithPrefix(string(text))
288         if err != nil {
289                 return err
290         }
291         *x = prefix
292         return nil
293 }
294
295 // IP4Address defines alias 'ip4_address'.
296 type IP4Address [4]uint8
297
298 func ParseIP4Address(s string) (IP4Address, error) {
299         ip := net.ParseIP(s).To4()
300         if ip == nil {
301                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
302         }
303         var ipaddr IP4Address
304         copy(ipaddr[:], ip.To4())
305         return ipaddr, nil
306 }
307
308 func (x IP4Address) ToIP() net.IP {
309         return net.IP(x[:]).To4()
310 }
311 func (x IP4Address) String() string {
312         return x.ToIP().String()
313 }
314 func (x *IP4Address) MarshalText() ([]byte, error) {
315         return []byte(x.String()), nil
316 }
317 func (x *IP4Address) UnmarshalText(text []byte) error {
318         ipaddr, err := ParseIP4Address(string(text))
319         if err != nil {
320                 return err
321         }
322         *x = ipaddr
323         return nil
324 }
325
326 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
327 type IP4AddressWithPrefix IP4Prefix
328
329 // IP6Address defines alias 'ip6_address'.
330 type IP6Address [16]uint8
331
332 func ParseIP6Address(s string) (IP6Address, error) {
333         ip := net.ParseIP(s).To16()
334         if ip == nil {
335                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
336         }
337         var ipaddr IP6Address
338         copy(ipaddr[:], ip.To16())
339         return ipaddr, nil
340 }
341
342 func (x IP6Address) ToIP() net.IP {
343         return net.IP(x[:]).To16()
344 }
345 func (x IP6Address) String() string {
346         return x.ToIP().String()
347 }
348 func (x *IP6Address) MarshalText() ([]byte, error) {
349         return []byte(x.String()), nil
350 }
351 func (x *IP6Address) UnmarshalText(text []byte) error {
352         ipaddr, err := ParseIP6Address(string(text))
353         if err != nil {
354                 return err
355         }
356         *x = ipaddr
357         return nil
358 }
359
360 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
361 type IP6AddressWithPrefix IP6Prefix
362
363 // Address defines type 'address'.
364 type Address struct {
365         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
366         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
367 }
368
369 func ParseAddress(s string) (Address, error) {
370         ip := net.ParseIP(s)
371         if ip == nil {
372                 return Address{}, fmt.Errorf("invalid address: %s", s)
373         }
374         var addr Address
375         if ip.To4() == nil {
376                 addr.Af = ADDRESS_IP6
377                 var ip6 IP6Address
378                 copy(ip6[:], ip.To16())
379                 addr.Un.SetIP6(ip6)
380         } else {
381                 addr.Af = ADDRESS_IP4
382                 var ip4 IP4Address
383                 copy(ip4[:], ip.To4())
384                 addr.Un.SetIP4(ip4)
385         }
386         return addr, nil
387 }
388 func (x Address) ToIP() net.IP {
389         if x.Af == ADDRESS_IP6 {
390                 ip6 := x.Un.GetIP6()
391                 return net.IP(ip6[:]).To16()
392         } else {
393                 ip4 := x.Un.GetIP4()
394                 return net.IP(ip4[:]).To4()
395         }
396 }
397 func (x Address) String() string {
398         return x.ToIP().String()
399 }
400 func (x *Address) MarshalText() ([]byte, error) {
401         return []byte(x.String()), nil
402 }
403 func (x *Address) UnmarshalText(text []byte) error {
404         addr, err := ParseAddress(string(text))
405         if err != nil {
406                 return err
407         }
408         *x = addr
409         return nil
410 }
411
412 // IP4Prefix defines type 'ip4_prefix'.
413 type IP4Prefix struct {
414         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
415         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
416 }
417
418 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
419         hasPrefix := strings.Contains(s, "/")
420         if hasPrefix {
421                 ip, network, err := net.ParseCIDR(s)
422                 if err != nil {
423                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
424                 }
425                 maskSize, _ := network.Mask.Size()
426                 prefix.Len = byte(maskSize)
427                 prefix.Address, err = ParseIP4Address(ip.String())
428                 if err != nil {
429                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
430                 }
431         } else {
432                 ip := net.ParseIP(s)
433                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
434                 if ip.To4() == nil {
435                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
436                 }
437                 prefix.Len = byte(defaultMaskSize)
438                 prefix.Address, err = ParseIP4Address(ip.String())
439                 if err != nil {
440                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
441                 }
442         }
443         return prefix, nil
444 }
445 func (x IP4Prefix) ToIPNet() *net.IPNet {
446         mask := net.CIDRMask(int(x.Len), 32)
447         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
448         return ipnet
449 }
450 func (x IP4Prefix) String() string {
451         ip := x.Address.String()
452         return ip + "/" + strconv.Itoa(int(x.Len))
453 }
454 func (x *IP4Prefix) MarshalText() ([]byte, error) {
455         return []byte(x.String()), nil
456 }
457 func (x *IP4Prefix) UnmarshalText(text []byte) error {
458         prefix, err := ParseIP4Prefix(string(text))
459         if err != nil {
460                 return err
461         }
462         *x = prefix
463         return nil
464 }
465
466 // IP6Prefix defines type 'ip6_prefix'.
467 type IP6Prefix struct {
468         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
469         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
470 }
471
472 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
473         hasPrefix := strings.Contains(s, "/")
474         if hasPrefix {
475                 ip, network, err := net.ParseCIDR(s)
476                 if err != nil {
477                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
478                 }
479                 maskSize, _ := network.Mask.Size()
480                 prefix.Len = byte(maskSize)
481                 prefix.Address, err = ParseIP6Address(ip.String())
482                 if err != nil {
483                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
484                 }
485         } else {
486                 ip := net.ParseIP(s)
487                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
488                 if ip.To4() == nil {
489                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
490                 }
491                 prefix.Len = byte(defaultMaskSize)
492                 prefix.Address, err = ParseIP6Address(ip.String())
493                 if err != nil {
494                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
495                 }
496         }
497         return prefix, nil
498 }
499 func (x IP6Prefix) ToIPNet() *net.IPNet {
500         mask := net.CIDRMask(int(x.Len), 128)
501         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
502         return ipnet
503 }
504 func (x IP6Prefix) String() string {
505         ip := x.Address.String()
506         return ip + "/" + strconv.Itoa(int(x.Len))
507 }
508 func (x *IP6Prefix) MarshalText() ([]byte, error) {
509         return []byte(x.String()), nil
510 }
511 func (x *IP6Prefix) UnmarshalText(text []byte) error {
512         prefix, err := ParseIP6Prefix(string(text))
513         if err != nil {
514                 return err
515         }
516         *x = prefix
517         return nil
518 }
519
520 // Mprefix defines type 'mprefix'.
521 type Mprefix struct {
522         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
523         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
524         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
525         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
526 }
527
528 // Prefix defines type 'prefix'.
529 type Prefix struct {
530         Address Address `binapi:"address,name=address" json:"address,omitempty"`
531         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
532 }
533
534 func ParsePrefix(ip string) (prefix Prefix, err error) {
535         hasPrefix := strings.Contains(ip, "/")
536         if hasPrefix {
537                 netIP, network, err := net.ParseCIDR(ip)
538                 if err != nil {
539                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
540                 }
541                 maskSize, _ := network.Mask.Size()
542                 prefix.Len = byte(maskSize)
543                 prefix.Address, err = ParseAddress(netIP.String())
544                 if err != nil {
545                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
546                 }
547         } else {
548                 netIP := net.ParseIP(ip)
549                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
550                 if netIP.To4() == nil {
551                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
552                 }
553                 prefix.Len = byte(defaultMaskSize)
554                 prefix.Address, err = ParseAddress(netIP.String())
555                 if err != nil {
556                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
557                 }
558         }
559         return prefix, nil
560 }
561 func (x Prefix) ToIPNet() *net.IPNet {
562         var mask net.IPMask
563         if x.Address.Af == ADDRESS_IP4 {
564                 mask = net.CIDRMask(int(x.Len), 32)
565         } else {
566                 mask = net.CIDRMask(int(x.Len), 128)
567         }
568         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
569         return ipnet
570 }
571 func (x Prefix) String() string {
572         ip := x.Address.String()
573         return ip + "/" + strconv.Itoa(int(x.Len))
574 }
575 func (x *Prefix) MarshalText() ([]byte, error) {
576         return []byte(x.String()), nil
577 }
578 func (x *Prefix) UnmarshalText(text []byte) error {
579         prefix, err := ParsePrefix(string(text))
580         if err != nil {
581                 return err
582         }
583         *x = prefix
584         return nil
585 }
586
587 // PrefixMatcher defines type 'prefix_matcher'.
588 type PrefixMatcher struct {
589         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
590         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
591 }
592
593 // Punt defines type 'punt'.
594 type Punt struct {
595         Type PuntType  `binapi:"punt_type,name=type" json:"type,omitempty"`
596         Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"`
597 }
598
599 // PuntException defines type 'punt_exception'.
600 type PuntException struct {
601         ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
602 }
603
604 // PuntIPProto defines type 'punt_ip_proto'.
605 type PuntIPProto struct {
606         Af       AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
607         Protocol IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
608 }
609
610 // PuntL4 defines type 'punt_l4'.
611 type PuntL4 struct {
612         Af       AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
613         Protocol IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
614         Port     uint16        `binapi:"u16,name=port" json:"port,omitempty"`
615 }
616
617 // PuntReason defines type 'punt_reason'.
618 type PuntReason struct {
619         ID   uint32 `binapi:"u32,name=id" json:"id,omitempty"`
620         Name string `binapi:"string[],name=name" json:"name,omitempty"`
621 }
622
623 // AddressUnion defines union 'address_union'.
624 type AddressUnion struct {
625         // IP4 *IP4Address
626         // IP6 *IP6Address
627         XXX_UnionData [16]byte
628 }
629
630 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
631         u.SetIP4(a)
632         return
633 }
634 func (u *AddressUnion) SetIP4(a IP4Address) {
635         buf := codec.NewBuffer(u.XXX_UnionData[:])
636         buf.EncodeBytes(a[:], 4)
637 }
638 func (u *AddressUnion) GetIP4() (a IP4Address) {
639         buf := codec.NewBuffer(u.XXX_UnionData[:])
640         copy(a[:], buf.DecodeBytes(4))
641         return
642 }
643
644 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
645         u.SetIP6(a)
646         return
647 }
648 func (u *AddressUnion) SetIP6(a IP6Address) {
649         buf := codec.NewBuffer(u.XXX_UnionData[:])
650         buf.EncodeBytes(a[:], 16)
651 }
652 func (u *AddressUnion) GetIP6() (a IP6Address) {
653         buf := codec.NewBuffer(u.XXX_UnionData[:])
654         copy(a[:], buf.DecodeBytes(16))
655         return
656 }
657
658 // PuntUnion defines union 'punt_union'.
659 type PuntUnion struct {
660         // Exception *PuntException
661         // L4 *PuntL4
662         // IPProto *PuntIPProto
663         XXX_UnionData [10]byte
664 }
665
666 func PuntUnionException(a PuntException) (u PuntUnion) {
667         u.SetException(a)
668         return
669 }
670 func (u *PuntUnion) SetException(a PuntException) {
671         buf := codec.NewBuffer(u.XXX_UnionData[:])
672         buf.EncodeUint32(a.ID)
673 }
674 func (u *PuntUnion) GetException() (a PuntException) {
675         buf := codec.NewBuffer(u.XXX_UnionData[:])
676         a.ID = buf.DecodeUint32()
677         return
678 }
679
680 func PuntUnionL4(a PuntL4) (u PuntUnion) {
681         u.SetL4(a)
682         return
683 }
684 func (u *PuntUnion) SetL4(a PuntL4) {
685         buf := codec.NewBuffer(u.XXX_UnionData[:])
686         buf.EncodeUint32(uint32(a.Af))
687         buf.EncodeUint32(uint32(a.Protocol))
688         buf.EncodeUint16(a.Port)
689 }
690 func (u *PuntUnion) GetL4() (a PuntL4) {
691         buf := codec.NewBuffer(u.XXX_UnionData[:])
692         a.Af = AddressFamily(buf.DecodeUint32())
693         a.Protocol = IPProto(buf.DecodeUint32())
694         a.Port = buf.DecodeUint16()
695         return
696 }
697
698 func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) {
699         u.SetIPProto(a)
700         return
701 }
702 func (u *PuntUnion) SetIPProto(a PuntIPProto) {
703         buf := codec.NewBuffer(u.XXX_UnionData[:])
704         buf.EncodeUint32(uint32(a.Af))
705         buf.EncodeUint32(uint32(a.Protocol))
706 }
707 func (u *PuntUnion) GetIPProto() (a PuntIPProto) {
708         buf := codec.NewBuffer(u.XXX_UnionData[:])
709         a.Af = AddressFamily(buf.DecodeUint32())
710         a.Protocol = IPProto(buf.DecodeUint32())
711         return
712 }
713
714 // PuntReasonDetails defines message 'punt_reason_details'.
715 type PuntReasonDetails struct {
716         Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
717 }
718
719 func (m *PuntReasonDetails) Reset()               { *m = PuntReasonDetails{} }
720 func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" }
721 func (*PuntReasonDetails) GetCrcString() string   { return "2c9d4a40" }
722 func (*PuntReasonDetails) GetMessageType() api.MessageType {
723         return api.ReplyMessage
724 }
725
726 func (m *PuntReasonDetails) Size() (size int) {
727         if m == nil {
728                 return 0
729         }
730         size += 4                      // m.Reason.ID
731         size += 4 + len(m.Reason.Name) // m.Reason.Name
732         return size
733 }
734 func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) {
735         if b == nil {
736                 b = make([]byte, m.Size())
737         }
738         buf := codec.NewBuffer(b)
739         buf.EncodeUint32(m.Reason.ID)
740         buf.EncodeString(m.Reason.Name, 0)
741         return buf.Bytes(), nil
742 }
743 func (m *PuntReasonDetails) Unmarshal(b []byte) error {
744         buf := codec.NewBuffer(b)
745         m.Reason.ID = buf.DecodeUint32()
746         m.Reason.Name = buf.DecodeString(0)
747         return nil
748 }
749
750 // PuntReasonDump defines message 'punt_reason_dump'.
751 type PuntReasonDump struct {
752         Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
753 }
754
755 func (m *PuntReasonDump) Reset()               { *m = PuntReasonDump{} }
756 func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" }
757 func (*PuntReasonDump) GetCrcString() string   { return "5c0dd4fe" }
758 func (*PuntReasonDump) GetMessageType() api.MessageType {
759         return api.RequestMessage
760 }
761
762 func (m *PuntReasonDump) Size() (size int) {
763         if m == nil {
764                 return 0
765         }
766         size += 4                      // m.Reason.ID
767         size += 4 + len(m.Reason.Name) // m.Reason.Name
768         return size
769 }
770 func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) {
771         if b == nil {
772                 b = make([]byte, m.Size())
773         }
774         buf := codec.NewBuffer(b)
775         buf.EncodeUint32(m.Reason.ID)
776         buf.EncodeString(m.Reason.Name, 0)
777         return buf.Bytes(), nil
778 }
779 func (m *PuntReasonDump) Unmarshal(b []byte) error {
780         buf := codec.NewBuffer(b)
781         m.Reason.ID = buf.DecodeUint32()
782         m.Reason.Name = buf.DecodeString(0)
783         return nil
784 }
785
786 // PuntSocketDeregister defines message 'punt_socket_deregister'.
787 type PuntSocketDeregister struct {
788         Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
789 }
790
791 func (m *PuntSocketDeregister) Reset()               { *m = PuntSocketDeregister{} }
792 func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" }
793 func (*PuntSocketDeregister) GetCrcString() string   { return "98a444f4" }
794 func (*PuntSocketDeregister) GetMessageType() api.MessageType {
795         return api.RequestMessage
796 }
797
798 func (m *PuntSocketDeregister) Size() (size int) {
799         if m == nil {
800                 return 0
801         }
802         size += 4      // m.Punt.Type
803         size += 1 * 10 // m.Punt.Punt
804         return size
805 }
806 func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) {
807         if b == nil {
808                 b = make([]byte, m.Size())
809         }
810         buf := codec.NewBuffer(b)
811         buf.EncodeUint32(uint32(m.Punt.Type))
812         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 10)
813         return buf.Bytes(), nil
814 }
815 func (m *PuntSocketDeregister) Unmarshal(b []byte) error {
816         buf := codec.NewBuffer(b)
817         m.Punt.Type = PuntType(buf.DecodeUint32())
818         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(10))
819         return nil
820 }
821
822 // PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'.
823 type PuntSocketDeregisterReply struct {
824         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
825 }
826
827 func (m *PuntSocketDeregisterReply) Reset()               { *m = PuntSocketDeregisterReply{} }
828 func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" }
829 func (*PuntSocketDeregisterReply) GetCrcString() string   { return "e8d4e804" }
830 func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType {
831         return api.ReplyMessage
832 }
833
834 func (m *PuntSocketDeregisterReply) Size() (size int) {
835         if m == nil {
836                 return 0
837         }
838         size += 4 // m.Retval
839         return size
840 }
841 func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) {
842         if b == nil {
843                 b = make([]byte, m.Size())
844         }
845         buf := codec.NewBuffer(b)
846         buf.EncodeInt32(m.Retval)
847         return buf.Bytes(), nil
848 }
849 func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error {
850         buf := codec.NewBuffer(b)
851         m.Retval = buf.DecodeInt32()
852         return nil
853 }
854
855 // PuntSocketDetails defines message 'punt_socket_details'.
856 type PuntSocketDetails struct {
857         Punt     Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
858         Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
859 }
860
861 func (m *PuntSocketDetails) Reset()               { *m = PuntSocketDetails{} }
862 func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" }
863 func (*PuntSocketDetails) GetCrcString() string   { return "1de0ce75" }
864 func (*PuntSocketDetails) GetMessageType() api.MessageType {
865         return api.ReplyMessage
866 }
867
868 func (m *PuntSocketDetails) Size() (size int) {
869         if m == nil {
870                 return 0
871         }
872         size += 4      // m.Punt.Type
873         size += 1 * 10 // m.Punt.Punt
874         size += 108    // m.Pathname
875         return size
876 }
877 func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) {
878         if b == nil {
879                 b = make([]byte, m.Size())
880         }
881         buf := codec.NewBuffer(b)
882         buf.EncodeUint32(uint32(m.Punt.Type))
883         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 10)
884         buf.EncodeString(m.Pathname, 108)
885         return buf.Bytes(), nil
886 }
887 func (m *PuntSocketDetails) Unmarshal(b []byte) error {
888         buf := codec.NewBuffer(b)
889         m.Punt.Type = PuntType(buf.DecodeUint32())
890         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(10))
891         m.Pathname = buf.DecodeString(108)
892         return nil
893 }
894
895 // PuntSocketDump defines message 'punt_socket_dump'.
896 type PuntSocketDump struct {
897         Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"`
898 }
899
900 func (m *PuntSocketDump) Reset()               { *m = PuntSocketDump{} }
901 func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" }
902 func (*PuntSocketDump) GetCrcString() string   { return "52974935" }
903 func (*PuntSocketDump) GetMessageType() api.MessageType {
904         return api.RequestMessage
905 }
906
907 func (m *PuntSocketDump) Size() (size int) {
908         if m == nil {
909                 return 0
910         }
911         size += 4 // m.Type
912         return size
913 }
914 func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) {
915         if b == nil {
916                 b = make([]byte, m.Size())
917         }
918         buf := codec.NewBuffer(b)
919         buf.EncodeUint32(uint32(m.Type))
920         return buf.Bytes(), nil
921 }
922 func (m *PuntSocketDump) Unmarshal(b []byte) error {
923         buf := codec.NewBuffer(b)
924         m.Type = PuntType(buf.DecodeUint32())
925         return nil
926 }
927
928 // PuntSocketRegister defines message 'punt_socket_register'.
929 type PuntSocketRegister struct {
930         HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"`
931         Punt          Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
932         Pathname      string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
933 }
934
935 func (m *PuntSocketRegister) Reset()               { *m = PuntSocketRegister{} }
936 func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" }
937 func (*PuntSocketRegister) GetCrcString() string   { return "c8cd10fa" }
938 func (*PuntSocketRegister) GetMessageType() api.MessageType {
939         return api.RequestMessage
940 }
941
942 func (m *PuntSocketRegister) Size() (size int) {
943         if m == nil {
944                 return 0
945         }
946         size += 4      // m.HeaderVersion
947         size += 4      // m.Punt.Type
948         size += 1 * 10 // m.Punt.Punt
949         size += 108    // m.Pathname
950         return size
951 }
952 func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) {
953         if b == nil {
954                 b = make([]byte, m.Size())
955         }
956         buf := codec.NewBuffer(b)
957         buf.EncodeUint32(m.HeaderVersion)
958         buf.EncodeUint32(uint32(m.Punt.Type))
959         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 10)
960         buf.EncodeString(m.Pathname, 108)
961         return buf.Bytes(), nil
962 }
963 func (m *PuntSocketRegister) Unmarshal(b []byte) error {
964         buf := codec.NewBuffer(b)
965         m.HeaderVersion = buf.DecodeUint32()
966         m.Punt.Type = PuntType(buf.DecodeUint32())
967         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(10))
968         m.Pathname = buf.DecodeString(108)
969         return nil
970 }
971
972 // PuntSocketRegisterReply defines message 'punt_socket_register_reply'.
973 type PuntSocketRegisterReply struct {
974         Retval   int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
975         Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
976 }
977
978 func (m *PuntSocketRegisterReply) Reset()               { *m = PuntSocketRegisterReply{} }
979 func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" }
980 func (*PuntSocketRegisterReply) GetCrcString() string   { return "bd30ae90" }
981 func (*PuntSocketRegisterReply) GetMessageType() api.MessageType {
982         return api.ReplyMessage
983 }
984
985 func (m *PuntSocketRegisterReply) Size() (size int) {
986         if m == nil {
987                 return 0
988         }
989         size += 4   // m.Retval
990         size += 108 // m.Pathname
991         return size
992 }
993 func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) {
994         if b == nil {
995                 b = make([]byte, m.Size())
996         }
997         buf := codec.NewBuffer(b)
998         buf.EncodeInt32(m.Retval)
999         buf.EncodeString(m.Pathname, 108)
1000         return buf.Bytes(), nil
1001 }
1002 func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error {
1003         buf := codec.NewBuffer(b)
1004         m.Retval = buf.DecodeInt32()
1005         m.Pathname = buf.DecodeString(108)
1006         return nil
1007 }
1008
1009 // SetPunt defines message 'set_punt'.
1010 type SetPunt struct {
1011         IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
1012         Punt  Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
1013 }
1014
1015 func (m *SetPunt) Reset()               { *m = SetPunt{} }
1016 func (*SetPunt) GetMessageName() string { return "set_punt" }
1017 func (*SetPunt) GetCrcString() string   { return "83799618" }
1018 func (*SetPunt) GetMessageType() api.MessageType {
1019         return api.RequestMessage
1020 }
1021
1022 func (m *SetPunt) Size() (size int) {
1023         if m == nil {
1024                 return 0
1025         }
1026         size += 1      // m.IsAdd
1027         size += 4      // m.Punt.Type
1028         size += 1 * 10 // m.Punt.Punt
1029         return size
1030 }
1031 func (m *SetPunt) Marshal(b []byte) ([]byte, error) {
1032         if b == nil {
1033                 b = make([]byte, m.Size())
1034         }
1035         buf := codec.NewBuffer(b)
1036         buf.EncodeBool(m.IsAdd)
1037         buf.EncodeUint32(uint32(m.Punt.Type))
1038         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 10)
1039         return buf.Bytes(), nil
1040 }
1041 func (m *SetPunt) Unmarshal(b []byte) error {
1042         buf := codec.NewBuffer(b)
1043         m.IsAdd = buf.DecodeBool()
1044         m.Punt.Type = PuntType(buf.DecodeUint32())
1045         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(10))
1046         return nil
1047 }
1048
1049 // SetPuntReply defines message 'set_punt_reply'.
1050 type SetPuntReply struct {
1051         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1052 }
1053
1054 func (m *SetPuntReply) Reset()               { *m = SetPuntReply{} }
1055 func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" }
1056 func (*SetPuntReply) GetCrcString() string   { return "e8d4e804" }
1057 func (*SetPuntReply) GetMessageType() api.MessageType {
1058         return api.ReplyMessage
1059 }
1060
1061 func (m *SetPuntReply) Size() (size int) {
1062         if m == nil {
1063                 return 0
1064         }
1065         size += 4 // m.Retval
1066         return size
1067 }
1068 func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) {
1069         if b == nil {
1070                 b = make([]byte, m.Size())
1071         }
1072         buf := codec.NewBuffer(b)
1073         buf.EncodeInt32(m.Retval)
1074         return buf.Bytes(), nil
1075 }
1076 func (m *SetPuntReply) Unmarshal(b []byte) error {
1077         buf := codec.NewBuffer(b)
1078         m.Retval = buf.DecodeInt32()
1079         return nil
1080 }
1081
1082 func init() { file_punt_binapi_init() }
1083 func file_punt_binapi_init() {
1084         api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40")
1085         api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe")
1086         api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98a444f4")
1087         api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804")
1088         api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_1de0ce75")
1089         api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935")
1090         api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_c8cd10fa")
1091         api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90")
1092         api.RegisterMessage((*SetPunt)(nil), "set_punt_83799618")
1093         api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804")
1094 }
1095
1096 // Messages returns list of all messages in this module.
1097 func AllMessages() []api.Message {
1098         return []api.Message{
1099                 (*PuntReasonDetails)(nil),
1100                 (*PuntReasonDump)(nil),
1101                 (*PuntSocketDeregister)(nil),
1102                 (*PuntSocketDeregisterReply)(nil),
1103                 (*PuntSocketDetails)(nil),
1104                 (*PuntSocketDump)(nil),
1105                 (*PuntSocketRegister)(nil),
1106                 (*PuntSocketRegisterReply)(nil),
1107                 (*SetPunt)(nil),
1108                 (*SetPuntReply)(nil),
1109         }
1110 }