Improve binapi generator
[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() int {
57         if m == nil {
58                 return 0
59         }
60         var size int
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         var buf *codec.Buffer
81         if b == nil {
82                 buf = codec.NewBuffer(make([]byte, m.Size()))
83         } else {
84                 buf = codec.NewBuffer(b)
85         }
86         buf.EncodeBool(m.IsAdd)
87         buf.EncodeString(m.Name, 64)
88         buf.EncodeUint32(uint32(m.Cir))
89         buf.EncodeUint32(uint32(m.Eir))
90         buf.EncodeUint64(uint64(m.Cb))
91         buf.EncodeUint64(uint64(m.Eb))
92         buf.EncodeUint8(uint8(m.RateType))
93         buf.EncodeUint8(uint8(m.RoundType))
94         buf.EncodeUint8(uint8(m.Type))
95         buf.EncodeBool(m.ColorAware)
96         buf.EncodeUint8(uint8(m.ConformAction.Type))
97         buf.EncodeUint8(uint8(m.ConformAction.Dscp))
98         buf.EncodeUint8(uint8(m.ExceedAction.Type))
99         buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
100         buf.EncodeUint8(uint8(m.ViolateAction.Type))
101         buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
102         return buf.Bytes(), nil
103 }
104 func (m *PolicerAddDel) Unmarshal(b []byte) error {
105         buf := codec.NewBuffer(b)
106         m.IsAdd = buf.DecodeBool()
107         m.Name = buf.DecodeString(64)
108         m.Cir = buf.DecodeUint32()
109         m.Eir = buf.DecodeUint32()
110         m.Cb = buf.DecodeUint64()
111         m.Eb = buf.DecodeUint64()
112         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
113         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
114         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
115         m.ColorAware = buf.DecodeBool()
116         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
117         m.ConformAction.Dscp = buf.DecodeUint8()
118         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
119         m.ExceedAction.Dscp = buf.DecodeUint8()
120         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
121         m.ViolateAction.Dscp = buf.DecodeUint8()
122         return nil
123 }
124
125 // PolicerAddDelReply defines message 'policer_add_del_reply'.
126 type PolicerAddDelReply struct {
127         Retval       int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
128         PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"`
129 }
130
131 func (m *PolicerAddDelReply) Reset()               { *m = PolicerAddDelReply{} }
132 func (*PolicerAddDelReply) GetMessageName() string { return "policer_add_del_reply" }
133 func (*PolicerAddDelReply) GetCrcString() string   { return "a177cef2" }
134 func (*PolicerAddDelReply) GetMessageType() api.MessageType {
135         return api.ReplyMessage
136 }
137
138 func (m *PolicerAddDelReply) Size() int {
139         if m == nil {
140                 return 0
141         }
142         var size int
143         size += 4 // m.Retval
144         size += 4 // m.PolicerIndex
145         return size
146 }
147 func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) {
148         var buf *codec.Buffer
149         if b == nil {
150                 buf = codec.NewBuffer(make([]byte, m.Size()))
151         } else {
152                 buf = codec.NewBuffer(b)
153         }
154         buf.EncodeUint32(uint32(m.Retval))
155         buf.EncodeUint32(uint32(m.PolicerIndex))
156         return buf.Bytes(), nil
157 }
158 func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
159         buf := codec.NewBuffer(b)
160         m.Retval = int32(buf.DecodeUint32())
161         m.PolicerIndex = buf.DecodeUint32()
162         return nil
163 }
164
165 // PolicerDetails defines message 'policer_details'.
166 type PolicerDetails struct {
167         Name               string                           `binapi:"string[64],name=name" json:"name,omitempty"`
168         Cir                uint32                           `binapi:"u32,name=cir" json:"cir,omitempty"`
169         Eir                uint32                           `binapi:"u32,name=eir" json:"eir,omitempty"`
170         Cb                 uint64                           `binapi:"u64,name=cb" json:"cb,omitempty"`
171         Eb                 uint64                           `binapi:"u64,name=eb" json:"eb,omitempty"`
172         RateType           policer_types.Sse2QosRateType    `binapi:"sse2_qos_rate_type,name=rate_type" json:"rate_type,omitempty"`
173         RoundType          policer_types.Sse2QosRoundType   `binapi:"sse2_qos_round_type,name=round_type" json:"round_type,omitempty"`
174         Type               policer_types.Sse2QosPolicerType `binapi:"sse2_qos_policer_type,name=type" json:"type,omitempty"`
175         ConformAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=conform_action" json:"conform_action,omitempty"`
176         ExceedAction       policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=exceed_action" json:"exceed_action,omitempty"`
177         ViolateAction      policer_types.Sse2QosAction      `binapi:"sse2_qos_action,name=violate_action" json:"violate_action,omitempty"`
178         SingleRate         bool                             `binapi:"bool,name=single_rate" json:"single_rate,omitempty"`
179         ColorAware         bool                             `binapi:"bool,name=color_aware" json:"color_aware,omitempty"`
180         Scale              uint32                           `binapi:"u32,name=scale" json:"scale,omitempty"`
181         CirTokensPerPeriod uint32                           `binapi:"u32,name=cir_tokens_per_period" json:"cir_tokens_per_period,omitempty"`
182         PirTokensPerPeriod uint32                           `binapi:"u32,name=pir_tokens_per_period" json:"pir_tokens_per_period,omitempty"`
183         CurrentLimit       uint32                           `binapi:"u32,name=current_limit" json:"current_limit,omitempty"`
184         CurrentBucket      uint32                           `binapi:"u32,name=current_bucket" json:"current_bucket,omitempty"`
185         ExtendedLimit      uint32                           `binapi:"u32,name=extended_limit" json:"extended_limit,omitempty"`
186         ExtendedBucket     uint32                           `binapi:"u32,name=extended_bucket" json:"extended_bucket,omitempty"`
187         LastUpdateTime     uint64                           `binapi:"u64,name=last_update_time" json:"last_update_time,omitempty"`
188 }
189
190 func (m *PolicerDetails) Reset()               { *m = PolicerDetails{} }
191 func (*PolicerDetails) GetMessageName() string { return "policer_details" }
192 func (*PolicerDetails) GetCrcString() string   { return "a43f781a" }
193 func (*PolicerDetails) GetMessageType() api.MessageType {
194         return api.ReplyMessage
195 }
196
197 func (m *PolicerDetails) Size() int {
198         if m == nil {
199                 return 0
200         }
201         var size int
202         size += 64 // m.Name
203         size += 4  // m.Cir
204         size += 4  // m.Eir
205         size += 8  // m.Cb
206         size += 8  // m.Eb
207         size += 1  // m.RateType
208         size += 1  // m.RoundType
209         size += 1  // m.Type
210         size += 1  // m.ConformAction.Type
211         size += 1  // m.ConformAction.Dscp
212         size += 1  // m.ExceedAction.Type
213         size += 1  // m.ExceedAction.Dscp
214         size += 1  // m.ViolateAction.Type
215         size += 1  // m.ViolateAction.Dscp
216         size += 1  // m.SingleRate
217         size += 1  // m.ColorAware
218         size += 4  // m.Scale
219         size += 4  // m.CirTokensPerPeriod
220         size += 4  // m.PirTokensPerPeriod
221         size += 4  // m.CurrentLimit
222         size += 4  // m.CurrentBucket
223         size += 4  // m.ExtendedLimit
224         size += 4  // m.ExtendedBucket
225         size += 8  // m.LastUpdateTime
226         return size
227 }
228 func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) {
229         var buf *codec.Buffer
230         if b == nil {
231                 buf = codec.NewBuffer(make([]byte, m.Size()))
232         } else {
233                 buf = codec.NewBuffer(b)
234         }
235         buf.EncodeString(m.Name, 64)
236         buf.EncodeUint32(uint32(m.Cir))
237         buf.EncodeUint32(uint32(m.Eir))
238         buf.EncodeUint64(uint64(m.Cb))
239         buf.EncodeUint64(uint64(m.Eb))
240         buf.EncodeUint8(uint8(m.RateType))
241         buf.EncodeUint8(uint8(m.RoundType))
242         buf.EncodeUint8(uint8(m.Type))
243         buf.EncodeUint8(uint8(m.ConformAction.Type))
244         buf.EncodeUint8(uint8(m.ConformAction.Dscp))
245         buf.EncodeUint8(uint8(m.ExceedAction.Type))
246         buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
247         buf.EncodeUint8(uint8(m.ViolateAction.Type))
248         buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
249         buf.EncodeBool(m.SingleRate)
250         buf.EncodeBool(m.ColorAware)
251         buf.EncodeUint32(uint32(m.Scale))
252         buf.EncodeUint32(uint32(m.CirTokensPerPeriod))
253         buf.EncodeUint32(uint32(m.PirTokensPerPeriod))
254         buf.EncodeUint32(uint32(m.CurrentLimit))
255         buf.EncodeUint32(uint32(m.CurrentBucket))
256         buf.EncodeUint32(uint32(m.ExtendedLimit))
257         buf.EncodeUint32(uint32(m.ExtendedBucket))
258         buf.EncodeUint64(uint64(m.LastUpdateTime))
259         return buf.Bytes(), nil
260 }
261 func (m *PolicerDetails) Unmarshal(b []byte) error {
262         buf := codec.NewBuffer(b)
263         m.Name = buf.DecodeString(64)
264         m.Cir = buf.DecodeUint32()
265         m.Eir = buf.DecodeUint32()
266         m.Cb = buf.DecodeUint64()
267         m.Eb = buf.DecodeUint64()
268         m.RateType = policer_types.Sse2QosRateType(buf.DecodeUint8())
269         m.RoundType = policer_types.Sse2QosRoundType(buf.DecodeUint8())
270         m.Type = policer_types.Sse2QosPolicerType(buf.DecodeUint8())
271         m.ConformAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
272         m.ConformAction.Dscp = buf.DecodeUint8()
273         m.ExceedAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
274         m.ExceedAction.Dscp = buf.DecodeUint8()
275         m.ViolateAction.Type = policer_types.Sse2QosActionType(buf.DecodeUint8())
276         m.ViolateAction.Dscp = buf.DecodeUint8()
277         m.SingleRate = buf.DecodeBool()
278         m.ColorAware = buf.DecodeBool()
279         m.Scale = buf.DecodeUint32()
280         m.CirTokensPerPeriod = buf.DecodeUint32()
281         m.PirTokensPerPeriod = buf.DecodeUint32()
282         m.CurrentLimit = buf.DecodeUint32()
283         m.CurrentBucket = buf.DecodeUint32()
284         m.ExtendedLimit = buf.DecodeUint32()
285         m.ExtendedBucket = buf.DecodeUint32()
286         m.LastUpdateTime = buf.DecodeUint64()
287         return nil
288 }
289
290 // PolicerDump defines message 'policer_dump'.
291 type PolicerDump struct {
292         MatchNameValid bool   `binapi:"bool,name=match_name_valid" json:"match_name_valid,omitempty"`
293         MatchName      string `binapi:"string[64],name=match_name" json:"match_name,omitempty"`
294 }
295
296 func (m *PolicerDump) Reset()               { *m = PolicerDump{} }
297 func (*PolicerDump) GetMessageName() string { return "policer_dump" }
298 func (*PolicerDump) GetCrcString() string   { return "35f1ae0f" }
299 func (*PolicerDump) GetMessageType() api.MessageType {
300         return api.RequestMessage
301 }
302
303 func (m *PolicerDump) Size() int {
304         if m == nil {
305                 return 0
306         }
307         var size int
308         size += 1  // m.MatchNameValid
309         size += 64 // m.MatchName
310         return size
311 }
312 func (m *PolicerDump) Marshal(b []byte) ([]byte, error) {
313         var buf *codec.Buffer
314         if b == nil {
315                 buf = codec.NewBuffer(make([]byte, m.Size()))
316         } else {
317                 buf = codec.NewBuffer(b)
318         }
319         buf.EncodeBool(m.MatchNameValid)
320         buf.EncodeString(m.MatchName, 64)
321         return buf.Bytes(), nil
322 }
323 func (m *PolicerDump) Unmarshal(b []byte) error {
324         buf := codec.NewBuffer(b)
325         m.MatchNameValid = buf.DecodeBool()
326         m.MatchName = buf.DecodeString(64)
327         return nil
328 }
329
330 func init() { file_policer_binapi_init() }
331 func file_policer_binapi_init() {
332         api.RegisterMessage((*PolicerAddDel)(nil), "policer_add_del_cb948f6e")
333         api.RegisterMessage((*PolicerAddDelReply)(nil), "policer_add_del_reply_a177cef2")
334         api.RegisterMessage((*PolicerDetails)(nil), "policer_details_a43f781a")
335         api.RegisterMessage((*PolicerDump)(nil), "policer_dump_35f1ae0f")
336 }
337
338 // Messages returns list of all messages in this module.
339 func AllMessages() []api.Message {
340         return []api.Message{
341                 (*PolicerAddDel)(nil),
342                 (*PolicerAddDelReply)(nil),
343                 (*PolicerDetails)(nil),
344                 (*PolicerDump)(nil),
345         }
346 }