Improve binapi generator
[govpp.git] / binapi / vmxnet3 / vmxnet3.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/vmxnet3.api.json
6
7 // Package vmxnet3 contains generated bindings for API file vmxnet3.api.
8 //
9 // Contents:
10 //   2 structs
11 //   6 messages
12 //
13 package vmxnet3
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    = "vmxnet3"
30         APIVersion = "1.1.0"
31         VersionCrc = 0x38928311
32 )
33
34 // Vmxnet3RxList defines type 'vmxnet3_rx_list'.
35 type Vmxnet3RxList struct {
36         RxQsize   uint16   `binapi:"u16,name=rx_qsize" json:"rx_qsize,omitempty"`
37         RxFill    []uint16 `binapi:"u16[2],name=rx_fill" json:"rx_fill,omitempty"`
38         RxNext    uint16   `binapi:"u16,name=rx_next" json:"rx_next,omitempty"`
39         RxProduce []uint16 `binapi:"u16[2],name=rx_produce" json:"rx_produce,omitempty"`
40         RxConsume []uint16 `binapi:"u16[2],name=rx_consume" json:"rx_consume,omitempty"`
41 }
42
43 // Vmxnet3TxList defines type 'vmxnet3_tx_list'.
44 type Vmxnet3TxList struct {
45         TxQsize   uint16 `binapi:"u16,name=tx_qsize" json:"tx_qsize,omitempty"`
46         TxNext    uint16 `binapi:"u16,name=tx_next" json:"tx_next,omitempty"`
47         TxProduce uint16 `binapi:"u16,name=tx_produce" json:"tx_produce,omitempty"`
48         TxConsume uint16 `binapi:"u16,name=tx_consume" json:"tx_consume,omitempty"`
49 }
50
51 // Vmxnet3Create defines message 'vmxnet3_create'.
52 type Vmxnet3Create struct {
53         PciAddr    uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"`
54         EnableElog int32  `binapi:"i32,name=enable_elog" json:"enable_elog,omitempty"`
55         RxqSize    uint16 `binapi:"u16,name=rxq_size" json:"rxq_size,omitempty"`
56         RxqNum     uint16 `binapi:"u16,name=rxq_num" json:"rxq_num,omitempty"`
57         TxqSize    uint16 `binapi:"u16,name=txq_size" json:"txq_size,omitempty"`
58         TxqNum     uint16 `binapi:"u16,name=txq_num" json:"txq_num,omitempty"`
59         Bind       uint8  `binapi:"u8,name=bind" json:"bind,omitempty"`
60         EnableGso  bool   `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"`
61 }
62
63 func (m *Vmxnet3Create) Reset()               { *m = Vmxnet3Create{} }
64 func (*Vmxnet3Create) GetMessageName() string { return "vmxnet3_create" }
65 func (*Vmxnet3Create) GetCrcString() string   { return "71a07314" }
66 func (*Vmxnet3Create) GetMessageType() api.MessageType {
67         return api.RequestMessage
68 }
69
70 func (m *Vmxnet3Create) Size() int {
71         if m == nil {
72                 return 0
73         }
74         var size int
75         size += 4 // m.PciAddr
76         size += 4 // m.EnableElog
77         size += 2 // m.RxqSize
78         size += 2 // m.RxqNum
79         size += 2 // m.TxqSize
80         size += 2 // m.TxqNum
81         size += 1 // m.Bind
82         size += 1 // m.EnableGso
83         return size
84 }
85 func (m *Vmxnet3Create) Marshal(b []byte) ([]byte, error) {
86         var buf *codec.Buffer
87         if b == nil {
88                 buf = codec.NewBuffer(make([]byte, m.Size()))
89         } else {
90                 buf = codec.NewBuffer(b)
91         }
92         buf.EncodeUint32(uint32(m.PciAddr))
93         buf.EncodeUint32(uint32(m.EnableElog))
94         buf.EncodeUint16(uint16(m.RxqSize))
95         buf.EncodeUint16(uint16(m.RxqNum))
96         buf.EncodeUint16(uint16(m.TxqSize))
97         buf.EncodeUint16(uint16(m.TxqNum))
98         buf.EncodeUint8(uint8(m.Bind))
99         buf.EncodeBool(m.EnableGso)
100         return buf.Bytes(), nil
101 }
102 func (m *Vmxnet3Create) Unmarshal(b []byte) error {
103         buf := codec.NewBuffer(b)
104         m.PciAddr = buf.DecodeUint32()
105         m.EnableElog = int32(buf.DecodeUint32())
106         m.RxqSize = buf.DecodeUint16()
107         m.RxqNum = buf.DecodeUint16()
108         m.TxqSize = buf.DecodeUint16()
109         m.TxqNum = buf.DecodeUint16()
110         m.Bind = buf.DecodeUint8()
111         m.EnableGso = buf.DecodeBool()
112         return nil
113 }
114
115 // Vmxnet3CreateReply defines message 'vmxnet3_create_reply'.
116 type Vmxnet3CreateReply struct {
117         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
118         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
119 }
120
121 func (m *Vmxnet3CreateReply) Reset()               { *m = Vmxnet3CreateReply{} }
122 func (*Vmxnet3CreateReply) GetMessageName() string { return "vmxnet3_create_reply" }
123 func (*Vmxnet3CreateReply) GetCrcString() string   { return "5383d31f" }
124 func (*Vmxnet3CreateReply) GetMessageType() api.MessageType {
125         return api.ReplyMessage
126 }
127
128 func (m *Vmxnet3CreateReply) Size() int {
129         if m == nil {
130                 return 0
131         }
132         var size int
133         size += 4 // m.Retval
134         size += 4 // m.SwIfIndex
135         return size
136 }
137 func (m *Vmxnet3CreateReply) Marshal(b []byte) ([]byte, error) {
138         var buf *codec.Buffer
139         if b == nil {
140                 buf = codec.NewBuffer(make([]byte, m.Size()))
141         } else {
142                 buf = codec.NewBuffer(b)
143         }
144         buf.EncodeUint32(uint32(m.Retval))
145         buf.EncodeUint32(uint32(m.SwIfIndex))
146         return buf.Bytes(), nil
147 }
148 func (m *Vmxnet3CreateReply) Unmarshal(b []byte) error {
149         buf := codec.NewBuffer(b)
150         m.Retval = int32(buf.DecodeUint32())
151         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
152         return nil
153 }
154
155 // Vmxnet3Delete defines message 'vmxnet3_delete'.
156 type Vmxnet3Delete struct {
157         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
158 }
159
160 func (m *Vmxnet3Delete) Reset()               { *m = Vmxnet3Delete{} }
161 func (*Vmxnet3Delete) GetMessageName() string { return "vmxnet3_delete" }
162 func (*Vmxnet3Delete) GetCrcString() string   { return "f9e6675e" }
163 func (*Vmxnet3Delete) GetMessageType() api.MessageType {
164         return api.RequestMessage
165 }
166
167 func (m *Vmxnet3Delete) Size() int {
168         if m == nil {
169                 return 0
170         }
171         var size int
172         size += 4 // m.SwIfIndex
173         return size
174 }
175 func (m *Vmxnet3Delete) Marshal(b []byte) ([]byte, error) {
176         var buf *codec.Buffer
177         if b == nil {
178                 buf = codec.NewBuffer(make([]byte, m.Size()))
179         } else {
180                 buf = codec.NewBuffer(b)
181         }
182         buf.EncodeUint32(uint32(m.SwIfIndex))
183         return buf.Bytes(), nil
184 }
185 func (m *Vmxnet3Delete) Unmarshal(b []byte) error {
186         buf := codec.NewBuffer(b)
187         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
188         return nil
189 }
190
191 // Vmxnet3DeleteReply defines message 'vmxnet3_delete_reply'.
192 type Vmxnet3DeleteReply struct {
193         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
194 }
195
196 func (m *Vmxnet3DeleteReply) Reset()               { *m = Vmxnet3DeleteReply{} }
197 func (*Vmxnet3DeleteReply) GetMessageName() string { return "vmxnet3_delete_reply" }
198 func (*Vmxnet3DeleteReply) GetCrcString() string   { return "e8d4e804" }
199 func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType {
200         return api.ReplyMessage
201 }
202
203 func (m *Vmxnet3DeleteReply) Size() int {
204         if m == nil {
205                 return 0
206         }
207         var size int
208         size += 4 // m.Retval
209         return size
210 }
211 func (m *Vmxnet3DeleteReply) Marshal(b []byte) ([]byte, error) {
212         var buf *codec.Buffer
213         if b == nil {
214                 buf = codec.NewBuffer(make([]byte, m.Size()))
215         } else {
216                 buf = codec.NewBuffer(b)
217         }
218         buf.EncodeUint32(uint32(m.Retval))
219         return buf.Bytes(), nil
220 }
221 func (m *Vmxnet3DeleteReply) Unmarshal(b []byte) error {
222         buf := codec.NewBuffer(b)
223         m.Retval = int32(buf.DecodeUint32())
224         return nil
225 }
226
227 // Vmxnet3Details defines message 'vmxnet3_details'.
228 type Vmxnet3Details struct {
229         SwIfIndex   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
230         IfName      string                         `binapi:"string[64],name=if_name" json:"if_name,omitempty"`
231         HwAddr      ethernet_types.MacAddress      `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
232         PciAddr     uint32                         `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"`
233         Version     uint8                          `binapi:"u8,name=version" json:"version,omitempty"`
234         AdminUpDown bool                           `binapi:"bool,name=admin_up_down" json:"admin_up_down,omitempty"`
235         RxCount     uint8                          `binapi:"u8,name=rx_count" json:"rx_count,omitempty"`
236         RxList      [16]Vmxnet3RxList              `binapi:"vmxnet3_rx_list[16],name=rx_list" json:"rx_list,omitempty"`
237         TxCount     uint8                          `binapi:"u8,name=tx_count" json:"tx_count,omitempty"`
238         TxList      [8]Vmxnet3TxList               `binapi:"vmxnet3_tx_list[8],name=tx_list" json:"tx_list,omitempty"`
239 }
240
241 func (m *Vmxnet3Details) Reset()               { *m = Vmxnet3Details{} }
242 func (*Vmxnet3Details) GetMessageName() string { return "vmxnet3_details" }
243 func (*Vmxnet3Details) GetCrcString() string   { return "829ba055" }
244 func (*Vmxnet3Details) GetMessageType() api.MessageType {
245         return api.ReplyMessage
246 }
247
248 func (m *Vmxnet3Details) Size() int {
249         if m == nil {
250                 return 0
251         }
252         var size int
253         size += 4     // m.SwIfIndex
254         size += 64    // m.IfName
255         size += 1 * 6 // m.HwAddr
256         size += 4     // m.PciAddr
257         size += 1     // m.Version
258         size += 1     // m.AdminUpDown
259         size += 1     // m.RxCount
260         for j1 := 0; j1 < 16; j1++ {
261                 var s1 Vmxnet3RxList
262                 _ = s1
263                 if j1 < len(m.RxList) {
264                         s1 = m.RxList[j1]
265                 }
266                 size += 2     // s1.RxQsize
267                 size += 2 * 2 // s1.RxFill
268                 size += 2     // s1.RxNext
269                 size += 2 * 2 // s1.RxProduce
270                 size += 2 * 2 // s1.RxConsume
271         }
272         size += 1 // m.TxCount
273         for j1 := 0; j1 < 8; j1++ {
274                 var s1 Vmxnet3TxList
275                 _ = s1
276                 if j1 < len(m.TxList) {
277                         s1 = m.TxList[j1]
278                 }
279                 size += 2 // s1.TxQsize
280                 size += 2 // s1.TxNext
281                 size += 2 // s1.TxProduce
282                 size += 2 // s1.TxConsume
283         }
284         return size
285 }
286 func (m *Vmxnet3Details) Marshal(b []byte) ([]byte, error) {
287         var buf *codec.Buffer
288         if b == nil {
289                 buf = codec.NewBuffer(make([]byte, m.Size()))
290         } else {
291                 buf = codec.NewBuffer(b)
292         }
293         buf.EncodeUint32(uint32(m.SwIfIndex))
294         buf.EncodeString(m.IfName, 64)
295         buf.EncodeBytes(m.HwAddr[:], 6)
296         buf.EncodeUint32(uint32(m.PciAddr))
297         buf.EncodeUint8(uint8(m.Version))
298         buf.EncodeBool(m.AdminUpDown)
299         buf.EncodeUint8(uint8(m.RxCount))
300         for j0 := 0; j0 < 16; j0++ {
301                 var v0 Vmxnet3RxList
302                 if j0 < len(m.RxList) {
303                         v0 = m.RxList[j0]
304                 }
305                 buf.EncodeUint16(uint16(v0.RxQsize))
306                 for i := 0; i < 2; i++ {
307                         var x uint16
308                         if i < len(v0.RxFill) {
309                                 x = uint16(v0.RxFill[i])
310                         }
311                         buf.EncodeUint16(uint16(x))
312                 }
313                 buf.EncodeUint16(uint16(v0.RxNext))
314                 for i := 0; i < 2; i++ {
315                         var x uint16
316                         if i < len(v0.RxProduce) {
317                                 x = uint16(v0.RxProduce[i])
318                         }
319                         buf.EncodeUint16(uint16(x))
320                 }
321                 for i := 0; i < 2; i++ {
322                         var x uint16
323                         if i < len(v0.RxConsume) {
324                                 x = uint16(v0.RxConsume[i])
325                         }
326                         buf.EncodeUint16(uint16(x))
327                 }
328         }
329         buf.EncodeUint8(uint8(m.TxCount))
330         for j0 := 0; j0 < 8; j0++ {
331                 var v0 Vmxnet3TxList
332                 if j0 < len(m.TxList) {
333                         v0 = m.TxList[j0]
334                 }
335                 buf.EncodeUint16(uint16(v0.TxQsize))
336                 buf.EncodeUint16(uint16(v0.TxNext))
337                 buf.EncodeUint16(uint16(v0.TxProduce))
338                 buf.EncodeUint16(uint16(v0.TxConsume))
339         }
340         return buf.Bytes(), nil
341 }
342 func (m *Vmxnet3Details) Unmarshal(b []byte) error {
343         buf := codec.NewBuffer(b)
344         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
345         m.IfName = buf.DecodeString(64)
346         copy(m.HwAddr[:], buf.DecodeBytes(6))
347         m.PciAddr = buf.DecodeUint32()
348         m.Version = buf.DecodeUint8()
349         m.AdminUpDown = buf.DecodeBool()
350         m.RxCount = buf.DecodeUint8()
351         for j0 := 0; j0 < 16; j0++ {
352                 m.RxList[j0].RxQsize = buf.DecodeUint16()
353                 m.RxList[j0].RxFill = make([]uint16, 2)
354                 for i := 0; i < len(m.RxList[j0].RxFill); i++ {
355                         m.RxList[j0].RxFill[i] = buf.DecodeUint16()
356                 }
357                 m.RxList[j0].RxNext = buf.DecodeUint16()
358                 m.RxList[j0].RxProduce = make([]uint16, 2)
359                 for i := 0; i < len(m.RxList[j0].RxProduce); i++ {
360                         m.RxList[j0].RxProduce[i] = buf.DecodeUint16()
361                 }
362                 m.RxList[j0].RxConsume = make([]uint16, 2)
363                 for i := 0; i < len(m.RxList[j0].RxConsume); i++ {
364                         m.RxList[j0].RxConsume[i] = buf.DecodeUint16()
365                 }
366         }
367         m.TxCount = buf.DecodeUint8()
368         for j0 := 0; j0 < 8; j0++ {
369                 m.TxList[j0].TxQsize = buf.DecodeUint16()
370                 m.TxList[j0].TxNext = buf.DecodeUint16()
371                 m.TxList[j0].TxProduce = buf.DecodeUint16()
372                 m.TxList[j0].TxConsume = buf.DecodeUint16()
373         }
374         return nil
375 }
376
377 // Vmxnet3Dump defines message 'vmxnet3_dump'.
378 type Vmxnet3Dump struct{}
379
380 func (m *Vmxnet3Dump) Reset()               { *m = Vmxnet3Dump{} }
381 func (*Vmxnet3Dump) GetMessageName() string { return "vmxnet3_dump" }
382 func (*Vmxnet3Dump) GetCrcString() string   { return "51077d14" }
383 func (*Vmxnet3Dump) GetMessageType() api.MessageType {
384         return api.RequestMessage
385 }
386
387 func (m *Vmxnet3Dump) Size() int {
388         if m == nil {
389                 return 0
390         }
391         var size int
392         return size
393 }
394 func (m *Vmxnet3Dump) Marshal(b []byte) ([]byte, error) {
395         var buf *codec.Buffer
396         if b == nil {
397                 buf = codec.NewBuffer(make([]byte, m.Size()))
398         } else {
399                 buf = codec.NewBuffer(b)
400         }
401         return buf.Bytes(), nil
402 }
403 func (m *Vmxnet3Dump) Unmarshal(b []byte) error {
404         return nil
405 }
406
407 func init() { file_vmxnet3_binapi_init() }
408 func file_vmxnet3_binapi_init() {
409         api.RegisterMessage((*Vmxnet3Create)(nil), "vmxnet3_create_71a07314")
410         api.RegisterMessage((*Vmxnet3CreateReply)(nil), "vmxnet3_create_reply_5383d31f")
411         api.RegisterMessage((*Vmxnet3Delete)(nil), "vmxnet3_delete_f9e6675e")
412         api.RegisterMessage((*Vmxnet3DeleteReply)(nil), "vmxnet3_delete_reply_e8d4e804")
413         api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3_details_829ba055")
414         api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3_dump_51077d14")
415 }
416
417 // Messages returns list of all messages in this module.
418 func AllMessages() []api.Message {
419         return []api.Message{
420                 (*Vmxnet3Create)(nil),
421                 (*Vmxnet3CreateReply)(nil),
422                 (*Vmxnet3Delete)(nil),
423                 (*Vmxnet3DeleteReply)(nil),
424                 (*Vmxnet3Details)(nil),
425                 (*Vmxnet3Dump)(nil),
426         }
427 }