binapigen: fix union size
[govpp.git] / binapi / vhost_user / vhost_user.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/vhost_user.api.json
6
7 // Package vhost_user contains generated bindings for API file vhost_user.api.
8 //
9 // Contents:
10 //   8 messages
11 //
12 package vhost_user
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
18         virtio_types "git.fd.io/govpp.git/binapi/virtio_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    = "vhost_user"
30         APIVersion = "4.0.1"
31         VersionCrc = 0x3df14dfe
32 )
33
34 // CreateVhostUserIf defines message 'create_vhost_user_if'.
35 type CreateVhostUserIf struct {
36         IsServer            bool                      `binapi:"bool,name=is_server" json:"is_server,omitempty"`
37         SockFilename        string                    `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
38         Renumber            bool                      `binapi:"bool,name=renumber" json:"renumber,omitempty"`
39         DisableMrgRxbuf     bool                      `binapi:"bool,name=disable_mrg_rxbuf" json:"disable_mrg_rxbuf,omitempty"`
40         DisableIndirectDesc bool                      `binapi:"bool,name=disable_indirect_desc" json:"disable_indirect_desc,omitempty"`
41         EnableGso           bool                      `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"`
42         EnablePacked        bool                      `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"`
43         CustomDevInstance   uint32                    `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"`
44         UseCustomMac        bool                      `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"`
45         MacAddress          ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
46         Tag                 string                    `binapi:"string[64],name=tag" json:"tag,omitempty"`
47 }
48
49 func (m *CreateVhostUserIf) Reset()               { *m = CreateVhostUserIf{} }
50 func (*CreateVhostUserIf) GetMessageName() string { return "create_vhost_user_if" }
51 func (*CreateVhostUserIf) GetCrcString() string   { return "c785c6fc" }
52 func (*CreateVhostUserIf) GetMessageType() api.MessageType {
53         return api.RequestMessage
54 }
55
56 func (m *CreateVhostUserIf) Size() (size int) {
57         if m == nil {
58                 return 0
59         }
60         size += 1     // m.IsServer
61         size += 256   // m.SockFilename
62         size += 1     // m.Renumber
63         size += 1     // m.DisableMrgRxbuf
64         size += 1     // m.DisableIndirectDesc
65         size += 1     // m.EnableGso
66         size += 1     // m.EnablePacked
67         size += 4     // m.CustomDevInstance
68         size += 1     // m.UseCustomMac
69         size += 1 * 6 // m.MacAddress
70         size += 64    // m.Tag
71         return size
72 }
73 func (m *CreateVhostUserIf) Marshal(b []byte) ([]byte, error) {
74         if b == nil {
75                 b = make([]byte, m.Size())
76         }
77         buf := codec.NewBuffer(b)
78         buf.EncodeBool(m.IsServer)
79         buf.EncodeString(m.SockFilename, 256)
80         buf.EncodeBool(m.Renumber)
81         buf.EncodeBool(m.DisableMrgRxbuf)
82         buf.EncodeBool(m.DisableIndirectDesc)
83         buf.EncodeBool(m.EnableGso)
84         buf.EncodeBool(m.EnablePacked)
85         buf.EncodeUint32(m.CustomDevInstance)
86         buf.EncodeBool(m.UseCustomMac)
87         buf.EncodeBytes(m.MacAddress[:], 6)
88         buf.EncodeString(m.Tag, 64)
89         return buf.Bytes(), nil
90 }
91 func (m *CreateVhostUserIf) Unmarshal(b []byte) error {
92         buf := codec.NewBuffer(b)
93         m.IsServer = buf.DecodeBool()
94         m.SockFilename = buf.DecodeString(256)
95         m.Renumber = buf.DecodeBool()
96         m.DisableMrgRxbuf = buf.DecodeBool()
97         m.DisableIndirectDesc = buf.DecodeBool()
98         m.EnableGso = buf.DecodeBool()
99         m.EnablePacked = buf.DecodeBool()
100         m.CustomDevInstance = buf.DecodeUint32()
101         m.UseCustomMac = buf.DecodeBool()
102         copy(m.MacAddress[:], buf.DecodeBytes(6))
103         m.Tag = buf.DecodeString(64)
104         return nil
105 }
106
107 // CreateVhostUserIfReply defines message 'create_vhost_user_if_reply'.
108 type CreateVhostUserIfReply struct {
109         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
110         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
111 }
112
113 func (m *CreateVhostUserIfReply) Reset()               { *m = CreateVhostUserIfReply{} }
114 func (*CreateVhostUserIfReply) GetMessageName() string { return "create_vhost_user_if_reply" }
115 func (*CreateVhostUserIfReply) GetCrcString() string   { return "5383d31f" }
116 func (*CreateVhostUserIfReply) GetMessageType() api.MessageType {
117         return api.ReplyMessage
118 }
119
120 func (m *CreateVhostUserIfReply) Size() (size int) {
121         if m == nil {
122                 return 0
123         }
124         size += 4 // m.Retval
125         size += 4 // m.SwIfIndex
126         return size
127 }
128 func (m *CreateVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
129         if b == nil {
130                 b = make([]byte, m.Size())
131         }
132         buf := codec.NewBuffer(b)
133         buf.EncodeInt32(m.Retval)
134         buf.EncodeUint32(uint32(m.SwIfIndex))
135         return buf.Bytes(), nil
136 }
137 func (m *CreateVhostUserIfReply) Unmarshal(b []byte) error {
138         buf := codec.NewBuffer(b)
139         m.Retval = buf.DecodeInt32()
140         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
141         return nil
142 }
143
144 // DeleteVhostUserIf defines message 'delete_vhost_user_if'.
145 type DeleteVhostUserIf struct {
146         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
147 }
148
149 func (m *DeleteVhostUserIf) Reset()               { *m = DeleteVhostUserIf{} }
150 func (*DeleteVhostUserIf) GetMessageName() string { return "delete_vhost_user_if" }
151 func (*DeleteVhostUserIf) GetCrcString() string   { return "f9e6675e" }
152 func (*DeleteVhostUserIf) GetMessageType() api.MessageType {
153         return api.RequestMessage
154 }
155
156 func (m *DeleteVhostUserIf) Size() (size int) {
157         if m == nil {
158                 return 0
159         }
160         size += 4 // m.SwIfIndex
161         return size
162 }
163 func (m *DeleteVhostUserIf) Marshal(b []byte) ([]byte, error) {
164         if b == nil {
165                 b = make([]byte, m.Size())
166         }
167         buf := codec.NewBuffer(b)
168         buf.EncodeUint32(uint32(m.SwIfIndex))
169         return buf.Bytes(), nil
170 }
171 func (m *DeleteVhostUserIf) Unmarshal(b []byte) error {
172         buf := codec.NewBuffer(b)
173         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
174         return nil
175 }
176
177 // DeleteVhostUserIfReply defines message 'delete_vhost_user_if_reply'.
178 type DeleteVhostUserIfReply struct {
179         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
180 }
181
182 func (m *DeleteVhostUserIfReply) Reset()               { *m = DeleteVhostUserIfReply{} }
183 func (*DeleteVhostUserIfReply) GetMessageName() string { return "delete_vhost_user_if_reply" }
184 func (*DeleteVhostUserIfReply) GetCrcString() string   { return "e8d4e804" }
185 func (*DeleteVhostUserIfReply) GetMessageType() api.MessageType {
186         return api.ReplyMessage
187 }
188
189 func (m *DeleteVhostUserIfReply) Size() (size int) {
190         if m == nil {
191                 return 0
192         }
193         size += 4 // m.Retval
194         return size
195 }
196 func (m *DeleteVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
197         if b == nil {
198                 b = make([]byte, m.Size())
199         }
200         buf := codec.NewBuffer(b)
201         buf.EncodeInt32(m.Retval)
202         return buf.Bytes(), nil
203 }
204 func (m *DeleteVhostUserIfReply) Unmarshal(b []byte) error {
205         buf := codec.NewBuffer(b)
206         m.Retval = buf.DecodeInt32()
207         return nil
208 }
209
210 // ModifyVhostUserIf defines message 'modify_vhost_user_if'.
211 type ModifyVhostUserIf struct {
212         SwIfIndex         interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
213         IsServer          bool                           `binapi:"bool,name=is_server" json:"is_server,omitempty"`
214         SockFilename      string                         `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
215         Renumber          bool                           `binapi:"bool,name=renumber" json:"renumber,omitempty"`
216         EnableGso         bool                           `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"`
217         EnablePacked      bool                           `binapi:"bool,name=enable_packed" json:"enable_packed,omitempty"`
218         CustomDevInstance uint32                         `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"`
219 }
220
221 func (m *ModifyVhostUserIf) Reset()               { *m = ModifyVhostUserIf{} }
222 func (*ModifyVhostUserIf) GetMessageName() string { return "modify_vhost_user_if" }
223 func (*ModifyVhostUserIf) GetCrcString() string   { return "0e71d40b" }
224 func (*ModifyVhostUserIf) GetMessageType() api.MessageType {
225         return api.RequestMessage
226 }
227
228 func (m *ModifyVhostUserIf) Size() (size int) {
229         if m == nil {
230                 return 0
231         }
232         size += 4   // m.SwIfIndex
233         size += 1   // m.IsServer
234         size += 256 // m.SockFilename
235         size += 1   // m.Renumber
236         size += 1   // m.EnableGso
237         size += 1   // m.EnablePacked
238         size += 4   // m.CustomDevInstance
239         return size
240 }
241 func (m *ModifyVhostUserIf) Marshal(b []byte) ([]byte, error) {
242         if b == nil {
243                 b = make([]byte, m.Size())
244         }
245         buf := codec.NewBuffer(b)
246         buf.EncodeUint32(uint32(m.SwIfIndex))
247         buf.EncodeBool(m.IsServer)
248         buf.EncodeString(m.SockFilename, 256)
249         buf.EncodeBool(m.Renumber)
250         buf.EncodeBool(m.EnableGso)
251         buf.EncodeBool(m.EnablePacked)
252         buf.EncodeUint32(m.CustomDevInstance)
253         return buf.Bytes(), nil
254 }
255 func (m *ModifyVhostUserIf) Unmarshal(b []byte) error {
256         buf := codec.NewBuffer(b)
257         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
258         m.IsServer = buf.DecodeBool()
259         m.SockFilename = buf.DecodeString(256)
260         m.Renumber = buf.DecodeBool()
261         m.EnableGso = buf.DecodeBool()
262         m.EnablePacked = buf.DecodeBool()
263         m.CustomDevInstance = buf.DecodeUint32()
264         return nil
265 }
266
267 // ModifyVhostUserIfReply defines message 'modify_vhost_user_if_reply'.
268 type ModifyVhostUserIfReply struct {
269         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
270 }
271
272 func (m *ModifyVhostUserIfReply) Reset()               { *m = ModifyVhostUserIfReply{} }
273 func (*ModifyVhostUserIfReply) GetMessageName() string { return "modify_vhost_user_if_reply" }
274 func (*ModifyVhostUserIfReply) GetCrcString() string   { return "e8d4e804" }
275 func (*ModifyVhostUserIfReply) GetMessageType() api.MessageType {
276         return api.ReplyMessage
277 }
278
279 func (m *ModifyVhostUserIfReply) Size() (size int) {
280         if m == nil {
281                 return 0
282         }
283         size += 4 // m.Retval
284         return size
285 }
286 func (m *ModifyVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
287         if b == nil {
288                 b = make([]byte, m.Size())
289         }
290         buf := codec.NewBuffer(b)
291         buf.EncodeInt32(m.Retval)
292         return buf.Bytes(), nil
293 }
294 func (m *ModifyVhostUserIfReply) Unmarshal(b []byte) error {
295         buf := codec.NewBuffer(b)
296         m.Retval = buf.DecodeInt32()
297         return nil
298 }
299
300 // SwInterfaceVhostUserDetails defines message 'sw_interface_vhost_user_details'.
301 type SwInterfaceVhostUserDetails struct {
302         SwIfIndex       interface_types.InterfaceIndex        `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
303         InterfaceName   string                                `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"`
304         VirtioNetHdrSz  uint32                                `binapi:"u32,name=virtio_net_hdr_sz" json:"virtio_net_hdr_sz,omitempty"`
305         FeaturesFirst32 virtio_types.VirtioNetFeaturesFirst32 `binapi:"virtio_net_features_first_32,name=features_first_32" json:"features_first_32,omitempty"`
306         FeaturesLast32  virtio_types.VirtioNetFeaturesLast32  `binapi:"virtio_net_features_last_32,name=features_last_32" json:"features_last_32,omitempty"`
307         IsServer        bool                                  `binapi:"bool,name=is_server" json:"is_server,omitempty"`
308         SockFilename    string                                `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
309         NumRegions      uint32                                `binapi:"u32,name=num_regions" json:"num_regions,omitempty"`
310         SockErrno       int32                                 `binapi:"i32,name=sock_errno" json:"sock_errno,omitempty"`
311 }
312
313 func (m *SwInterfaceVhostUserDetails) Reset()               { *m = SwInterfaceVhostUserDetails{} }
314 func (*SwInterfaceVhostUserDetails) GetMessageName() string { return "sw_interface_vhost_user_details" }
315 func (*SwInterfaceVhostUserDetails) GetCrcString() string   { return "98530df1" }
316 func (*SwInterfaceVhostUserDetails) GetMessageType() api.MessageType {
317         return api.ReplyMessage
318 }
319
320 func (m *SwInterfaceVhostUserDetails) Size() (size int) {
321         if m == nil {
322                 return 0
323         }
324         size += 4   // m.SwIfIndex
325         size += 64  // m.InterfaceName
326         size += 4   // m.VirtioNetHdrSz
327         size += 4   // m.FeaturesFirst32
328         size += 4   // m.FeaturesLast32
329         size += 1   // m.IsServer
330         size += 256 // m.SockFilename
331         size += 4   // m.NumRegions
332         size += 4   // m.SockErrno
333         return size
334 }
335 func (m *SwInterfaceVhostUserDetails) Marshal(b []byte) ([]byte, error) {
336         if b == nil {
337                 b = make([]byte, m.Size())
338         }
339         buf := codec.NewBuffer(b)
340         buf.EncodeUint32(uint32(m.SwIfIndex))
341         buf.EncodeString(m.InterfaceName, 64)
342         buf.EncodeUint32(m.VirtioNetHdrSz)
343         buf.EncodeUint32(uint32(m.FeaturesFirst32))
344         buf.EncodeUint32(uint32(m.FeaturesLast32))
345         buf.EncodeBool(m.IsServer)
346         buf.EncodeString(m.SockFilename, 256)
347         buf.EncodeUint32(m.NumRegions)
348         buf.EncodeInt32(m.SockErrno)
349         return buf.Bytes(), nil
350 }
351 func (m *SwInterfaceVhostUserDetails) Unmarshal(b []byte) error {
352         buf := codec.NewBuffer(b)
353         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
354         m.InterfaceName = buf.DecodeString(64)
355         m.VirtioNetHdrSz = buf.DecodeUint32()
356         m.FeaturesFirst32 = virtio_types.VirtioNetFeaturesFirst32(buf.DecodeUint32())
357         m.FeaturesLast32 = virtio_types.VirtioNetFeaturesLast32(buf.DecodeUint32())
358         m.IsServer = buf.DecodeBool()
359         m.SockFilename = buf.DecodeString(256)
360         m.NumRegions = buf.DecodeUint32()
361         m.SockErrno = buf.DecodeInt32()
362         return nil
363 }
364
365 // SwInterfaceVhostUserDump defines message 'sw_interface_vhost_user_dump'.
366 type SwInterfaceVhostUserDump struct {
367         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
368 }
369
370 func (m *SwInterfaceVhostUserDump) Reset()               { *m = SwInterfaceVhostUserDump{} }
371 func (*SwInterfaceVhostUserDump) GetMessageName() string { return "sw_interface_vhost_user_dump" }
372 func (*SwInterfaceVhostUserDump) GetCrcString() string   { return "f9e6675e" }
373 func (*SwInterfaceVhostUserDump) GetMessageType() api.MessageType {
374         return api.RequestMessage
375 }
376
377 func (m *SwInterfaceVhostUserDump) Size() (size int) {
378         if m == nil {
379                 return 0
380         }
381         size += 4 // m.SwIfIndex
382         return size
383 }
384 func (m *SwInterfaceVhostUserDump) Marshal(b []byte) ([]byte, error) {
385         if b == nil {
386                 b = make([]byte, m.Size())
387         }
388         buf := codec.NewBuffer(b)
389         buf.EncodeUint32(uint32(m.SwIfIndex))
390         return buf.Bytes(), nil
391 }
392 func (m *SwInterfaceVhostUserDump) Unmarshal(b []byte) error {
393         buf := codec.NewBuffer(b)
394         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
395         return nil
396 }
397
398 func init() { file_vhost_user_binapi_init() }
399 func file_vhost_user_binapi_init() {
400         api.RegisterMessage((*CreateVhostUserIf)(nil), "create_vhost_user_if_c785c6fc")
401         api.RegisterMessage((*CreateVhostUserIfReply)(nil), "create_vhost_user_if_reply_5383d31f")
402         api.RegisterMessage((*DeleteVhostUserIf)(nil), "delete_vhost_user_if_f9e6675e")
403         api.RegisterMessage((*DeleteVhostUserIfReply)(nil), "delete_vhost_user_if_reply_e8d4e804")
404         api.RegisterMessage((*ModifyVhostUserIf)(nil), "modify_vhost_user_if_0e71d40b")
405         api.RegisterMessage((*ModifyVhostUserIfReply)(nil), "modify_vhost_user_if_reply_e8d4e804")
406         api.RegisterMessage((*SwInterfaceVhostUserDetails)(nil), "sw_interface_vhost_user_details_98530df1")
407         api.RegisterMessage((*SwInterfaceVhostUserDump)(nil), "sw_interface_vhost_user_dump_f9e6675e")
408 }
409
410 // Messages returns list of all messages in this module.
411 func AllMessages() []api.Message {
412         return []api.Message{
413                 (*CreateVhostUserIf)(nil),
414                 (*CreateVhostUserIfReply)(nil),
415                 (*DeleteVhostUserIf)(nil),
416                 (*DeleteVhostUserIfReply)(nil),
417                 (*ModifyVhostUserIf)(nil),
418                 (*ModifyVhostUserIfReply)(nil),
419                 (*SwInterfaceVhostUserDetails)(nil),
420                 (*SwInterfaceVhostUserDump)(nil),
421         }
422 }