Improve binapi generator
[govpp.git] / binapi / virtio / virtio.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/virtio.api.json
6
7 // Package virtio contains generated bindings for API file virtio.api.
8 //
9 // Contents:
10 //   6 messages
11 //
12 package virtio
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         pci_types "git.fd.io/govpp.git/binapi/pci_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    = "virtio"
30         APIVersion = "2.0.0"
31         VersionCrc = 0x601b1fdc
32 )
33
34 // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
35 type SwInterfaceVirtioPciDetails struct {
36         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
37         PciAddr   pci_types.PciAddress           `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
38         MacAddr   ethernet_types.MacAddress      `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"`
39         TxRingSz  uint16                         `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
40         RxRingSz  uint16                         `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
41         Features  uint64                         `binapi:"u64,name=features" json:"features,omitempty"`
42 }
43
44 func (m *SwInterfaceVirtioPciDetails) Reset()               { *m = SwInterfaceVirtioPciDetails{} }
45 func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
46 func (*SwInterfaceVirtioPciDetails) GetCrcString() string   { return "16187f3a" }
47 func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
48         return api.ReplyMessage
49 }
50
51 func (m *SwInterfaceVirtioPciDetails) Size() int {
52         if m == nil {
53                 return 0
54         }
55         var size int
56         size += 4     // m.SwIfIndex
57         size += 2     // m.PciAddr.Domain
58         size += 1     // m.PciAddr.Bus
59         size += 1     // m.PciAddr.Slot
60         size += 1     // m.PciAddr.Function
61         size += 1 * 6 // m.MacAddr
62         size += 2     // m.TxRingSz
63         size += 2     // m.RxRingSz
64         size += 8     // m.Features
65         return size
66 }
67 func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
68         var buf *codec.Buffer
69         if b == nil {
70                 buf = codec.NewBuffer(make([]byte, m.Size()))
71         } else {
72                 buf = codec.NewBuffer(b)
73         }
74         buf.EncodeUint32(uint32(m.SwIfIndex))
75         buf.EncodeUint16(uint16(m.PciAddr.Domain))
76         buf.EncodeUint8(uint8(m.PciAddr.Bus))
77         buf.EncodeUint8(uint8(m.PciAddr.Slot))
78         buf.EncodeUint8(uint8(m.PciAddr.Function))
79         buf.EncodeBytes(m.MacAddr[:], 6)
80         buf.EncodeUint16(uint16(m.TxRingSz))
81         buf.EncodeUint16(uint16(m.RxRingSz))
82         buf.EncodeUint64(uint64(m.Features))
83         return buf.Bytes(), nil
84 }
85 func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
86         buf := codec.NewBuffer(b)
87         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
88         m.PciAddr.Domain = buf.DecodeUint16()
89         m.PciAddr.Bus = buf.DecodeUint8()
90         m.PciAddr.Slot = buf.DecodeUint8()
91         m.PciAddr.Function = buf.DecodeUint8()
92         copy(m.MacAddr[:], buf.DecodeBytes(6))
93         m.TxRingSz = buf.DecodeUint16()
94         m.RxRingSz = buf.DecodeUint16()
95         m.Features = buf.DecodeUint64()
96         return nil
97 }
98
99 // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'.
100 type SwInterfaceVirtioPciDump struct{}
101
102 func (m *SwInterfaceVirtioPciDump) Reset()               { *m = SwInterfaceVirtioPciDump{} }
103 func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" }
104 func (*SwInterfaceVirtioPciDump) GetCrcString() string   { return "51077d14" }
105 func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
106         return api.RequestMessage
107 }
108
109 func (m *SwInterfaceVirtioPciDump) Size() int {
110         if m == nil {
111                 return 0
112         }
113         var size int
114         return size
115 }
116 func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
117         var buf *codec.Buffer
118         if b == nil {
119                 buf = codec.NewBuffer(make([]byte, m.Size()))
120         } else {
121                 buf = codec.NewBuffer(b)
122         }
123         return buf.Bytes(), nil
124 }
125 func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
126         return nil
127 }
128
129 // VirtioPciCreate defines message 'virtio_pci_create'.
130 type VirtioPciCreate struct {
131         PciAddr                pci_types.PciAddress      `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
132         UseRandomMac           bool                      `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
133         MacAddress             ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
134         GsoEnabled             bool                      `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
135         ChecksumOffloadEnabled bool                      `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"`
136         Features               uint64                    `binapi:"u64,name=features" json:"features,omitempty"`
137 }
138
139 func (m *VirtioPciCreate) Reset()               { *m = VirtioPciCreate{} }
140 func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
141 func (*VirtioPciCreate) GetCrcString() string   { return "a9f1370c" }
142 func (*VirtioPciCreate) GetMessageType() api.MessageType {
143         return api.RequestMessage
144 }
145
146 func (m *VirtioPciCreate) Size() int {
147         if m == nil {
148                 return 0
149         }
150         var size int
151         size += 2     // m.PciAddr.Domain
152         size += 1     // m.PciAddr.Bus
153         size += 1     // m.PciAddr.Slot
154         size += 1     // m.PciAddr.Function
155         size += 1     // m.UseRandomMac
156         size += 1 * 6 // m.MacAddress
157         size += 1     // m.GsoEnabled
158         size += 1     // m.ChecksumOffloadEnabled
159         size += 8     // m.Features
160         return size
161 }
162 func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
163         var buf *codec.Buffer
164         if b == nil {
165                 buf = codec.NewBuffer(make([]byte, m.Size()))
166         } else {
167                 buf = codec.NewBuffer(b)
168         }
169         buf.EncodeUint16(uint16(m.PciAddr.Domain))
170         buf.EncodeUint8(uint8(m.PciAddr.Bus))
171         buf.EncodeUint8(uint8(m.PciAddr.Slot))
172         buf.EncodeUint8(uint8(m.PciAddr.Function))
173         buf.EncodeBool(m.UseRandomMac)
174         buf.EncodeBytes(m.MacAddress[:], 6)
175         buf.EncodeBool(m.GsoEnabled)
176         buf.EncodeBool(m.ChecksumOffloadEnabled)
177         buf.EncodeUint64(uint64(m.Features))
178         return buf.Bytes(), nil
179 }
180 func (m *VirtioPciCreate) Unmarshal(b []byte) error {
181         buf := codec.NewBuffer(b)
182         m.PciAddr.Domain = buf.DecodeUint16()
183         m.PciAddr.Bus = buf.DecodeUint8()
184         m.PciAddr.Slot = buf.DecodeUint8()
185         m.PciAddr.Function = buf.DecodeUint8()
186         m.UseRandomMac = buf.DecodeBool()
187         copy(m.MacAddress[:], buf.DecodeBytes(6))
188         m.GsoEnabled = buf.DecodeBool()
189         m.ChecksumOffloadEnabled = buf.DecodeBool()
190         m.Features = buf.DecodeUint64()
191         return nil
192 }
193
194 // VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
195 type VirtioPciCreateReply struct {
196         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
197         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
198 }
199
200 func (m *VirtioPciCreateReply) Reset()               { *m = VirtioPciCreateReply{} }
201 func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" }
202 func (*VirtioPciCreateReply) GetCrcString() string   { return "5383d31f" }
203 func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
204         return api.ReplyMessage
205 }
206
207 func (m *VirtioPciCreateReply) Size() int {
208         if m == nil {
209                 return 0
210         }
211         var size int
212         size += 4 // m.Retval
213         size += 4 // m.SwIfIndex
214         return size
215 }
216 func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
217         var buf *codec.Buffer
218         if b == nil {
219                 buf = codec.NewBuffer(make([]byte, m.Size()))
220         } else {
221                 buf = codec.NewBuffer(b)
222         }
223         buf.EncodeUint32(uint32(m.Retval))
224         buf.EncodeUint32(uint32(m.SwIfIndex))
225         return buf.Bytes(), nil
226 }
227 func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
228         buf := codec.NewBuffer(b)
229         m.Retval = int32(buf.DecodeUint32())
230         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
231         return nil
232 }
233
234 // VirtioPciDelete defines message 'virtio_pci_delete'.
235 type VirtioPciDelete struct {
236         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
237 }
238
239 func (m *VirtioPciDelete) Reset()               { *m = VirtioPciDelete{} }
240 func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" }
241 func (*VirtioPciDelete) GetCrcString() string   { return "f9e6675e" }
242 func (*VirtioPciDelete) GetMessageType() api.MessageType {
243         return api.RequestMessage
244 }
245
246 func (m *VirtioPciDelete) Size() int {
247         if m == nil {
248                 return 0
249         }
250         var size int
251         size += 4 // m.SwIfIndex
252         return size
253 }
254 func (m *VirtioPciDelete) 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         return buf.Bytes(), nil
263 }
264 func (m *VirtioPciDelete) Unmarshal(b []byte) error {
265         buf := codec.NewBuffer(b)
266         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
267         return nil
268 }
269
270 // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'.
271 type VirtioPciDeleteReply struct {
272         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
273 }
274
275 func (m *VirtioPciDeleteReply) Reset()               { *m = VirtioPciDeleteReply{} }
276 func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" }
277 func (*VirtioPciDeleteReply) GetCrcString() string   { return "e8d4e804" }
278 func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
279         return api.ReplyMessage
280 }
281
282 func (m *VirtioPciDeleteReply) Size() int {
283         if m == nil {
284                 return 0
285         }
286         var size int
287         size += 4 // m.Retval
288         return size
289 }
290 func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
291         var buf *codec.Buffer
292         if b == nil {
293                 buf = codec.NewBuffer(make([]byte, m.Size()))
294         } else {
295                 buf = codec.NewBuffer(b)
296         }
297         buf.EncodeUint32(uint32(m.Retval))
298         return buf.Bytes(), nil
299 }
300 func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
301         buf := codec.NewBuffer(b)
302         m.Retval = int32(buf.DecodeUint32())
303         return nil
304 }
305
306 func init() { file_virtio_binapi_init() }
307 func file_virtio_binapi_init() {
308         api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a")
309         api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
310         api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c")
311         api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
312         api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
313         api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
314 }
315
316 // Messages returns list of all messages in this module.
317 func AllMessages() []api.Message {
318         return []api.Message{
319                 (*SwInterfaceVirtioPciDetails)(nil),
320                 (*SwInterfaceVirtioPciDump)(nil),
321                 (*VirtioPciCreate)(nil),
322                 (*VirtioPciCreateReply)(nil),
323                 (*VirtioPciDelete)(nil),
324                 (*VirtioPciDeleteReply)(nil),
325         }
326 }