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