Change module name to go.fd.io/govpp
[govpp.git] / binapi / af_packet / af_packet.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.6.0-dev
4 //  VPP:              22.02-release
5 // source: /usr/share/vpp/api/core/af_packet.api.json
6
7 // Package af_packet contains generated bindings for API file af_packet.api.
8 //
9 // Contents:
10 //  10 messages
11 //
12 package af_packet
13
14 import (
15         api "go.fd.io/govpp/api"
16         ethernet_types "go.fd.io/govpp/binapi/ethernet_types"
17         interface_types "go.fd.io/govpp/binapi/interface_types"
18         codec "go.fd.io/govpp/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    = "af_packet"
29         APIVersion = "2.0.0"
30         VersionCrc = 0x589bd50e
31 )
32
33 // AfPacketCreate defines message 'af_packet_create'.
34 type AfPacketCreate struct {
35         HwAddr          ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
36         UseRandomHwAddr bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
37         HostIfName      string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
38 }
39
40 func (m *AfPacketCreate) Reset()               { *m = AfPacketCreate{} }
41 func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" }
42 func (*AfPacketCreate) GetCrcString() string   { return "a190415f" }
43 func (*AfPacketCreate) GetMessageType() api.MessageType {
44         return api.RequestMessage
45 }
46
47 func (m *AfPacketCreate) Size() (size int) {
48         if m == nil {
49                 return 0
50         }
51         size += 1 * 6 // m.HwAddr
52         size += 1     // m.UseRandomHwAddr
53         size += 64    // m.HostIfName
54         return size
55 }
56 func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
57         if b == nil {
58                 b = make([]byte, m.Size())
59         }
60         buf := codec.NewBuffer(b)
61         buf.EncodeBytes(m.HwAddr[:], 6)
62         buf.EncodeBool(m.UseRandomHwAddr)
63         buf.EncodeString(m.HostIfName, 64)
64         return buf.Bytes(), nil
65 }
66 func (m *AfPacketCreate) Unmarshal(b []byte) error {
67         buf := codec.NewBuffer(b)
68         copy(m.HwAddr[:], buf.DecodeBytes(6))
69         m.UseRandomHwAddr = buf.DecodeBool()
70         m.HostIfName = buf.DecodeString(64)
71         return nil
72 }
73
74 // AfPacketCreateReply defines message 'af_packet_create_reply'.
75 type AfPacketCreateReply struct {
76         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
77         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
78 }
79
80 func (m *AfPacketCreateReply) Reset()               { *m = AfPacketCreateReply{} }
81 func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
82 func (*AfPacketCreateReply) GetCrcString() string   { return "5383d31f" }
83 func (*AfPacketCreateReply) GetMessageType() api.MessageType {
84         return api.ReplyMessage
85 }
86
87 func (m *AfPacketCreateReply) Size() (size int) {
88         if m == nil {
89                 return 0
90         }
91         size += 4 // m.Retval
92         size += 4 // m.SwIfIndex
93         return size
94 }
95 func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
96         if b == nil {
97                 b = make([]byte, m.Size())
98         }
99         buf := codec.NewBuffer(b)
100         buf.EncodeInt32(m.Retval)
101         buf.EncodeUint32(uint32(m.SwIfIndex))
102         return buf.Bytes(), nil
103 }
104 func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
105         buf := codec.NewBuffer(b)
106         m.Retval = buf.DecodeInt32()
107         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
108         return nil
109 }
110
111 // AfPacketCreateV2 defines message 'af_packet_create_v2'.
112 type AfPacketCreateV2 struct {
113         HwAddr           ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
114         UseRandomHwAddr  bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
115         HostIfName       string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
116         RxFrameSize      uint32                    `binapi:"u32,name=rx_frame_size" json:"rx_frame_size,omitempty"`
117         TxFrameSize      uint32                    `binapi:"u32,name=tx_frame_size" json:"tx_frame_size,omitempty"`
118         RxFramesPerBlock uint32                    `binapi:"u32,name=rx_frames_per_block" json:"rx_frames_per_block,omitempty"`
119         TxFramesPerBlock uint32                    `binapi:"u32,name=tx_frames_per_block" json:"tx_frames_per_block,omitempty"`
120         Flags            uint32                    `binapi:"u32,name=flags" json:"flags,omitempty"`
121         NumRxQueues      uint16                    `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
122 }
123
124 func (m *AfPacketCreateV2) Reset()               { *m = AfPacketCreateV2{} }
125 func (*AfPacketCreateV2) GetMessageName() string { return "af_packet_create_v2" }
126 func (*AfPacketCreateV2) GetCrcString() string   { return "4aff0436" }
127 func (*AfPacketCreateV2) GetMessageType() api.MessageType {
128         return api.RequestMessage
129 }
130
131 func (m *AfPacketCreateV2) Size() (size int) {
132         if m == nil {
133                 return 0
134         }
135         size += 1 * 6 // m.HwAddr
136         size += 1     // m.UseRandomHwAddr
137         size += 64    // m.HostIfName
138         size += 4     // m.RxFrameSize
139         size += 4     // m.TxFrameSize
140         size += 4     // m.RxFramesPerBlock
141         size += 4     // m.TxFramesPerBlock
142         size += 4     // m.Flags
143         size += 2     // m.NumRxQueues
144         return size
145 }
146 func (m *AfPacketCreateV2) Marshal(b []byte) ([]byte, error) {
147         if b == nil {
148                 b = make([]byte, m.Size())
149         }
150         buf := codec.NewBuffer(b)
151         buf.EncodeBytes(m.HwAddr[:], 6)
152         buf.EncodeBool(m.UseRandomHwAddr)
153         buf.EncodeString(m.HostIfName, 64)
154         buf.EncodeUint32(m.RxFrameSize)
155         buf.EncodeUint32(m.TxFrameSize)
156         buf.EncodeUint32(m.RxFramesPerBlock)
157         buf.EncodeUint32(m.TxFramesPerBlock)
158         buf.EncodeUint32(m.Flags)
159         buf.EncodeUint16(m.NumRxQueues)
160         return buf.Bytes(), nil
161 }
162 func (m *AfPacketCreateV2) Unmarshal(b []byte) error {
163         buf := codec.NewBuffer(b)
164         copy(m.HwAddr[:], buf.DecodeBytes(6))
165         m.UseRandomHwAddr = buf.DecodeBool()
166         m.HostIfName = buf.DecodeString(64)
167         m.RxFrameSize = buf.DecodeUint32()
168         m.TxFrameSize = buf.DecodeUint32()
169         m.RxFramesPerBlock = buf.DecodeUint32()
170         m.TxFramesPerBlock = buf.DecodeUint32()
171         m.Flags = buf.DecodeUint32()
172         m.NumRxQueues = buf.DecodeUint16()
173         return nil
174 }
175
176 // AfPacketCreateV2Reply defines message 'af_packet_create_v2_reply'.
177 type AfPacketCreateV2Reply struct {
178         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
179         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
180 }
181
182 func (m *AfPacketCreateV2Reply) Reset()               { *m = AfPacketCreateV2Reply{} }
183 func (*AfPacketCreateV2Reply) GetMessageName() string { return "af_packet_create_v2_reply" }
184 func (*AfPacketCreateV2Reply) GetCrcString() string   { return "5383d31f" }
185 func (*AfPacketCreateV2Reply) GetMessageType() api.MessageType {
186         return api.ReplyMessage
187 }
188
189 func (m *AfPacketCreateV2Reply) Size() (size int) {
190         if m == nil {
191                 return 0
192         }
193         size += 4 // m.Retval
194         size += 4 // m.SwIfIndex
195         return size
196 }
197 func (m *AfPacketCreateV2Reply) Marshal(b []byte) ([]byte, error) {
198         if b == nil {
199                 b = make([]byte, m.Size())
200         }
201         buf := codec.NewBuffer(b)
202         buf.EncodeInt32(m.Retval)
203         buf.EncodeUint32(uint32(m.SwIfIndex))
204         return buf.Bytes(), nil
205 }
206 func (m *AfPacketCreateV2Reply) Unmarshal(b []byte) error {
207         buf := codec.NewBuffer(b)
208         m.Retval = buf.DecodeInt32()
209         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
210         return nil
211 }
212
213 // AfPacketDelete defines message 'af_packet_delete'.
214 type AfPacketDelete struct {
215         HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
216 }
217
218 func (m *AfPacketDelete) Reset()               { *m = AfPacketDelete{} }
219 func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
220 func (*AfPacketDelete) GetCrcString() string   { return "863fa648" }
221 func (*AfPacketDelete) GetMessageType() api.MessageType {
222         return api.RequestMessage
223 }
224
225 func (m *AfPacketDelete) Size() (size int) {
226         if m == nil {
227                 return 0
228         }
229         size += 64 // m.HostIfName
230         return size
231 }
232 func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
233         if b == nil {
234                 b = make([]byte, m.Size())
235         }
236         buf := codec.NewBuffer(b)
237         buf.EncodeString(m.HostIfName, 64)
238         return buf.Bytes(), nil
239 }
240 func (m *AfPacketDelete) Unmarshal(b []byte) error {
241         buf := codec.NewBuffer(b)
242         m.HostIfName = buf.DecodeString(64)
243         return nil
244 }
245
246 // AfPacketDeleteReply defines message 'af_packet_delete_reply'.
247 type AfPacketDeleteReply struct {
248         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
249 }
250
251 func (m *AfPacketDeleteReply) Reset()               { *m = AfPacketDeleteReply{} }
252 func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
253 func (*AfPacketDeleteReply) GetCrcString() string   { return "e8d4e804" }
254 func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
255         return api.ReplyMessage
256 }
257
258 func (m *AfPacketDeleteReply) Size() (size int) {
259         if m == nil {
260                 return 0
261         }
262         size += 4 // m.Retval
263         return size
264 }
265 func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
266         if b == nil {
267                 b = make([]byte, m.Size())
268         }
269         buf := codec.NewBuffer(b)
270         buf.EncodeInt32(m.Retval)
271         return buf.Bytes(), nil
272 }
273 func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
274         buf := codec.NewBuffer(b)
275         m.Retval = buf.DecodeInt32()
276         return nil
277 }
278
279 // AfPacketDetails defines message 'af_packet_details'.
280 type AfPacketDetails struct {
281         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
282         HostIfName string                         `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
283 }
284
285 func (m *AfPacketDetails) Reset()               { *m = AfPacketDetails{} }
286 func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
287 func (*AfPacketDetails) GetCrcString() string   { return "58c7c042" }
288 func (*AfPacketDetails) GetMessageType() api.MessageType {
289         return api.ReplyMessage
290 }
291
292 func (m *AfPacketDetails) Size() (size int) {
293         if m == nil {
294                 return 0
295         }
296         size += 4  // m.SwIfIndex
297         size += 64 // m.HostIfName
298         return size
299 }
300 func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
301         if b == nil {
302                 b = make([]byte, m.Size())
303         }
304         buf := codec.NewBuffer(b)
305         buf.EncodeUint32(uint32(m.SwIfIndex))
306         buf.EncodeString(m.HostIfName, 64)
307         return buf.Bytes(), nil
308 }
309 func (m *AfPacketDetails) Unmarshal(b []byte) error {
310         buf := codec.NewBuffer(b)
311         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
312         m.HostIfName = buf.DecodeString(64)
313         return nil
314 }
315
316 // AfPacketDump defines message 'af_packet_dump'.
317 type AfPacketDump struct{}
318
319 func (m *AfPacketDump) Reset()               { *m = AfPacketDump{} }
320 func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
321 func (*AfPacketDump) GetCrcString() string   { return "51077d14" }
322 func (*AfPacketDump) GetMessageType() api.MessageType {
323         return api.RequestMessage
324 }
325
326 func (m *AfPacketDump) Size() (size int) {
327         if m == nil {
328                 return 0
329         }
330         return size
331 }
332 func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
333         if b == nil {
334                 b = make([]byte, m.Size())
335         }
336         buf := codec.NewBuffer(b)
337         return buf.Bytes(), nil
338 }
339 func (m *AfPacketDump) Unmarshal(b []byte) error {
340         return nil
341 }
342
343 // AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'.
344 type AfPacketSetL4CksumOffload struct {
345         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
346         Set       bool                           `binapi:"bool,name=set" json:"set,omitempty"`
347 }
348
349 func (m *AfPacketSetL4CksumOffload) Reset()               { *m = AfPacketSetL4CksumOffload{} }
350 func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
351 func (*AfPacketSetL4CksumOffload) GetCrcString() string   { return "319cd5c8" }
352 func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
353         return api.RequestMessage
354 }
355
356 func (m *AfPacketSetL4CksumOffload) Size() (size int) {
357         if m == nil {
358                 return 0
359         }
360         size += 4 // m.SwIfIndex
361         size += 1 // m.Set
362         return size
363 }
364 func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
365         if b == nil {
366                 b = make([]byte, m.Size())
367         }
368         buf := codec.NewBuffer(b)
369         buf.EncodeUint32(uint32(m.SwIfIndex))
370         buf.EncodeBool(m.Set)
371         return buf.Bytes(), nil
372 }
373 func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error {
374         buf := codec.NewBuffer(b)
375         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
376         m.Set = buf.DecodeBool()
377         return nil
378 }
379
380 // AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'.
381 type AfPacketSetL4CksumOffloadReply struct {
382         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
383 }
384
385 func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
386 func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
387         return "af_packet_set_l4_cksum_offload_reply"
388 }
389 func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
390 func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
391         return api.ReplyMessage
392 }
393
394 func (m *AfPacketSetL4CksumOffloadReply) Size() (size int) {
395         if m == nil {
396                 return 0
397         }
398         size += 4 // m.Retval
399         return size
400 }
401 func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
402         if b == nil {
403                 b = make([]byte, m.Size())
404         }
405         buf := codec.NewBuffer(b)
406         buf.EncodeInt32(m.Retval)
407         return buf.Bytes(), nil
408 }
409 func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
410         buf := codec.NewBuffer(b)
411         m.Retval = buf.DecodeInt32()
412         return nil
413 }
414
415 func init() { file_af_packet_binapi_init() }
416 func file_af_packet_binapi_init() {
417         api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f")
418         api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f")
419         api.RegisterMessage((*AfPacketCreateV2)(nil), "af_packet_create_v2_4aff0436")
420         api.RegisterMessage((*AfPacketCreateV2Reply)(nil), "af_packet_create_v2_reply_5383d31f")
421         api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648")
422         api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804")
423         api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042")
424         api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14")
425         api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8")
426         api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804")
427 }
428
429 // Messages returns list of all messages in this module.
430 func AllMessages() []api.Message {
431         return []api.Message{
432                 (*AfPacketCreate)(nil),
433                 (*AfPacketCreateReply)(nil),
434                 (*AfPacketCreateV2)(nil),
435                 (*AfPacketCreateV2Reply)(nil),
436                 (*AfPacketDelete)(nil),
437                 (*AfPacketDeleteReply)(nil),
438                 (*AfPacketDetails)(nil),
439                 (*AfPacketDump)(nil),
440                 (*AfPacketSetL4CksumOffload)(nil),
441                 (*AfPacketSetL4CksumOffloadReply)(nil),
442         }
443 }