binapigen: fix union size
[govpp.git] / binapi / policer / policer.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.05-release
5 // source: /usr/share/vpp/api/core/policer.api.json
6
7 // Package policer contains generated bindings for API file policer.api.
8 //
9 // Contents:
10 //   4 messages
11 //
12 package policer
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         policer_types "git.fd.io/govpp.git/binapi/policer_types"
17         codec "git.fd.io/govpp.git/codec"
18 )
19
20 // This is a compile-time assertion to ensure that this generated file
21 // is compatible with the GoVPP api package it is being compiled against.
22 // A compilation error at this line likely means your copy of the
23 // GoVPP api package needs to be updated.
24 const _ = api.GoVppAPIPackageIsVersion2
25
26 const (
27         APIFile    = "policer"
28         APIVersion = "2.0.0"
29         VersionCrc = 0xd9188811
30 )
31
32 // PolicerAddDel defines message 'policer_add_del'.
33 type PolicerAddDel struct {
34         IsAdd         bool                             `binapi:"bool,name=is_add" json:"is_add,omitempty"`
35         Name          string                           `binapi:"string[64],name=name" json:"name,omitempty"`
36         Cir           uint32                           `binapi:"u32,name=cir" json:"cir,omitempty"`
37         Eir           uint32                           `binapi:"u32,name=eir" json:"eir,omitempty"`
38         Cb            uint64                           `binapi:"u64,name=cb" json:"cb,omitempty"`
39         Eb            uint64                           `binapi:"u64,name=eb" json:"eb,omitempty"`
40         RateType      policer_types.Sse2QosRateType    `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
41         RoundType     policer_types.Sse2QosRoundType   `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
42         Type          policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
43         ColorAware    bool                             `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
44         ConformAction policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
45         ExceedAction  policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
46         ViolateAction policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
47 }
48
49 func (m *PolicerAddDel) Reset()               { *m = PolicerAddDel{} }
50 func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" }
51 func (*PolicerAddDel) GetCrcString() string   { return "cb948f6e" }
52 func (*PolicerAddDel) GetMessageType() api.MessageType {
53         return api.RequestMessage
54 }
55
56 func (m *PolicerAddDel) Size() (size int) {
57         if m == nil {
58                 return 0
59         }
60         size += 1  // m.IsAdd
61         size += 64 // m.Name
62         size += 4  // m.Cir
63         size += 4  // m.Eir
64         size += 8  // m.Cb
65         size += 8  // m.Eb
66         size += 1  // m.RateType
67         size += 1  // m.RoundType
68         size += 1  // m.Type
69         size += 1  // m.ColorAware
70         size += 1  // m.ConformAction.Type
71         size += 1  // m.ConformAction.Dscp
72         size += 1  // m.ExceedAction.Type
73         size += 1  // m.ExceedAction.Dscp
74         size += 1  // m.ViolateAction.Type
75         size += 1  // m.ViolateAction.Dscp
76         return size
77 }
78 func (m *PolicerAddDel) Marshal(b []byte) ([]byte, error) {
79         if b == nil {
80                 b = make([]byte, m.Size())
81         }
82         buf := codec.NewBuffer(b)
83         buf.EncodeBool(m.IsAdd)
84         buf.EncodeString(m.Name, 64)
85         buf.EncodeUint32(m.Cir)
86         buf.EncodeUint32(m.Eir)
87         buf.EncodeUint64(m.Cb)
88         buf.EncodeUint64(m.Eb)
89         buf.EncodeUint8(uint8(m.RateType))
90         buf.EncodeUint8(uint8(m.RoundType))
91         buf.EncodeUint8(uint8(m.Type))
92         buf.EncodeBool(m.ColorAware)
93         buf.EncodeUint8(uint8(m.ConformAction.Type))
94         buf.EncodeUint8(m.ConformAction.Dscp)
95         buf.EncodeUint8(uint8(m.ExceedAction.Type))
96         buf.EncodeUint8(m.ExceedAction.Dscp)
97         buf.EncodeUint8(uint8(m.ViolateAction.Type))
98         buf.EncodeUint8(m.ViolateAction.Dscp)
99         return buf.Bytes(), nil
100 }
101 func (m *PolicerAddDel) Unmarshal(b []byte) error {
102         buf := codec.NewBuffer(b)
103         m.IsAdd = buf.DecodeBool()
104         m.Name = buf.DecodeString(64)
105         m.Cir = buf.DecodeUint32()
106         m.Eir = buf.DecodeUint32()
107         m.Cb = buf.DecodeUint64()
108         m.Eb = buf.DecodeUint64()
109         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
110         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
111         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
112         m.ColorAware = buf.DecodeBool()
113         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
114         m.ConformAction.Dscp = buf.DecodeUint8()
115         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
116         m.ExceedAction.Dscp = buf.DecodeUint8()
117         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
118         m.ViolateAction.Dscp = buf.DecodeUint8()
119         return nil
120 }
121
122 // PolicerAddDelReply defines message 'policer_add_del_reply'.
123 type PolicerAddDelReply struct {
124         Retval       int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
125         PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"`
126 }
127
128 func (m *PolicerAddDelReply) Reset()               { *m = PolicerAddDelReply{} }
129 func (*PolicerAddDelReply) GetMessageName() string { return "policer_add_del_reply" }
130 func (*PolicerAddDelReply) GetCrcString() string   { return "a177cef2" }
131 func (*PolicerAddDelReply) GetMessageType() api.MessageType {
132         return api.ReplyMessage
133 }
134
135 func (m *PolicerAddDelReply) Size() (size int) {
136         if m == nil {
137                 return 0
138         }
139         size += 4 // m.Retval
140         size += 4 // m.PolicerIndex
141         return size
142 }
143 func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) {
144         if b == nil {
145                 b = make([]byte, m.Size())
146         }
147         buf := codec.NewBuffer(b)
148         buf.EncodeInt32(m.Retval)
149         buf.EncodeUint32(m.PolicerIndex)
150         return buf.Bytes(), nil
151 }
152 func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
153         buf := codec.NewBuffer(b)
154         m.Retval = buf.DecodeInt32()
155         m.PolicerIndex = buf.DecodeUint32()
156         return nil
157 }
158
159 // PolicerDetails defines message 'policer_details'.
160 type PolicerDetails struct {
161         Name               string                           `binapi:"string[64],name=name" json:"name,omitempty"`
162         Cir                uint32                           `binapi:"u32,name=cir" json:"cir,omitempty"`
163         Eir                uint32                           `binapi:"u32,name=eir" json:"eir,omitempty"`
164         Cb                 uint64                           `binapi:"u64,name=cb" json:"cb,omitempty"`
165         Eb                 uint64                           `binapi:"u64,name=eb" json:"eb,omitempty"`
166         RateType           policer_types.Sse2QosRateType    `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
167         RoundType          policer_types.Sse2QosRoundType   `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
168         Type               policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
169         ConformAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
170         ExceedAction       policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
171         ViolateAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
172         SingleRate         bool                             `binapi:"bool,name=single_rate" json:"single_rate,omitempty"`
173         ColorAware         bool                             `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
174         Scale              uint32                           `binapi:"u32,name=scale" json:"scale,omitempty"`
175         CirTokensPerPeriod uint32                           `binapi:"u32,name=cir_tokens_per_period" json:"cir_tokens_per_period,omitempty"`
176         PirTokensPerPeriod uint32                           `binapi:"u32,name=pir_tokens_per_period" json:"pir_tokens_per_period,omitempty"`
177         CurrentLimit       uint32                           `binapi:"u32,name=current_limit" json:"current_limit,omitempty"`
178         CurrentBucket      uint32                           `binapi:"u32,name=current_bucket" json:"current_bucket,omitempty"`
179         ExtendedLimit      uint32                           `binapi:"u32,name=extended_limit" json:"extended_limit,omitempty"`
180         ExtendedBucket     uint32                           `binapi:"u32,name=extended_bucket" json:"extended_bucket,omitempty"`
181         LastUpdateTime     uint64                           `binapi:"u64,name=last_update_time" json:"last_update_time,omitempty"`
182 }
183
184 func (m *PolicerDetails) Reset()               { *m = PolicerDetails{} }
185 func (*PolicerDetails) GetMessageName() string { return "policer_details" }
186 func (*PolicerDetails) GetCrcString() string   { return "a43f781a" }
187 func (*PolicerDetails) GetMessageType() api.MessageType {
188         return api.ReplyMessage
189 }
190
191 func (m *PolicerDetails) Size() (size int) {
192         if m == nil {
193                 return 0
194         }
195         size += 64 // m.Name
196         size += 4  // m.Cir
197         size += 4  // m.Eir
198         size += 8  // m.Cb
199         size += 8  // m.Eb
200         size += 1  // m.RateType
201         size += 1  // m.RoundType
202         size += 1  // m.Type
203         size += 1  // m.ConformAction.Type
204         size += 1  // m.ConformAction.Dscp
205         size += 1  // m.ExceedAction.Type
206         size += 1  // m.ExceedAction.Dscp
207         size += 1  // m.ViolateAction.Type
208         size += 1  // m.ViolateAction.Dscp
209         size += 1  // m.SingleRate
210         size += 1  // m.ColorAware
211         size += 4  // m.Scale
212         size += 4  // m.CirTokensPerPeriod
213         size += 4  // m.PirTokensPerPeriod
214         size += 4  // m.CurrentLimit
215         size += 4  // m.CurrentBucket
216         size += 4  // m.ExtendedLimit
217         size += 4  // m.ExtendedBucket
218         size += 8  // m.LastUpdateTime
219         return size
220 }
221 func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) {
222         if b == nil {
223                 b = make([]byte, m.Size())
224         }
225         buf := codec.NewBuffer(b)
226         buf.EncodeString(m.Name, 64)
227         buf.EncodeUint32(m.Cir)
228         buf.EncodeUint32(m.Eir)
229         buf.EncodeUint64(m.Cb)
230         buf.EncodeUint64(m.Eb)
231         buf.EncodeUint8(uint8(m.RateType))
232         buf.EncodeUint8(uint8(m.RoundType))
233         buf.EncodeUint8(uint8(m.Type))
234         buf.EncodeUint8(uint8(m.ConformAction.Type))
235         buf.EncodeUint8(m.ConformAction.Dscp)
236         buf.EncodeUint8(uint8(m.ExceedAction.Type))
237         buf.EncodeUint8(m.ExceedAction.Dscp)
238         buf.EncodeUint8(uint8(m.ViolateAction.Type))
239         buf.EncodeUint8(m.ViolateAction.Dscp)
240         buf.EncodeBool(m.SingleRate)
241         buf.EncodeBool(m.ColorAware)
242         buf.EncodeUint32(m.Scale)
243         buf.EncodeUint32(m.CirTokensPerPeriod)
244         buf.EncodeUint32(m.PirTokensPerPeriod)
245         buf.EncodeUint32(m.CurrentLimit)
246         buf.EncodeUint32(m.CurrentBucket)
247         buf.EncodeUint32(m.ExtendedLimit)
248         buf.EncodeUint32(m.ExtendedBucket)
249         buf.EncodeUint64(m.LastUpdateTime)
250         return buf.Bytes(), nil
251 }
252 func (m *PolicerDetails) Unmarshal(b []byte) error {
253         buf := codec.NewBuffer(b)
254         m.Name = buf.DecodeString(64)
255         m.Cir = buf.DecodeUint32()
256         m.Eir = buf.DecodeUint32()
257         m.Cb = buf.DecodeUint64()
258         m.Eb = buf.DecodeUint64()
259         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
260         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
261         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
262         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
263         m.ConformAction.Dscp = buf.DecodeUint8()
264         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
265         m.ExceedAction.Dscp = buf.DecodeUint8()
266         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
267         m.ViolateAction.Dscp = buf.DecodeUint8()
268         m.SingleRate = buf.DecodeBool()
269         m.ColorAware = buf.DecodeBool()
270         m.Scale = buf.DecodeUint32()
271         m.CirTokensPerPeriod = buf.DecodeUint32()
272         m.PirTokensPerPeriod = buf.DecodeUint32()
273         m.CurrentLimit = buf.DecodeUint32()
274         m.CurrentBucket = buf.DecodeUint32()
275         m.ExtendedLimit = buf.DecodeUint32()
276         m.ExtendedBucket = buf.DecodeUint32()
277         m.LastUpdateTime = buf.DecodeUint64()
278         return nil
279 }
280
281 // PolicerDump defines message 'policer_dump'.
282 type PolicerDump struct {
283         MatchNameValid bool   `binapi:"bool,name=match_name_valid" json:"match_name_valid,omitempty"`
284         MatchName      string `binapi:"string[64],name=match_name" json:"match_name,omitempty"`
285 }
286
287 func (m *PolicerDump) Reset()               { *m = PolicerDump{} }
288 func (*PolicerDump) GetMessageName() string { return "policer_dump" }
289 func (*PolicerDump) GetCrcString() string   { return "35f1ae0f" }
290 func (*PolicerDump) GetMessageType() api.MessageType {
291         return api.RequestMessage
292 }
293
294 func (m *PolicerDump) Size() (size int) {
295         if m == nil {
296                 return 0
297         }
298         size += 1  // m.MatchNameValid
299         size += 64 // m.MatchName
300         return size
301 }
302 func (m *PolicerDump) Marshal(b []byte) ([]byte, error) {
303         if b == nil {
304                 b = make([]byte, m.Size())
305         }
306         buf := codec.NewBuffer(b)
307         buf.EncodeBool(m.MatchNameValid)
308         buf.EncodeString(m.MatchName, 64)
309         return buf.Bytes(), nil
310 }
311 func (m *PolicerDump) Unmarshal(b []byte) error {
312         buf := codec.NewBuffer(b)
313         m.MatchNameValid = buf.DecodeBool()
314         m.MatchName = buf.DecodeString(64)
315         return nil
316 }
317
318 func init() { file_policer_binapi_init() }
319 func file_policer_binapi_init() {
320         api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e")
321         api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2")
322         api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a")
323         api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f")
324 }
325
326 // Messages returns list of all messages in this module.
327 func AllMessages() []api.Message {
328         return []api.Message{
329                 (*PolicerAddDel)(nil),
330                 (*PolicerAddDelReply)(nil),
331                 (*PolicerDetails)(nil),
332                 (*PolicerDump)(nil),
333         }
334 }