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