5482411dcbdc7ec04df559d888057adf7b96c2f9
[govpp.git] / internal / testbinapi / binapi2001 / igmp / igmp.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/igmp.api.json
6
7 // Package igmp contains generated bindings for API file igmp.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  12 enums
12 //   8 structs
13 //   1 union
14 //  19 messages
15 //
16 package igmp
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    = "igmp"
35         APIVersion = "1.0.0"
36         VersionCrc = 0xfd1fef7b
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 // FilterMode defines enum 'filter_mode'.
67 type FilterMode uint32
68
69 const (
70         EXCLUDE FilterMode = 0
71         INCLUDE FilterMode = 1
72 )
73
74 var (
75         FilterMode_name = map[uint32]string{
76                 0: "EXCLUDE",
77                 1: "INCLUDE",
78         }
79         FilterMode_value = map[string]uint32{
80                 "EXCLUDE": 0,
81                 "INCLUDE": 1,
82         }
83 )
84
85 func (x FilterMode) String() string {
86         s, ok := FilterMode_name[uint32(x)]
87         if ok {
88                 return s
89         }
90         return "FilterMode(" + strconv.Itoa(int(x)) + ")"
91 }
92
93 // GroupPrefixType defines enum 'group_prefix_type'.
94 type GroupPrefixType uint32
95
96 const (
97         ASM GroupPrefixType = 0
98         SSM GroupPrefixType = 1
99 )
100
101 var (
102         GroupPrefixType_name = map[uint32]string{
103                 0: "ASM",
104                 1: "SSM",
105         }
106         GroupPrefixType_value = map[string]uint32{
107                 "ASM": 0,
108                 "SSM": 1,
109         }
110 )
111
112 func (x GroupPrefixType) String() string {
113         s, ok := GroupPrefixType_name[uint32(x)]
114         if ok {
115                 return s
116         }
117         return "GroupPrefixType(" + strconv.Itoa(int(x)) + ")"
118 }
119
120 // IfStatusFlags defines enum 'if_status_flags'.
121 type IfStatusFlags uint32
122
123 const (
124         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
125         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
126 )
127
128 var (
129         IfStatusFlags_name = map[uint32]string{
130                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
131                 2: "IF_STATUS_API_FLAG_LINK_UP",
132         }
133         IfStatusFlags_value = map[string]uint32{
134                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
135                 "IF_STATUS_API_FLAG_LINK_UP":  2,
136         }
137 )
138
139 func (x IfStatusFlags) String() string {
140         s, ok := IfStatusFlags_name[uint32(x)]
141         if ok {
142                 return s
143         }
144         str := func(n uint32) string {
145                 s, ok := IfStatusFlags_name[uint32(n)]
146                 if ok {
147                         return s
148                 }
149                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
150         }
151         for i := uint32(0); i <= 32; i++ {
152                 val := uint32(x)
153                 if val&(1<<i) != 0 {
154                         if s != "" {
155                                 s += "|"
156                         }
157                         s += str(1 << i)
158                 }
159         }
160         if s == "" {
161                 return str(uint32(x))
162         }
163         return s
164 }
165
166 // IfType defines enum 'if_type'.
167 type IfType uint32
168
169 const (
170         IF_API_TYPE_HARDWARE IfType = 1
171         IF_API_TYPE_SUB      IfType = 2
172         IF_API_TYPE_P2P      IfType = 3
173         IF_API_TYPE_PIPE     IfType = 4
174 )
175
176 var (
177         IfType_name = map[uint32]string{
178                 1: "IF_API_TYPE_HARDWARE",
179                 2: "IF_API_TYPE_SUB",
180                 3: "IF_API_TYPE_P2P",
181                 4: "IF_API_TYPE_PIPE",
182         }
183         IfType_value = map[string]uint32{
184                 "IF_API_TYPE_HARDWARE": 1,
185                 "IF_API_TYPE_SUB":      2,
186                 "IF_API_TYPE_P2P":      3,
187                 "IF_API_TYPE_PIPE":     4,
188         }
189 )
190
191 func (x IfType) String() string {
192         s, ok := IfType_name[uint32(x)]
193         if ok {
194                 return s
195         }
196         return "IfType(" + strconv.Itoa(int(x)) + ")"
197 }
198
199 // IPDscp defines enum 'ip_dscp'.
200 type IPDscp uint8
201
202 const (
203         IP_API_DSCP_CS0  IPDscp = 0
204         IP_API_DSCP_CS1  IPDscp = 8
205         IP_API_DSCP_AF11 IPDscp = 10
206         IP_API_DSCP_AF12 IPDscp = 12
207         IP_API_DSCP_AF13 IPDscp = 14
208         IP_API_DSCP_CS2  IPDscp = 16
209         IP_API_DSCP_AF21 IPDscp = 18
210         IP_API_DSCP_AF22 IPDscp = 20
211         IP_API_DSCP_AF23 IPDscp = 22
212         IP_API_DSCP_CS3  IPDscp = 24
213         IP_API_DSCP_AF31 IPDscp = 26
214         IP_API_DSCP_AF32 IPDscp = 28
215         IP_API_DSCP_AF33 IPDscp = 30
216         IP_API_DSCP_CS4  IPDscp = 32
217         IP_API_DSCP_AF41 IPDscp = 34
218         IP_API_DSCP_AF42 IPDscp = 36
219         IP_API_DSCP_AF43 IPDscp = 38
220         IP_API_DSCP_CS5  IPDscp = 40
221         IP_API_DSCP_EF   IPDscp = 46
222         IP_API_DSCP_CS6  IPDscp = 48
223         IP_API_DSCP_CS7  IPDscp = 50
224 )
225
226 var (
227         IPDscp_name = map[uint8]string{
228                 0:  "IP_API_DSCP_CS0",
229                 8:  "IP_API_DSCP_CS1",
230                 10: "IP_API_DSCP_AF11",
231                 12: "IP_API_DSCP_AF12",
232                 14: "IP_API_DSCP_AF13",
233                 16: "IP_API_DSCP_CS2",
234                 18: "IP_API_DSCP_AF21",
235                 20: "IP_API_DSCP_AF22",
236                 22: "IP_API_DSCP_AF23",
237                 24: "IP_API_DSCP_CS3",
238                 26: "IP_API_DSCP_AF31",
239                 28: "IP_API_DSCP_AF32",
240                 30: "IP_API_DSCP_AF33",
241                 32: "IP_API_DSCP_CS4",
242                 34: "IP_API_DSCP_AF41",
243                 36: "IP_API_DSCP_AF42",
244                 38: "IP_API_DSCP_AF43",
245                 40: "IP_API_DSCP_CS5",
246                 46: "IP_API_DSCP_EF",
247                 48: "IP_API_DSCP_CS6",
248                 50: "IP_API_DSCP_CS7",
249         }
250         IPDscp_value = map[string]uint8{
251                 "IP_API_DSCP_CS0":  0,
252                 "IP_API_DSCP_CS1":  8,
253                 "IP_API_DSCP_AF11": 10,
254                 "IP_API_DSCP_AF12": 12,
255                 "IP_API_DSCP_AF13": 14,
256                 "IP_API_DSCP_CS2":  16,
257                 "IP_API_DSCP_AF21": 18,
258                 "IP_API_DSCP_AF22": 20,
259                 "IP_API_DSCP_AF23": 22,
260                 "IP_API_DSCP_CS3":  24,
261                 "IP_API_DSCP_AF31": 26,
262                 "IP_API_DSCP_AF32": 28,
263                 "IP_API_DSCP_AF33": 30,
264                 "IP_API_DSCP_CS4":  32,
265                 "IP_API_DSCP_AF41": 34,
266                 "IP_API_DSCP_AF42": 36,
267                 "IP_API_DSCP_AF43": 38,
268                 "IP_API_DSCP_CS5":  40,
269                 "IP_API_DSCP_EF":   46,
270                 "IP_API_DSCP_CS6":  48,
271                 "IP_API_DSCP_CS7":  50,
272         }
273 )
274
275 func (x IPDscp) String() string {
276         s, ok := IPDscp_name[uint8(x)]
277         if ok {
278                 return s
279         }
280         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
281 }
282
283 // IPEcn defines enum 'ip_ecn'.
284 type IPEcn uint8
285
286 const (
287         IP_API_ECN_NONE IPEcn = 0
288         IP_API_ECN_ECT0 IPEcn = 1
289         IP_API_ECN_ECT1 IPEcn = 2
290         IP_API_ECN_CE   IPEcn = 3
291 )
292
293 var (
294         IPEcn_name = map[uint8]string{
295                 0: "IP_API_ECN_NONE",
296                 1: "IP_API_ECN_ECT0",
297                 2: "IP_API_ECN_ECT1",
298                 3: "IP_API_ECN_CE",
299         }
300         IPEcn_value = map[string]uint8{
301                 "IP_API_ECN_NONE": 0,
302                 "IP_API_ECN_ECT0": 1,
303                 "IP_API_ECN_ECT1": 2,
304                 "IP_API_ECN_CE":   3,
305         }
306 )
307
308 func (x IPEcn) String() string {
309         s, ok := IPEcn_name[uint8(x)]
310         if ok {
311                 return s
312         }
313         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
314 }
315
316 // IPProto defines enum 'ip_proto'.
317 type IPProto uint32
318
319 const (
320         IP_API_PROTO_HOPOPT   IPProto = 0
321         IP_API_PROTO_ICMP     IPProto = 1
322         IP_API_PROTO_IGMP     IPProto = 2
323         IP_API_PROTO_TCP      IPProto = 6
324         IP_API_PROTO_UDP      IPProto = 17
325         IP_API_PROTO_GRE      IPProto = 47
326         IP_API_PROTO_AH       IPProto = 50
327         IP_API_PROTO_ESP      IPProto = 51
328         IP_API_PROTO_EIGRP    IPProto = 88
329         IP_API_PROTO_OSPF     IPProto = 89
330         IP_API_PROTO_SCTP     IPProto = 132
331         IP_API_PROTO_RESERVED IPProto = 255
332 )
333
334 var (
335         IPProto_name = map[uint32]string{
336                 0:   "IP_API_PROTO_HOPOPT",
337                 1:   "IP_API_PROTO_ICMP",
338                 2:   "IP_API_PROTO_IGMP",
339                 6:   "IP_API_PROTO_TCP",
340                 17:  "IP_API_PROTO_UDP",
341                 47:  "IP_API_PROTO_GRE",
342                 50:  "IP_API_PROTO_AH",
343                 51:  "IP_API_PROTO_ESP",
344                 88:  "IP_API_PROTO_EIGRP",
345                 89:  "IP_API_PROTO_OSPF",
346                 132: "IP_API_PROTO_SCTP",
347                 255: "IP_API_PROTO_RESERVED",
348         }
349         IPProto_value = map[string]uint32{
350                 "IP_API_PROTO_HOPOPT":   0,
351                 "IP_API_PROTO_ICMP":     1,
352                 "IP_API_PROTO_IGMP":     2,
353                 "IP_API_PROTO_TCP":      6,
354                 "IP_API_PROTO_UDP":      17,
355                 "IP_API_PROTO_GRE":      47,
356                 "IP_API_PROTO_AH":       50,
357                 "IP_API_PROTO_ESP":      51,
358                 "IP_API_PROTO_EIGRP":    88,
359                 "IP_API_PROTO_OSPF":     89,
360                 "IP_API_PROTO_SCTP":     132,
361                 "IP_API_PROTO_RESERVED": 255,
362         }
363 )
364
365 func (x IPProto) String() string {
366         s, ok := IPProto_name[uint32(x)]
367         if ok {
368                 return s
369         }
370         return "IPProto(" + strconv.Itoa(int(x)) + ")"
371 }
372
373 // LinkDuplex defines enum 'link_duplex'.
374 type LinkDuplex uint32
375
376 const (
377         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
378         LINK_DUPLEX_API_HALF    LinkDuplex = 1
379         LINK_DUPLEX_API_FULL    LinkDuplex = 2
380 )
381
382 var (
383         LinkDuplex_name = map[uint32]string{
384                 0: "LINK_DUPLEX_API_UNKNOWN",
385                 1: "LINK_DUPLEX_API_HALF",
386                 2: "LINK_DUPLEX_API_FULL",
387         }
388         LinkDuplex_value = map[string]uint32{
389                 "LINK_DUPLEX_API_UNKNOWN": 0,
390                 "LINK_DUPLEX_API_HALF":    1,
391                 "LINK_DUPLEX_API_FULL":    2,
392         }
393 )
394
395 func (x LinkDuplex) String() string {
396         s, ok := LinkDuplex_name[uint32(x)]
397         if ok {
398                 return s
399         }
400         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
401 }
402
403 // MtuProto defines enum 'mtu_proto'.
404 type MtuProto uint32
405
406 const (
407         MTU_PROTO_API_L3   MtuProto = 1
408         MTU_PROTO_API_IP4  MtuProto = 2
409         MTU_PROTO_API_IP6  MtuProto = 3
410         MTU_PROTO_API_MPLS MtuProto = 4
411         MTU_PROTO_API_N    MtuProto = 5
412 )
413
414 var (
415         MtuProto_name = map[uint32]string{
416                 1: "MTU_PROTO_API_L3",
417                 2: "MTU_PROTO_API_IP4",
418                 3: "MTU_PROTO_API_IP6",
419                 4: "MTU_PROTO_API_MPLS",
420                 5: "MTU_PROTO_API_N",
421         }
422         MtuProto_value = map[string]uint32{
423                 "MTU_PROTO_API_L3":   1,
424                 "MTU_PROTO_API_IP4":  2,
425                 "MTU_PROTO_API_IP6":  3,
426                 "MTU_PROTO_API_MPLS": 4,
427                 "MTU_PROTO_API_N":    5,
428         }
429 )
430
431 func (x MtuProto) String() string {
432         s, ok := MtuProto_name[uint32(x)]
433         if ok {
434                 return s
435         }
436         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
437 }
438
439 // RxMode defines enum 'rx_mode'.
440 type RxMode uint32
441
442 const (
443         RX_MODE_API_UNKNOWN   RxMode = 0
444         RX_MODE_API_POLLING   RxMode = 1
445         RX_MODE_API_INTERRUPT RxMode = 2
446         RX_MODE_API_ADAPTIVE  RxMode = 3
447         RX_MODE_API_DEFAULT   RxMode = 4
448 )
449
450 var (
451         RxMode_name = map[uint32]string{
452                 0: "RX_MODE_API_UNKNOWN",
453                 1: "RX_MODE_API_POLLING",
454                 2: "RX_MODE_API_INTERRUPT",
455                 3: "RX_MODE_API_ADAPTIVE",
456                 4: "RX_MODE_API_DEFAULT",
457         }
458         RxMode_value = map[string]uint32{
459                 "RX_MODE_API_UNKNOWN":   0,
460                 "RX_MODE_API_POLLING":   1,
461                 "RX_MODE_API_INTERRUPT": 2,
462                 "RX_MODE_API_ADAPTIVE":  3,
463                 "RX_MODE_API_DEFAULT":   4,
464         }
465 )
466
467 func (x RxMode) String() string {
468         s, ok := RxMode_name[uint32(x)]
469         if ok {
470                 return s
471         }
472         return "RxMode(" + strconv.Itoa(int(x)) + ")"
473 }
474
475 // SubIfFlags defines enum 'sub_if_flags'.
476 type SubIfFlags uint32
477
478 const (
479         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
480         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
481         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
482         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
483         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
484         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
485         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
486         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
487         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
488         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
489 )
490
491 var (
492         SubIfFlags_name = map[uint32]string{
493                 1:   "SUB_IF_API_FLAG_NO_TAGS",
494                 2:   "SUB_IF_API_FLAG_ONE_TAG",
495                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
496                 8:   "SUB_IF_API_FLAG_DOT1AD",
497                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
498                 32:  "SUB_IF_API_FLAG_DEFAULT",
499                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
500                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
501                 254: "SUB_IF_API_FLAG_MASK_VNET",
502                 256: "SUB_IF_API_FLAG_DOT1AH",
503         }
504         SubIfFlags_value = map[string]uint32{
505                 "SUB_IF_API_FLAG_NO_TAGS":           1,
506                 "SUB_IF_API_FLAG_ONE_TAG":           2,
507                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
508                 "SUB_IF_API_FLAG_DOT1AD":            8,
509                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
510                 "SUB_IF_API_FLAG_DEFAULT":           32,
511                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
512                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
513                 "SUB_IF_API_FLAG_MASK_VNET":         254,
514                 "SUB_IF_API_FLAG_DOT1AH":            256,
515         }
516 )
517
518 func (x SubIfFlags) String() string {
519         s, ok := SubIfFlags_name[uint32(x)]
520         if ok {
521                 return s
522         }
523         str := func(n uint32) string {
524                 s, ok := SubIfFlags_name[uint32(n)]
525                 if ok {
526                         return s
527                 }
528                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
529         }
530         for i := uint32(0); i <= 32; i++ {
531                 val := uint32(x)
532                 if val&(1<<i) != 0 {
533                         if s != "" {
534                                 s += "|"
535                         }
536                         s += str(1 << i)
537                 }
538         }
539         if s == "" {
540                 return str(uint32(x))
541         }
542         return s
543 }
544
545 // AddressWithPrefix defines alias 'address_with_prefix'.
546 type AddressWithPrefix Prefix
547
548 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
549         prefix, err := ParsePrefix(s)
550         if err != nil {
551                 return AddressWithPrefix{}, err
552         }
553         return AddressWithPrefix(prefix), nil
554 }
555 func (x AddressWithPrefix) String() string {
556         return Prefix(x).String()
557 }
558 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
559         return []byte(x.String()), nil
560 }
561 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
562         prefix, err := ParseAddressWithPrefix(string(text))
563         if err != nil {
564                 return err
565         }
566         *x = prefix
567         return nil
568 }
569
570 // InterfaceIndex defines alias 'interface_index'.
571 type InterfaceIndex uint32
572
573 // IP4Address defines alias 'ip4_address'.
574 type IP4Address [4]uint8
575
576 func ParseIP4Address(s string) (IP4Address, error) {
577         ip := net.ParseIP(s).To4()
578         if ip == nil {
579                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
580         }
581         var ipaddr IP4Address
582         copy(ipaddr[:], ip.To4())
583         return ipaddr, nil
584 }
585
586 func (x IP4Address) ToIP() net.IP {
587         return net.IP(x[:]).To4()
588 }
589 func (x IP4Address) String() string {
590         return x.ToIP().String()
591 }
592 func (x *IP4Address) MarshalText() ([]byte, error) {
593         return []byte(x.String()), nil
594 }
595 func (x *IP4Address) UnmarshalText(text []byte) error {
596         ipaddr, err := ParseIP4Address(string(text))
597         if err != nil {
598                 return err
599         }
600         *x = ipaddr
601         return nil
602 }
603
604 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
605 type IP4AddressWithPrefix IP4Prefix
606
607 // IP6Address defines alias 'ip6_address'.
608 type IP6Address [16]uint8
609
610 func ParseIP6Address(s string) (IP6Address, error) {
611         ip := net.ParseIP(s).To16()
612         if ip == nil {
613                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
614         }
615         var ipaddr IP6Address
616         copy(ipaddr[:], ip.To16())
617         return ipaddr, nil
618 }
619
620 func (x IP6Address) ToIP() net.IP {
621         return net.IP(x[:]).To16()
622 }
623 func (x IP6Address) String() string {
624         return x.ToIP().String()
625 }
626 func (x *IP6Address) MarshalText() ([]byte, error) {
627         return []byte(x.String()), nil
628 }
629 func (x *IP6Address) UnmarshalText(text []byte) error {
630         ipaddr, err := ParseIP6Address(string(text))
631         if err != nil {
632                 return err
633         }
634         *x = ipaddr
635         return nil
636 }
637
638 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
639 type IP6AddressWithPrefix IP6Prefix
640
641 // Address defines type 'address'.
642 type Address struct {
643         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
644         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
645 }
646
647 func ParseAddress(s string) (Address, error) {
648         ip := net.ParseIP(s)
649         if ip == nil {
650                 return Address{}, fmt.Errorf("invalid address: %s", s)
651         }
652         var addr Address
653         if ip.To4() == nil {
654                 addr.Af = ADDRESS_IP6
655                 var ip6 IP6Address
656                 copy(ip6[:], ip.To16())
657                 addr.Un.SetIP6(ip6)
658         } else {
659                 addr.Af = ADDRESS_IP4
660                 var ip4 IP4Address
661                 copy(ip4[:], ip.To4())
662                 addr.Un.SetIP4(ip4)
663         }
664         return addr, nil
665 }
666 func (x Address) ToIP() net.IP {
667         if x.Af == ADDRESS_IP6 {
668                 ip6 := x.Un.GetIP6()
669                 return net.IP(ip6[:]).To16()
670         } else {
671                 ip4 := x.Un.GetIP4()
672                 return net.IP(ip4[:]).To4()
673         }
674 }
675 func (x Address) String() string {
676         return x.ToIP().String()
677 }
678 func (x *Address) MarshalText() ([]byte, error) {
679         return []byte(x.String()), nil
680 }
681 func (x *Address) UnmarshalText(text []byte) error {
682         addr, err := ParseAddress(string(text))
683         if err != nil {
684                 return err
685         }
686         *x = addr
687         return nil
688 }
689
690 // GroupPrefix defines type 'group_prefix'.
691 type GroupPrefix struct {
692         Type   GroupPrefixType `binapi:"group_prefix_type,name=type" json:"type,omitempty"`
693         Prefix Prefix          `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
694 }
695
696 // IgmpGroup defines type 'igmp_group'.
697 type IgmpGroup struct {
698         Filter    FilterMode     `binapi:"filter_mode,name=filter" json:"filter,omitempty"`
699         NSrcs     uint8          `binapi:"u8,name=n_srcs" json:"-"`
700         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
701         Gaddr     IP4Address     `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"`
702         Saddrs    []IP4Address   `binapi:"ip4_address[n_srcs],name=saddrs" json:"saddrs,omitempty"`
703 }
704
705 // IP4Prefix defines type 'ip4_prefix'.
706 type IP4Prefix struct {
707         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
708         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
709 }
710
711 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
712         hasPrefix := strings.Contains(s, "/")
713         if hasPrefix {
714                 ip, network, err := net.ParseCIDR(s)
715                 if err != nil {
716                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
717                 }
718                 maskSize, _ := network.Mask.Size()
719                 prefix.Len = byte(maskSize)
720                 prefix.Address, err = ParseIP4Address(ip.String())
721                 if err != nil {
722                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
723                 }
724         } else {
725                 ip := net.ParseIP(s)
726                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
727                 if ip.To4() == nil {
728                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
729                 }
730                 prefix.Len = byte(defaultMaskSize)
731                 prefix.Address, err = ParseIP4Address(ip.String())
732                 if err != nil {
733                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
734                 }
735         }
736         return prefix, nil
737 }
738 func (x IP4Prefix) ToIPNet() *net.IPNet {
739         mask := net.CIDRMask(int(x.Len), 32)
740         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
741         return ipnet
742 }
743 func (x IP4Prefix) String() string {
744         ip := x.Address.String()
745         return ip + "/" + strconv.Itoa(int(x.Len))
746 }
747 func (x *IP4Prefix) MarshalText() ([]byte, error) {
748         return []byte(x.String()), nil
749 }
750 func (x *IP4Prefix) UnmarshalText(text []byte) error {
751         prefix, err := ParseIP4Prefix(string(text))
752         if err != nil {
753                 return err
754         }
755         *x = prefix
756         return nil
757 }
758
759 // IP6Prefix defines type 'ip6_prefix'.
760 type IP6Prefix struct {
761         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
762         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
763 }
764
765 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
766         hasPrefix := strings.Contains(s, "/")
767         if hasPrefix {
768                 ip, network, err := net.ParseCIDR(s)
769                 if err != nil {
770                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
771                 }
772                 maskSize, _ := network.Mask.Size()
773                 prefix.Len = byte(maskSize)
774                 prefix.Address, err = ParseIP6Address(ip.String())
775                 if err != nil {
776                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
777                 }
778         } else {
779                 ip := net.ParseIP(s)
780                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
781                 if ip.To4() == nil {
782                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
783                 }
784                 prefix.Len = byte(defaultMaskSize)
785                 prefix.Address, err = ParseIP6Address(ip.String())
786                 if err != nil {
787                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
788                 }
789         }
790         return prefix, nil
791 }
792 func (x IP6Prefix) ToIPNet() *net.IPNet {
793         mask := net.CIDRMask(int(x.Len), 128)
794         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
795         return ipnet
796 }
797 func (x IP6Prefix) String() string {
798         ip := x.Address.String()
799         return ip + "/" + strconv.Itoa(int(x.Len))
800 }
801 func (x *IP6Prefix) MarshalText() ([]byte, error) {
802         return []byte(x.String()), nil
803 }
804 func (x *IP6Prefix) UnmarshalText(text []byte) error {
805         prefix, err := ParseIP6Prefix(string(text))
806         if err != nil {
807                 return err
808         }
809         *x = prefix
810         return nil
811 }
812
813 // Mprefix defines type 'mprefix'.
814 type Mprefix struct {
815         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
816         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
817         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
818         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
819 }
820
821 // Prefix defines type 'prefix'.
822 type Prefix struct {
823         Address Address `binapi:"address,name=address" json:"address,omitempty"`
824         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
825 }
826
827 func ParsePrefix(ip string) (prefix Prefix, err error) {
828         hasPrefix := strings.Contains(ip, "/")
829         if hasPrefix {
830                 netIP, network, err := net.ParseCIDR(ip)
831                 if err != nil {
832                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
833                 }
834                 maskSize, _ := network.Mask.Size()
835                 prefix.Len = byte(maskSize)
836                 prefix.Address, err = ParseAddress(netIP.String())
837                 if err != nil {
838                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
839                 }
840         } else {
841                 netIP := net.ParseIP(ip)
842                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
843                 if netIP.To4() == nil {
844                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
845                 }
846                 prefix.Len = byte(defaultMaskSize)
847                 prefix.Address, err = ParseAddress(netIP.String())
848                 if err != nil {
849                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
850                 }
851         }
852         return prefix, nil
853 }
854 func (x Prefix) ToIPNet() *net.IPNet {
855         var mask net.IPMask
856         if x.Address.Af == ADDRESS_IP4 {
857                 mask = net.CIDRMask(int(x.Len), 32)
858         } else {
859                 mask = net.CIDRMask(int(x.Len), 128)
860         }
861         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
862         return ipnet
863 }
864 func (x Prefix) String() string {
865         ip := x.Address.String()
866         return ip + "/" + strconv.Itoa(int(x.Len))
867 }
868 func (x *Prefix) MarshalText() ([]byte, error) {
869         return []byte(x.String()), nil
870 }
871 func (x *Prefix) UnmarshalText(text []byte) error {
872         prefix, err := ParsePrefix(string(text))
873         if err != nil {
874                 return err
875         }
876         *x = prefix
877         return nil
878 }
879
880 // PrefixMatcher defines type 'prefix_matcher'.
881 type PrefixMatcher struct {
882         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
883         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
884 }
885
886 // AddressUnion defines union 'address_union'.
887 type AddressUnion struct {
888         // IP4 *IP4Address
889         // IP6 *IP6Address
890         XXX_UnionData [16]byte
891 }
892
893 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
894         u.SetIP4(a)
895         return
896 }
897 func (u *AddressUnion) SetIP4(a IP4Address) {
898         buf := codec.NewBuffer(u.XXX_UnionData[:])
899         buf.EncodeBytes(a[:], 4)
900 }
901 func (u *AddressUnion) GetIP4() (a IP4Address) {
902         buf := codec.NewBuffer(u.XXX_UnionData[:])
903         copy(a[:], buf.DecodeBytes(4))
904         return
905 }
906
907 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
908         u.SetIP6(a)
909         return
910 }
911 func (u *AddressUnion) SetIP6(a IP6Address) {
912         buf := codec.NewBuffer(u.XXX_UnionData[:])
913         buf.EncodeBytes(a[:], 16)
914 }
915 func (u *AddressUnion) GetIP6() (a IP6Address) {
916         buf := codec.NewBuffer(u.XXX_UnionData[:])
917         copy(a[:], buf.DecodeBytes(16))
918         return
919 }
920
921 // IgmpClearInterface defines message 'igmp_clear_interface'.
922 type IgmpClearInterface struct {
923         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
924 }
925
926 func (m *IgmpClearInterface) Reset()               { *m = IgmpClearInterface{} }
927 func (*IgmpClearInterface) GetMessageName() string { return "igmp_clear_interface" }
928 func (*IgmpClearInterface) GetCrcString() string   { return "f9e6675e" }
929 func (*IgmpClearInterface) GetMessageType() api.MessageType {
930         return api.RequestMessage
931 }
932
933 func (m *IgmpClearInterface) Size() (size int) {
934         if m == nil {
935                 return 0
936         }
937         size += 4 // m.SwIfIndex
938         return size
939 }
940 func (m *IgmpClearInterface) Marshal(b []byte) ([]byte, error) {
941         if b == nil {
942                 b = make([]byte, m.Size())
943         }
944         buf := codec.NewBuffer(b)
945         buf.EncodeUint32(uint32(m.SwIfIndex))
946         return buf.Bytes(), nil
947 }
948 func (m *IgmpClearInterface) Unmarshal(b []byte) error {
949         buf := codec.NewBuffer(b)
950         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
951         return nil
952 }
953
954 // IgmpClearInterfaceReply defines message 'igmp_clear_interface_reply'.
955 type IgmpClearInterfaceReply struct {
956         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
957 }
958
959 func (m *IgmpClearInterfaceReply) Reset()               { *m = IgmpClearInterfaceReply{} }
960 func (*IgmpClearInterfaceReply) GetMessageName() string { return "igmp_clear_interface_reply" }
961 func (*IgmpClearInterfaceReply) GetCrcString() string   { return "e8d4e804" }
962 func (*IgmpClearInterfaceReply) GetMessageType() api.MessageType {
963         return api.ReplyMessage
964 }
965
966 func (m *IgmpClearInterfaceReply) Size() (size int) {
967         if m == nil {
968                 return 0
969         }
970         size += 4 // m.Retval
971         return size
972 }
973 func (m *IgmpClearInterfaceReply) Marshal(b []byte) ([]byte, error) {
974         if b == nil {
975                 b = make([]byte, m.Size())
976         }
977         buf := codec.NewBuffer(b)
978         buf.EncodeInt32(m.Retval)
979         return buf.Bytes(), nil
980 }
981 func (m *IgmpClearInterfaceReply) Unmarshal(b []byte) error {
982         buf := codec.NewBuffer(b)
983         m.Retval = buf.DecodeInt32()
984         return nil
985 }
986
987 // IgmpDetails defines message 'igmp_details'.
988 type IgmpDetails struct {
989         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
990         Saddr     IP4Address     `binapi:"ip4_address,name=saddr" json:"saddr,omitempty"`
991         Gaddr     IP4Address     `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"`
992 }
993
994 func (m *IgmpDetails) Reset()               { *m = IgmpDetails{} }
995 func (*IgmpDetails) GetMessageName() string { return "igmp_details" }
996 func (*IgmpDetails) GetCrcString() string   { return "52f12a89" }
997 func (*IgmpDetails) GetMessageType() api.MessageType {
998         return api.ReplyMessage
999 }
1000
1001 func (m *IgmpDetails) Size() (size int) {
1002         if m == nil {
1003                 return 0
1004         }
1005         size += 4     // m.SwIfIndex
1006         size += 1 * 4 // m.Saddr
1007         size += 1 * 4 // m.Gaddr
1008         return size
1009 }
1010 func (m *IgmpDetails) Marshal(b []byte) ([]byte, error) {
1011         if b == nil {
1012                 b = make([]byte, m.Size())
1013         }
1014         buf := codec.NewBuffer(b)
1015         buf.EncodeUint32(uint32(m.SwIfIndex))
1016         buf.EncodeBytes(m.Saddr[:], 4)
1017         buf.EncodeBytes(m.Gaddr[:], 4)
1018         return buf.Bytes(), nil
1019 }
1020 func (m *IgmpDetails) Unmarshal(b []byte) error {
1021         buf := codec.NewBuffer(b)
1022         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1023         copy(m.Saddr[:], buf.DecodeBytes(4))
1024         copy(m.Gaddr[:], buf.DecodeBytes(4))
1025         return nil
1026 }
1027
1028 // IgmpDump defines message 'igmp_dump'.
1029 type IgmpDump struct {
1030         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1031 }
1032
1033 func (m *IgmpDump) Reset()               { *m = IgmpDump{} }
1034 func (*IgmpDump) GetMessageName() string { return "igmp_dump" }
1035 func (*IgmpDump) GetCrcString() string   { return "f9e6675e" }
1036 func (*IgmpDump) GetMessageType() api.MessageType {
1037         return api.RequestMessage
1038 }
1039
1040 func (m *IgmpDump) Size() (size int) {
1041         if m == nil {
1042                 return 0
1043         }
1044         size += 4 // m.SwIfIndex
1045         return size
1046 }
1047 func (m *IgmpDump) Marshal(b []byte) ([]byte, error) {
1048         if b == nil {
1049                 b = make([]byte, m.Size())
1050         }
1051         buf := codec.NewBuffer(b)
1052         buf.EncodeUint32(uint32(m.SwIfIndex))
1053         return buf.Bytes(), nil
1054 }
1055 func (m *IgmpDump) Unmarshal(b []byte) error {
1056         buf := codec.NewBuffer(b)
1057         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1058         return nil
1059 }
1060
1061 // IgmpEnableDisable defines message 'igmp_enable_disable'.
1062 type IgmpEnableDisable struct {
1063         Enable    bool           `binapi:"bool,name=enable" json:"enable,omitempty"`
1064         Mode      uint8          `binapi:"u8,name=mode" json:"mode,omitempty"`
1065         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1066 }
1067
1068 func (m *IgmpEnableDisable) Reset()               { *m = IgmpEnableDisable{} }
1069 func (*IgmpEnableDisable) GetMessageName() string { return "igmp_enable_disable" }
1070 func (*IgmpEnableDisable) GetCrcString() string   { return "b1edfb96" }
1071 func (*IgmpEnableDisable) GetMessageType() api.MessageType {
1072         return api.RequestMessage
1073 }
1074
1075 func (m *IgmpEnableDisable) Size() (size int) {
1076         if m == nil {
1077                 return 0
1078         }
1079         size += 1 // m.Enable
1080         size += 1 // m.Mode
1081         size += 4 // m.SwIfIndex
1082         return size
1083 }
1084 func (m *IgmpEnableDisable) Marshal(b []byte) ([]byte, error) {
1085         if b == nil {
1086                 b = make([]byte, m.Size())
1087         }
1088         buf := codec.NewBuffer(b)
1089         buf.EncodeBool(m.Enable)
1090         buf.EncodeUint8(m.Mode)
1091         buf.EncodeUint32(uint32(m.SwIfIndex))
1092         return buf.Bytes(), nil
1093 }
1094 func (m *IgmpEnableDisable) Unmarshal(b []byte) error {
1095         buf := codec.NewBuffer(b)
1096         m.Enable = buf.DecodeBool()
1097         m.Mode = buf.DecodeUint8()
1098         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1099         return nil
1100 }
1101
1102 // IgmpEnableDisableReply defines message 'igmp_enable_disable_reply'.
1103 type IgmpEnableDisableReply struct {
1104         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1105 }
1106
1107 func (m *IgmpEnableDisableReply) Reset()               { *m = IgmpEnableDisableReply{} }
1108 func (*IgmpEnableDisableReply) GetMessageName() string { return "igmp_enable_disable_reply" }
1109 func (*IgmpEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
1110 func (*IgmpEnableDisableReply) GetMessageType() api.MessageType {
1111         return api.ReplyMessage
1112 }
1113
1114 func (m *IgmpEnableDisableReply) Size() (size int) {
1115         if m == nil {
1116                 return 0
1117         }
1118         size += 4 // m.Retval
1119         return size
1120 }
1121 func (m *IgmpEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1122         if b == nil {
1123                 b = make([]byte, m.Size())
1124         }
1125         buf := codec.NewBuffer(b)
1126         buf.EncodeInt32(m.Retval)
1127         return buf.Bytes(), nil
1128 }
1129 func (m *IgmpEnableDisableReply) Unmarshal(b []byte) error {
1130         buf := codec.NewBuffer(b)
1131         m.Retval = buf.DecodeInt32()
1132         return nil
1133 }
1134
1135 // IgmpEvent defines message 'igmp_event'.
1136 type IgmpEvent struct {
1137         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1138         Filter    FilterMode     `binapi:"filter_mode,name=filter" json:"filter,omitempty"`
1139         Saddr     IP4Address     `binapi:"ip4_address,name=saddr" json:"saddr,omitempty"`
1140         Gaddr     IP4Address     `binapi:"ip4_address,name=gaddr" json:"gaddr,omitempty"`
1141 }
1142
1143 func (m *IgmpEvent) Reset()               { *m = IgmpEvent{} }
1144 func (*IgmpEvent) GetMessageName() string { return "igmp_event" }
1145 func (*IgmpEvent) GetCrcString() string   { return "d7696eaf" }
1146 func (*IgmpEvent) GetMessageType() api.MessageType {
1147         return api.OtherMessage
1148 }
1149
1150 func (m *IgmpEvent) Size() (size int) {
1151         if m == nil {
1152                 return 0
1153         }
1154         size += 4     // m.SwIfIndex
1155         size += 4     // m.Filter
1156         size += 1 * 4 // m.Saddr
1157         size += 1 * 4 // m.Gaddr
1158         return size
1159 }
1160 func (m *IgmpEvent) Marshal(b []byte) ([]byte, error) {
1161         if b == nil {
1162                 b = make([]byte, m.Size())
1163         }
1164         buf := codec.NewBuffer(b)
1165         buf.EncodeUint32(uint32(m.SwIfIndex))
1166         buf.EncodeUint32(uint32(m.Filter))
1167         buf.EncodeBytes(m.Saddr[:], 4)
1168         buf.EncodeBytes(m.Gaddr[:], 4)
1169         return buf.Bytes(), nil
1170 }
1171 func (m *IgmpEvent) Unmarshal(b []byte) error {
1172         buf := codec.NewBuffer(b)
1173         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1174         m.Filter = FilterMode(buf.DecodeUint32())
1175         copy(m.Saddr[:], buf.DecodeBytes(4))
1176         copy(m.Gaddr[:], buf.DecodeBytes(4))
1177         return nil
1178 }
1179
1180 // IgmpGroupPrefixDetails defines message 'igmp_group_prefix_details'.
1181 type IgmpGroupPrefixDetails struct {
1182         Gp GroupPrefix `binapi:"group_prefix,name=gp" json:"gp,omitempty"`
1183 }
1184
1185 func (m *IgmpGroupPrefixDetails) Reset()               { *m = IgmpGroupPrefixDetails{} }
1186 func (*IgmpGroupPrefixDetails) GetMessageName() string { return "igmp_group_prefix_details" }
1187 func (*IgmpGroupPrefixDetails) GetCrcString() string   { return "c3b3c526" }
1188 func (*IgmpGroupPrefixDetails) GetMessageType() api.MessageType {
1189         return api.ReplyMessage
1190 }
1191
1192 func (m *IgmpGroupPrefixDetails) Size() (size int) {
1193         if m == nil {
1194                 return 0
1195         }
1196         size += 4      // m.Gp.Type
1197         size += 4      // m.Gp.Prefix.Address.Af
1198         size += 1 * 16 // m.Gp.Prefix.Address.Un
1199         size += 1      // m.Gp.Prefix.Len
1200         return size
1201 }
1202 func (m *IgmpGroupPrefixDetails) Marshal(b []byte) ([]byte, error) {
1203         if b == nil {
1204                 b = make([]byte, m.Size())
1205         }
1206         buf := codec.NewBuffer(b)
1207         buf.EncodeUint32(uint32(m.Gp.Type))
1208         buf.EncodeUint32(uint32(m.Gp.Prefix.Address.Af))
1209         buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 16)
1210         buf.EncodeUint8(m.Gp.Prefix.Len)
1211         return buf.Bytes(), nil
1212 }
1213 func (m *IgmpGroupPrefixDetails) Unmarshal(b []byte) error {
1214         buf := codec.NewBuffer(b)
1215         m.Gp.Type = GroupPrefixType(buf.DecodeUint32())
1216         m.Gp.Prefix.Address.Af = AddressFamily(buf.DecodeUint32())
1217         copy(m.Gp.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1218         m.Gp.Prefix.Len = buf.DecodeUint8()
1219         return nil
1220 }
1221
1222 // IgmpGroupPrefixDump defines message 'igmp_group_prefix_dump'.
1223 type IgmpGroupPrefixDump struct{}
1224
1225 func (m *IgmpGroupPrefixDump) Reset()               { *m = IgmpGroupPrefixDump{} }
1226 func (*IgmpGroupPrefixDump) GetMessageName() string { return "igmp_group_prefix_dump" }
1227 func (*IgmpGroupPrefixDump) GetCrcString() string   { return "51077d14" }
1228 func (*IgmpGroupPrefixDump) GetMessageType() api.MessageType {
1229         return api.RequestMessage
1230 }
1231
1232 func (m *IgmpGroupPrefixDump) Size() (size int) {
1233         if m == nil {
1234                 return 0
1235         }
1236         return size
1237 }
1238 func (m *IgmpGroupPrefixDump) Marshal(b []byte) ([]byte, error) {
1239         if b == nil {
1240                 b = make([]byte, m.Size())
1241         }
1242         buf := codec.NewBuffer(b)
1243         return buf.Bytes(), nil
1244 }
1245 func (m *IgmpGroupPrefixDump) Unmarshal(b []byte) error {
1246         return nil
1247 }
1248
1249 // IgmpGroupPrefixSet defines message 'igmp_group_prefix_set'.
1250 type IgmpGroupPrefixSet struct {
1251         Gp GroupPrefix `binapi:"group_prefix,name=gp" json:"gp,omitempty"`
1252 }
1253
1254 func (m *IgmpGroupPrefixSet) Reset()               { *m = IgmpGroupPrefixSet{} }
1255 func (*IgmpGroupPrefixSet) GetMessageName() string { return "igmp_group_prefix_set" }
1256 func (*IgmpGroupPrefixSet) GetCrcString() string   { return "d4f20ac5" }
1257 func (*IgmpGroupPrefixSet) GetMessageType() api.MessageType {
1258         return api.RequestMessage
1259 }
1260
1261 func (m *IgmpGroupPrefixSet) Size() (size int) {
1262         if m == nil {
1263                 return 0
1264         }
1265         size += 4      // m.Gp.Type
1266         size += 4      // m.Gp.Prefix.Address.Af
1267         size += 1 * 16 // m.Gp.Prefix.Address.Un
1268         size += 1      // m.Gp.Prefix.Len
1269         return size
1270 }
1271 func (m *IgmpGroupPrefixSet) Marshal(b []byte) ([]byte, error) {
1272         if b == nil {
1273                 b = make([]byte, m.Size())
1274         }
1275         buf := codec.NewBuffer(b)
1276         buf.EncodeUint32(uint32(m.Gp.Type))
1277         buf.EncodeUint32(uint32(m.Gp.Prefix.Address.Af))
1278         buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 16)
1279         buf.EncodeUint8(m.Gp.Prefix.Len)
1280         return buf.Bytes(), nil
1281 }
1282 func (m *IgmpGroupPrefixSet) Unmarshal(b []byte) error {
1283         buf := codec.NewBuffer(b)
1284         m.Gp.Type = GroupPrefixType(buf.DecodeUint32())
1285         m.Gp.Prefix.Address.Af = AddressFamily(buf.DecodeUint32())
1286         copy(m.Gp.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
1287         m.Gp.Prefix.Len = buf.DecodeUint8()
1288         return nil
1289 }
1290
1291 // IgmpGroupPrefixSetReply defines message 'igmp_group_prefix_set_reply'.
1292 type IgmpGroupPrefixSetReply struct {
1293         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1294 }
1295
1296 func (m *IgmpGroupPrefixSetReply) Reset()               { *m = IgmpGroupPrefixSetReply{} }
1297 func (*IgmpGroupPrefixSetReply) GetMessageName() string { return "igmp_group_prefix_set_reply" }
1298 func (*IgmpGroupPrefixSetReply) GetCrcString() string   { return "e8d4e804" }
1299 func (*IgmpGroupPrefixSetReply) GetMessageType() api.MessageType {
1300         return api.ReplyMessage
1301 }
1302
1303 func (m *IgmpGroupPrefixSetReply) Size() (size int) {
1304         if m == nil {
1305                 return 0
1306         }
1307         size += 4 // m.Retval
1308         return size
1309 }
1310 func (m *IgmpGroupPrefixSetReply) Marshal(b []byte) ([]byte, error) {
1311         if b == nil {
1312                 b = make([]byte, m.Size())
1313         }
1314         buf := codec.NewBuffer(b)
1315         buf.EncodeInt32(m.Retval)
1316         return buf.Bytes(), nil
1317 }
1318 func (m *IgmpGroupPrefixSetReply) Unmarshal(b []byte) error {
1319         buf := codec.NewBuffer(b)
1320         m.Retval = buf.DecodeInt32()
1321         return nil
1322 }
1323
1324 // IgmpListen defines message 'igmp_listen'.
1325 type IgmpListen struct {
1326         Group IgmpGroup `binapi:"igmp_group,name=group" json:"group,omitempty"`
1327 }
1328
1329 func (m *IgmpListen) Reset()               { *m = IgmpListen{} }
1330 func (*IgmpListen) GetMessageName() string { return "igmp_listen" }
1331 func (*IgmpListen) GetCrcString() string   { return "3f93a51a" }
1332 func (*IgmpListen) GetMessageType() api.MessageType {
1333         return api.RequestMessage
1334 }
1335
1336 func (m *IgmpListen) Size() (size int) {
1337         if m == nil {
1338                 return 0
1339         }
1340         size += 4     // m.Group.Filter
1341         size += 1     // m.Group.NSrcs
1342         size += 4     // m.Group.SwIfIndex
1343         size += 1 * 4 // m.Group.Gaddr
1344         for j2 := 0; j2 < len(m.Group.Saddrs); j2++ {
1345                 var s2 IP4Address
1346                 _ = s2
1347                 if j2 < len(m.Group.Saddrs) {
1348                         s2 = m.Group.Saddrs[j2]
1349                 }
1350                 size += 1 * 4 // s2
1351         }
1352         return size
1353 }
1354 func (m *IgmpListen) Marshal(b []byte) ([]byte, error) {
1355         if b == nil {
1356                 b = make([]byte, m.Size())
1357         }
1358         buf := codec.NewBuffer(b)
1359         buf.EncodeUint32(uint32(m.Group.Filter))
1360         buf.EncodeUint8(uint8(len(m.Group.Saddrs)))
1361         buf.EncodeUint32(uint32(m.Group.SwIfIndex))
1362         buf.EncodeBytes(m.Group.Gaddr[:], 4)
1363         for j1 := 0; j1 < len(m.Group.Saddrs); j1++ {
1364                 var v1 IP4Address // Saddrs
1365                 if j1 < len(m.Group.Saddrs) {
1366                         v1 = m.Group.Saddrs[j1]
1367                 }
1368                 buf.EncodeBytes(v1[:], 4)
1369         }
1370         return buf.Bytes(), nil
1371 }
1372 func (m *IgmpListen) Unmarshal(b []byte) error {
1373         buf := codec.NewBuffer(b)
1374         m.Group.Filter = FilterMode(buf.DecodeUint32())
1375         m.Group.NSrcs = buf.DecodeUint8()
1376         m.Group.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1377         copy(m.Group.Gaddr[:], buf.DecodeBytes(4))
1378         m.Group.Saddrs = make([]IP4Address, m.Group.NSrcs)
1379         for j1 := 0; j1 < len(m.Group.Saddrs); j1++ {
1380                 copy(m.Group.Saddrs[j1][:], buf.DecodeBytes(4))
1381         }
1382         return nil
1383 }
1384
1385 // IgmpListenReply defines message 'igmp_listen_reply'.
1386 type IgmpListenReply struct {
1387         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1388 }
1389
1390 func (m *IgmpListenReply) Reset()               { *m = IgmpListenReply{} }
1391 func (*IgmpListenReply) GetMessageName() string { return "igmp_listen_reply" }
1392 func (*IgmpListenReply) GetCrcString() string   { return "e8d4e804" }
1393 func (*IgmpListenReply) GetMessageType() api.MessageType {
1394         return api.ReplyMessage
1395 }
1396
1397 func (m *IgmpListenReply) Size() (size int) {
1398         if m == nil {
1399                 return 0
1400         }
1401         size += 4 // m.Retval
1402         return size
1403 }
1404 func (m *IgmpListenReply) Marshal(b []byte) ([]byte, error) {
1405         if b == nil {
1406                 b = make([]byte, m.Size())
1407         }
1408         buf := codec.NewBuffer(b)
1409         buf.EncodeInt32(m.Retval)
1410         return buf.Bytes(), nil
1411 }
1412 func (m *IgmpListenReply) Unmarshal(b []byte) error {
1413         buf := codec.NewBuffer(b)
1414         m.Retval = buf.DecodeInt32()
1415         return nil
1416 }
1417
1418 // IgmpProxyDeviceAddDel defines message 'igmp_proxy_device_add_del'.
1419 type IgmpProxyDeviceAddDel struct {
1420         Add       uint8          `binapi:"u8,name=add" json:"add,omitempty"`
1421         VrfID     uint32         `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
1422         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1423 }
1424
1425 func (m *IgmpProxyDeviceAddDel) Reset()               { *m = IgmpProxyDeviceAddDel{} }
1426 func (*IgmpProxyDeviceAddDel) GetMessageName() string { return "igmp_proxy_device_add_del" }
1427 func (*IgmpProxyDeviceAddDel) GetCrcString() string   { return "0b9be9ce" }
1428 func (*IgmpProxyDeviceAddDel) GetMessageType() api.MessageType {
1429         return api.RequestMessage
1430 }
1431
1432 func (m *IgmpProxyDeviceAddDel) Size() (size int) {
1433         if m == nil {
1434                 return 0
1435         }
1436         size += 1 // m.Add
1437         size += 4 // m.VrfID
1438         size += 4 // m.SwIfIndex
1439         return size
1440 }
1441 func (m *IgmpProxyDeviceAddDel) Marshal(b []byte) ([]byte, error) {
1442         if b == nil {
1443                 b = make([]byte, m.Size())
1444         }
1445         buf := codec.NewBuffer(b)
1446         buf.EncodeUint8(m.Add)
1447         buf.EncodeUint32(m.VrfID)
1448         buf.EncodeUint32(uint32(m.SwIfIndex))
1449         return buf.Bytes(), nil
1450 }
1451 func (m *IgmpProxyDeviceAddDel) Unmarshal(b []byte) error {
1452         buf := codec.NewBuffer(b)
1453         m.Add = buf.DecodeUint8()
1454         m.VrfID = buf.DecodeUint32()
1455         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1456         return nil
1457 }
1458
1459 // IgmpProxyDeviceAddDelInterface defines message 'igmp_proxy_device_add_del_interface'.
1460 type IgmpProxyDeviceAddDelInterface struct {
1461         Add       bool           `binapi:"bool,name=add" json:"add,omitempty"`
1462         VrfID     uint32         `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
1463         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1464 }
1465
1466 func (m *IgmpProxyDeviceAddDelInterface) Reset() { *m = IgmpProxyDeviceAddDelInterface{} }
1467 func (*IgmpProxyDeviceAddDelInterface) GetMessageName() string {
1468         return "igmp_proxy_device_add_del_interface"
1469 }
1470 func (*IgmpProxyDeviceAddDelInterface) GetCrcString() string { return "1a9ec24a" }
1471 func (*IgmpProxyDeviceAddDelInterface) GetMessageType() api.MessageType {
1472         return api.RequestMessage
1473 }
1474
1475 func (m *IgmpProxyDeviceAddDelInterface) Size() (size int) {
1476         if m == nil {
1477                 return 0
1478         }
1479         size += 1 // m.Add
1480         size += 4 // m.VrfID
1481         size += 4 // m.SwIfIndex
1482         return size
1483 }
1484 func (m *IgmpProxyDeviceAddDelInterface) Marshal(b []byte) ([]byte, error) {
1485         if b == nil {
1486                 b = make([]byte, m.Size())
1487         }
1488         buf := codec.NewBuffer(b)
1489         buf.EncodeBool(m.Add)
1490         buf.EncodeUint32(m.VrfID)
1491         buf.EncodeUint32(uint32(m.SwIfIndex))
1492         return buf.Bytes(), nil
1493 }
1494 func (m *IgmpProxyDeviceAddDelInterface) Unmarshal(b []byte) error {
1495         buf := codec.NewBuffer(b)
1496         m.Add = buf.DecodeBool()
1497         m.VrfID = buf.DecodeUint32()
1498         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1499         return nil
1500 }
1501
1502 // IgmpProxyDeviceAddDelInterfaceReply defines message 'igmp_proxy_device_add_del_interface_reply'.
1503 type IgmpProxyDeviceAddDelInterfaceReply struct {
1504         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1505 }
1506
1507 func (m *IgmpProxyDeviceAddDelInterfaceReply) Reset() { *m = IgmpProxyDeviceAddDelInterfaceReply{} }
1508 func (*IgmpProxyDeviceAddDelInterfaceReply) GetMessageName() string {
1509         return "igmp_proxy_device_add_del_interface_reply"
1510 }
1511 func (*IgmpProxyDeviceAddDelInterfaceReply) GetCrcString() string { return "e8d4e804" }
1512 func (*IgmpProxyDeviceAddDelInterfaceReply) GetMessageType() api.MessageType {
1513         return api.ReplyMessage
1514 }
1515
1516 func (m *IgmpProxyDeviceAddDelInterfaceReply) Size() (size int) {
1517         if m == nil {
1518                 return 0
1519         }
1520         size += 4 // m.Retval
1521         return size
1522 }
1523 func (m *IgmpProxyDeviceAddDelInterfaceReply) Marshal(b []byte) ([]byte, error) {
1524         if b == nil {
1525                 b = make([]byte, m.Size())
1526         }
1527         buf := codec.NewBuffer(b)
1528         buf.EncodeInt32(m.Retval)
1529         return buf.Bytes(), nil
1530 }
1531 func (m *IgmpProxyDeviceAddDelInterfaceReply) Unmarshal(b []byte) error {
1532         buf := codec.NewBuffer(b)
1533         m.Retval = buf.DecodeInt32()
1534         return nil
1535 }
1536
1537 // IgmpProxyDeviceAddDelReply defines message 'igmp_proxy_device_add_del_reply'.
1538 type IgmpProxyDeviceAddDelReply struct {
1539         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1540 }
1541
1542 func (m *IgmpProxyDeviceAddDelReply) Reset()               { *m = IgmpProxyDeviceAddDelReply{} }
1543 func (*IgmpProxyDeviceAddDelReply) GetMessageName() string { return "igmp_proxy_device_add_del_reply" }
1544 func (*IgmpProxyDeviceAddDelReply) GetCrcString() string   { return "e8d4e804" }
1545 func (*IgmpProxyDeviceAddDelReply) GetMessageType() api.MessageType {
1546         return api.ReplyMessage
1547 }
1548
1549 func (m *IgmpProxyDeviceAddDelReply) Size() (size int) {
1550         if m == nil {
1551                 return 0
1552         }
1553         size += 4 // m.Retval
1554         return size
1555 }
1556 func (m *IgmpProxyDeviceAddDelReply) Marshal(b []byte) ([]byte, error) {
1557         if b == nil {
1558                 b = make([]byte, m.Size())
1559         }
1560         buf := codec.NewBuffer(b)
1561         buf.EncodeInt32(m.Retval)
1562         return buf.Bytes(), nil
1563 }
1564 func (m *IgmpProxyDeviceAddDelReply) Unmarshal(b []byte) error {
1565         buf := codec.NewBuffer(b)
1566         m.Retval = buf.DecodeInt32()
1567         return nil
1568 }
1569
1570 // WantIgmpEvents defines message 'want_igmp_events'.
1571 type WantIgmpEvents struct {
1572         Enable uint32 `binapi:"u32,name=enable" json:"enable,omitempty"`
1573         PID    uint32 `binapi:"u32,name=pid" json:"pid,omitempty"`
1574 }
1575
1576 func (m *WantIgmpEvents) Reset()               { *m = WantIgmpEvents{} }
1577 func (*WantIgmpEvents) GetMessageName() string { return "want_igmp_events" }
1578 func (*WantIgmpEvents) GetCrcString() string   { return "cfaccc1f" }
1579 func (*WantIgmpEvents) GetMessageType() api.MessageType {
1580         return api.RequestMessage
1581 }
1582
1583 func (m *WantIgmpEvents) Size() (size int) {
1584         if m == nil {
1585                 return 0
1586         }
1587         size += 4 // m.Enable
1588         size += 4 // m.PID
1589         return size
1590 }
1591 func (m *WantIgmpEvents) Marshal(b []byte) ([]byte, error) {
1592         if b == nil {
1593                 b = make([]byte, m.Size())
1594         }
1595         buf := codec.NewBuffer(b)
1596         buf.EncodeUint32(m.Enable)
1597         buf.EncodeUint32(m.PID)
1598         return buf.Bytes(), nil
1599 }
1600 func (m *WantIgmpEvents) Unmarshal(b []byte) error {
1601         buf := codec.NewBuffer(b)
1602         m.Enable = buf.DecodeUint32()
1603         m.PID = buf.DecodeUint32()
1604         return nil
1605 }
1606
1607 // WantIgmpEventsReply defines message 'want_igmp_events_reply'.
1608 type WantIgmpEventsReply struct {
1609         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1610 }
1611
1612 func (m *WantIgmpEventsReply) Reset()               { *m = WantIgmpEventsReply{} }
1613 func (*WantIgmpEventsReply) GetMessageName() string { return "want_igmp_events_reply" }
1614 func (*WantIgmpEventsReply) GetCrcString() string   { return "e8d4e804" }
1615 func (*WantIgmpEventsReply) GetMessageType() api.MessageType {
1616         return api.ReplyMessage
1617 }
1618
1619 func (m *WantIgmpEventsReply) Size() (size int) {
1620         if m == nil {
1621                 return 0
1622         }
1623         size += 4 // m.Retval
1624         return size
1625 }
1626 func (m *WantIgmpEventsReply) Marshal(b []byte) ([]byte, error) {
1627         if b == nil {
1628                 b = make([]byte, m.Size())
1629         }
1630         buf := codec.NewBuffer(b)
1631         buf.EncodeInt32(m.Retval)
1632         return buf.Bytes(), nil
1633 }
1634 func (m *WantIgmpEventsReply) Unmarshal(b []byte) error {
1635         buf := codec.NewBuffer(b)
1636         m.Retval = buf.DecodeInt32()
1637         return nil
1638 }
1639
1640 func init() { file_igmp_binapi_init() }
1641 func file_igmp_binapi_init() {
1642         api.RegisterMessage((*IgmpClearInterface)(nil), "igmp_clear_interface_f9e6675e")
1643         api.RegisterMessage((*IgmpClearInterfaceReply)(nil), "igmp_clear_interface_reply_e8d4e804")
1644         api.RegisterMessage((*IgmpDetails)(nil), "igmp_details_52f12a89")
1645         api.RegisterMessage((*IgmpDump)(nil), "igmp_dump_f9e6675e")
1646         api.RegisterMessage((*IgmpEnableDisable)(nil), "igmp_enable_disable_b1edfb96")
1647         api.RegisterMessage((*IgmpEnableDisableReply)(nil), "igmp_enable_disable_reply_e8d4e804")
1648         api.RegisterMessage((*IgmpEvent)(nil), "igmp_event_d7696eaf")
1649         api.RegisterMessage((*IgmpGroupPrefixDetails)(nil), "igmp_group_prefix_details_c3b3c526")
1650         api.RegisterMessage((*IgmpGroupPrefixDump)(nil), "igmp_group_prefix_dump_51077d14")
1651         api.RegisterMessage((*IgmpGroupPrefixSet)(nil), "igmp_group_prefix_set_d4f20ac5")
1652         api.RegisterMessage((*IgmpGroupPrefixSetReply)(nil), "igmp_group_prefix_set_reply_e8d4e804")
1653         api.RegisterMessage((*IgmpListen)(nil), "igmp_listen_3f93a51a")
1654         api.RegisterMessage((*IgmpListenReply)(nil), "igmp_listen_reply_e8d4e804")
1655         api.RegisterMessage((*IgmpProxyDeviceAddDel)(nil), "igmp_proxy_device_add_del_0b9be9ce")
1656         api.RegisterMessage((*IgmpProxyDeviceAddDelInterface)(nil), "igmp_proxy_device_add_del_interface_1a9ec24a")
1657         api.RegisterMessage((*IgmpProxyDeviceAddDelInterfaceReply)(nil), "igmp_proxy_device_add_del_interface_reply_e8d4e804")
1658         api.RegisterMessage((*IgmpProxyDeviceAddDelReply)(nil), "igmp_proxy_device_add_del_reply_e8d4e804")
1659         api.RegisterMessage((*WantIgmpEvents)(nil), "want_igmp_events_cfaccc1f")
1660         api.RegisterMessage((*WantIgmpEventsReply)(nil), "want_igmp_events_reply_e8d4e804")
1661 }
1662
1663 // Messages returns list of all messages in this module.
1664 func AllMessages() []api.Message {
1665         return []api.Message{
1666                 (*IgmpClearInterface)(nil),
1667                 (*IgmpClearInterfaceReply)(nil),
1668                 (*IgmpDetails)(nil),
1669                 (*IgmpDump)(nil),
1670                 (*IgmpEnableDisable)(nil),
1671                 (*IgmpEnableDisableReply)(nil),
1672                 (*IgmpEvent)(nil),
1673                 (*IgmpGroupPrefixDetails)(nil),
1674                 (*IgmpGroupPrefixDump)(nil),
1675                 (*IgmpGroupPrefixSet)(nil),
1676                 (*IgmpGroupPrefixSetReply)(nil),
1677                 (*IgmpListen)(nil),
1678                 (*IgmpListenReply)(nil),
1679                 (*IgmpProxyDeviceAddDel)(nil),
1680                 (*IgmpProxyDeviceAddDelInterface)(nil),
1681                 (*IgmpProxyDeviceAddDelInterfaceReply)(nil),
1682                 (*IgmpProxyDeviceAddDelReply)(nil),
1683                 (*WantIgmpEvents)(nil),
1684                 (*WantIgmpEventsReply)(nil),
1685         }
1686 }