Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / udp_ping / udp_ping.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/plugins/udp_ping.api.json
6
7 // Package udp_ping contains generated bindings for API file udp_ping.api.
8 //
9 // Contents:
10 //   5 aliases
11 //   4 enums
12 //   6 structs
13 //   1 union
14 //   4 messages
15 //
16 package udp_ping
17
18 import (
19         "fmt"
20         "net"
21         "strconv"
22         "strings"
23
24         api "git.fd.io/govpp.git/api"
25         codec "git.fd.io/govpp.git/codec"
26 )
27
28 // This is a compile-time assertion to ensure that this generated file
29 // is compatible with the GoVPP api package it is being compiled against.
30 // A compilation error at this line likely means your copy of the
31 // GoVPP api package needs to be updated.
32 const _ = api.GoVppAPIPackageIsVersion2
33
34 const (
35         APIFile    = "udp_ping"
36         APIVersion = "3.0.0"
37         VersionCrc = 0x5a416f51
38 )
39
40 // AddressFamily defines enum 'address_family'.
41 type AddressFamily uint32
42
43 const (
44         ADDRESS_IP4 AddressFamily = 0
45         ADDRESS_IP6 AddressFamily = 1
46 )
47
48 var (
49         AddressFamily_name = map[uint32]string{
50                 0: "ADDRESS_IP4",
51                 1: "ADDRESS_IP6",
52         }
53         AddressFamily_value = map[string]uint32{
54                 "ADDRESS_IP4": 0,
55                 "ADDRESS_IP6": 1,
56         }
57 )
58
59 func (x AddressFamily) String() string {
60         s, ok := AddressFamily_name[uint32(x)]
61         if ok {
62                 return s
63         }
64         return "AddressFamily(" + strconv.Itoa(int(x)) + ")"
65 }
66
67 // IPDscp defines enum 'ip_dscp'.
68 type IPDscp uint8
69
70 const (
71         IP_API_DSCP_CS0  IPDscp = 0
72         IP_API_DSCP_CS1  IPDscp = 8
73         IP_API_DSCP_AF11 IPDscp = 10
74         IP_API_DSCP_AF12 IPDscp = 12
75         IP_API_DSCP_AF13 IPDscp = 14
76         IP_API_DSCP_CS2  IPDscp = 16
77         IP_API_DSCP_AF21 IPDscp = 18
78         IP_API_DSCP_AF22 IPDscp = 20
79         IP_API_DSCP_AF23 IPDscp = 22
80         IP_API_DSCP_CS3  IPDscp = 24
81         IP_API_DSCP_AF31 IPDscp = 26
82         IP_API_DSCP_AF32 IPDscp = 28
83         IP_API_DSCP_AF33 IPDscp = 30
84         IP_API_DSCP_CS4  IPDscp = 32
85         IP_API_DSCP_AF41 IPDscp = 34
86         IP_API_DSCP_AF42 IPDscp = 36
87         IP_API_DSCP_AF43 IPDscp = 38
88         IP_API_DSCP_CS5  IPDscp = 40
89         IP_API_DSCP_EF   IPDscp = 46
90         IP_API_DSCP_CS6  IPDscp = 48
91         IP_API_DSCP_CS7  IPDscp = 50
92 )
93
94 var (
95         IPDscp_name = map[uint8]string{
96                 0:  "IP_API_DSCP_CS0",
97                 8:  "IP_API_DSCP_CS1",
98                 10: "IP_API_DSCP_AF11",
99                 12: "IP_API_DSCP_AF12",
100                 14: "IP_API_DSCP_AF13",
101                 16: "IP_API_DSCP_CS2",
102                 18: "IP_API_DSCP_AF21",
103                 20: "IP_API_DSCP_AF22",
104                 22: "IP_API_DSCP_AF23",
105                 24: "IP_API_DSCP_CS3",
106                 26: "IP_API_DSCP_AF31",
107                 28: "IP_API_DSCP_AF32",
108                 30: "IP_API_DSCP_AF33",
109                 32: "IP_API_DSCP_CS4",
110                 34: "IP_API_DSCP_AF41",
111                 36: "IP_API_DSCP_AF42",
112                 38: "IP_API_DSCP_AF43",
113                 40: "IP_API_DSCP_CS5",
114                 46: "IP_API_DSCP_EF",
115                 48: "IP_API_DSCP_CS6",
116                 50: "IP_API_DSCP_CS7",
117         }
118         IPDscp_value = map[string]uint8{
119                 "IP_API_DSCP_CS0":  0,
120                 "IP_API_DSCP_CS1":  8,
121                 "IP_API_DSCP_AF11": 10,
122                 "IP_API_DSCP_AF12": 12,
123                 "IP_API_DSCP_AF13": 14,
124                 "IP_API_DSCP_CS2":  16,
125                 "IP_API_DSCP_AF21": 18,
126                 "IP_API_DSCP_AF22": 20,
127                 "IP_API_DSCP_AF23": 22,
128                 "IP_API_DSCP_CS3":  24,
129                 "IP_API_DSCP_AF31": 26,
130                 "IP_API_DSCP_AF32": 28,
131                 "IP_API_DSCP_AF33": 30,
132                 "IP_API_DSCP_CS4":  32,
133                 "IP_API_DSCP_AF41": 34,
134                 "IP_API_DSCP_AF42": 36,
135                 "IP_API_DSCP_AF43": 38,
136                 "IP_API_DSCP_CS5":  40,
137                 "IP_API_DSCP_EF":   46,
138                 "IP_API_DSCP_CS6":  48,
139                 "IP_API_DSCP_CS7":  50,
140         }
141 )
142
143 func (x IPDscp) String() string {
144         s, ok := IPDscp_name[uint8(x)]
145         if ok {
146                 return s
147         }
148         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
149 }
150
151 // IPEcn defines enum 'ip_ecn'.
152 type IPEcn uint8
153
154 const (
155         IP_API_ECN_NONE IPEcn = 0
156         IP_API_ECN_ECT0 IPEcn = 1
157         IP_API_ECN_ECT1 IPEcn = 2
158         IP_API_ECN_CE   IPEcn = 3
159 )
160
161 var (
162         IPEcn_name = map[uint8]string{
163                 0: "IP_API_ECN_NONE",
164                 1: "IP_API_ECN_ECT0",
165                 2: "IP_API_ECN_ECT1",
166                 3: "IP_API_ECN_CE",
167         }
168         IPEcn_value = map[string]uint8{
169                 "IP_API_ECN_NONE": 0,
170                 "IP_API_ECN_ECT0": 1,
171                 "IP_API_ECN_ECT1": 2,
172                 "IP_API_ECN_CE":   3,
173         }
174 )
175
176 func (x IPEcn) String() string {
177         s, ok := IPEcn_name[uint8(x)]
178         if ok {
179                 return s
180         }
181         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
182 }
183
184 // IPProto defines enum 'ip_proto'.
185 type IPProto uint32
186
187 const (
188         IP_API_PROTO_HOPOPT   IPProto = 0
189         IP_API_PROTO_ICMP     IPProto = 1
190         IP_API_PROTO_IGMP     IPProto = 2
191         IP_API_PROTO_TCP      IPProto = 6
192         IP_API_PROTO_UDP      IPProto = 17
193         IP_API_PROTO_GRE      IPProto = 47
194         IP_API_PROTO_AH       IPProto = 50
195         IP_API_PROTO_ESP      IPProto = 51
196         IP_API_PROTO_EIGRP    IPProto = 88
197         IP_API_PROTO_OSPF     IPProto = 89
198         IP_API_PROTO_SCTP     IPProto = 132
199         IP_API_PROTO_RESERVED IPProto = 255
200 )
201
202 var (
203         IPProto_name = map[uint32]string{
204                 0:   "IP_API_PROTO_HOPOPT",
205                 1:   "IP_API_PROTO_ICMP",
206                 2:   "IP_API_PROTO_IGMP",
207                 6:   "IP_API_PROTO_TCP",
208                 17:  "IP_API_PROTO_UDP",
209                 47:  "IP_API_PROTO_GRE",
210                 50:  "IP_API_PROTO_AH",
211                 51:  "IP_API_PROTO_ESP",
212                 88:  "IP_API_PROTO_EIGRP",
213                 89:  "IP_API_PROTO_OSPF",
214                 132: "IP_API_PROTO_SCTP",
215                 255: "IP_API_PROTO_RESERVED",
216         }
217         IPProto_value = map[string]uint32{
218                 "IP_API_PROTO_HOPOPT":   0,
219                 "IP_API_PROTO_ICMP":     1,
220                 "IP_API_PROTO_IGMP":     2,
221                 "IP_API_PROTO_TCP":      6,
222                 "IP_API_PROTO_UDP":      17,
223                 "IP_API_PROTO_GRE":      47,
224                 "IP_API_PROTO_AH":       50,
225                 "IP_API_PROTO_ESP":      51,
226                 "IP_API_PROTO_EIGRP":    88,
227                 "IP_API_PROTO_OSPF":     89,
228                 "IP_API_PROTO_SCTP":     132,
229                 "IP_API_PROTO_RESERVED": 255,
230         }
231 )
232
233 func (x IPProto) String() string {
234         s, ok := IPProto_name[uint32(x)]
235         if ok {
236                 return s
237         }
238         return "IPProto(" + strconv.Itoa(int(x)) + ")"
239 }
240
241 // AddressWithPrefix defines alias 'address_with_prefix'.
242 type AddressWithPrefix Prefix
243
244 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
245         prefix, err := ParsePrefix(s)
246         if err != nil {
247                 return AddressWithPrefix{}, err
248         }
249         return AddressWithPrefix(prefix), nil
250 }
251
252 func (x AddressWithPrefix) String() string {
253         return Prefix(x).String()
254 }
255
256 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
257         return []byte(x.String()), nil
258 }
259
260 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
261         prefix, err := ParseAddressWithPrefix(string(text))
262         if err != nil {
263                 return err
264         }
265         *x = prefix
266         return nil
267 }
268
269 // IP4Address defines alias 'ip4_address'.
270 type IP4Address [4]uint8
271
272 func ParseIP4Address(s string) (IP4Address, error) {
273         ip := net.ParseIP(s).To4()
274         if ip == nil {
275                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
276         }
277         var ipaddr IP4Address
278         copy(ipaddr[:], ip.To4())
279         return ipaddr, nil
280 }
281
282 func (x IP4Address) ToIP() net.IP {
283         return net.IP(x[:]).To4()
284 }
285
286 func (x IP4Address) String() string {
287         return x.ToIP().String()
288 }
289
290 func (x *IP4Address) MarshalText() ([]byte, error) {
291         return []byte(x.String()), nil
292 }
293
294 func (x *IP4Address) UnmarshalText(text []byte) error {
295         ipaddr, err := ParseIP4Address(string(text))
296         if err != nil {
297                 return err
298         }
299         *x = ipaddr
300         return nil
301 }
302
303 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
304 type IP4AddressWithPrefix IP4Prefix
305
306 // IP6Address defines alias 'ip6_address'.
307 type IP6Address [16]uint8
308
309 func ParseIP6Address(s string) (IP6Address, error) {
310         ip := net.ParseIP(s).To16()
311         if ip == nil {
312                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
313         }
314         var ipaddr IP6Address
315         copy(ipaddr[:], ip.To16())
316         return ipaddr, nil
317 }
318
319 func (x IP6Address) ToIP() net.IP {
320         return net.IP(x[:]).To16()
321 }
322
323 func (x IP6Address) String() string {
324         return x.ToIP().String()
325 }
326
327 func (x *IP6Address) MarshalText() ([]byte, error) {
328         return []byte(x.String()), nil
329 }
330
331 func (x *IP6Address) UnmarshalText(text []byte) error {
332         ipaddr, err := ParseIP6Address(string(text))
333         if err != nil {
334                 return err
335         }
336         *x = ipaddr
337         return nil
338 }
339
340 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
341 type IP6AddressWithPrefix IP6Prefix
342
343 // Address defines type 'address'.
344 type Address struct {
345         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
346         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
347 }
348
349 func ParseAddress(s string) (Address, error) {
350         ip := net.ParseIP(s)
351         if ip == nil {
352                 return Address{}, fmt.Errorf("invalid address: %s", s)
353         }
354         return AddressFromIP(ip), nil
355 }
356
357 func AddressFromIP(ip net.IP) Address {
358         var addr Address
359         if ip.To4() == nil {
360                 addr.Af = ADDRESS_IP6
361                 var ip6 IP6Address
362                 copy(ip6[:], ip.To16())
363                 addr.Un.SetIP6(ip6)
364         } else {
365                 addr.Af = ADDRESS_IP4
366                 var ip4 IP4Address
367                 copy(ip4[:], ip.To4())
368                 addr.Un.SetIP4(ip4)
369         }
370         return addr
371 }
372
373 func (x Address) ToIP() net.IP {
374         if x.Af == ADDRESS_IP6 {
375                 ip6 := x.Un.GetIP6()
376                 return net.IP(ip6[:]).To16()
377         } else {
378                 ip4 := x.Un.GetIP4()
379                 return net.IP(ip4[:]).To4()
380         }
381 }
382
383 func (x Address) String() string {
384         return x.ToIP().String()
385 }
386
387 func (x *Address) MarshalText() ([]byte, error) {
388         return []byte(x.String()), nil
389 }
390
391 func (x *Address) UnmarshalText(text []byte) error {
392         addr, err := ParseAddress(string(text))
393         if err != nil {
394                 return err
395         }
396         *x = addr
397         return nil
398 }
399
400 // IP4Prefix defines type 'ip4_prefix'.
401 type IP4Prefix struct {
402         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
403         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
404 }
405
406 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
407         hasPrefix := strings.Contains(s, "/")
408         if hasPrefix {
409                 ip, network, err := net.ParseCIDR(s)
410                 if err != nil {
411                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
412                 }
413                 maskSize, _ := network.Mask.Size()
414                 prefix.Len = byte(maskSize)
415                 prefix.Address, err = ParseIP4Address(ip.String())
416                 if err != nil {
417                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
418                 }
419         } else {
420                 ip := net.ParseIP(s)
421                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
422                 if ip.To4() == nil {
423                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
424                 }
425                 prefix.Len = byte(defaultMaskSize)
426                 prefix.Address, err = ParseIP4Address(ip.String())
427                 if err != nil {
428                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
429                 }
430         }
431         return prefix, nil
432 }
433
434 func (x IP4Prefix) ToIPNet() *net.IPNet {
435         mask := net.CIDRMask(int(x.Len), 32)
436         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
437         return ipnet
438 }
439
440 func (x IP4Prefix) String() string {
441         ip := x.Address.String()
442         return ip + "/" + strconv.Itoa(int(x.Len))
443 }
444
445 func (x *IP4Prefix) MarshalText() ([]byte, error) {
446         return []byte(x.String()), nil
447 }
448
449 func (x *IP4Prefix) UnmarshalText(text []byte) error {
450         prefix, err := ParseIP4Prefix(string(text))
451         if err != nil {
452                 return err
453         }
454         *x = prefix
455         return nil
456 }
457
458 // IP6Prefix defines type 'ip6_prefix'.
459 type IP6Prefix struct {
460         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
461         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
462 }
463
464 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
465         hasPrefix := strings.Contains(s, "/")
466         if hasPrefix {
467                 ip, network, err := net.ParseCIDR(s)
468                 if err != nil {
469                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
470                 }
471                 maskSize, _ := network.Mask.Size()
472                 prefix.Len = byte(maskSize)
473                 prefix.Address, err = ParseIP6Address(ip.String())
474                 if err != nil {
475                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
476                 }
477         } else {
478                 ip := net.ParseIP(s)
479                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
480                 if ip.To4() == nil {
481                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
482                 }
483                 prefix.Len = byte(defaultMaskSize)
484                 prefix.Address, err = ParseIP6Address(ip.String())
485                 if err != nil {
486                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
487                 }
488         }
489         return prefix, nil
490 }
491
492 func (x IP6Prefix) ToIPNet() *net.IPNet {
493         mask := net.CIDRMask(int(x.Len), 128)
494         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
495         return ipnet
496 }
497
498 func (x IP6Prefix) String() string {
499         ip := x.Address.String()
500         return ip + "/" + strconv.Itoa(int(x.Len))
501 }
502
503 func (x *IP6Prefix) MarshalText() ([]byte, error) {
504         return []byte(x.String()), nil
505 }
506
507 func (x *IP6Prefix) UnmarshalText(text []byte) error {
508         prefix, err := ParseIP6Prefix(string(text))
509         if err != nil {
510                 return err
511         }
512         *x = prefix
513         return nil
514 }
515
516 // Mprefix defines type 'mprefix'.
517 type Mprefix struct {
518         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
519         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
520         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
521         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
522 }
523
524 // Prefix defines type 'prefix'.
525 type Prefix struct {
526         Address Address `binapi:"address,name=address" json:"address,omitempty"`
527         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
528 }
529
530 func ParsePrefix(ip string) (prefix Prefix, err error) {
531         hasPrefix := strings.Contains(ip, "/")
532         if hasPrefix {
533                 netIP, network, err := net.ParseCIDR(ip)
534                 if err != nil {
535                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
536                 }
537                 maskSize, _ := network.Mask.Size()
538                 prefix.Len = byte(maskSize)
539                 prefix.Address, err = ParseAddress(netIP.String())
540                 if err != nil {
541                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
542                 }
543         } else {
544                 netIP := net.ParseIP(ip)
545                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
546                 if netIP.To4() == nil {
547                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
548                 }
549                 prefix.Len = byte(defaultMaskSize)
550                 prefix.Address, err = ParseAddress(netIP.String())
551                 if err != nil {
552                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
553                 }
554         }
555         return prefix, nil
556 }
557
558 func (x Prefix) ToIPNet() *net.IPNet {
559         var mask net.IPMask
560         if x.Address.Af == ADDRESS_IP4 {
561                 mask = net.CIDRMask(int(x.Len), 32)
562         } else {
563                 mask = net.CIDRMask(int(x.Len), 128)
564         }
565         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
566         return ipnet
567 }
568
569 func (x Prefix) String() string {
570         ip := x.Address.String()
571         return ip + "/" + strconv.Itoa(int(x.Len))
572 }
573
574 func (x *Prefix) MarshalText() ([]byte, error) {
575         return []byte(x.String()), nil
576 }
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 // AddressUnion defines union 'address_union'.
594 type AddressUnion struct {
595         // AddressUnion can be one of:
596         // - IP4 *IP4Address
597         // - IP6 *IP6Address
598         XXX_UnionData [16]byte
599 }
600
601 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
602         u.SetIP4(a)
603         return
604 }
605 func (u *AddressUnion) SetIP4(a IP4Address) {
606         buf := codec.NewBuffer(u.XXX_UnionData[:])
607         buf.EncodeBytes(a[:], 4)
608 }
609 func (u *AddressUnion) GetIP4() (a IP4Address) {
610         buf := codec.NewBuffer(u.XXX_UnionData[:])
611         copy(a[:], buf.DecodeBytes(4))
612         return
613 }
614
615 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
616         u.SetIP6(a)
617         return
618 }
619 func (u *AddressUnion) SetIP6(a IP6Address) {
620         buf := codec.NewBuffer(u.XXX_UnionData[:])
621         buf.EncodeBytes(a[:], 16)
622 }
623 func (u *AddressUnion) GetIP6() (a IP6Address) {
624         buf := codec.NewBuffer(u.XXX_UnionData[:])
625         copy(a[:], buf.DecodeBytes(16))
626         return
627 }
628
629 // UDPPingAddDel defines message 'udp_ping_add_del'.
630 type UDPPingAddDel struct {
631         SrcIPAddress Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"`
632         DstIPAddress Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"`
633         StartSrcPort uint16  `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"`
634         EndSrcPort   uint16  `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"`
635         StartDstPort uint16  `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"`
636         EndDstPort   uint16  `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"`
637         Interval     uint16  `binapi:"u16,name=interval" json:"interval,omitempty"`
638         Dis          uint8   `binapi:"u8,name=dis" json:"dis,omitempty"`
639         FaultDet     uint8   `binapi:"u8,name=fault_det" json:"fault_det,omitempty"`
640         Reserve      []byte  `binapi:"u8[3],name=reserve" json:"reserve,omitempty"`
641 }
642
643 func (m *UDPPingAddDel) Reset()               { *m = UDPPingAddDel{} }
644 func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" }
645 func (*UDPPingAddDel) GetCrcString() string   { return "c692b188" }
646 func (*UDPPingAddDel) GetMessageType() api.MessageType {
647         return api.RequestMessage
648 }
649
650 func (m *UDPPingAddDel) Size() (size int) {
651         if m == nil {
652                 return 0
653         }
654         size += 4      // m.SrcIPAddress.Af
655         size += 1 * 16 // m.SrcIPAddress.Un
656         size += 4      // m.DstIPAddress.Af
657         size += 1 * 16 // m.DstIPAddress.Un
658         size += 2      // m.StartSrcPort
659         size += 2      // m.EndSrcPort
660         size += 2      // m.StartDstPort
661         size += 2      // m.EndDstPort
662         size += 2      // m.Interval
663         size += 1      // m.Dis
664         size += 1      // m.FaultDet
665         size += 1 * 3  // m.Reserve
666         return size
667 }
668 func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) {
669         if b == nil {
670                 b = make([]byte, m.Size())
671         }
672         buf := codec.NewBuffer(b)
673         buf.EncodeUint32(uint32(m.SrcIPAddress.Af))
674         buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16)
675         buf.EncodeUint32(uint32(m.DstIPAddress.Af))
676         buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16)
677         buf.EncodeUint16(m.StartSrcPort)
678         buf.EncodeUint16(m.EndSrcPort)
679         buf.EncodeUint16(m.StartDstPort)
680         buf.EncodeUint16(m.EndDstPort)
681         buf.EncodeUint16(m.Interval)
682         buf.EncodeUint8(m.Dis)
683         buf.EncodeUint8(m.FaultDet)
684         buf.EncodeBytes(m.Reserve, 3)
685         return buf.Bytes(), nil
686 }
687 func (m *UDPPingAddDel) Unmarshal(b []byte) error {
688         buf := codec.NewBuffer(b)
689         m.SrcIPAddress.Af = AddressFamily(buf.DecodeUint32())
690         copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
691         m.DstIPAddress.Af = AddressFamily(buf.DecodeUint32())
692         copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
693         m.StartSrcPort = buf.DecodeUint16()
694         m.EndSrcPort = buf.DecodeUint16()
695         m.StartDstPort = buf.DecodeUint16()
696         m.EndDstPort = buf.DecodeUint16()
697         m.Interval = buf.DecodeUint16()
698         m.Dis = buf.DecodeUint8()
699         m.FaultDet = buf.DecodeUint8()
700         m.Reserve = make([]byte, 3)
701         copy(m.Reserve, buf.DecodeBytes(len(m.Reserve)))
702         return nil
703 }
704
705 // UDPPingAddDelReply defines message 'udp_ping_add_del_reply'.
706 type UDPPingAddDelReply struct {
707         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
708 }
709
710 func (m *UDPPingAddDelReply) Reset()               { *m = UDPPingAddDelReply{} }
711 func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" }
712 func (*UDPPingAddDelReply) GetCrcString() string   { return "e8d4e804" }
713 func (*UDPPingAddDelReply) GetMessageType() api.MessageType {
714         return api.ReplyMessage
715 }
716
717 func (m *UDPPingAddDelReply) Size() (size int) {
718         if m == nil {
719                 return 0
720         }
721         size += 4 // m.Retval
722         return size
723 }
724 func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) {
725         if b == nil {
726                 b = make([]byte, m.Size())
727         }
728         buf := codec.NewBuffer(b)
729         buf.EncodeInt32(m.Retval)
730         return buf.Bytes(), nil
731 }
732 func (m *UDPPingAddDelReply) Unmarshal(b []byte) error {
733         buf := codec.NewBuffer(b)
734         m.Retval = buf.DecodeInt32()
735         return nil
736 }
737
738 // UDPPingExport defines message 'udp_ping_export'.
739 type UDPPingExport struct {
740         Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"`
741 }
742
743 func (m *UDPPingExport) Reset()               { *m = UDPPingExport{} }
744 func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" }
745 func (*UDPPingExport) GetCrcString() string   { return "b3e225d2" }
746 func (*UDPPingExport) GetMessageType() api.MessageType {
747         return api.RequestMessage
748 }
749
750 func (m *UDPPingExport) Size() (size int) {
751         if m == nil {
752                 return 0
753         }
754         size += 1 // m.Enable
755         return size
756 }
757 func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) {
758         if b == nil {
759                 b = make([]byte, m.Size())
760         }
761         buf := codec.NewBuffer(b)
762         buf.EncodeBool(m.Enable)
763         return buf.Bytes(), nil
764 }
765 func (m *UDPPingExport) Unmarshal(b []byte) error {
766         buf := codec.NewBuffer(b)
767         m.Enable = buf.DecodeBool()
768         return nil
769 }
770
771 // UDPPingExportReply defines message 'udp_ping_export_reply'.
772 type UDPPingExportReply struct {
773         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
774 }
775
776 func (m *UDPPingExportReply) Reset()               { *m = UDPPingExportReply{} }
777 func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" }
778 func (*UDPPingExportReply) GetCrcString() string   { return "e8d4e804" }
779 func (*UDPPingExportReply) GetMessageType() api.MessageType {
780         return api.ReplyMessage
781 }
782
783 func (m *UDPPingExportReply) Size() (size int) {
784         if m == nil {
785                 return 0
786         }
787         size += 4 // m.Retval
788         return size
789 }
790 func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) {
791         if b == nil {
792                 b = make([]byte, m.Size())
793         }
794         buf := codec.NewBuffer(b)
795         buf.EncodeInt32(m.Retval)
796         return buf.Bytes(), nil
797 }
798 func (m *UDPPingExportReply) Unmarshal(b []byte) error {
799         buf := codec.NewBuffer(b)
800         m.Retval = buf.DecodeInt32()
801         return nil
802 }
803
804 func init() { file_udp_ping_binapi_init() }
805 func file_udp_ping_binapi_init() {
806         api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_c692b188")
807         api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804")
808         api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2")
809         api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804")
810 }
811
812 // Messages returns list of all messages in this module.
813 func AllMessages() []api.Message {
814         return []api.Message{
815                 (*UDPPingAddDel)(nil),
816                 (*UDPPingAddDelReply)(nil),
817                 (*UDPPingExport)(nil),
818                 (*UDPPingExportReply)(nil),
819         }
820 }