Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / qos / qos.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/qos.api.json
6
7 // Package qos contains generated bindings for API file qos.api.
8 //
9 // Contents:
10 //   6 aliases
11 //  11 enums
12 //  11 structs
13 //   1 union
14 //  19 messages
15 //
16 package qos
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    = "qos"
36         APIVersion = "1.1.1"
37         VersionCrc = 0x86291f7f
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 // QosSource defines enum 'qos_source'.
387 type QosSource uint8
388
389 const (
390         QOS_API_SOURCE_EXT  QosSource = 0
391         QOS_API_SOURCE_VLAN QosSource = 1
392         QOS_API_SOURCE_MPLS QosSource = 2
393         QOS_API_SOURCE_IP   QosSource = 3
394 )
395
396 var (
397         QosSource_name = map[uint8]string{
398                 0: "QOS_API_SOURCE_EXT",
399                 1: "QOS_API_SOURCE_VLAN",
400                 2: "QOS_API_SOURCE_MPLS",
401                 3: "QOS_API_SOURCE_IP",
402         }
403         QosSource_value = map[string]uint8{
404                 "QOS_API_SOURCE_EXT":  0,
405                 "QOS_API_SOURCE_VLAN": 1,
406                 "QOS_API_SOURCE_MPLS": 2,
407                 "QOS_API_SOURCE_IP":   3,
408         }
409 )
410
411 func (x QosSource) String() string {
412         s, ok := QosSource_name[uint8(x)]
413         if ok {
414                 return s
415         }
416         return "QosSource(" + strconv.Itoa(int(x)) + ")"
417 }
418
419 // RxMode defines enum 'rx_mode'.
420 type RxMode uint32
421
422 const (
423         RX_MODE_API_UNKNOWN   RxMode = 0
424         RX_MODE_API_POLLING   RxMode = 1
425         RX_MODE_API_INTERRUPT RxMode = 2
426         RX_MODE_API_ADAPTIVE  RxMode = 3
427         RX_MODE_API_DEFAULT   RxMode = 4
428 )
429
430 var (
431         RxMode_name = map[uint32]string{
432                 0: "RX_MODE_API_UNKNOWN",
433                 1: "RX_MODE_API_POLLING",
434                 2: "RX_MODE_API_INTERRUPT",
435                 3: "RX_MODE_API_ADAPTIVE",
436                 4: "RX_MODE_API_DEFAULT",
437         }
438         RxMode_value = map[string]uint32{
439                 "RX_MODE_API_UNKNOWN":   0,
440                 "RX_MODE_API_POLLING":   1,
441                 "RX_MODE_API_INTERRUPT": 2,
442                 "RX_MODE_API_ADAPTIVE":  3,
443                 "RX_MODE_API_DEFAULT":   4,
444         }
445 )
446
447 func (x RxMode) String() string {
448         s, ok := RxMode_name[uint32(x)]
449         if ok {
450                 return s
451         }
452         return "RxMode(" + strconv.Itoa(int(x)) + ")"
453 }
454
455 // SubIfFlags defines enum 'sub_if_flags'.
456 type SubIfFlags uint32
457
458 const (
459         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
460         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
461         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
462         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
463         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
464         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
465         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
466         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
467         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
468         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
469 )
470
471 var (
472         SubIfFlags_name = map[uint32]string{
473                 1:   "SUB_IF_API_FLAG_NO_TAGS",
474                 2:   "SUB_IF_API_FLAG_ONE_TAG",
475                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
476                 8:   "SUB_IF_API_FLAG_DOT1AD",
477                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
478                 32:  "SUB_IF_API_FLAG_DEFAULT",
479                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
480                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
481                 254: "SUB_IF_API_FLAG_MASK_VNET",
482                 256: "SUB_IF_API_FLAG_DOT1AH",
483         }
484         SubIfFlags_value = map[string]uint32{
485                 "SUB_IF_API_FLAG_NO_TAGS":           1,
486                 "SUB_IF_API_FLAG_ONE_TAG":           2,
487                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
488                 "SUB_IF_API_FLAG_DOT1AD":            8,
489                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
490                 "SUB_IF_API_FLAG_DEFAULT":           32,
491                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
492                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
493                 "SUB_IF_API_FLAG_MASK_VNET":         254,
494                 "SUB_IF_API_FLAG_DOT1AH":            256,
495         }
496 )
497
498 func (x SubIfFlags) String() string {
499         s, ok := SubIfFlags_name[uint32(x)]
500         if ok {
501                 return s
502         }
503         str := func(n uint32) string {
504                 s, ok := SubIfFlags_name[uint32(n)]
505                 if ok {
506                         return s
507                 }
508                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
509         }
510         for i := uint32(0); i <= 32; i++ {
511                 val := uint32(x)
512                 if val&(1<<i) != 0 {
513                         if s != "" {
514                                 s += "|"
515                         }
516                         s += str(1 << i)
517                 }
518         }
519         if s == "" {
520                 return str(uint32(x))
521         }
522         return s
523 }
524
525 // AddressWithPrefix defines alias 'address_with_prefix'.
526 type AddressWithPrefix Prefix
527
528 func ParseAddressWithPrefix(s string) (AddressWithPrefix, error) {
529         prefix, err := ParsePrefix(s)
530         if err != nil {
531                 return AddressWithPrefix{}, err
532         }
533         return AddressWithPrefix(prefix), nil
534 }
535
536 func (x AddressWithPrefix) String() string {
537         return Prefix(x).String()
538 }
539
540 func (x *AddressWithPrefix) MarshalText() ([]byte, error) {
541         return []byte(x.String()), nil
542 }
543
544 func (x *AddressWithPrefix) UnmarshalText(text []byte) error {
545         prefix, err := ParseAddressWithPrefix(string(text))
546         if err != nil {
547                 return err
548         }
549         *x = prefix
550         return nil
551 }
552
553 // InterfaceIndex defines alias 'interface_index'.
554 type InterfaceIndex uint32
555
556 // IP4Address defines alias 'ip4_address'.
557 type IP4Address [4]uint8
558
559 func ParseIP4Address(s string) (IP4Address, error) {
560         ip := net.ParseIP(s).To4()
561         if ip == nil {
562                 return IP4Address{}, fmt.Errorf("invalid IP address: %s", s)
563         }
564         var ipaddr IP4Address
565         copy(ipaddr[:], ip.To4())
566         return ipaddr, nil
567 }
568
569 func (x IP4Address) ToIP() net.IP {
570         return net.IP(x[:]).To4()
571 }
572
573 func (x IP4Address) String() string {
574         return x.ToIP().String()
575 }
576
577 func (x *IP4Address) MarshalText() ([]byte, error) {
578         return []byte(x.String()), nil
579 }
580
581 func (x *IP4Address) UnmarshalText(text []byte) error {
582         ipaddr, err := ParseIP4Address(string(text))
583         if err != nil {
584                 return err
585         }
586         *x = ipaddr
587         return nil
588 }
589
590 // IP4AddressWithPrefix defines alias 'ip4_address_with_prefix'.
591 type IP4AddressWithPrefix IP4Prefix
592
593 // IP6Address defines alias 'ip6_address'.
594 type IP6Address [16]uint8
595
596 func ParseIP6Address(s string) (IP6Address, error) {
597         ip := net.ParseIP(s).To16()
598         if ip == nil {
599                 return IP6Address{}, fmt.Errorf("invalid IP address: %s", s)
600         }
601         var ipaddr IP6Address
602         copy(ipaddr[:], ip.To16())
603         return ipaddr, nil
604 }
605
606 func (x IP6Address) ToIP() net.IP {
607         return net.IP(x[:]).To16()
608 }
609
610 func (x IP6Address) String() string {
611         return x.ToIP().String()
612 }
613
614 func (x *IP6Address) MarshalText() ([]byte, error) {
615         return []byte(x.String()), nil
616 }
617
618 func (x *IP6Address) UnmarshalText(text []byte) error {
619         ipaddr, err := ParseIP6Address(string(text))
620         if err != nil {
621                 return err
622         }
623         *x = ipaddr
624         return nil
625 }
626
627 // IP6AddressWithPrefix defines alias 'ip6_address_with_prefix'.
628 type IP6AddressWithPrefix IP6Prefix
629
630 // Address defines type 'address'.
631 type Address struct {
632         Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
633         Un AddressUnion  `binapi:"address_union,name=un" json:"un,omitempty"`
634 }
635
636 func ParseAddress(s string) (Address, error) {
637         ip := net.ParseIP(s)
638         if ip == nil {
639                 return Address{}, fmt.Errorf("invalid address: %s", s)
640         }
641         return AddressFromIP(ip), nil
642 }
643
644 func AddressFromIP(ip net.IP) Address {
645         var addr Address
646         if ip.To4() == nil {
647                 addr.Af = ADDRESS_IP6
648                 var ip6 IP6Address
649                 copy(ip6[:], ip.To16())
650                 addr.Un.SetIP6(ip6)
651         } else {
652                 addr.Af = ADDRESS_IP4
653                 var ip4 IP4Address
654                 copy(ip4[:], ip.To4())
655                 addr.Un.SetIP4(ip4)
656         }
657         return addr
658 }
659
660 func (x Address) ToIP() net.IP {
661         if x.Af == ADDRESS_IP6 {
662                 ip6 := x.Un.GetIP6()
663                 return net.IP(ip6[:]).To16()
664         } else {
665                 ip4 := x.Un.GetIP4()
666                 return net.IP(ip4[:]).To4()
667         }
668 }
669
670 func (x Address) String() string {
671         return x.ToIP().String()
672 }
673
674 func (x *Address) MarshalText() ([]byte, error) {
675         return []byte(x.String()), nil
676 }
677
678 func (x *Address) UnmarshalText(text []byte) error {
679         addr, err := ParseAddress(string(text))
680         if err != nil {
681                 return err
682         }
683         *x = addr
684         return nil
685 }
686
687 // IP4Prefix defines type 'ip4_prefix'.
688 type IP4Prefix struct {
689         Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"`
690         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
691 }
692
693 func ParseIP4Prefix(s string) (prefix IP4Prefix, err error) {
694         hasPrefix := strings.Contains(s, "/")
695         if hasPrefix {
696                 ip, network, err := net.ParseCIDR(s)
697                 if err != nil {
698                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
699                 }
700                 maskSize, _ := network.Mask.Size()
701                 prefix.Len = byte(maskSize)
702                 prefix.Address, err = ParseIP4Address(ip.String())
703                 if err != nil {
704                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
705                 }
706         } else {
707                 ip := net.ParseIP(s)
708                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
709                 if ip.To4() == nil {
710                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
711                 }
712                 prefix.Len = byte(defaultMaskSize)
713                 prefix.Address, err = ParseIP4Address(ip.String())
714                 if err != nil {
715                         return IP4Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
716                 }
717         }
718         return prefix, nil
719 }
720
721 func (x IP4Prefix) ToIPNet() *net.IPNet {
722         mask := net.CIDRMask(int(x.Len), 32)
723         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
724         return ipnet
725 }
726
727 func (x IP4Prefix) String() string {
728         ip := x.Address.String()
729         return ip + "/" + strconv.Itoa(int(x.Len))
730 }
731
732 func (x *IP4Prefix) MarshalText() ([]byte, error) {
733         return []byte(x.String()), nil
734 }
735
736 func (x *IP4Prefix) UnmarshalText(text []byte) error {
737         prefix, err := ParseIP4Prefix(string(text))
738         if err != nil {
739                 return err
740         }
741         *x = prefix
742         return nil
743 }
744
745 // IP6Prefix defines type 'ip6_prefix'.
746 type IP6Prefix struct {
747         Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"`
748         Len     uint8      `binapi:"u8,name=len" json:"len,omitempty"`
749 }
750
751 func ParseIP6Prefix(s string) (prefix IP6Prefix, err error) {
752         hasPrefix := strings.Contains(s, "/")
753         if hasPrefix {
754                 ip, network, err := net.ParseCIDR(s)
755                 if err != nil {
756                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
757                 }
758                 maskSize, _ := network.Mask.Size()
759                 prefix.Len = byte(maskSize)
760                 prefix.Address, err = ParseIP6Address(ip.String())
761                 if err != nil {
762                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
763                 }
764         } else {
765                 ip := net.ParseIP(s)
766                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
767                 if ip.To4() == nil {
768                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
769                 }
770                 prefix.Len = byte(defaultMaskSize)
771                 prefix.Address, err = ParseIP6Address(ip.String())
772                 if err != nil {
773                         return IP6Prefix{}, fmt.Errorf("invalid IP %s: %s", s, err)
774                 }
775         }
776         return prefix, nil
777 }
778
779 func (x IP6Prefix) ToIPNet() *net.IPNet {
780         mask := net.CIDRMask(int(x.Len), 128)
781         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
782         return ipnet
783 }
784
785 func (x IP6Prefix) String() string {
786         ip := x.Address.String()
787         return ip + "/" + strconv.Itoa(int(x.Len))
788 }
789
790 func (x *IP6Prefix) MarshalText() ([]byte, error) {
791         return []byte(x.String()), nil
792 }
793
794 func (x *IP6Prefix) UnmarshalText(text []byte) error {
795         prefix, err := ParseIP6Prefix(string(text))
796         if err != nil {
797                 return err
798         }
799         *x = prefix
800         return nil
801 }
802
803 // Mprefix defines type 'mprefix'.
804 type Mprefix struct {
805         Af               AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
806         GrpAddressLength uint16        `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"`
807         GrpAddress       AddressUnion  `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"`
808         SrcAddress       AddressUnion  `binapi:"address_union,name=src_address" json:"src_address,omitempty"`
809 }
810
811 // Prefix defines type 'prefix'.
812 type Prefix struct {
813         Address Address `binapi:"address,name=address" json:"address,omitempty"`
814         Len     uint8   `binapi:"u8,name=len" json:"len,omitempty"`
815 }
816
817 func ParsePrefix(ip string) (prefix Prefix, err error) {
818         hasPrefix := strings.Contains(ip, "/")
819         if hasPrefix {
820                 netIP, network, err := net.ParseCIDR(ip)
821                 if err != nil {
822                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
823                 }
824                 maskSize, _ := network.Mask.Size()
825                 prefix.Len = byte(maskSize)
826                 prefix.Address, err = ParseAddress(netIP.String())
827                 if err != nil {
828                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
829                 }
830         } else {
831                 netIP := net.ParseIP(ip)
832                 defaultMaskSize, _ := net.CIDRMask(32, 32).Size()
833                 if netIP.To4() == nil {
834                         defaultMaskSize, _ = net.CIDRMask(128, 128).Size()
835                 }
836                 prefix.Len = byte(defaultMaskSize)
837                 prefix.Address, err = ParseAddress(netIP.String())
838                 if err != nil {
839                         return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err)
840                 }
841         }
842         return prefix, nil
843 }
844
845 func (x Prefix) ToIPNet() *net.IPNet {
846         var mask net.IPMask
847         if x.Address.Af == ADDRESS_IP4 {
848                 mask = net.CIDRMask(int(x.Len), 32)
849         } else {
850                 mask = net.CIDRMask(int(x.Len), 128)
851         }
852         ipnet := &net.IPNet{IP: x.Address.ToIP(), Mask: mask}
853         return ipnet
854 }
855
856 func (x Prefix) String() string {
857         ip := x.Address.String()
858         return ip + "/" + strconv.Itoa(int(x.Len))
859 }
860
861 func (x *Prefix) MarshalText() ([]byte, error) {
862         return []byte(x.String()), nil
863 }
864
865 func (x *Prefix) UnmarshalText(text []byte) error {
866         prefix, err := ParsePrefix(string(text))
867         if err != nil {
868                 return err
869         }
870         *x = prefix
871         return nil
872 }
873
874 // PrefixMatcher defines type 'prefix_matcher'.
875 type PrefixMatcher struct {
876         Le uint8 `binapi:"u8,name=le" json:"le,omitempty"`
877         Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"`
878 }
879
880 // QosEgressMap defines type 'qos_egress_map'.
881 type QosEgressMap struct {
882         ID   uint32             `binapi:"u32,name=id" json:"id,omitempty"`
883         Rows [4]QosEgressMapRow `binapi:"qos_egress_map_row[4],name=rows" json:"rows,omitempty"`
884 }
885
886 // QosEgressMapRow defines type 'qos_egress_map_row'.
887 type QosEgressMapRow struct {
888         Outputs []byte `binapi:"u8[256],name=outputs" json:"outputs,omitempty"`
889 }
890
891 // QosMark defines type 'qos_mark'.
892 type QosMark struct {
893         SwIfIndex    uint32    `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
894         MapID        uint32    `binapi:"u32,name=map_id" json:"map_id,omitempty"`
895         OutputSource QosSource `binapi:"qos_source,name=output_source" json:"output_source,omitempty"`
896 }
897
898 // QosRecord defines type 'qos_record'.
899 type QosRecord struct {
900         SwIfIndex   InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
901         InputSource QosSource      `binapi:"qos_source,name=input_source" json:"input_source,omitempty"`
902 }
903
904 // QosStore defines type 'qos_store'.
905 type QosStore struct {
906         SwIfIndex   InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
907         InputSource QosSource      `binapi:"qos_source,name=input_source" json:"input_source,omitempty"`
908         Value       uint8          `binapi:"u8,name=value" json:"value,omitempty"`
909 }
910
911 // AddressUnion defines union 'address_union'.
912 type AddressUnion struct {
913         // AddressUnion can be one of:
914         // - IP4 *IP4Address
915         // - IP6 *IP6Address
916         XXX_UnionData [16]byte
917 }
918
919 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
920         u.SetIP4(a)
921         return
922 }
923 func (u *AddressUnion) SetIP4(a IP4Address) {
924         buf := codec.NewBuffer(u.XXX_UnionData[:])
925         buf.EncodeBytes(a[:], 4)
926 }
927 func (u *AddressUnion) GetIP4() (a IP4Address) {
928         buf := codec.NewBuffer(u.XXX_UnionData[:])
929         copy(a[:], buf.DecodeBytes(4))
930         return
931 }
932
933 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
934         u.SetIP6(a)
935         return
936 }
937 func (u *AddressUnion) SetIP6(a IP6Address) {
938         buf := codec.NewBuffer(u.XXX_UnionData[:])
939         buf.EncodeBytes(a[:], 16)
940 }
941 func (u *AddressUnion) GetIP6() (a IP6Address) {
942         buf := codec.NewBuffer(u.XXX_UnionData[:])
943         copy(a[:], buf.DecodeBytes(16))
944         return
945 }
946
947 // QosEgressMapDelete defines message 'qos_egress_map_delete'.
948 type QosEgressMapDelete struct {
949         ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
950 }
951
952 func (m *QosEgressMapDelete) Reset()               { *m = QosEgressMapDelete{} }
953 func (*QosEgressMapDelete) GetMessageName() string { return "qos_egress_map_delete" }
954 func (*QosEgressMapDelete) GetCrcString() string   { return "3a91bde5" }
955 func (*QosEgressMapDelete) GetMessageType() api.MessageType {
956         return api.RequestMessage
957 }
958
959 func (m *QosEgressMapDelete) Size() (size int) {
960         if m == nil {
961                 return 0
962         }
963         size += 4 // m.ID
964         return size
965 }
966 func (m *QosEgressMapDelete) Marshal(b []byte) ([]byte, error) {
967         if b == nil {
968                 b = make([]byte, m.Size())
969         }
970         buf := codec.NewBuffer(b)
971         buf.EncodeUint32(m.ID)
972         return buf.Bytes(), nil
973 }
974 func (m *QosEgressMapDelete) Unmarshal(b []byte) error {
975         buf := codec.NewBuffer(b)
976         m.ID = buf.DecodeUint32()
977         return nil
978 }
979
980 // QosEgressMapDeleteReply defines message 'qos_egress_map_delete_reply'.
981 type QosEgressMapDeleteReply struct {
982         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
983 }
984
985 func (m *QosEgressMapDeleteReply) Reset()               { *m = QosEgressMapDeleteReply{} }
986 func (*QosEgressMapDeleteReply) GetMessageName() string { return "qos_egress_map_delete_reply" }
987 func (*QosEgressMapDeleteReply) GetCrcString() string   { return "e8d4e804" }
988 func (*QosEgressMapDeleteReply) GetMessageType() api.MessageType {
989         return api.ReplyMessage
990 }
991
992 func (m *QosEgressMapDeleteReply) Size() (size int) {
993         if m == nil {
994                 return 0
995         }
996         size += 4 // m.Retval
997         return size
998 }
999 func (m *QosEgressMapDeleteReply) Marshal(b []byte) ([]byte, error) {
1000         if b == nil {
1001                 b = make([]byte, m.Size())
1002         }
1003         buf := codec.NewBuffer(b)
1004         buf.EncodeInt32(m.Retval)
1005         return buf.Bytes(), nil
1006 }
1007 func (m *QosEgressMapDeleteReply) Unmarshal(b []byte) error {
1008         buf := codec.NewBuffer(b)
1009         m.Retval = buf.DecodeInt32()
1010         return nil
1011 }
1012
1013 // QosEgressMapDetails defines message 'qos_egress_map_details'.
1014 type QosEgressMapDetails struct {
1015         Map QosEgressMap `binapi:"qos_egress_map,name=map" json:"map,omitempty"`
1016 }
1017
1018 func (m *QosEgressMapDetails) Reset()               { *m = QosEgressMapDetails{} }
1019 func (*QosEgressMapDetails) GetMessageName() string { return "qos_egress_map_details" }
1020 func (*QosEgressMapDetails) GetCrcString() string   { return "46c5653c" }
1021 func (*QosEgressMapDetails) GetMessageType() api.MessageType {
1022         return api.ReplyMessage
1023 }
1024
1025 func (m *QosEgressMapDetails) Size() (size int) {
1026         if m == nil {
1027                 return 0
1028         }
1029         size += 4 // m.Map.ID
1030         for j2 := 0; j2 < 4; j2++ {
1031                 size += 1 * 256 // m.Map.Rows[j2].Outputs
1032         }
1033         return size
1034 }
1035 func (m *QosEgressMapDetails) Marshal(b []byte) ([]byte, error) {
1036         if b == nil {
1037                 b = make([]byte, m.Size())
1038         }
1039         buf := codec.NewBuffer(b)
1040         buf.EncodeUint32(m.Map.ID)
1041         for j1 := 0; j1 < 4; j1++ {
1042                 buf.EncodeBytes(m.Map.Rows[j1].Outputs, 256)
1043         }
1044         return buf.Bytes(), nil
1045 }
1046 func (m *QosEgressMapDetails) Unmarshal(b []byte) error {
1047         buf := codec.NewBuffer(b)
1048         m.Map.ID = buf.DecodeUint32()
1049         for j1 := 0; j1 < 4; j1++ {
1050                 m.Map.Rows[j1].Outputs = make([]byte, 256)
1051                 copy(m.Map.Rows[j1].Outputs, buf.DecodeBytes(len(m.Map.Rows[j1].Outputs)))
1052         }
1053         return nil
1054 }
1055
1056 // QosEgressMapDump defines message 'qos_egress_map_dump'.
1057 type QosEgressMapDump struct{}
1058
1059 func (m *QosEgressMapDump) Reset()               { *m = QosEgressMapDump{} }
1060 func (*QosEgressMapDump) GetMessageName() string { return "qos_egress_map_dump" }
1061 func (*QosEgressMapDump) GetCrcString() string   { return "51077d14" }
1062 func (*QosEgressMapDump) GetMessageType() api.MessageType {
1063         return api.RequestMessage
1064 }
1065
1066 func (m *QosEgressMapDump) Size() (size int) {
1067         if m == nil {
1068                 return 0
1069         }
1070         return size
1071 }
1072 func (m *QosEgressMapDump) Marshal(b []byte) ([]byte, error) {
1073         if b == nil {
1074                 b = make([]byte, m.Size())
1075         }
1076         buf := codec.NewBuffer(b)
1077         return buf.Bytes(), nil
1078 }
1079 func (m *QosEgressMapDump) Unmarshal(b []byte) error {
1080         return nil
1081 }
1082
1083 // QosEgressMapUpdate defines message 'qos_egress_map_update'.
1084 type QosEgressMapUpdate struct {
1085         Map QosEgressMap `binapi:"qos_egress_map,name=map" json:"map,omitempty"`
1086 }
1087
1088 func (m *QosEgressMapUpdate) Reset()               { *m = QosEgressMapUpdate{} }
1089 func (*QosEgressMapUpdate) GetMessageName() string { return "qos_egress_map_update" }
1090 func (*QosEgressMapUpdate) GetCrcString() string   { return "6d1c065f" }
1091 func (*QosEgressMapUpdate) GetMessageType() api.MessageType {
1092         return api.RequestMessage
1093 }
1094
1095 func (m *QosEgressMapUpdate) Size() (size int) {
1096         if m == nil {
1097                 return 0
1098         }
1099         size += 4 // m.Map.ID
1100         for j2 := 0; j2 < 4; j2++ {
1101                 size += 1 * 256 // m.Map.Rows[j2].Outputs
1102         }
1103         return size
1104 }
1105 func (m *QosEgressMapUpdate) Marshal(b []byte) ([]byte, error) {
1106         if b == nil {
1107                 b = make([]byte, m.Size())
1108         }
1109         buf := codec.NewBuffer(b)
1110         buf.EncodeUint32(m.Map.ID)
1111         for j1 := 0; j1 < 4; j1++ {
1112                 buf.EncodeBytes(m.Map.Rows[j1].Outputs, 256)
1113         }
1114         return buf.Bytes(), nil
1115 }
1116 func (m *QosEgressMapUpdate) Unmarshal(b []byte) error {
1117         buf := codec.NewBuffer(b)
1118         m.Map.ID = buf.DecodeUint32()
1119         for j1 := 0; j1 < 4; j1++ {
1120                 m.Map.Rows[j1].Outputs = make([]byte, 256)
1121                 copy(m.Map.Rows[j1].Outputs, buf.DecodeBytes(len(m.Map.Rows[j1].Outputs)))
1122         }
1123         return nil
1124 }
1125
1126 // QosEgressMapUpdateReply defines message 'qos_egress_map_update_reply'.
1127 type QosEgressMapUpdateReply struct {
1128         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1129 }
1130
1131 func (m *QosEgressMapUpdateReply) Reset()               { *m = QosEgressMapUpdateReply{} }
1132 func (*QosEgressMapUpdateReply) GetMessageName() string { return "qos_egress_map_update_reply" }
1133 func (*QosEgressMapUpdateReply) GetCrcString() string   { return "e8d4e804" }
1134 func (*QosEgressMapUpdateReply) GetMessageType() api.MessageType {
1135         return api.ReplyMessage
1136 }
1137
1138 func (m *QosEgressMapUpdateReply) Size() (size int) {
1139         if m == nil {
1140                 return 0
1141         }
1142         size += 4 // m.Retval
1143         return size
1144 }
1145 func (m *QosEgressMapUpdateReply) Marshal(b []byte) ([]byte, error) {
1146         if b == nil {
1147                 b = make([]byte, m.Size())
1148         }
1149         buf := codec.NewBuffer(b)
1150         buf.EncodeInt32(m.Retval)
1151         return buf.Bytes(), nil
1152 }
1153 func (m *QosEgressMapUpdateReply) Unmarshal(b []byte) error {
1154         buf := codec.NewBuffer(b)
1155         m.Retval = buf.DecodeInt32()
1156         return nil
1157 }
1158
1159 // QosMarkDetails defines message 'qos_mark_details'.
1160 type QosMarkDetails struct {
1161         Mark QosMark `binapi:"qos_mark,name=mark" json:"mark,omitempty"`
1162 }
1163
1164 func (m *QosMarkDetails) Reset()               { *m = QosMarkDetails{} }
1165 func (*QosMarkDetails) GetMessageName() string { return "qos_mark_details" }
1166 func (*QosMarkDetails) GetCrcString() string   { return "89fe81a9" }
1167 func (*QosMarkDetails) GetMessageType() api.MessageType {
1168         return api.ReplyMessage
1169 }
1170
1171 func (m *QosMarkDetails) Size() (size int) {
1172         if m == nil {
1173                 return 0
1174         }
1175         size += 4 // m.Mark.SwIfIndex
1176         size += 4 // m.Mark.MapID
1177         size += 1 // m.Mark.OutputSource
1178         return size
1179 }
1180 func (m *QosMarkDetails) Marshal(b []byte) ([]byte, error) {
1181         if b == nil {
1182                 b = make([]byte, m.Size())
1183         }
1184         buf := codec.NewBuffer(b)
1185         buf.EncodeUint32(m.Mark.SwIfIndex)
1186         buf.EncodeUint32(m.Mark.MapID)
1187         buf.EncodeUint8(uint8(m.Mark.OutputSource))
1188         return buf.Bytes(), nil
1189 }
1190 func (m *QosMarkDetails) Unmarshal(b []byte) error {
1191         buf := codec.NewBuffer(b)
1192         m.Mark.SwIfIndex = buf.DecodeUint32()
1193         m.Mark.MapID = buf.DecodeUint32()
1194         m.Mark.OutputSource = QosSource(buf.DecodeUint8())
1195         return nil
1196 }
1197
1198 // QosMarkDetailsReply defines message 'qos_mark_details_reply'.
1199 type QosMarkDetailsReply struct {
1200         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1201 }
1202
1203 func (m *QosMarkDetailsReply) Reset()               { *m = QosMarkDetailsReply{} }
1204 func (*QosMarkDetailsReply) GetMessageName() string { return "qos_mark_details_reply" }
1205 func (*QosMarkDetailsReply) GetCrcString() string   { return "e8d4e804" }
1206 func (*QosMarkDetailsReply) GetMessageType() api.MessageType {
1207         return api.ReplyMessage
1208 }
1209
1210 func (m *QosMarkDetailsReply) Size() (size int) {
1211         if m == nil {
1212                 return 0
1213         }
1214         size += 4 // m.Retval
1215         return size
1216 }
1217 func (m *QosMarkDetailsReply) Marshal(b []byte) ([]byte, error) {
1218         if b == nil {
1219                 b = make([]byte, m.Size())
1220         }
1221         buf := codec.NewBuffer(b)
1222         buf.EncodeInt32(m.Retval)
1223         return buf.Bytes(), nil
1224 }
1225 func (m *QosMarkDetailsReply) Unmarshal(b []byte) error {
1226         buf := codec.NewBuffer(b)
1227         m.Retval = buf.DecodeInt32()
1228         return nil
1229 }
1230
1231 // QosMarkDump defines message 'qos_mark_dump'.
1232 type QosMarkDump struct {
1233         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
1234 }
1235
1236 func (m *QosMarkDump) Reset()               { *m = QosMarkDump{} }
1237 func (*QosMarkDump) GetMessageName() string { return "qos_mark_dump" }
1238 func (*QosMarkDump) GetCrcString() string   { return "f9e6675e" }
1239 func (*QosMarkDump) GetMessageType() api.MessageType {
1240         return api.RequestMessage
1241 }
1242
1243 func (m *QosMarkDump) Size() (size int) {
1244         if m == nil {
1245                 return 0
1246         }
1247         size += 4 // m.SwIfIndex
1248         return size
1249 }
1250 func (m *QosMarkDump) Marshal(b []byte) ([]byte, error) {
1251         if b == nil {
1252                 b = make([]byte, m.Size())
1253         }
1254         buf := codec.NewBuffer(b)
1255         buf.EncodeUint32(uint32(m.SwIfIndex))
1256         return buf.Bytes(), nil
1257 }
1258 func (m *QosMarkDump) Unmarshal(b []byte) error {
1259         buf := codec.NewBuffer(b)
1260         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1261         return nil
1262 }
1263
1264 // QosMarkEnableDisable defines message 'qos_mark_enable_disable'.
1265 type QosMarkEnableDisable struct {
1266         Enable bool    `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1267         Mark   QosMark `binapi:"qos_mark,name=mark" json:"mark,omitempty"`
1268 }
1269
1270 func (m *QosMarkEnableDisable) Reset()               { *m = QosMarkEnableDisable{} }
1271 func (*QosMarkEnableDisable) GetMessageName() string { return "qos_mark_enable_disable" }
1272 func (*QosMarkEnableDisable) GetCrcString() string   { return "1a010f74" }
1273 func (*QosMarkEnableDisable) GetMessageType() api.MessageType {
1274         return api.RequestMessage
1275 }
1276
1277 func (m *QosMarkEnableDisable) Size() (size int) {
1278         if m == nil {
1279                 return 0
1280         }
1281         size += 1 // m.Enable
1282         size += 4 // m.Mark.SwIfIndex
1283         size += 4 // m.Mark.MapID
1284         size += 1 // m.Mark.OutputSource
1285         return size
1286 }
1287 func (m *QosMarkEnableDisable) Marshal(b []byte) ([]byte, error) {
1288         if b == nil {
1289                 b = make([]byte, m.Size())
1290         }
1291         buf := codec.NewBuffer(b)
1292         buf.EncodeBool(m.Enable)
1293         buf.EncodeUint32(m.Mark.SwIfIndex)
1294         buf.EncodeUint32(m.Mark.MapID)
1295         buf.EncodeUint8(uint8(m.Mark.OutputSource))
1296         return buf.Bytes(), nil
1297 }
1298 func (m *QosMarkEnableDisable) Unmarshal(b []byte) error {
1299         buf := codec.NewBuffer(b)
1300         m.Enable = buf.DecodeBool()
1301         m.Mark.SwIfIndex = buf.DecodeUint32()
1302         m.Mark.MapID = buf.DecodeUint32()
1303         m.Mark.OutputSource = QosSource(buf.DecodeUint8())
1304         return nil
1305 }
1306
1307 // QosMarkEnableDisableReply defines message 'qos_mark_enable_disable_reply'.
1308 type QosMarkEnableDisableReply struct {
1309         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1310 }
1311
1312 func (m *QosMarkEnableDisableReply) Reset()               { *m = QosMarkEnableDisableReply{} }
1313 func (*QosMarkEnableDisableReply) GetMessageName() string { return "qos_mark_enable_disable_reply" }
1314 func (*QosMarkEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
1315 func (*QosMarkEnableDisableReply) GetMessageType() api.MessageType {
1316         return api.ReplyMessage
1317 }
1318
1319 func (m *QosMarkEnableDisableReply) Size() (size int) {
1320         if m == nil {
1321                 return 0
1322         }
1323         size += 4 // m.Retval
1324         return size
1325 }
1326 func (m *QosMarkEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1327         if b == nil {
1328                 b = make([]byte, m.Size())
1329         }
1330         buf := codec.NewBuffer(b)
1331         buf.EncodeInt32(m.Retval)
1332         return buf.Bytes(), nil
1333 }
1334 func (m *QosMarkEnableDisableReply) Unmarshal(b []byte) error {
1335         buf := codec.NewBuffer(b)
1336         m.Retval = buf.DecodeInt32()
1337         return nil
1338 }
1339
1340 // QosRecordDetails defines message 'qos_record_details'.
1341 type QosRecordDetails struct {
1342         Record QosRecord `binapi:"qos_record,name=record" json:"record,omitempty"`
1343 }
1344
1345 func (m *QosRecordDetails) Reset()               { *m = QosRecordDetails{} }
1346 func (*QosRecordDetails) GetMessageName() string { return "qos_record_details" }
1347 func (*QosRecordDetails) GetCrcString() string   { return "4956ccdd" }
1348 func (*QosRecordDetails) GetMessageType() api.MessageType {
1349         return api.ReplyMessage
1350 }
1351
1352 func (m *QosRecordDetails) Size() (size int) {
1353         if m == nil {
1354                 return 0
1355         }
1356         size += 4 // m.Record.SwIfIndex
1357         size += 1 // m.Record.InputSource
1358         return size
1359 }
1360 func (m *QosRecordDetails) Marshal(b []byte) ([]byte, error) {
1361         if b == nil {
1362                 b = make([]byte, m.Size())
1363         }
1364         buf := codec.NewBuffer(b)
1365         buf.EncodeUint32(uint32(m.Record.SwIfIndex))
1366         buf.EncodeUint8(uint8(m.Record.InputSource))
1367         return buf.Bytes(), nil
1368 }
1369 func (m *QosRecordDetails) Unmarshal(b []byte) error {
1370         buf := codec.NewBuffer(b)
1371         m.Record.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1372         m.Record.InputSource = QosSource(buf.DecodeUint8())
1373         return nil
1374 }
1375
1376 // QosRecordDump defines message 'qos_record_dump'.
1377 type QosRecordDump struct{}
1378
1379 func (m *QosRecordDump) Reset()               { *m = QosRecordDump{} }
1380 func (*QosRecordDump) GetMessageName() string { return "qos_record_dump" }
1381 func (*QosRecordDump) GetCrcString() string   { return "51077d14" }
1382 func (*QosRecordDump) GetMessageType() api.MessageType {
1383         return api.RequestMessage
1384 }
1385
1386 func (m *QosRecordDump) Size() (size int) {
1387         if m == nil {
1388                 return 0
1389         }
1390         return size
1391 }
1392 func (m *QosRecordDump) Marshal(b []byte) ([]byte, error) {
1393         if b == nil {
1394                 b = make([]byte, m.Size())
1395         }
1396         buf := codec.NewBuffer(b)
1397         return buf.Bytes(), nil
1398 }
1399 func (m *QosRecordDump) Unmarshal(b []byte) error {
1400         return nil
1401 }
1402
1403 // QosRecordEnableDisable defines message 'qos_record_enable_disable'.
1404 type QosRecordEnableDisable struct {
1405         Enable bool      `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1406         Record QosRecord `binapi:"qos_record,name=record" json:"record,omitempty"`
1407 }
1408
1409 func (m *QosRecordEnableDisable) Reset()               { *m = QosRecordEnableDisable{} }
1410 func (*QosRecordEnableDisable) GetMessageName() string { return "qos_record_enable_disable" }
1411 func (*QosRecordEnableDisable) GetCrcString() string   { return "25b33f88" }
1412 func (*QosRecordEnableDisable) GetMessageType() api.MessageType {
1413         return api.RequestMessage
1414 }
1415
1416 func (m *QosRecordEnableDisable) Size() (size int) {
1417         if m == nil {
1418                 return 0
1419         }
1420         size += 1 // m.Enable
1421         size += 4 // m.Record.SwIfIndex
1422         size += 1 // m.Record.InputSource
1423         return size
1424 }
1425 func (m *QosRecordEnableDisable) Marshal(b []byte) ([]byte, error) {
1426         if b == nil {
1427                 b = make([]byte, m.Size())
1428         }
1429         buf := codec.NewBuffer(b)
1430         buf.EncodeBool(m.Enable)
1431         buf.EncodeUint32(uint32(m.Record.SwIfIndex))
1432         buf.EncodeUint8(uint8(m.Record.InputSource))
1433         return buf.Bytes(), nil
1434 }
1435 func (m *QosRecordEnableDisable) Unmarshal(b []byte) error {
1436         buf := codec.NewBuffer(b)
1437         m.Enable = buf.DecodeBool()
1438         m.Record.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1439         m.Record.InputSource = QosSource(buf.DecodeUint8())
1440         return nil
1441 }
1442
1443 // QosRecordEnableDisableReply defines message 'qos_record_enable_disable_reply'.
1444 type QosRecordEnableDisableReply struct {
1445         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1446 }
1447
1448 func (m *QosRecordEnableDisableReply) Reset()               { *m = QosRecordEnableDisableReply{} }
1449 func (*QosRecordEnableDisableReply) GetMessageName() string { return "qos_record_enable_disable_reply" }
1450 func (*QosRecordEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
1451 func (*QosRecordEnableDisableReply) GetMessageType() api.MessageType {
1452         return api.ReplyMessage
1453 }
1454
1455 func (m *QosRecordEnableDisableReply) Size() (size int) {
1456         if m == nil {
1457                 return 0
1458         }
1459         size += 4 // m.Retval
1460         return size
1461 }
1462 func (m *QosRecordEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1463         if b == nil {
1464                 b = make([]byte, m.Size())
1465         }
1466         buf := codec.NewBuffer(b)
1467         buf.EncodeInt32(m.Retval)
1468         return buf.Bytes(), nil
1469 }
1470 func (m *QosRecordEnableDisableReply) Unmarshal(b []byte) error {
1471         buf := codec.NewBuffer(b)
1472         m.Retval = buf.DecodeInt32()
1473         return nil
1474 }
1475
1476 // QosStoreDetails defines message 'qos_store_details'.
1477 type QosStoreDetails struct {
1478         Store QosStore `binapi:"qos_store,name=store" json:"store,omitempty"`
1479 }
1480
1481 func (m *QosStoreDetails) Reset()               { *m = QosStoreDetails{} }
1482 func (*QosStoreDetails) GetMessageName() string { return "qos_store_details" }
1483 func (*QosStoreDetails) GetCrcString() string   { return "038a6d48" }
1484 func (*QosStoreDetails) GetMessageType() api.MessageType {
1485         return api.ReplyMessage
1486 }
1487
1488 func (m *QosStoreDetails) Size() (size int) {
1489         if m == nil {
1490                 return 0
1491         }
1492         size += 4 // m.Store.SwIfIndex
1493         size += 1 // m.Store.InputSource
1494         size += 1 // m.Store.Value
1495         return size
1496 }
1497 func (m *QosStoreDetails) Marshal(b []byte) ([]byte, error) {
1498         if b == nil {
1499                 b = make([]byte, m.Size())
1500         }
1501         buf := codec.NewBuffer(b)
1502         buf.EncodeUint32(uint32(m.Store.SwIfIndex))
1503         buf.EncodeUint8(uint8(m.Store.InputSource))
1504         buf.EncodeUint8(m.Store.Value)
1505         return buf.Bytes(), nil
1506 }
1507 func (m *QosStoreDetails) Unmarshal(b []byte) error {
1508         buf := codec.NewBuffer(b)
1509         m.Store.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1510         m.Store.InputSource = QosSource(buf.DecodeUint8())
1511         m.Store.Value = buf.DecodeUint8()
1512         return nil
1513 }
1514
1515 // QosStoreDump defines message 'qos_store_dump'.
1516 type QosStoreDump struct{}
1517
1518 func (m *QosStoreDump) Reset()               { *m = QosStoreDump{} }
1519 func (*QosStoreDump) GetMessageName() string { return "qos_store_dump" }
1520 func (*QosStoreDump) GetCrcString() string   { return "51077d14" }
1521 func (*QosStoreDump) GetMessageType() api.MessageType {
1522         return api.RequestMessage
1523 }
1524
1525 func (m *QosStoreDump) Size() (size int) {
1526         if m == nil {
1527                 return 0
1528         }
1529         return size
1530 }
1531 func (m *QosStoreDump) Marshal(b []byte) ([]byte, error) {
1532         if b == nil {
1533                 b = make([]byte, m.Size())
1534         }
1535         buf := codec.NewBuffer(b)
1536         return buf.Bytes(), nil
1537 }
1538 func (m *QosStoreDump) Unmarshal(b []byte) error {
1539         return nil
1540 }
1541
1542 // QosStoreEnableDisable defines message 'qos_store_enable_disable'.
1543 type QosStoreEnableDisable struct {
1544         Enable bool     `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
1545         Store  QosStore `binapi:"qos_store,name=store" json:"store,omitempty"`
1546 }
1547
1548 func (m *QosStoreEnableDisable) Reset()               { *m = QosStoreEnableDisable{} }
1549 func (*QosStoreEnableDisable) GetMessageName() string { return "qos_store_enable_disable" }
1550 func (*QosStoreEnableDisable) GetCrcString() string   { return "3507235e" }
1551 func (*QosStoreEnableDisable) GetMessageType() api.MessageType {
1552         return api.RequestMessage
1553 }
1554
1555 func (m *QosStoreEnableDisable) Size() (size int) {
1556         if m == nil {
1557                 return 0
1558         }
1559         size += 1 // m.Enable
1560         size += 4 // m.Store.SwIfIndex
1561         size += 1 // m.Store.InputSource
1562         size += 1 // m.Store.Value
1563         return size
1564 }
1565 func (m *QosStoreEnableDisable) Marshal(b []byte) ([]byte, error) {
1566         if b == nil {
1567                 b = make([]byte, m.Size())
1568         }
1569         buf := codec.NewBuffer(b)
1570         buf.EncodeBool(m.Enable)
1571         buf.EncodeUint32(uint32(m.Store.SwIfIndex))
1572         buf.EncodeUint8(uint8(m.Store.InputSource))
1573         buf.EncodeUint8(m.Store.Value)
1574         return buf.Bytes(), nil
1575 }
1576 func (m *QosStoreEnableDisable) Unmarshal(b []byte) error {
1577         buf := codec.NewBuffer(b)
1578         m.Enable = buf.DecodeBool()
1579         m.Store.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
1580         m.Store.InputSource = QosSource(buf.DecodeUint8())
1581         m.Store.Value = buf.DecodeUint8()
1582         return nil
1583 }
1584
1585 // QosStoreEnableDisableReply defines message 'qos_store_enable_disable_reply'.
1586 type QosStoreEnableDisableReply struct {
1587         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
1588 }
1589
1590 func (m *QosStoreEnableDisableReply) Reset()               { *m = QosStoreEnableDisableReply{} }
1591 func (*QosStoreEnableDisableReply) GetMessageName() string { return "qos_store_enable_disable_reply" }
1592 func (*QosStoreEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
1593 func (*QosStoreEnableDisableReply) GetMessageType() api.MessageType {
1594         return api.ReplyMessage
1595 }
1596
1597 func (m *QosStoreEnableDisableReply) Size() (size int) {
1598         if m == nil {
1599                 return 0
1600         }
1601         size += 4 // m.Retval
1602         return size
1603 }
1604 func (m *QosStoreEnableDisableReply) Marshal(b []byte) ([]byte, error) {
1605         if b == nil {
1606                 b = make([]byte, m.Size())
1607         }
1608         buf := codec.NewBuffer(b)
1609         buf.EncodeInt32(m.Retval)
1610         return buf.Bytes(), nil
1611 }
1612 func (m *QosStoreEnableDisableReply) Unmarshal(b []byte) error {
1613         buf := codec.NewBuffer(b)
1614         m.Retval = buf.DecodeInt32()
1615         return nil
1616 }
1617
1618 func init() { file_qos_binapi_init() }
1619 func file_qos_binapi_init() {
1620         api.RegisterMessage((*QosEgressMapDelete)(nil), "qos_egress_map_delete_3a91bde5")
1621         api.RegisterMessage((*QosEgressMapDeleteReply)(nil), "qos_egress_map_delete_reply_e8d4e804")
1622         api.RegisterMessage((*QosEgressMapDetails)(nil), "qos_egress_map_details_46c5653c")
1623         api.RegisterMessage((*QosEgressMapDump)(nil), "qos_egress_map_dump_51077d14")
1624         api.RegisterMessage((*QosEgressMapUpdate)(nil), "qos_egress_map_update_6d1c065f")
1625         api.RegisterMessage((*QosEgressMapUpdateReply)(nil), "qos_egress_map_update_reply_e8d4e804")
1626         api.RegisterMessage((*QosMarkDetails)(nil), "qos_mark_details_89fe81a9")
1627         api.RegisterMessage((*QosMarkDetailsReply)(nil), "qos_mark_details_reply_e8d4e804")
1628         api.RegisterMessage((*QosMarkDump)(nil), "qos_mark_dump_f9e6675e")
1629         api.RegisterMessage((*QosMarkEnableDisable)(nil), "qos_mark_enable_disable_1a010f74")
1630         api.RegisterMessage((*QosMarkEnableDisableReply)(nil), "qos_mark_enable_disable_reply_e8d4e804")
1631         api.RegisterMessage((*QosRecordDetails)(nil), "qos_record_details_4956ccdd")
1632         api.RegisterMessage((*QosRecordDump)(nil), "qos_record_dump_51077d14")
1633         api.RegisterMessage((*QosRecordEnableDisable)(nil), "qos_record_enable_disable_25b33f88")
1634         api.RegisterMessage((*QosRecordEnableDisableReply)(nil), "qos_record_enable_disable_reply_e8d4e804")
1635         api.RegisterMessage((*QosStoreDetails)(nil), "qos_store_details_038a6d48")
1636         api.RegisterMessage((*QosStoreDump)(nil), "qos_store_dump_51077d14")
1637         api.RegisterMessage((*QosStoreEnableDisable)(nil), "qos_store_enable_disable_3507235e")
1638         api.RegisterMessage((*QosStoreEnableDisableReply)(nil), "qos_store_enable_disable_reply_e8d4e804")
1639 }
1640
1641 // Messages returns list of all messages in this module.
1642 func AllMessages() []api.Message {
1643         return []api.Message{
1644                 (*QosEgressMapDelete)(nil),
1645                 (*QosEgressMapDeleteReply)(nil),
1646                 (*QosEgressMapDetails)(nil),
1647                 (*QosEgressMapDump)(nil),
1648                 (*QosEgressMapUpdate)(nil),
1649                 (*QosEgressMapUpdateReply)(nil),
1650                 (*QosMarkDetails)(nil),
1651                 (*QosMarkDetailsReply)(nil),
1652                 (*QosMarkDump)(nil),
1653                 (*QosMarkEnableDisable)(nil),
1654                 (*QosMarkEnableDisableReply)(nil),
1655                 (*QosRecordDetails)(nil),
1656                 (*QosRecordDump)(nil),
1657                 (*QosRecordEnableDisable)(nil),
1658                 (*QosRecordEnableDisableReply)(nil),
1659                 (*QosStoreDetails)(nil),
1660                 (*QosStoreDump)(nil),
1661                 (*QosStoreEnableDisable)(nil),
1662                 (*QosStoreEnableDisableReply)(nil),
1663         }
1664 }