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