Improve binapi generator
[govpp.git] / binapi / mactime / mactime.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/plugins/mactime.api.json
6
7 // Package mactime contains generated bindings for API file mactime.api.
8 //
9 // Contents:
10 //   2 structs
11 //   7 messages
12 //
13 package mactime
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "mactime"
30         APIVersion = "2.0.0"
31         VersionCrc = 0x9283d3e
32 )
33
34 // MactimeTimeRange defines type 'mactime_time_range'.
35 type MactimeTimeRange struct {
36         Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
37         End   float64 `binapi:"f64,name=end" json:"end,omitempty"`
38 }
39
40 // TimeRange defines type 'time_range'.
41 type TimeRange struct {
42         Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
43         End   float64 `binapi:"f64,name=end" json:"end,omitempty"`
44 }
45
46 // MactimeAddDelRange defines message 'mactime_add_del_range'.
47 type MactimeAddDelRange struct {
48         IsAdd      bool                      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
49         Drop       bool                      `binapi:"bool,name=drop" json:"drop,omitempty"`
50         Allow      bool                      `binapi:"bool,name=allow" json:"allow,omitempty"`
51         AllowQuota uint8                     `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"`
52         NoUDP10001 bool                      `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"`
53         DataQuota  uint64                    `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
54         MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
55         DeviceName string                    `binapi:"string[64],name=device_name" json:"device_name,omitempty"`
56         Count      uint32                    `binapi:"u32,name=count" json:"-"`
57         Ranges     []TimeRange               `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"`
58 }
59
60 func (m *MactimeAddDelRange) Reset()               { *m = MactimeAddDelRange{} }
61 func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" }
62 func (*MactimeAddDelRange) GetCrcString() string   { return "101858ef" }
63 func (*MactimeAddDelRange) GetMessageType() api.MessageType {
64         return api.RequestMessage
65 }
66
67 func (m *MactimeAddDelRange) Size() int {
68         if m == nil {
69                 return 0
70         }
71         var size int
72         size += 1     // m.IsAdd
73         size += 1     // m.Drop
74         size += 1     // m.Allow
75         size += 1     // m.AllowQuota
76         size += 1     // m.NoUDP10001
77         size += 8     // m.DataQuota
78         size += 1 * 6 // m.MacAddress
79         size += 64    // m.DeviceName
80         size += 4     // m.Count
81         for j1 := 0; j1 < len(m.Ranges); j1++ {
82                 var s1 TimeRange
83                 _ = s1
84                 if j1 < len(m.Ranges) {
85                         s1 = m.Ranges[j1]
86                 }
87                 size += 8 // s1.Start
88                 size += 8 // s1.End
89         }
90         return size
91 }
92 func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) {
93         var buf *codec.Buffer
94         if b == nil {
95                 buf = codec.NewBuffer(make([]byte, m.Size()))
96         } else {
97                 buf = codec.NewBuffer(b)
98         }
99         buf.EncodeBool(m.IsAdd)
100         buf.EncodeBool(m.Drop)
101         buf.EncodeBool(m.Allow)
102         buf.EncodeUint8(uint8(m.AllowQuota))
103         buf.EncodeBool(m.NoUDP10001)
104         buf.EncodeUint64(uint64(m.DataQuota))
105         buf.EncodeBytes(m.MacAddress[:], 6)
106         buf.EncodeString(m.DeviceName, 64)
107         buf.EncodeUint32(uint32(len(m.Ranges)))
108         for j0 := 0; j0 < len(m.Ranges); j0++ {
109                 var v0 TimeRange
110                 if j0 < len(m.Ranges) {
111                         v0 = m.Ranges[j0]
112                 }
113                 buf.EncodeFloat64(float64(v0.Start))
114                 buf.EncodeFloat64(float64(v0.End))
115         }
116         return buf.Bytes(), nil
117 }
118 func (m *MactimeAddDelRange) Unmarshal(b []byte) error {
119         buf := codec.NewBuffer(b)
120         m.IsAdd = buf.DecodeBool()
121         m.Drop = buf.DecodeBool()
122         m.Allow = buf.DecodeBool()
123         m.AllowQuota = buf.DecodeUint8()
124         m.NoUDP10001 = buf.DecodeBool()
125         m.DataQuota = buf.DecodeUint64()
126         copy(m.MacAddress[:], buf.DecodeBytes(6))
127         m.DeviceName = buf.DecodeString(64)
128         m.Count = buf.DecodeUint32()
129         m.Ranges = make([]TimeRange, int(m.Count))
130         for j0 := 0; j0 < len(m.Ranges); j0++ {
131                 m.Ranges[j0].Start = float64(buf.DecodeFloat64())
132                 m.Ranges[j0].End = float64(buf.DecodeFloat64())
133         }
134         return nil
135 }
136
137 // MactimeAddDelRangeReply defines message 'mactime_add_del_range_reply'.
138 type MactimeAddDelRangeReply struct {
139         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
140 }
141
142 func (m *MactimeAddDelRangeReply) Reset()               { *m = MactimeAddDelRangeReply{} }
143 func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" }
144 func (*MactimeAddDelRangeReply) GetCrcString() string   { return "e8d4e804" }
145 func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType {
146         return api.ReplyMessage
147 }
148
149 func (m *MactimeAddDelRangeReply) Size() int {
150         if m == nil {
151                 return 0
152         }
153         var size int
154         size += 4 // m.Retval
155         return size
156 }
157 func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) {
158         var buf *codec.Buffer
159         if b == nil {
160                 buf = codec.NewBuffer(make([]byte, m.Size()))
161         } else {
162                 buf = codec.NewBuffer(b)
163         }
164         buf.EncodeUint32(uint32(m.Retval))
165         return buf.Bytes(), nil
166 }
167 func (m *MactimeAddDelRangeReply) Unmarshal(b []byte) error {
168         buf := codec.NewBuffer(b)
169         m.Retval = int32(buf.DecodeUint32())
170         return nil
171 }
172
173 // MactimeDetails defines message 'mactime_details'.
174 type MactimeDetails struct {
175         PoolIndex       uint32                    `binapi:"u32,name=pool_index" json:"pool_index,omitempty"`
176         MacAddress      ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
177         DataQuota       uint64                    `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
178         DataUsedInRange uint64                    `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"`
179         Flags           uint32                    `binapi:"u32,name=flags" json:"flags,omitempty"`
180         DeviceName      string                    `binapi:"string[64],name=device_name" json:"device_name,omitempty"`
181         Nranges         uint32                    `binapi:"u32,name=nranges" json:"-"`
182         Ranges          []MactimeTimeRange        `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"`
183 }
184
185 func (m *MactimeDetails) Reset()               { *m = MactimeDetails{} }
186 func (*MactimeDetails) GetMessageName() string { return "mactime_details" }
187 func (*MactimeDetails) GetCrcString() string   { return "44921c06" }
188 func (*MactimeDetails) GetMessageType() api.MessageType {
189         return api.ReplyMessage
190 }
191
192 func (m *MactimeDetails) Size() int {
193         if m == nil {
194                 return 0
195         }
196         var size int
197         size += 4     // m.PoolIndex
198         size += 1 * 6 // m.MacAddress
199         size += 8     // m.DataQuota
200         size += 8     // m.DataUsedInRange
201         size += 4     // m.Flags
202         size += 64    // m.DeviceName
203         size += 4     // m.Nranges
204         for j1 := 0; j1 < len(m.Ranges); j1++ {
205                 var s1 MactimeTimeRange
206                 _ = s1
207                 if j1 < len(m.Ranges) {
208                         s1 = m.Ranges[j1]
209                 }
210                 size += 8 // s1.Start
211                 size += 8 // s1.End
212         }
213         return size
214 }
215 func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) {
216         var buf *codec.Buffer
217         if b == nil {
218                 buf = codec.NewBuffer(make([]byte, m.Size()))
219         } else {
220                 buf = codec.NewBuffer(b)
221         }
222         buf.EncodeUint32(uint32(m.PoolIndex))
223         buf.EncodeBytes(m.MacAddress[:], 6)
224         buf.EncodeUint64(uint64(m.DataQuota))
225         buf.EncodeUint64(uint64(m.DataUsedInRange))
226         buf.EncodeUint32(uint32(m.Flags))
227         buf.EncodeString(m.DeviceName, 64)
228         buf.EncodeUint32(uint32(len(m.Ranges)))
229         for j0 := 0; j0 < len(m.Ranges); j0++ {
230                 var v0 MactimeTimeRange
231                 if j0 < len(m.Ranges) {
232                         v0 = m.Ranges[j0]
233                 }
234                 buf.EncodeFloat64(float64(v0.Start))
235                 buf.EncodeFloat64(float64(v0.End))
236         }
237         return buf.Bytes(), nil
238 }
239 func (m *MactimeDetails) Unmarshal(b []byte) error {
240         buf := codec.NewBuffer(b)
241         m.PoolIndex = buf.DecodeUint32()
242         copy(m.MacAddress[:], buf.DecodeBytes(6))
243         m.DataQuota = buf.DecodeUint64()
244         m.DataUsedInRange = buf.DecodeUint64()
245         m.Flags = buf.DecodeUint32()
246         m.DeviceName = buf.DecodeString(64)
247         m.Nranges = buf.DecodeUint32()
248         m.Ranges = make([]MactimeTimeRange, int(m.Nranges))
249         for j0 := 0; j0 < len(m.Ranges); j0++ {
250                 m.Ranges[j0].Start = float64(buf.DecodeFloat64())
251                 m.Ranges[j0].End = float64(buf.DecodeFloat64())
252         }
253         return nil
254 }
255
256 // MactimeDump defines message 'mactime_dump'.
257 type MactimeDump struct {
258         MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"`
259 }
260
261 func (m *MactimeDump) Reset()               { *m = MactimeDump{} }
262 func (*MactimeDump) GetMessageName() string { return "mactime_dump" }
263 func (*MactimeDump) GetCrcString() string   { return "8f454e23" }
264 func (*MactimeDump) GetMessageType() api.MessageType {
265         return api.RequestMessage
266 }
267
268 func (m *MactimeDump) Size() int {
269         if m == nil {
270                 return 0
271         }
272         var size int
273         size += 4 // m.MyTableEpoch
274         return size
275 }
276 func (m *MactimeDump) Marshal(b []byte) ([]byte, error) {
277         var buf *codec.Buffer
278         if b == nil {
279                 buf = codec.NewBuffer(make([]byte, m.Size()))
280         } else {
281                 buf = codec.NewBuffer(b)
282         }
283         buf.EncodeUint32(uint32(m.MyTableEpoch))
284         return buf.Bytes(), nil
285 }
286 func (m *MactimeDump) Unmarshal(b []byte) error {
287         buf := codec.NewBuffer(b)
288         m.MyTableEpoch = buf.DecodeUint32()
289         return nil
290 }
291
292 // MactimeDumpReply defines message 'mactime_dump_reply'.
293 type MactimeDumpReply struct {
294         Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
295         TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"`
296 }
297
298 func (m *MactimeDumpReply) Reset()               { *m = MactimeDumpReply{} }
299 func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" }
300 func (*MactimeDumpReply) GetCrcString() string   { return "49bcc753" }
301 func (*MactimeDumpReply) GetMessageType() api.MessageType {
302         return api.ReplyMessage
303 }
304
305 func (m *MactimeDumpReply) Size() int {
306         if m == nil {
307                 return 0
308         }
309         var size int
310         size += 4 // m.Retval
311         size += 4 // m.TableEpoch
312         return size
313 }
314 func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) {
315         var buf *codec.Buffer
316         if b == nil {
317                 buf = codec.NewBuffer(make([]byte, m.Size()))
318         } else {
319                 buf = codec.NewBuffer(b)
320         }
321         buf.EncodeUint32(uint32(m.Retval))
322         buf.EncodeUint32(uint32(m.TableEpoch))
323         return buf.Bytes(), nil
324 }
325 func (m *MactimeDumpReply) Unmarshal(b []byte) error {
326         buf := codec.NewBuffer(b)
327         m.Retval = int32(buf.DecodeUint32())
328         m.TableEpoch = buf.DecodeUint32()
329         return nil
330 }
331
332 // MactimeEnableDisable defines message 'mactime_enable_disable'.
333 type MactimeEnableDisable struct {
334         EnableDisable bool                           `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
335         SwIfIndex     interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
336 }
337
338 func (m *MactimeEnableDisable) Reset()               { *m = MactimeEnableDisable{} }
339 func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" }
340 func (*MactimeEnableDisable) GetCrcString() string   { return "3865946c" }
341 func (*MactimeEnableDisable) GetMessageType() api.MessageType {
342         return api.RequestMessage
343 }
344
345 func (m *MactimeEnableDisable) Size() int {
346         if m == nil {
347                 return 0
348         }
349         var size int
350         size += 1 // m.EnableDisable
351         size += 4 // m.SwIfIndex
352         return size
353 }
354 func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) {
355         var buf *codec.Buffer
356         if b == nil {
357                 buf = codec.NewBuffer(make([]byte, m.Size()))
358         } else {
359                 buf = codec.NewBuffer(b)
360         }
361         buf.EncodeBool(m.EnableDisable)
362         buf.EncodeUint32(uint32(m.SwIfIndex))
363         return buf.Bytes(), nil
364 }
365 func (m *MactimeEnableDisable) Unmarshal(b []byte) error {
366         buf := codec.NewBuffer(b)
367         m.EnableDisable = buf.DecodeBool()
368         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
369         return nil
370 }
371
372 // MactimeEnableDisableReply defines message 'mactime_enable_disable_reply'.
373 type MactimeEnableDisableReply struct {
374         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
375 }
376
377 func (m *MactimeEnableDisableReply) Reset()               { *m = MactimeEnableDisableReply{} }
378 func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" }
379 func (*MactimeEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
380 func (*MactimeEnableDisableReply) GetMessageType() api.MessageType {
381         return api.ReplyMessage
382 }
383
384 func (m *MactimeEnableDisableReply) Size() int {
385         if m == nil {
386                 return 0
387         }
388         var size int
389         size += 4 // m.Retval
390         return size
391 }
392 func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
393         var buf *codec.Buffer
394         if b == nil {
395                 buf = codec.NewBuffer(make([]byte, m.Size()))
396         } else {
397                 buf = codec.NewBuffer(b)
398         }
399         buf.EncodeUint32(uint32(m.Retval))
400         return buf.Bytes(), nil
401 }
402 func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error {
403         buf := codec.NewBuffer(b)
404         m.Retval = int32(buf.DecodeUint32())
405         return nil
406 }
407
408 func init() { file_mactime_binapi_init() }
409 func file_mactime_binapi_init() {
410         api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_101858ef")
411         api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime_add_del_range_reply_e8d4e804")
412         api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_44921c06")
413         api.RegisterMessage((*MactimeDump)(nil), "mactime_dump_8f454e23")
414         api.RegisterMessage((*MactimeDumpReply)(nil), "mactime_dump_reply_49bcc753")
415         api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime_enable_disable_3865946c")
416         api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime_enable_disable_reply_e8d4e804")
417 }
418
419 // Messages returns list of all messages in this module.
420 func AllMessages() []api.Message {
421         return []api.Message{
422                 (*MactimeAddDelRange)(nil),
423                 (*MactimeAddDelRangeReply)(nil),
424                 (*MactimeDetails)(nil),
425                 (*MactimeDump)(nil),
426                 (*MactimeDumpReply)(nil),
427                 (*MactimeEnableDisable)(nil),
428                 (*MactimeEnableDisableReply)(nil),
429         }
430 }