binapigen: fix union size
[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() (size int) {
71         if m == nil {
72                 return 0
73         }
74         size += 4 // m.PciAddr
75         size += 4 // m.EnableElog
76         size += 2 // m.RxqSize
77         size += 2 // m.RxqNum
78         size += 2 // m.TxqSize
79         size += 2 // m.TxqNum
80         size += 1 // m.Bind
81         size += 1 // m.EnableGso
82         return size
83 }
84 func (m *Vmxnet3Create) Marshal(b []byte) ([]byte, error) {
85         if b == nil {
86                 b = make([]byte, m.Size())
87         }
88         buf := codec.NewBuffer(b)
89         buf.EncodeUint32(m.PciAddr)
90         buf.EncodeInt32(m.EnableElog)
91         buf.EncodeUint16(m.RxqSize)
92         buf.EncodeUint16(m.RxqNum)
93         buf.EncodeUint16(m.TxqSize)
94         buf.EncodeUint16(m.TxqNum)
95         buf.EncodeUint8(m.Bind)
96         buf.EncodeBool(m.EnableGso)
97         return buf.Bytes(), nil
98 }
99 func (m *Vmxnet3Create) Unmarshal(b []byte) error {
100         buf := codec.NewBuffer(b)
101         m.PciAddr = buf.DecodeUint32()
102         m.EnableElog = buf.DecodeInt32()
103         m.RxqSize = buf.DecodeUint16()
104         m.RxqNum = buf.DecodeUint16()
105         m.TxqSize = buf.DecodeUint16()
106         m.TxqNum = buf.DecodeUint16()
107         m.Bind = buf.DecodeUint8()
108         m.EnableGso = buf.DecodeBool()
109         return nil
110 }
111
112 // Vmxnet3CreateReply defines message 'vmxnet3_create_reply'.
113 type Vmxnet3CreateReply struct {
114         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
115         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
116 }
117
118 func (m *Vmxnet3CreateReply) Reset()               { *m = Vmxnet3CreateReply{} }
119 func (*Vmxnet3CreateReply) GetMessageName() string { return "vmxnet3_create_reply" }
120 func (*Vmxnet3CreateReply) GetCrcString() string   { return "5383d31f" }
121 func (*Vmxnet3CreateReply) GetMessageType() api.MessageType {
122         return api.ReplyMessage
123 }
124
125 func (m *Vmxnet3CreateReply) Size() (size int) {
126         if m == nil {
127                 return 0
128         }
129         size += 4 // m.Retval
130         size += 4 // m.SwIfIndex
131         return size
132 }
133 func (m *Vmxnet3CreateReply) Marshal(b []byte) ([]byte, error) {
134         if b == nil {
135                 b = make([]byte, m.Size())
136         }
137         buf := codec.NewBuffer(b)
138         buf.EncodeInt32(m.Retval)
139         buf.EncodeUint32(uint32(m.SwIfIndex))
140         return buf.Bytes(), nil
141 }
142 func (m *Vmxnet3CreateReply) Unmarshal(b []byte) error {
143         buf := codec.NewBuffer(b)
144         m.Retval = buf.DecodeInt32()
145         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
146         return nil
147 }
148
149 // Vmxnet3Delete defines message 'vmxnet3_delete'.
150 type Vmxnet3Delete struct {
151         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
152 }
153
154 func (m *Vmxnet3Delete) Reset()               { *m = Vmxnet3Delete{} }
155 func (*Vmxnet3Delete) GetMessageName() string { return "vmxnet3_delete" }
156 func (*Vmxnet3Delete) GetCrcString() string   { return "f9e6675e" }
157 func (*Vmxnet3Delete) GetMessageType() api.MessageType {
158         return api.RequestMessage
159 }
160
161 func (m *Vmxnet3Delete) Size() (size int) {
162         if m == nil {
163                 return 0
164         }
165         size += 4 // m.SwIfIndex
166         return size
167 }
168 func (m *Vmxnet3Delete) Marshal(b []byte) ([]byte, error) {
169         if b == nil {
170                 b = make([]byte, m.Size())
171         }
172         buf := codec.NewBuffer(b)
173         buf.EncodeUint32(uint32(m.SwIfIndex))
174         return buf.Bytes(), nil
175 }
176 func (m *Vmxnet3Delete) Unmarshal(b []byte) error {
177         buf := codec.NewBuffer(b)
178         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
179         return nil
180 }
181
182 // Vmxnet3DeleteReply defines message 'vmxnet3_delete_reply'.
183 type Vmxnet3DeleteReply struct {
184         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
185 }
186
187 func (m *Vmxnet3DeleteReply) Reset()               { *m = Vmxnet3DeleteReply{} }
188 func (*Vmxnet3DeleteReply) GetMessageName() string { return "vmxnet3_delete_reply" }
189 func (*Vmxnet3DeleteReply) GetCrcString() string   { return "e8d4e804" }
190 func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType {
191         return api.ReplyMessage
192 }
193
194 func (m *Vmxnet3DeleteReply) Size() (size int) {
195         if m == nil {
196                 return 0
197         }
198         size += 4 // m.Retval
199         return size
200 }
201 func (m *Vmxnet3DeleteReply) Marshal(b []byte) ([]byte, error) {
202         if b == nil {
203                 b = make([]byte, m.Size())
204         }
205         buf := codec.NewBuffer(b)
206         buf.EncodeInt32(m.Retval)
207         return buf.Bytes(), nil
208 }
209 func (m *Vmxnet3DeleteReply) Unmarshal(b []byte) error {
210         buf := codec.NewBuffer(b)
211         m.Retval = buf.DecodeInt32()
212         return nil
213 }
214
215 // Vmxnet3Details defines message 'vmxnet3_details'.
216 type Vmxnet3Details struct {
217         SwIfIndex   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
218         IfName      string                         `binapi:"string[64],name=if_name" json:"if_name,omitempty"`
219         HwAddr      ethernet_types.MacAddress      `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
220         PciAddr     uint32                         `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"`
221         Version     uint8                          `binapi:"u8,name=version" json:"version,omitempty"`
222         AdminUpDown bool                           `binapi:"bool,name=admin_up_down" json:"admin_up_down,omitempty"`
223         RxCount     uint8                          `binapi:"u8,name=rx_count" json:"rx_count,omitempty"`
224         RxList      [16]Vmxnet3RxList              `binapi:"vmxnet3_rx_list[16],name=rx_list" json:"rx_list,omitempty"`
225         TxCount     uint8                          `binapi:"u8,name=tx_count" json:"tx_count,omitempty"`
226         TxList      [8]Vmxnet3TxList               `binapi:"vmxnet3_tx_list[8],name=tx_list" json:"tx_list,omitempty"`
227 }
228
229 func (m *Vmxnet3Details) Reset()               { *m = Vmxnet3Details{} }
230 func (*Vmxnet3Details) GetMessageName() string { return "vmxnet3_details" }
231 func (*Vmxnet3Details) GetCrcString() string   { return "829ba055" }
232 func (*Vmxnet3Details) GetMessageType() api.MessageType {
233         return api.ReplyMessage
234 }
235
236 func (m *Vmxnet3Details) Size() (size int) {
237         if m == nil {
238                 return 0
239         }
240         size += 4     // m.SwIfIndex
241         size += 64    // m.IfName
242         size += 1 * 6 // m.HwAddr
243         size += 4     // m.PciAddr
244         size += 1     // m.Version
245         size += 1     // m.AdminUpDown
246         size += 1     // m.RxCount
247         for j1 := 0; j1 < 16; j1++ {
248                 size += 2     // m.RxList[j1].RxQsize
249                 size += 2 * 2 // m.RxList[j1].RxFill
250                 size += 2     // m.RxList[j1].RxNext
251                 size += 2 * 2 // m.RxList[j1].RxProduce
252                 size += 2 * 2 // m.RxList[j1].RxConsume
253         }
254         size += 1 // m.TxCount
255         for j1 := 0; j1 < 8; j1++ {
256                 size += 2 // m.TxList[j1].TxQsize
257                 size += 2 // m.TxList[j1].TxNext
258                 size += 2 // m.TxList[j1].TxProduce
259                 size += 2 // m.TxList[j1].TxConsume
260         }
261         return size
262 }
263 func (m *Vmxnet3Details) Marshal(b []byte) ([]byte, error) {
264         if b == nil {
265                 b = make([]byte, m.Size())
266         }
267         buf := codec.NewBuffer(b)
268         buf.EncodeUint32(uint32(m.SwIfIndex))
269         buf.EncodeString(m.IfName, 64)
270         buf.EncodeBytes(m.HwAddr[:], 6)
271         buf.EncodeUint32(m.PciAddr)
272         buf.EncodeUint8(m.Version)
273         buf.EncodeBool(m.AdminUpDown)
274         buf.EncodeUint8(m.RxCount)
275         for j0 := 0; j0 < 16; j0++ {
276                 buf.EncodeUint16(m.RxList[j0].RxQsize)
277                 for i := 0; i < 2; i++ {
278                         var x uint16
279                         if i < len(m.RxList[j0].RxFill) {
280                                 x = uint16(m.RxList[j0].RxFill[i])
281                         }
282                         buf.EncodeUint16(x)
283                 }
284                 buf.EncodeUint16(m.RxList[j0].RxNext)
285                 for i := 0; i < 2; i++ {
286                         var x uint16
287                         if i < len(m.RxList[j0].RxProduce) {
288                                 x = uint16(m.RxList[j0].RxProduce[i])
289                         }
290                         buf.EncodeUint16(x)
291                 }
292                 for i := 0; i < 2; i++ {
293                         var x uint16
294                         if i < len(m.RxList[j0].RxConsume) {
295                                 x = uint16(m.RxList[j0].RxConsume[i])
296                         }
297                         buf.EncodeUint16(x)
298                 }
299         }
300         buf.EncodeUint8(m.TxCount)
301         for j0 := 0; j0 < 8; j0++ {
302                 buf.EncodeUint16(m.TxList[j0].TxQsize)
303                 buf.EncodeUint16(m.TxList[j0].TxNext)
304                 buf.EncodeUint16(m.TxList[j0].TxProduce)
305                 buf.EncodeUint16(m.TxList[j0].TxConsume)
306         }
307         return buf.Bytes(), nil
308 }
309 func (m *Vmxnet3Details) Unmarshal(b []byte) error {
310         buf := codec.NewBuffer(b)
311         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
312         m.IfName = buf.DecodeString(64)
313         copy(m.HwAddr[:], buf.DecodeBytes(6))
314         m.PciAddr = buf.DecodeUint32()
315         m.Version = buf.DecodeUint8()
316         m.AdminUpDown = buf.DecodeBool()
317         m.RxCount = buf.DecodeUint8()
318         for j0 := 0; j0 < 16; j0++ {
319                 m.RxList[j0].RxQsize = buf.DecodeUint16()
320                 m.RxList[j0].RxFill = make([]uint16, 2)
321                 for i := 0; i < len(m.RxList[j0].RxFill); i++ {
322                         m.RxList[j0].RxFill[i] = buf.DecodeUint16()
323                 }
324                 m.RxList[j0].RxNext = buf.DecodeUint16()
325                 m.RxList[j0].RxProduce = make([]uint16, 2)
326                 for i := 0; i < len(m.RxList[j0].RxProduce); i++ {
327                         m.RxList[j0].RxProduce[i] = buf.DecodeUint16()
328                 }
329                 m.RxList[j0].RxConsume = make([]uint16, 2)
330                 for i := 0; i < len(m.RxList[j0].RxConsume); i++ {
331                         m.RxList[j0].RxConsume[i] = buf.DecodeUint16()
332                 }
333         }
334         m.TxCount = buf.DecodeUint8()
335         for j0 := 0; j0 < 8; j0++ {
336                 m.TxList[j0].TxQsize = buf.DecodeUint16()
337                 m.TxList[j0].TxNext = buf.DecodeUint16()
338                 m.TxList[j0].TxProduce = buf.DecodeUint16()
339                 m.TxList[j0].TxConsume = buf.DecodeUint16()
340         }
341         return nil
342 }
343
344 // Vmxnet3Dump defines message 'vmxnet3_dump'.
345 type Vmxnet3Dump struct{}
346
347 func (m *Vmxnet3Dump) Reset()               { *m = Vmxnet3Dump{} }
348 func (*Vmxnet3Dump) GetMessageName() string { return "vmxnet3_dump" }
349 func (*Vmxnet3Dump) GetCrcString() string   { return "51077d14" }
350 func (*Vmxnet3Dump) GetMessageType() api.MessageType {
351         return api.RequestMessage
352 }
353
354 func (m *Vmxnet3Dump) Size() (size int) {
355         if m == nil {
356                 return 0
357         }
358         return size
359 }
360 func (m *Vmxnet3Dump) Marshal(b []byte) ([]byte, error) {
361         if b == nil {
362                 b = make([]byte, m.Size())
363         }
364         buf := codec.NewBuffer(b)
365         return buf.Bytes(), nil
366 }
367 func (m *Vmxnet3Dump) Unmarshal(b []byte) error {
368         return nil
369 }
370
371 func init() { file_vmxnet3_binapi_init() }
372 func file_vmxnet3_binapi_init() {
373         api.RegisterMessage((*Vmxnet3Create)(nil), "vmxnet3_create_71a07314")
374         api.RegisterMessage((*Vmxnet3CreateReply)(nil), "vmxnet3_create_reply_5383d31f")
375         api.RegisterMessage((*Vmxnet3Delete)(nil), "vmxnet3_delete_f9e6675e")
376         api.RegisterMessage((*Vmxnet3DeleteReply)(nil), "vmxnet3_delete_reply_e8d4e804")
377         api.RegisterMessage((*Vmxnet3Details)(nil), "vmxnet3_details_829ba055")
378         api.RegisterMessage((*Vmxnet3Dump)(nil), "vmxnet3_dump_51077d14")
379 }
380
381 // Messages returns list of all messages in this module.
382 func AllMessages() []api.Message {
383         return []api.Message{
384                 (*Vmxnet3Create)(nil),
385                 (*Vmxnet3CreateReply)(nil),
386                 (*Vmxnet3Delete)(nil),
387                 (*Vmxnet3DeleteReply)(nil),
388                 (*Vmxnet3Details)(nil),
389                 (*Vmxnet3Dump)(nil),
390         }
391 }