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