Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / tapv2 / tapv2.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/core/tapv2.api.json
6
7 // Package tapv2 contains generated bindings for API file tapv2.api.
8 //
9 // Contents:
10 //   7 aliases
11 //  11 enums
12 //   6 structs
13 //   1 union
14 //   6 messages
15 //
16 package tapv2
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    = "tapv2"
36         APIVersion = "3.0.0"
37         VersionCrc = 0x7d58f9a4
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 // IfStatusFlags defines enum 'if_status_flags'.
68 type IfStatusFlags uint32
69
70 const (
71         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
72         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
73 )
74
75 var (
76         IfStatusFlags_name = map[uint32]string{
77                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
78                 2: "IF_STATUS_API_FLAG_LINK_UP",
79         }
80         IfStatusFlags_value = map[string]uint32{
81                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
82                 "IF_STATUS_API_FLAG_LINK_UP":  2,
83         }
84 )
85
86 func (x IfStatusFlags) String() string {
87         s, ok := IfStatusFlags_name[uint32(x)]
88         if ok {
89                 return s
90         }
91         str := func(n uint32) string {
92                 s, ok := IfStatusFlags_name[uint32(n)]
93                 if ok {
94                         return s
95                 }
96                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
97         }
98         for i := uint32(0); i <= 32; i++ {
99                 val := uint32(x)
100                 if val&(1<<i) != 0 {
101                         if s != "" {
102                                 s += "|"
103                         }
104                         s += str(1 << i)
105                 }
106         }
107         if s == "" {
108                 return str(uint32(x))
109         }
110         return s
111 }
112
113 // IfType defines enum 'if_type'.
114 type IfType uint32
115
116 const (
117         IF_API_TYPE_HARDWARE IfType = 1
118         IF_API_TYPE_SUB      IfType = 2
119         IF_API_TYPE_P2P      IfType = 3
120         IF_API_TYPE_PIPE     IfType = 4
121 )
122
123 var (
124         IfType_name = map[uint32]string{
125                 1: "IF_API_TYPE_HARDWARE",
126                 2: "IF_API_TYPE_SUB",
127                 3: "IF_API_TYPE_P2P",
128                 4: "IF_API_TYPE_PIPE",
129         }
130         IfType_value = map[string]uint32{
131                 "IF_API_TYPE_HARDWARE": 1,
132                 "IF_API_TYPE_SUB":      2,
133                 "IF_API_TYPE_P2P":      3,
134                 "IF_API_TYPE_PIPE":     4,
135         }
136 )
137
138 func (x IfType) String() string {
139         s, ok := IfType_name[uint32(x)]
140         if ok {
141                 return s
142         }
143         return "IfType(" + strconv.Itoa(int(x)) + ")"
144 }
145
146 // IPDscp defines enum 'ip_dscp'.
147 type IPDscp uint8
148
149 const (
150         IP_API_DSCP_CS0  IPDscp = 0
151         IP_API_DSCP_CS1  IPDscp = 8
152         IP_API_DSCP_AF11 IPDscp = 10
153         IP_API_DSCP_AF12 IPDscp = 12
154         IP_API_DSCP_AF13 IPDscp = 14
155         IP_API_DSCP_CS2  IPDscp = 16
156         IP_API_DSCP_AF21 IPDscp = 18
157         IP_API_DSCP_AF22 IPDscp = 20
158         IP_API_DSCP_AF23 IPDscp = 22
159         IP_API_DSCP_CS3  IPDscp = 24
160         IP_API_DSCP_AF31 IPDscp = 26
161         IP_API_DSCP_AF32 IPDscp = 28
162         IP_API_DSCP_AF33 IPDscp = 30
163         IP_API_DSCP_CS4  IPDscp = 32
164         IP_API_DSCP_AF41 IPDscp = 34
165         IP_API_DSCP_AF42 IPDscp = 36
166         IP_API_DSCP_AF43 IPDscp = 38
167         IP_API_DSCP_CS5  IPDscp = 40
168         IP_API_DSCP_EF   IPDscp = 46
169         IP_API_DSCP_CS6  IPDscp = 48
170         IP_API_DSCP_CS7  IPDscp = 50
171 )
172
173 var (
174         IPDscp_name = map[uint8]string{
175                 0:  "IP_API_DSCP_CS0",
176                 8:  "IP_API_DSCP_CS1",
177                 10: "IP_API_DSCP_AF11",
178                 12: "IP_API_DSCP_AF12",
179                 14: "IP_API_DSCP_AF13",
180                 16: "IP_API_DSCP_CS2",
181                 18: "IP_API_DSCP_AF21",
182                 20: "IP_API_DSCP_AF22",
183                 22: "IP_API_DSCP_AF23",
184                 24: "IP_API_DSCP_CS3",
185                 26: "IP_API_DSCP_AF31",
186                 28: "IP_API_DSCP_AF32",
187                 30: "IP_API_DSCP_AF33",
188                 32: "IP_API_DSCP_CS4",
189                 34: "IP_API_DSCP_AF41",
190                 36: "IP_API_DSCP_AF42",
191                 38: "IP_API_DSCP_AF43",
192                 40: "IP_API_DSCP_CS5",
193                 46: "IP_API_DSCP_EF",
194                 48: "IP_API_DSCP_CS6",
195                 50: "IP_API_DSCP_CS7",
196         }
197         IPDscp_value = map[string]uint8{
198                 "IP_API_DSCP_CS0":  0,
199                 "IP_API_DSCP_CS1":  8,
200                 "IP_API_DSCP_AF11": 10,
201                 "IP_API_DSCP_AF12": 12,
202                 "IP_API_DSCP_AF13": 14,
203                 "IP_API_DSCP_CS2":  16,
204                 "IP_API_DSCP_AF21": 18,
205                 "IP_API_DSCP_AF22": 20,
206                 "IP_API_DSCP_AF23": 22,
207                 "IP_API_DSCP_CS3":  24,
208                 "IP_API_DSCP_AF31": 26,
209                 "IP_API_DSCP_AF32": 28,
210                 "IP_API_DSCP_AF33": 30,
211                 "IP_API_DSCP_CS4":  32,
212                 "IP_API_DSCP_AF41": 34,
213                 "IP_API_DSCP_AF42": 36,
214                 "IP_API_DSCP_AF43": 38,
215                 "IP_API_DSCP_CS5":  40,
216                 "IP_API_DSCP_EF":   46,
217                 "IP_API_DSCP_CS6":  48,
218                 "IP_API_DSCP_CS7":  50,
219         }
220 )
221
222 func (x IPDscp) String() string {
223         s, ok := IPDscp_name[uint8(x)]
224         if ok {
225                 return s
226         }
227         return "IPDscp(" + strconv.Itoa(int(x)) + ")"
228 }
229
230 // IPEcn defines enum 'ip_ecn'.
231 type IPEcn uint8
232
233 const (
234         IP_API_ECN_NONE IPEcn = 0
235         IP_API_ECN_ECT0 IPEcn = 1
236         IP_API_ECN_ECT1 IPEcn = 2
237         IP_API_ECN_CE   IPEcn = 3
238 )
239
240 var (
241         IPEcn_name = map[uint8]string{
242                 0: "IP_API_ECN_NONE",
243                 1: "IP_API_ECN_ECT0",
244                 2: "IP_API_ECN_ECT1",
245                 3: "IP_API_ECN_CE",
246         }
247         IPEcn_value = map[string]uint8{
248                 "IP_API_ECN_NONE": 0,
249                 "IP_API_ECN_ECT0": 1,
250                 "IP_API_ECN_ECT1": 2,
251                 "IP_API_ECN_CE":   3,
252         }
253 )
254
255 func (x IPEcn) String() string {
256         s, ok := IPEcn_name[uint8(x)]
257         if ok {
258                 return s
259         }
260         return "IPEcn(" + strconv.Itoa(int(x)) + ")"
261 }
262
263 // IPProto defines enum 'ip_proto'.
264 type IPProto uint32
265
266 const (
267         IP_API_PROTO_HOPOPT   IPProto = 0
268         IP_API_PROTO_ICMP     IPProto = 1
269         IP_API_PROTO_IGMP     IPProto = 2
270         IP_API_PROTO_TCP      IPProto = 6
271         IP_API_PROTO_UDP      IPProto = 17
272         IP_API_PROTO_GRE      IPProto = 47
273         IP_API_PROTO_AH       IPProto = 50
274         IP_API_PROTO_ESP      IPProto = 51
275         IP_API_PROTO_EIGRP    IPProto = 88
276         IP_API_PROTO_OSPF     IPProto = 89
277         IP_API_PROTO_SCTP     IPProto = 132
278         IP_API_PROTO_RESERVED IPProto = 255
279 )
280
281 var (
282         IPProto_name = map[uint32]string{
283                 0:   "IP_API_PROTO_HOPOPT",
284                 1:   "IP_API_PROTO_ICMP",
285                 2:   "IP_API_PROTO_IGMP",
286                 6:   "IP_API_PROTO_TCP",
287                 17:  "IP_API_PROTO_UDP",
288                 47:  "IP_API_PROTO_GRE",
289                 50:  "IP_API_PROTO_AH",
290                 51:  "IP_API_PROTO_ESP",
291                 88:  "IP_API_PROTO_EIGRP",
292                 89:  "IP_API_PROTO_OSPF",
293                 132: "IP_API_PROTO_SCTP",
294                 255: "IP_API_PROTO_RESERVED",
295         }
296         IPProto_value = map[string]uint32{
297                 "IP_API_PROTO_HOPOPT":   0,
298                 "IP_API_PROTO_ICMP":     1,
299                 "IP_API_PROTO_IGMP":     2,
300                 "IP_API_PROTO_TCP":      6,
301                 "IP_API_PROTO_UDP":      17,
302                 "IP_API_PROTO_GRE":      47,
303                 "IP_API_PROTO_AH":       50,
304                 "IP_API_PROTO_ESP":      51,
305                 "IP_API_PROTO_EIGRP":    88,
306                 "IP_API_PROTO_OSPF":     89,
307                 "IP_API_PROTO_SCTP":     132,
308                 "IP_API_PROTO_RESERVED": 255,
309         }
310 )
311
312 func (x IPProto) String() string {
313         s, ok := IPProto_name[uint32(x)]
314         if ok {
315                 return s
316         }
317         return "IPProto(" + strconv.Itoa(int(x)) + ")"
318 }
319
320 // LinkDuplex defines enum 'link_duplex'.
321 type LinkDuplex uint32
322
323 const (
324         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
325         LINK_DUPLEX_API_HALF    LinkDuplex = 1
326         LINK_DUPLEX_API_FULL    LinkDuplex = 2
327 )
328
329 var (
330         LinkDuplex_name = map[uint32]string{
331                 0: "LINK_DUPLEX_API_UNKNOWN",
332                 1: "LINK_DUPLEX_API_HALF",
333                 2: "LINK_DUPLEX_API_FULL",
334         }
335         LinkDuplex_value = map[string]uint32{
336                 "LINK_DUPLEX_API_UNKNOWN": 0,
337                 "LINK_DUPLEX_API_HALF":    1,
338                 "LINK_DUPLEX_API_FULL":    2,
339         }
340 )
341
342 func (x LinkDuplex) String() string {
343         s, ok := LinkDuplex_name[uint32(x)]
344         if ok {
345                 return s
346         }
347         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
348 }
349
350 // MtuProto defines enum 'mtu_proto'.
351 type MtuProto uint32
352
353 const (
354         MTU_PROTO_API_L3   MtuProto = 1
355         MTU_PROTO_API_IP4  MtuProto = 2
356         MTU_PROTO_API_IP6  MtuProto = 3
357         MTU_PROTO_API_MPLS MtuProto = 4
358         MTU_PROTO_API_N    MtuProto = 5
359 )
360
361 var (
362         MtuProto_name = map[uint32]string{
363                 1: "MTU_PROTO_API_L3",
364                 2: "MTU_PROTO_API_IP4",
365                 3: "MTU_PROTO_API_IP6",
366                 4: "MTU_PROTO_API_MPLS",
367                 5: "MTU_PROTO_API_N",
368         }
369         MtuProto_value = map[string]uint32{
370                 "MTU_PROTO_API_L3":   1,
371                 "MTU_PROTO_API_IP4":  2,
372                 "MTU_PROTO_API_IP6":  3,
373                 "MTU_PROTO_API_MPLS": 4,
374                 "MTU_PROTO_API_N":    5,
375         }
376 )
377
378 func (x MtuProto) String() string {
379         s, ok := MtuProto_name[uint32(x)]
380         if ok {
381                 return s
382         }
383         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
384 }
385
386 // RxMode defines enum 'rx_mode'.
387 type RxMode uint32
388
389 const (
390         RX_MODE_API_UNKNOWN   RxMode = 0
391         RX_MODE_API_POLLING   RxMode = 1
392         RX_MODE_API_INTERRUPT RxMode = 2
393         RX_MODE_API_ADAPTIVE  RxMode = 3
394         RX_MODE_API_DEFAULT   RxMode = 4
395 )
396
397 var (
398         RxMode_name = map[uint32]string{
399                 0: "RX_MODE_API_UNKNOWN",
400                 1: "RX_MODE_API_POLLING",
401                 2: "RX_MODE_API_INTERRUPT",
402                 3: "RX_MODE_API_ADAPTIVE",
403                 4: "RX_MODE_API_DEFAULT",
404         }
405         RxMode_value = map[string]uint32{
406                 "RX_MODE_API_UNKNOWN":   0,
407                 "RX_MODE_API_POLLING":   1,
408                 "RX_MODE_API_INTERRUPT": 2,
409                 "RX_MODE_API_ADAPTIVE":  3,
410                 "RX_MODE_API_DEFAULT":   4,
411         }
412 )
413
414 func (x RxMode) String() string {
415         s, ok := RxMode_name[uint32(x)]
416         if ok {
417                 return s
418         }
419         return "RxMode(" + strconv.Itoa(int(x)) + ")"
420 }
421
422 // SubIfFlags defines enum 'sub_if_flags'.
423 type SubIfFlags uint32
424
425 const (
426         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
427         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
428         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
429         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
430         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
431         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
432         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
433         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
434         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
435         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
436 )
437
438 var (
439         SubIfFlags_name = map[uint32]string{
440                 1:   "SUB_IF_API_FLAG_NO_TAGS",
441                 2:   "SUB_IF_API_FLAG_ONE_TAG",
442                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
443                 8:   "SUB_IF_API_FLAG_DOT1AD",
444                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
445                 32:  "SUB_IF_API_FLAG_DEFAULT",
446                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
447                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
448                 254: "SUB_IF_API_FLAG_MASK_VNET",
449                 256: "SUB_IF_API_FLAG_DOT1AH",
450         }
451         SubIfFlags_value = map[string]uint32{
452                 "SUB_IF_API_FLAG_NO_TAGS":           1,
453                 "SUB_IF_API_FLAG_ONE_TAG":           2,
454                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
455                 "SUB_IF_API_FLAG_DOT1AD":            8,
456                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
457                 "SUB_IF_API_FLAG_DEFAULT":           32,
458                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
459                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
460                 "SUB_IF_API_FLAG_MASK_VNET":         254,
461                 "SUB_IF_API_FLAG_DOT1AH":            256,
462         }
463 )
464
465 func (x SubIfFlags) String() string {
466         s, ok := SubIfFlags_name[uint32(x)]
467         if ok {
468                 return s
469         }
470         str := func(n uint32) string {
471                 s, ok := SubIfFlags_name[uint32(n)]
472                 if ok {
473                         return s
474                 }
475                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
476         }
477         for i := uint32(0); i <= 32; i++ {
478                 val := uint32(x)
479                 if val&(1<<i) != 0 {
480                         if s != "" {
481                                 s += "|"
482                         }
483                         s += str(1 << i)
484                 }
485         }
486         if s == "" {
487                 return str(uint32(x))
488         }
489         return s
490 }
491
492 // TapFlags defines enum 'tap_flags'.
493 type TapFlags uint32
494
495 const (
496         TAP_FLAG_GSO          TapFlags = 1
497         TAP_FLAG_CSUM_OFFLOAD TapFlags = 2
498 )
499
500 var (
501         TapFlags_name = map[uint32]string{
502                 1: "TAP_FLAG_GSO",
503                 2: "TAP_FLAG_CSUM_OFFLOAD",
504         }
505         TapFlags_value = map[string]uint32{
506                 "TAP_FLAG_GSO":          1,
507                 "TAP_FLAG_CSUM_OFFLOAD": 2,
508         }
509 )
510
511 func (x TapFlags) String() string {
512         s, ok := TapFlags_name[uint32(x)]
513         if ok {
514                 return s
515         }
516         str := func(n uint32) string {
517                 s, ok := TapFlags_name[uint32(n)]
518                 if ok {
519                         return s
520                 }
521                 return "TapFlags(" + strconv.Itoa(int(n)) + ")"
522         }
523         for i := uint32(0); i <= 32; i++ {
524                 val := uint32(x)
525                 if val&(1<<i) != 0 {
526                         if s != "" {
527                                 s += "|"
528                         }
529                         s += str(1 << i)
530                 }
531         }
532         if s == "" {
533                 return str(uint32(x))
534         }
535         return s
536 }
537
538 // AddressWithPrefix defines alias 'address_with_prefix'.
539 type AddressWithPrefix Prefix
540
541 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
542         prefix, err := ParsePrefix(s)
543         if err != nil {
544                 return AddressWithPrefix{}, err
545         }
546         return AddressWithPrefix(prefix), nil
547 }
548
549 func (x AddressWithPrefix) String() string {
550         return Prefix(x).String()
551 }
552
553 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
554         return []byte(x.String()), nil
555 }
556
557 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
558         prefix, err := ParseAddressWithPrefix(string(text))
559         if err != nil {
560                 return err
561         }
562         *x = prefix
563         return nil
564 }
565
566 // InterfaceIndex defines alias 'interface_index'.
567 type InterfaceIndex uint32
568
569 // IP4Address defines alias 'ip4_address'.
570 type IP4Address [4]uint8
571
572 func ParseIP4Address(s string) (IP4Address, error) {
573         ip := net.ParseIP(s).To4()
574         if ip == nil {
575                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
576         }
577         var ipaddr IP4Address
578         copy(ipaddr[:], ip.To4())
579         return ipaddr, nil
580 }
581
582 func (x IP4Address) ToIP() net.IP {
583         return net.IP(x[:]).To4()
584 }
585
586 func (x IP4Address) String() string {
587         return x.ToIP().String()
588 }
589
590 func (x *IP4Address) MarshalText() ([]byte, error) {
591         return []byte(x.String()), nil
592 }
593
594 func (x *IP4Address) UnmarshalText(text []byte) error {
595         ipaddr, err := ParseIP4Address(string(text))
596         if err != nil {
597                 return err
598         }
599         *x = ipaddr
600         return nil
601 }
602
603 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
604 type IP4AddressWithPrefix IP4Prefix
605
606 // IP6Address defines alias 'ip6_address'.
607 type IP6Address [16]uint8
608
609 func ParseIP6Address(s string) (IP6Address, error) {
610         ip := net.ParseIP(s).To16()
611         if ip == nil {
612                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
613         }
614         var ipaddr IP6Address
615         copy(ipaddr[:], ip.To16())
616         return ipaddr, nil
617 }
618
619 func (x IP6Address) ToIP() net.IP {
620         return net.IP(x[:]).To16()
621 }
622
623 func (x IP6Address) String() string {
624         return x.ToIP().String()
625 }
626
627 func (x *IP6Address) MarshalText() ([]byte, error) {
628         return []byte(x.String()), nil
629 }
630
631 func (x *IP6Address) UnmarshalText(text []byte) error {
632         ipaddr, err := ParseIP6Address(string(text))
633         if err != nil {
634                 return err
635         }
636         *x = ipaddr
637         return nil
638 }
639
640 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
641 type IP6AddressWithPrefix IP6Prefix
642
643 // MacAddress defines alias 'mac_address'.
644 type MacAddress [6]uint8
645
646 func ParseMacAddress(s string) (MacAddress, error) {
647         var macaddr MacAddress
648         mac, err := net.ParseMAC(s)
649         if err != nil {
650                 return macaddr, err
651         }
652         copy(macaddr[:], mac[:])
653         return macaddr, nil
654 }
655
656 func (x MacAddress) ToMAC() net.HardwareAddr {
657         return net.HardwareAddr(x[:])
658 }
659
660 func (x MacAddress) String() string {
661         return x.ToMAC().String()
662 }
663
664 func (x *MacAddress) MarshalText() ([]byte, error) {
665         return []byte(x.String()), nil
666 }
667
668 func (x *MacAddress) UnmarshalText(text []byte) error {
669         mac, err := ParseMacAddress(string(text))
670         if err != nil {
671                 return err
672         }
673         *x = mac
674         return nil
675 }
676
677 // Address defines type 'address'.
678 type Address struct {
679         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
680         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
681 }
682
683 func ParseAddress(s string) (Address, error) {
684         ip := net.ParseIP(s)
685         if ip == nil {
686                 return Address{}, fmt.Errorf("invalid address: %s", s)
687         }
688         return AddressFromIP(ip), nil
689 }
690
691 func AddressFromIP(ip net.IP) Address {
692         var addr Address
693         if ip.To4() == nil {
694                 addr.Af = ADDRESS_IP6
695                 var ip6 IP6Address
696                 copy(ip6[:], ip.To16())
697                 addr.Un.SetIP6(ip6)
698         } else {
699                 addr.Af = ADDRESS_IP4
700                 var ip4 IP4Address
701                 copy(ip4[:], ip.To4())
702                 addr.Un.SetIP4(ip4)
703         }
704         return addr
705 }
706
707 func (x Address) ToIP() net.IP {
708         if x.Af == ADDRESS_IP6 {
709                 ip6 := x.Un.GetIP6()
710                 return net.IP(ip6[:]).To16()
711         } else {
712                 ip4 := x.Un.GetIP4()
713                 return net.IP(ip4[:]).To4()
714         }
715 }
716
717 func (x Address) String() string {
718         return x.ToIP().String()
719 }
720
721 func (x *Address) MarshalText() ([]byte, error) {
722         return []byte(x.String()), nil
723 }
724
725 func (x *Address) UnmarshalText(text []byte) error {
726         addr, err := ParseAddress(string(text))
727         if err != nil {
728                 return err
729         }
730         *x = addr
731         return nil
732 }
733
734 // IP4Prefix defines type 'ip4_prefix'.
735 type IP4Prefix struct {
736         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
737         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
738 }
739
740 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
741         hasPrefix := strings.Contains(s, "/")
742         if hasPrefix {
743                 ip, network, err := net.ParseCIDR(s)
744                 if err != nil {
745                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
746                 }
747                 maskSize, _ := network.Mask.Size()
748                 prefix.Len = byte(maskSize)
749                 prefix.Address, err = ParseIP4Address(ip.String())
750                 if err != nil {
751                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
752                 }
753         } else {
754                 ip := net.ParseIP(s)
755                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
756                 if ip.To4() == nil {
757                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
758                 }
759                 prefix.Len = byte(defaultMaskSize)
760                 prefix.Address, err = ParseIP4Address(ip.String())
761                 if err != nil {
762                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
763                 }
764         }
765         return prefix, nil
766 }
767
768 func (x IP4Prefix) ToIPNet() *net.IPNet {
769         mask := net.CIDRMask(int(x.Len), 32)
770         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
771         return ipnet
772 }
773
774 func (x IP4Prefix) String() string {
775         ip := x.Address.String()
776         return ip + "/" + strconv.Itoa(int(x.Len))
777 }
778
779 func (x *IP4Prefix) MarshalText() ([]byte, error) {
780         return []byte(x.String()), nil
781 }
782
783 func (x *IP4Prefix) UnmarshalText(text []byte) error {
784         prefix, err := ParseIP4Prefix(string(text))
785         if err != nil {
786                 return err
787         }
788         *x = prefix
789         return nil
790 }
791
792 // IP6Prefix defines type 'ip6_prefix'.
793 type IP6Prefix struct {
794         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
795         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
796 }
797
798 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
799         hasPrefix := strings.Contains(s, "/")
800         if hasPrefix {
801                 ip, network, err := net.ParseCIDR(s)
802                 if err != nil {
803                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
804                 }
805                 maskSize, _ := network.Mask.Size()
806                 prefix.Len = byte(maskSize)
807                 prefix.Address, err = ParseIP6Address(ip.String())
808                 if err != nil {
809                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
810                 }
811         } else {
812                 ip := net.ParseIP(s)
813                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
814                 if ip.To4() == nil {
815                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
816                 }
817                 prefix.Len = byte(defaultMaskSize)
818                 prefix.Address, err = ParseIP6Address(ip.String())
819                 if err != nil {
820                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
821                 }
822         }
823         return prefix, nil
824 }
825
826 func (x IP6Prefix) ToIPNet() *net.IPNet {
827         mask := net.CIDRMask(int(x.Len), 128)
828         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
829         return ipnet
830 }
831
832 func (x IP6Prefix) String() string {
833         ip := x.Address.String()
834         return ip + "/" + strconv.Itoa(int(x.Len))
835 }
836
837 func (x *IP6Prefix) MarshalText() ([]byte, error) {
838         return []byte(x.String()), nil
839 }
840
841 func (x *IP6Prefix) UnmarshalText(text []byte) error {
842         prefix, err := ParseIP6Prefix(string(text))
843         if err != nil {
844                 return err
845         }
846         *x = prefix
847         return nil
848 }
849
850 // Mprefix defines type 'mprefix'.
851 type Mprefix struct {
852         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
853         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
854         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
855         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
856 }
857
858 // Prefix defines type 'prefix'.
859 type Prefix struct {
860         Address Address `binapi:"address,name=address" json:"address,omitempty"`
861         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
862 }
863
864 func ParsePrefix(ip string) (prefix Prefix, err error) {
865         hasPrefix := strings.Contains(ip, "/")
866         if hasPrefix {
867                 netIP, network, err := net.ParseCIDR(ip)
868                 if err != nil {
869                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
870                 }
871                 maskSize, _ := network.Mask.Size()
872                 prefix.Len = byte(maskSize)
873                 prefix.Address, err = ParseAddress(netIP.String())
874                 if err != nil {
875                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
876                 }
877         } else {
878                 netIP := net.ParseIP(ip)
879                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
880                 if netIP.To4() == nil {
881                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
882                 }
883                 prefix.Len = byte(defaultMaskSize)
884                 prefix.Address, err = ParseAddress(netIP.String())
885                 if err != nil {
886                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
887                 }
888         }
889         return prefix, nil
890 }
891
892 func (x Prefix) ToIPNet() *net.IPNet {
893         var mask net.IPMask
894         if x.Address.Af == ADDRESS_IP4 {
895                 mask = net.CIDRMask(int(x.Len), 32)
896         } else {
897                 mask = net.CIDRMask(int(x.Len), 128)
898         }
899         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
900         return ipnet
901 }
902
903 func (x Prefix) String() string {
904         ip := x.Address.String()
905         return ip + "/" + strconv.Itoa(int(x.Len))
906 }
907
908 func (x *Prefix) MarshalText() ([]byte, error) {
909         return []byte(x.String()), nil
910 }
911
912 func (x *Prefix) UnmarshalText(text []byte) error {
913         prefix, err := ParsePrefix(string(text))
914         if err != nil {
915                 return err
916         }
917         *x = prefix
918         return nil
919 }
920
921 // PrefixMatcher defines type 'prefix_matcher'.
922 type PrefixMatcher struct {
923         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
924         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
925 }
926
927 // AddressUnion defines union 'address_union'.
928 type AddressUnion struct {
929         // AddressUnion can be one of:
930         // - IP4 *IP4Address
931         // - IP6 *IP6Address
932         XXX_UnionData [16]byte
933 }
934
935 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
936         u.SetIP4(a)
937         return
938 }
939 func (u *AddressUnion) SetIP4(a IP4Address) {
940         buf := codec.NewBuffer(u.XXX_UnionData[:])
941         buf.EncodeBytes(a[:], 4)
942 }
943 func (u *AddressUnion) GetIP4() (a IP4Address) {
944         buf := codec.NewBuffer(u.XXX_UnionData[:])
945         copy(a[:], buf.DecodeBytes(4))
946         return
947 }
948
949 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
950         u.SetIP6(a)
951         return
952 }
953 func (u *AddressUnion) SetIP6(a IP6Address) {
954         buf := codec.NewBuffer(u.XXX_UnionData[:])
955         buf.EncodeBytes(a[:], 16)
956 }
957 func (u *AddressUnion) GetIP6() (a IP6Address) {
958         buf := codec.NewBuffer(u.XXX_UnionData[:])
959         copy(a[:], buf.DecodeBytes(16))
960         return
961 }
962
963 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'.
964 type SwInterfaceTapV2Details struct {
965         SwIfIndex     uint32               `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
966         ID            uint32               `binapi:"u32,name=id" json:"id,omitempty"`
967         TxRingSz      uint16               `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
968         RxRingSz      uint16               `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
969         HostMtuSize   uint32               `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
970         HostMacAddr   MacAddress           `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
971         HostIP4Prefix IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
972         HostIP6Prefix IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
973         TapFlags      TapFlags             `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
974         DevName       string               `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"`
975         HostIfName    string               `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
976         HostNamespace string               `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
977         HostBridge    string               `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
978 }
979
980 func (m *SwInterfaceTapV2Details) Reset()               { *m = SwInterfaceTapV2Details{} }
981 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" }
982 func (*SwInterfaceTapV2Details) GetCrcString() string   { return "e53c16de" }
983 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
984         return api.ReplyMessage
985 }
986
987 func (m *SwInterfaceTapV2Details) Size() (size int) {
988         if m == nil {
989                 return 0
990         }
991         size += 4      // m.SwIfIndex
992         size += 4      // m.ID
993         size += 2      // m.TxRingSz
994         size += 2      // m.RxRingSz
995         size += 4      // m.HostMtuSize
996         size += 1 * 6  // m.HostMacAddr
997         size += 1 * 4  // m.HostIP4Prefix.Address
998         size += 1      // m.HostIP4Prefix.Len
999         size += 1 * 16 // m.HostIP6Prefix.Address
1000         size += 1      // m.HostIP6Prefix.Len
1001         size += 4      // m.TapFlags
1002         size += 64     // m.DevName
1003         size += 64     // m.HostIfName
1004         size += 64     // m.HostNamespace
1005         size += 64     // m.HostBridge
1006         return size
1007 }
1008 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
1009         if b == nil {
1010                 b = make([]byte, m.Size())
1011         }
1012         buf := codec.NewBuffer(b)
1013         buf.EncodeUint32(m.SwIfIndex)
1014         buf.EncodeUint32(m.ID)
1015         buf.EncodeUint16(m.TxRingSz)
1016         buf.EncodeUint16(m.RxRingSz)
1017         buf.EncodeUint32(m.HostMtuSize)
1018         buf.EncodeBytes(m.HostMacAddr[:], 6)
1019         buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
1020         buf.EncodeUint8(m.HostIP4Prefix.Len)
1021         buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
1022         buf.EncodeUint8(m.HostIP6Prefix.Len)
1023         buf.EncodeUint32(uint32(m.TapFlags))
1024         buf.EncodeString(m.DevName, 64)
1025         buf.EncodeString(m.HostIfName, 64)
1026         buf.EncodeString(m.HostNamespace, 64)
1027         buf.EncodeString(m.HostBridge, 64)
1028         return buf.Bytes(), nil
1029 }
1030 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
1031         buf := codec.NewBuffer(b)
1032         m.SwIfIndex = buf.DecodeUint32()
1033         m.ID = buf.DecodeUint32()
1034         m.TxRingSz = buf.DecodeUint16()
1035         m.RxRingSz = buf.DecodeUint16()
1036         m.HostMtuSize = buf.DecodeUint32()
1037         copy(m.HostMacAddr[:], buf.DecodeBytes(6))
1038         copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
1039         m.HostIP4Prefix.Len = buf.DecodeUint8()
1040         copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
1041         m.HostIP6Prefix.Len = buf.DecodeUint8()
1042         m.TapFlags = TapFlags(buf.DecodeUint32())
1043         m.DevName = buf.DecodeString(64)
1044         m.HostIfName = buf.DecodeString(64)
1045         m.HostNamespace = buf.DecodeString(64)
1046         m.HostBridge = buf.DecodeString(64)
1047         return nil
1048 }
1049
1050 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
1051 type SwInterfaceTapV2Dump struct {
1052         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
1053 }
1054
1055 func (m *SwInterfaceTapV2Dump) Reset()               { *m = SwInterfaceTapV2Dump{} }
1056 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" }
1057 func (*SwInterfaceTapV2Dump) GetCrcString() string   { return "f9e6675e" }
1058 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
1059         return api.RequestMessage
1060 }
1061
1062 func (m *SwInterfaceTapV2Dump) Size() (size int) {
1063         if m == nil {
1064                 return 0
1065         }
1066         size += 4 // m.SwIfIndex
1067         return size
1068 }
1069 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
1070         if b == nil {
1071                 b = make([]byte, m.Size())
1072         }
1073         buf := codec.NewBuffer(b)
1074         buf.EncodeUint32(uint32(m.SwIfIndex))
1075         return buf.Bytes(), nil
1076 }
1077 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
1078         buf := codec.NewBuffer(b)
1079         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1080         return nil
1081 }
1082
1083 // TapCreateV2 defines message 'tap_create_v2'.
1084 type TapCreateV2 struct {
1085         ID               uint32               `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
1086         UseRandomMac     bool                 `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
1087         MacAddress       MacAddress           `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
1088         NumRxQueues      uint8                `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
1089         TxRingSz         uint16               `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
1090         RxRingSz         uint16               `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
1091         HostMtuSet       bool                 `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
1092         HostMtuSize      uint32               `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
1093         HostMacAddrSet   bool                 `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
1094         HostMacAddr      MacAddress           `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"`
1095         HostIP4PrefixSet bool                 `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"`
1096         HostIP4Prefix    IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"`
1097         HostIP6PrefixSet bool                 `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"`
1098         HostIP6Prefix    IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"`
1099         HostIP4GwSet     bool                 `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"`
1100         HostIP4Gw        IP4Address           `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"`
1101         HostIP6GwSet     bool                 `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"`
1102         HostIP6Gw        IP6Address           `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"`
1103         TapFlags         TapFlags             `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"`
1104         HostNamespaceSet bool                 `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"`
1105         HostNamespace    string               `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"`
1106         HostIfNameSet    bool                 `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"`
1107         HostIfName       string               `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
1108         HostBridgeSet    bool                 `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"`
1109         HostBridge       string               `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"`
1110         Tag              string               `binapi:"string[],name=tag" json:"tag,omitempty"`
1111 }
1112
1113 func (m *TapCreateV2) Reset()               { *m = TapCreateV2{} }
1114 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" }
1115 func (*TapCreateV2) GetCrcString() string   { return "445835fd" }
1116 func (*TapCreateV2) GetMessageType() api.MessageType {
1117         return api.RequestMessage
1118 }
1119
1120 func (m *TapCreateV2) Size() (size int) {
1121         if m == nil {
1122                 return 0
1123         }
1124         size += 4              // m.ID
1125         size += 1              // m.UseRandomMac
1126         size += 1 * 6          // m.MacAddress
1127         size += 1              // m.NumRxQueues
1128         size += 2              // m.TxRingSz
1129         size += 2              // m.RxRingSz
1130         size += 1              // m.HostMtuSet
1131         size += 4              // m.HostMtuSize
1132         size += 1              // m.HostMacAddrSet
1133         size += 1 * 6          // m.HostMacAddr
1134         size += 1              // m.HostIP4PrefixSet
1135         size += 1 * 4          // m.HostIP4Prefix.Address
1136         size += 1              // m.HostIP4Prefix.Len
1137         size += 1              // m.HostIP6PrefixSet
1138         size += 1 * 16         // m.HostIP6Prefix.Address
1139         size += 1              // m.HostIP6Prefix.Len
1140         size += 1              // m.HostIP4GwSet
1141         size += 1 * 4          // m.HostIP4Gw
1142         size += 1              // m.HostIP6GwSet
1143         size += 1 * 16         // m.HostIP6Gw
1144         size += 4              // m.TapFlags
1145         size += 1              // m.HostNamespaceSet
1146         size += 64             // m.HostNamespace
1147         size += 1              // m.HostIfNameSet
1148         size += 64             // m.HostIfName
1149         size += 1              // m.HostBridgeSet
1150         size += 64             // m.HostBridge
1151         size += 4 + len(m.Tag) // m.Tag
1152         return size
1153 }
1154 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
1155         if b == nil {
1156                 b = make([]byte, m.Size())
1157         }
1158         buf := codec.NewBuffer(b)
1159         buf.EncodeUint32(m.ID)
1160         buf.EncodeBool(m.UseRandomMac)
1161         buf.EncodeBytes(m.MacAddress[:], 6)
1162         buf.EncodeUint8(m.NumRxQueues)
1163         buf.EncodeUint16(m.TxRingSz)
1164         buf.EncodeUint16(m.RxRingSz)
1165         buf.EncodeBool(m.HostMtuSet)
1166         buf.EncodeUint32(m.HostMtuSize)
1167         buf.EncodeBool(m.HostMacAddrSet)
1168         buf.EncodeBytes(m.HostMacAddr[:], 6)
1169         buf.EncodeBool(m.HostIP4PrefixSet)
1170         buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
1171         buf.EncodeUint8(m.HostIP4Prefix.Len)
1172         buf.EncodeBool(m.HostIP6PrefixSet)
1173         buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
1174         buf.EncodeUint8(m.HostIP6Prefix.Len)
1175         buf.EncodeBool(m.HostIP4GwSet)
1176         buf.EncodeBytes(m.HostIP4Gw[:], 4)
1177         buf.EncodeBool(m.HostIP6GwSet)
1178         buf.EncodeBytes(m.HostIP6Gw[:], 16)
1179         buf.EncodeUint32(uint32(m.TapFlags))
1180         buf.EncodeBool(m.HostNamespaceSet)
1181         buf.EncodeString(m.HostNamespace, 64)
1182         buf.EncodeBool(m.HostIfNameSet)
1183         buf.EncodeString(m.HostIfName, 64)
1184         buf.EncodeBool(m.HostBridgeSet)
1185         buf.EncodeString(m.HostBridge, 64)
1186         buf.EncodeString(m.Tag, 0)
1187         return buf.Bytes(), nil
1188 }
1189 func (m *TapCreateV2) Unmarshal(b []byte) error {
1190         buf := codec.NewBuffer(b)
1191         m.ID = buf.DecodeUint32()
1192         m.UseRandomMac = buf.DecodeBool()
1193         copy(m.MacAddress[:], buf.DecodeBytes(6))
1194         m.NumRxQueues = buf.DecodeUint8()
1195         m.TxRingSz = buf.DecodeUint16()
1196         m.RxRingSz = buf.DecodeUint16()
1197         m.HostMtuSet = buf.DecodeBool()
1198         m.HostMtuSize = buf.DecodeUint32()
1199         m.HostMacAddrSet = buf.DecodeBool()
1200         copy(m.HostMacAddr[:], buf.DecodeBytes(6))
1201         m.HostIP4PrefixSet = buf.DecodeBool()
1202         copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4))
1203         m.HostIP4Prefix.Len = buf.DecodeUint8()
1204         m.HostIP6PrefixSet = buf.DecodeBool()
1205         copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16))
1206         m.HostIP6Prefix.Len = buf.DecodeUint8()
1207         m.HostIP4GwSet = buf.DecodeBool()
1208         copy(m.HostIP4Gw[:], buf.DecodeBytes(4))
1209         m.HostIP6GwSet = buf.DecodeBool()
1210         copy(m.HostIP6Gw[:], buf.DecodeBytes(16))
1211         m.TapFlags = TapFlags(buf.DecodeUint32())
1212         m.HostNamespaceSet = buf.DecodeBool()
1213         m.HostNamespace = buf.DecodeString(64)
1214         m.HostIfNameSet = buf.DecodeBool()
1215         m.HostIfName = buf.DecodeString(64)
1216         m.HostBridgeSet = buf.DecodeBool()
1217         m.HostBridge = buf.DecodeString(64)
1218         m.Tag = buf.DecodeString(0)
1219         return nil
1220 }
1221
1222 // TapCreateV2Reply defines message 'tap_create_v2_reply'.
1223 type TapCreateV2Reply struct {
1224         Retval    int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
1225         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1226 }
1227
1228 func (m *TapCreateV2Reply) Reset()               { *m = TapCreateV2Reply{} }
1229 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" }
1230 func (*TapCreateV2Reply) GetCrcString() string   { return "5383d31f" }
1231 func (*TapCreateV2Reply) GetMessageType() api.MessageType {
1232         return api.ReplyMessage
1233 }
1234
1235 func (m *TapCreateV2Reply) Size() (size int) {
1236         if m == nil {
1237                 return 0
1238         }
1239         size += 4 // m.Retval
1240         size += 4 // m.SwIfIndex
1241         return size
1242 }
1243 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
1244         if b == nil {
1245                 b = make([]byte, m.Size())
1246         }
1247         buf := codec.NewBuffer(b)
1248         buf.EncodeInt32(m.Retval)
1249         buf.EncodeUint32(uint32(m.SwIfIndex))
1250         return buf.Bytes(), nil
1251 }
1252 func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
1253         buf := codec.NewBuffer(b)
1254         m.Retval = buf.DecodeInt32()
1255         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1256         return nil
1257 }
1258
1259 // TapDeleteV2 defines message 'tap_delete_v2'.
1260 type TapDeleteV2 struct {
1261         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1262 }
1263
1264 func (m *TapDeleteV2) Reset()               { *m = TapDeleteV2{} }
1265 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" }
1266 func (*TapDeleteV2) GetCrcString() string   { return "f9e6675e" }
1267 func (*TapDeleteV2) GetMessageType() api.MessageType {
1268         return api.RequestMessage
1269 }
1270
1271 func (m *TapDeleteV2) Size() (size int) {
1272         if m == nil {
1273                 return 0
1274         }
1275         size += 4 // m.SwIfIndex
1276         return size
1277 }
1278 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
1279         if b == nil {
1280                 b = make([]byte, m.Size())
1281         }
1282         buf := codec.NewBuffer(b)
1283         buf.EncodeUint32(uint32(m.SwIfIndex))
1284         return buf.Bytes(), nil
1285 }
1286 func (m *TapDeleteV2) Unmarshal(b []byte) error {
1287         buf := codec.NewBuffer(b)
1288         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1289         return nil
1290 }
1291
1292 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'.
1293 type TapDeleteV2Reply struct {
1294         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1295 }
1296
1297 func (m *TapDeleteV2Reply) Reset()               { *m = TapDeleteV2Reply{} }
1298 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" }
1299 func (*TapDeleteV2Reply) GetCrcString() string   { return "e8d4e804" }
1300 func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
1301         return api.ReplyMessage
1302 }
1303
1304 func (m *TapDeleteV2Reply) Size() (size int) {
1305         if m == nil {
1306                 return 0
1307         }
1308         size += 4 // m.Retval
1309         return size
1310 }
1311 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
1312         if b == nil {
1313                 b = make([]byte, m.Size())
1314         }
1315         buf := codec.NewBuffer(b)
1316         buf.EncodeInt32(m.Retval)
1317         return buf.Bytes(), nil
1318 }
1319 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
1320         buf := codec.NewBuffer(b)
1321         m.Retval = buf.DecodeInt32()
1322         return nil
1323 }
1324
1325 func init() { file_tapv2_binapi_init() }
1326 func file_tapv2_binapi_init() {
1327         api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_e53c16de")
1328         api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e")
1329         api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_445835fd")
1330         api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f")
1331         api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e")
1332         api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804")
1333 }
1334
1335 // Messages returns list of all messages in this module.
1336 func AllMessages() []api.Message {
1337         return []api.Message{
1338                 (*SwInterfaceTapV2Details)(nil),
1339                 (*SwInterfaceTapV2Dump)(nil),
1340                 (*TapCreateV2)(nil),
1341                 (*TapCreateV2Reply)(nil),
1342                 (*TapDeleteV2)(nil),
1343                 (*TapDeleteV2Reply)(nil),
1344         }
1345 }