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