GoVPP release v0.5.0
[govpp.git] / binapi / policer / policer.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0
4 //  VPP:              22.02-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 //   8 messages
11 //
12 package policer
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_types"
17         policer_types "git.fd.io/govpp.git/binapi/policer_types"
18         codec "git.fd.io/govpp.git/codec"
19 )
20
21 // This is a compile-time assertion to ensure that this generated file
22 // is compatible with the GoVPP api package it is being compiled against.
23 // A compilation error at this line likely means your copy of the
24 // GoVPP api package needs to be updated.
25 const _ = api.GoVppAPIPackageIsVersion2
26
27 const (
28         APIFile    = "policer"
29         APIVersion = "2.0.0"
30         VersionCrc = 0xf14848c
31 )
32
33 // PolicerAddDel defines message 'policer_add_del'.
34 type PolicerAddDel struct {
35         IsAdd         bool                             `binapi:"bool,name=is_add" json:"is_add,omitempty"`
36         Name          string                           `binapi:"string[64],name=name" json:"name,omitempty"`
37         Cir           uint32                           `binapi:"u32,name=cir" json:"cir,omitempty"`
38         Eir           uint32                           `binapi:"u32,name=eir" json:"eir,omitempty"`
39         Cb            uint64                           `binapi:"u64,name=cb" json:"cb,omitempty"`
40         Eb            uint64                           `binapi:"u64,name=eb" json:"eb,omitempty"`
41         RateType      policer_types.Sse2QosRateType    `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
42         RoundType     policer_types.Sse2QosRoundType   `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
43         Type          policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
44         ColorAware    bool                             `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
45         ConformAction policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
46         ExceedAction  policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
47         ViolateAction policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
48 }
49
50 func (m *PolicerAddDel) Reset()               { *m = PolicerAddDel{} }
51 func (*PolicerAddDel) GetMessageName() string { return "policer_add_del" }
52 func (*PolicerAddDel) GetCrcString() string   { return "2b31dd38" }
53 func (*PolicerAddDel) GetMessageType() api.MessageType {
54         return api.RequestMessage
55 }
56
57 func (m *PolicerAddDel) Size() (size int) {
58         if m == nil {
59                 return 0
60         }
61         size += 1  // m.IsAdd
62         size += 64 // m.Name
63         size += 4  // m.Cir
64         size += 4  // m.Eir
65         size += 8  // m.Cb
66         size += 8  // m.Eb
67         size += 1  // m.RateType
68         size += 1  // m.RoundType
69         size += 1  // m.Type
70         size += 1  // m.ColorAware
71         size += 1  // m.ConformAction.Type
72         size += 1  // m.ConformAction.Dscp
73         size += 1  // m.ExceedAction.Type
74         size += 1  // m.ExceedAction.Dscp
75         size += 1  // m.ViolateAction.Type
76         size += 1  // m.ViolateAction.Dscp
77         return size
78 }
79 func (m *PolicerAddDel) Marshal(b []byte) ([]byte, error) {
80         if b == nil {
81                 b = make([]byte, m.Size())
82         }
83         buf := codec.NewBuffer(b)
84         buf.EncodeBool(m.IsAdd)
85         buf.EncodeString(m.Name, 64)
86         buf.EncodeUint32(m.Cir)
87         buf.EncodeUint32(m.Eir)
88         buf.EncodeUint64(m.Cb)
89         buf.EncodeUint64(m.Eb)
90         buf.EncodeUint8(uint8(m.RateType))
91         buf.EncodeUint8(uint8(m.RoundType))
92         buf.EncodeUint8(uint8(m.Type))
93         buf.EncodeBool(m.ColorAware)
94         buf.EncodeUint8(uint8(m.ConformAction.Type))
95         buf.EncodeUint8(m.ConformAction.Dscp)
96         buf.EncodeUint8(uint8(m.ExceedAction.Type))
97         buf.EncodeUint8(m.ExceedAction.Dscp)
98         buf.EncodeUint8(uint8(m.ViolateAction.Type))
99         buf.EncodeUint8(m.ViolateAction.Dscp)
100         return buf.Bytes(), nil
101 }
102 func (m *PolicerAddDel) Unmarshal(b []byte) error {
103         buf := codec.NewBuffer(b)
104         m.IsAdd = buf.DecodeBool()
105         m.Name = buf.DecodeString(64)
106         m.Cir = buf.DecodeUint32()
107         m.Eir = buf.DecodeUint32()
108         m.Cb = buf.DecodeUint64()
109         m.Eb = buf.DecodeUint64()
110         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
111         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
112         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
113         m.ColorAware = buf.DecodeBool()
114         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
115         m.ConformAction.Dscp = buf.DecodeUint8()
116         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
117         m.ExceedAction.Dscp = buf.DecodeUint8()
118         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
119         m.ViolateAction.Dscp = buf.DecodeUint8()
120         return nil
121 }
122
123 // PolicerAddDelReply defines message 'policer_add_del_reply'.
124 type PolicerAddDelReply struct {
125         Retval       int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
126         PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"`
127 }
128
129 func (m *PolicerAddDelReply) Reset()               { *m = PolicerAddDelReply{} }
130 func (*PolicerAddDelReply) GetMessageName() string { return "policer_add_del_reply" }
131 func (*PolicerAddDelReply) GetCrcString() string   { return "a177cef2" }
132 func (*PolicerAddDelReply) GetMessageType() api.MessageType {
133         return api.ReplyMessage
134 }
135
136 func (m *PolicerAddDelReply) Size() (size int) {
137         if m == nil {
138                 return 0
139         }
140         size += 4 // m.Retval
141         size += 4 // m.PolicerIndex
142         return size
143 }
144 func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) {
145         if b == nil {
146                 b = make([]byte, m.Size())
147         }
148         buf := codec.NewBuffer(b)
149         buf.EncodeInt32(m.Retval)
150         buf.EncodeUint32(m.PolicerIndex)
151         return buf.Bytes(), nil
152 }
153 func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
154         buf := codec.NewBuffer(b)
155         m.Retval = buf.DecodeInt32()
156         m.PolicerIndex = buf.DecodeUint32()
157         return nil
158 }
159
160 // PolicerBind defines message 'policer_bind'.
161 type PolicerBind struct {
162         Name        string `binapi:"string[64],name=name" json:"name,omitempty"`
163         WorkerIndex uint32 `binapi:"u32,name=worker_index" json:"worker_index,omitempty"`
164         BindEnable  bool   `binapi:"bool,name=bind_enable" json:"bind_enable,omitempty"`
165 }
166
167 func (m *PolicerBind) Reset()               { *m = PolicerBind{} }
168 func (*PolicerBind) GetMessageName() string { return "policer_bind" }
169 func (*PolicerBind) GetCrcString() string   { return "dcf516f9" }
170 func (*PolicerBind) GetMessageType() api.MessageType {
171         return api.RequestMessage
172 }
173
174 func (m *PolicerBind) Size() (size int) {
175         if m == nil {
176                 return 0
177         }
178         size += 64 // m.Name
179         size += 4  // m.WorkerIndex
180         size += 1  // m.BindEnable
181         return size
182 }
183 func (m *PolicerBind) Marshal(b []byte) ([]byte, error) {
184         if b == nil {
185                 b = make([]byte, m.Size())
186         }
187         buf := codec.NewBuffer(b)
188         buf.EncodeString(m.Name, 64)
189         buf.EncodeUint32(m.WorkerIndex)
190         buf.EncodeBool(m.BindEnable)
191         return buf.Bytes(), nil
192 }
193 func (m *PolicerBind) Unmarshal(b []byte) error {
194         buf := codec.NewBuffer(b)
195         m.Name = buf.DecodeString(64)
196         m.WorkerIndex = buf.DecodeUint32()
197         m.BindEnable = buf.DecodeBool()
198         return nil
199 }
200
201 // PolicerBindReply defines message 'policer_bind_reply'.
202 type PolicerBindReply struct {
203         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
204 }
205
206 func (m *PolicerBindReply) Reset()               { *m = PolicerBindReply{} }
207 func (*PolicerBindReply) GetMessageName() string { return "policer_bind_reply" }
208 func (*PolicerBindReply) GetCrcString() string   { return "e8d4e804" }
209 func (*PolicerBindReply) GetMessageType() api.MessageType {
210         return api.ReplyMessage
211 }
212
213 func (m *PolicerBindReply) Size() (size int) {
214         if m == nil {
215                 return 0
216         }
217         size += 4 // m.Retval
218         return size
219 }
220 func (m *PolicerBindReply) Marshal(b []byte) ([]byte, error) {
221         if b == nil {
222                 b = make([]byte, m.Size())
223         }
224         buf := codec.NewBuffer(b)
225         buf.EncodeInt32(m.Retval)
226         return buf.Bytes(), nil
227 }
228 func (m *PolicerBindReply) Unmarshal(b []byte) error {
229         buf := codec.NewBuffer(b)
230         m.Retval = buf.DecodeInt32()
231         return nil
232 }
233
234 // PolicerDetails defines message 'policer_details'.
235 type PolicerDetails struct {
236         Name               string                           `binapi:"string[64],name=name" json:"name,omitempty"`
237         Cir                uint32                           `binapi:"u32,name=cir" json:"cir,omitempty"`
238         Eir                uint32                           `binapi:"u32,name=eir" json:"eir,omitempty"`
239         Cb                 uint64                           `binapi:"u64,name=cb" json:"cb,omitempty"`
240         Eb                 uint64                           `binapi:"u64,name=eb" json:"eb,omitempty"`
241         RateType           policer_types.Sse2QosRateType    `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
242         RoundType          policer_types.Sse2QosRoundType   `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
243         Type               policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
244         ConformAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
245         ExceedAction       policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
246         ViolateAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
247         SingleRate         bool                             `binapi:"bool,name=single_rate" json:"single_rate,omitempty"`
248         ColorAware         bool                             `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
249         Scale              uint32                           `binapi:"u32,name=scale" json:"scale,omitempty"`
250         CirTokensPerPeriod uint32                           `binapi:"u32,name=cir_tokens_per_period" json:"cir_tokens_per_period,omitempty"`
251         PirTokensPerPeriod uint32                           `binapi:"u32,name=pir_tokens_per_period" json:"pir_tokens_per_period,omitempty"`
252         CurrentLimit       uint32                           `binapi:"u32,name=current_limit" json:"current_limit,omitempty"`
253         CurrentBucket      uint32                           `binapi:"u32,name=current_bucket" json:"current_bucket,omitempty"`
254         ExtendedLimit      uint32                           `binapi:"u32,name=extended_limit" json:"extended_limit,omitempty"`
255         ExtendedBucket     uint32                           `binapi:"u32,name=extended_bucket" json:"extended_bucket,omitempty"`
256         LastUpdateTime     uint64                           `binapi:"u64,name=last_update_time" json:"last_update_time,omitempty"`
257 }
258
259 func (m *PolicerDetails) Reset()               { *m = PolicerDetails{} }
260 func (*PolicerDetails) GetMessageName() string { return "policer_details" }
261 func (*PolicerDetails) GetCrcString() string   { return "72d0e248" }
262 func (*PolicerDetails) GetMessageType() api.MessageType {
263         return api.ReplyMessage
264 }
265
266 func (m *PolicerDetails) Size() (size int) {
267         if m == nil {
268                 return 0
269         }
270         size += 64 // m.Name
271         size += 4  // m.Cir
272         size += 4  // m.Eir
273         size += 8  // m.Cb
274         size += 8  // m.Eb
275         size += 1  // m.RateType
276         size += 1  // m.RoundType
277         size += 1  // m.Type
278         size += 1  // m.ConformAction.Type
279         size += 1  // m.ConformAction.Dscp
280         size += 1  // m.ExceedAction.Type
281         size += 1  // m.ExceedAction.Dscp
282         size += 1  // m.ViolateAction.Type
283         size += 1  // m.ViolateAction.Dscp
284         size += 1  // m.SingleRate
285         size += 1  // m.ColorAware
286         size += 4  // m.Scale
287         size += 4  // m.CirTokensPerPeriod
288         size += 4  // m.PirTokensPerPeriod
289         size += 4  // m.CurrentLimit
290         size += 4  // m.CurrentBucket
291         size += 4  // m.ExtendedLimit
292         size += 4  // m.ExtendedBucket
293         size += 8  // m.LastUpdateTime
294         return size
295 }
296 func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) {
297         if b == nil {
298                 b = make([]byte, m.Size())
299         }
300         buf := codec.NewBuffer(b)
301         buf.EncodeString(m.Name, 64)
302         buf.EncodeUint32(m.Cir)
303         buf.EncodeUint32(m.Eir)
304         buf.EncodeUint64(m.Cb)
305         buf.EncodeUint64(m.Eb)
306         buf.EncodeUint8(uint8(m.RateType))
307         buf.EncodeUint8(uint8(m.RoundType))
308         buf.EncodeUint8(uint8(m.Type))
309         buf.EncodeUint8(uint8(m.ConformAction.Type))
310         buf.EncodeUint8(m.ConformAction.Dscp)
311         buf.EncodeUint8(uint8(m.ExceedAction.Type))
312         buf.EncodeUint8(m.ExceedAction.Dscp)
313         buf.EncodeUint8(uint8(m.ViolateAction.Type))
314         buf.EncodeUint8(m.ViolateAction.Dscp)
315         buf.EncodeBool(m.SingleRate)
316         buf.EncodeBool(m.ColorAware)
317         buf.EncodeUint32(m.Scale)
318         buf.EncodeUint32(m.CirTokensPerPeriod)
319         buf.EncodeUint32(m.PirTokensPerPeriod)
320         buf.EncodeUint32(m.CurrentLimit)
321         buf.EncodeUint32(m.CurrentBucket)
322         buf.EncodeUint32(m.ExtendedLimit)
323         buf.EncodeUint32(m.ExtendedBucket)
324         buf.EncodeUint64(m.LastUpdateTime)
325         return buf.Bytes(), nil
326 }
327 func (m *PolicerDetails) Unmarshal(b []byte) error {
328         buf := codec.NewBuffer(b)
329         m.Name = buf.DecodeString(64)
330         m.Cir = buf.DecodeUint32()
331         m.Eir = buf.DecodeUint32()
332         m.Cb = buf.DecodeUint64()
333         m.Eb = buf.DecodeUint64()
334         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
335         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
336         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
337         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
338         m.ConformAction.Dscp = buf.DecodeUint8()
339         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
340         m.ExceedAction.Dscp = buf.DecodeUint8()
341         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
342         m.ViolateAction.Dscp = buf.DecodeUint8()
343         m.SingleRate = buf.DecodeBool()
344         m.ColorAware = buf.DecodeBool()
345         m.Scale = buf.DecodeUint32()
346         m.CirTokensPerPeriod = buf.DecodeUint32()
347         m.PirTokensPerPeriod = buf.DecodeUint32()
348         m.CurrentLimit = buf.DecodeUint32()
349         m.CurrentBucket = buf.DecodeUint32()
350         m.ExtendedLimit = buf.DecodeUint32()
351         m.ExtendedBucket = buf.DecodeUint32()
352         m.LastUpdateTime = buf.DecodeUint64()
353         return nil
354 }
355
356 // PolicerDump defines message 'policer_dump'.
357 type PolicerDump struct {
358         MatchNameValid bool   `binapi:"bool,name=match_name_valid" json:"match_name_valid,omitempty"`
359         MatchName      string `binapi:"string[64],name=match_name" json:"match_name,omitempty"`
360 }
361
362 func (m *PolicerDump) Reset()               { *m = PolicerDump{} }
363 func (*PolicerDump) GetMessageName() string { return "policer_dump" }
364 func (*PolicerDump) GetCrcString() string   { return "35f1ae0f" }
365 func (*PolicerDump) GetMessageType() api.MessageType {
366         return api.RequestMessage
367 }
368
369 func (m *PolicerDump) Size() (size int) {
370         if m == nil {
371                 return 0
372         }
373         size += 1  // m.MatchNameValid
374         size += 64 // m.MatchName
375         return size
376 }
377 func (m *PolicerDump) Marshal(b []byte) ([]byte, error) {
378         if b == nil {
379                 b = make([]byte, m.Size())
380         }
381         buf := codec.NewBuffer(b)
382         buf.EncodeBool(m.MatchNameValid)
383         buf.EncodeString(m.MatchName, 64)
384         return buf.Bytes(), nil
385 }
386 func (m *PolicerDump) Unmarshal(b []byte) error {
387         buf := codec.NewBuffer(b)
388         m.MatchNameValid = buf.DecodeBool()
389         m.MatchName = buf.DecodeString(64)
390         return nil
391 }
392
393 // PolicerInput defines message 'policer_input'.
394 type PolicerInput struct {
395         Name      string                         `binapi:"string[64],name=name" json:"name,omitempty"`
396         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
397         Apply     bool                           `binapi:"bool,name=apply" json:"apply,omitempty"`
398 }
399
400 func (m *PolicerInput) Reset()               { *m = PolicerInput{} }
401 func (*PolicerInput) GetMessageName() string { return "policer_input" }
402 func (*PolicerInput) GetCrcString() string   { return "233f0ef5" }
403 func (*PolicerInput) GetMessageType() api.MessageType {
404         return api.RequestMessage
405 }
406
407 func (m *PolicerInput) Size() (size int) {
408         if m == nil {
409                 return 0
410         }
411         size += 64 // m.Name
412         size += 4  // m.SwIfIndex
413         size += 1  // m.Apply
414         return size
415 }
416 func (m *PolicerInput) Marshal(b []byte) ([]byte, error) {
417         if b == nil {
418                 b = make([]byte, m.Size())
419         }
420         buf := codec.NewBuffer(b)
421         buf.EncodeString(m.Name, 64)
422         buf.EncodeUint32(uint32(m.SwIfIndex))
423         buf.EncodeBool(m.Apply)
424         return buf.Bytes(), nil
425 }
426 func (m *PolicerInput) Unmarshal(b []byte) error {
427         buf := codec.NewBuffer(b)
428         m.Name = buf.DecodeString(64)
429         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
430         m.Apply = buf.DecodeBool()
431         return nil
432 }
433
434 // PolicerInputReply defines message 'policer_input_reply'.
435 type PolicerInputReply struct {
436         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
437 }
438
439 func (m *PolicerInputReply) Reset()               { *m = PolicerInputReply{} }
440 func (*PolicerInputReply) GetMessageName() string { return "policer_input_reply" }
441 func (*PolicerInputReply) GetCrcString() string   { return "e8d4e804" }
442 func (*PolicerInputReply) GetMessageType() api.MessageType {
443         return api.ReplyMessage
444 }
445
446 func (m *PolicerInputReply) Size() (size int) {
447         if m == nil {
448                 return 0
449         }
450         size += 4 // m.Retval
451         return size
452 }
453 func (m *PolicerInputReply) Marshal(b []byte) ([]byte, error) {
454         if b == nil {
455                 b = make([]byte, m.Size())
456         }
457         buf := codec.NewBuffer(b)
458         buf.EncodeInt32(m.Retval)
459         return buf.Bytes(), nil
460 }
461 func (m *PolicerInputReply) Unmarshal(b []byte) error {
462         buf := codec.NewBuffer(b)
463         m.Retval = buf.DecodeInt32()
464         return nil
465 }
466
467 func init() { file_policer_binapi_init() }
468 func file_policer_binapi_init() {
469         api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_2b31dd38")
470         api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2")
471         api.RegisterMessage((*PolicerBind)(nil), "policer_bind_dcf516f9")
472         api.RegisterMessage((*PolicerBindReply)(nil), "policer_bind_reply_e8d4e804")
473         api.RegisterMessage((*PolicerDetails)(nil), "policer_details_72d0e248")
474         api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f")
475         api.RegisterMessage((*PolicerInput)(nil), "policer_input_233f0ef5")
476         api.RegisterMessage((*PolicerInputReply)(nil), "policer_input_reply_e8d4e804")
477 }
478
479 // Messages returns list of all messages in this module.
480 func AllMessages() []api.Message {
481         return []api.Message{
482                 (*PolicerAddDel)(nil),
483                 (*PolicerAddDelReply)(nil),
484                 (*PolicerBind)(nil),
485                 (*PolicerBindReply)(nil),
486                 (*PolicerDetails)(nil),
487                 (*PolicerDump)(nil),
488                 (*PolicerInput)(nil),
489                 (*PolicerInputReply)(nil),
490         }
491 }