646636efdaf45708d005a43a7ca89916766e8c58
[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.4.0-dev
4 //  VPP:              20.05-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 //   8 messages
11 //
12 package af_packet
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         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    = "af_packet"
29         APIVersion = "2.0.0"
30         VersionCrc = 0xe0b6c022
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() int {
48         if m == nil {
49                 return 0
50         }
51         var size int
52         size += 1 * 6 // m.HwAddr
53         size += 1     // m.UseRandomHwAddr
54         size += 64    // m.HostIfName
55         return size
56 }
57 func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
58         var buf *codec.Buffer
59         if b == nil {
60                 buf = codec.NewBuffer(make([]byte, m.Size()))
61         } else {
62                 buf = codec.NewBuffer(b)
63         }
64         buf.EncodeBytes(m.HwAddr[:], 6)
65         buf.EncodeBool(m.UseRandomHwAddr)
66         buf.EncodeString(m.HostIfName, 64)
67         return buf.Bytes(), nil
68 }
69 func (m *AfPacketCreate) Unmarshal(b []byte) error {
70         buf := codec.NewBuffer(b)
71         copy(m.HwAddr[:], buf.DecodeBytes(6))
72         m.UseRandomHwAddr = buf.DecodeBool()
73         m.HostIfName = buf.DecodeString(64)
74         return nil
75 }
76
77 // AfPacketCreateReply defines message 'af_packet_create_reply'.
78 type AfPacketCreateReply struct {
79         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
80         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
81 }
82
83 func (m *AfPacketCreateReply) Reset()               { *m = AfPacketCreateReply{} }
84 func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
85 func (*AfPacketCreateReply) GetCrcString() string   { return "5383d31f" }
86 func (*AfPacketCreateReply) GetMessageType() api.MessageType {
87         return api.ReplyMessage
88 }
89
90 func (m *AfPacketCreateReply) Size() int {
91         if m == nil {
92                 return 0
93         }
94         var size int
95         size += 4 // m.Retval
96         size += 4 // m.SwIfIndex
97         return size
98 }
99 func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
100         var buf *codec.Buffer
101         if b == nil {
102                 buf = codec.NewBuffer(make([]byte, m.Size()))
103         } else {
104                 buf = codec.NewBuffer(b)
105         }
106         buf.EncodeUint32(uint32(m.Retval))
107         buf.EncodeUint32(uint32(m.SwIfIndex))
108         return buf.Bytes(), nil
109 }
110 func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
111         buf := codec.NewBuffer(b)
112         m.Retval = int32(buf.DecodeUint32())
113         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
114         return nil
115 }
116
117 // AfPacketDelete defines message 'af_packet_delete'.
118 type AfPacketDelete struct {
119         HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
120 }
121
122 func (m *AfPacketDelete) Reset()               { *m = AfPacketDelete{} }
123 func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
124 func (*AfPacketDelete) GetCrcString() string   { return "863fa648" }
125 func (*AfPacketDelete) GetMessageType() api.MessageType {
126         return api.RequestMessage
127 }
128
129 func (m *AfPacketDelete) Size() int {
130         if m == nil {
131                 return 0
132         }
133         var size int
134         size += 64 // m.HostIfName
135         return size
136 }
137 func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
138         var buf *codec.Buffer
139         if b == nil {
140                 buf = codec.NewBuffer(make([]byte, m.Size()))
141         } else {
142                 buf = codec.NewBuffer(b)
143         }
144         buf.EncodeString(m.HostIfName, 64)
145         return buf.Bytes(), nil
146 }
147 func (m *AfPacketDelete) Unmarshal(b []byte) error {
148         buf := codec.NewBuffer(b)
149         m.HostIfName = buf.DecodeString(64)
150         return nil
151 }
152
153 // AfPacketDeleteReply defines message 'af_packet_delete_reply'.
154 type AfPacketDeleteReply struct {
155         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
156 }
157
158 func (m *AfPacketDeleteReply) Reset()               { *m = AfPacketDeleteReply{} }
159 func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
160 func (*AfPacketDeleteReply) GetCrcString() string   { return "e8d4e804" }
161 func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
162         return api.ReplyMessage
163 }
164
165 func (m *AfPacketDeleteReply) Size() int {
166         if m == nil {
167                 return 0
168         }
169         var size int
170         size += 4 // m.Retval
171         return size
172 }
173 func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
174         var buf *codec.Buffer
175         if b == nil {
176                 buf = codec.NewBuffer(make([]byte, m.Size()))
177         } else {
178                 buf = codec.NewBuffer(b)
179         }
180         buf.EncodeUint32(uint32(m.Retval))
181         return buf.Bytes(), nil
182 }
183 func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
184         buf := codec.NewBuffer(b)
185         m.Retval = int32(buf.DecodeUint32())
186         return nil
187 }
188
189 // AfPacketDetails defines message 'af_packet_details'.
190 type AfPacketDetails struct {
191         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
192         HostIfName string                         `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
193 }
194
195 func (m *AfPacketDetails) Reset()               { *m = AfPacketDetails{} }
196 func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
197 func (*AfPacketDetails) GetCrcString() string   { return "58c7c042" }
198 func (*AfPacketDetails) GetMessageType() api.MessageType {
199         return api.ReplyMessage
200 }
201
202 func (m *AfPacketDetails) Size() int {
203         if m == nil {
204                 return 0
205         }
206         var size int
207         size += 4  // m.SwIfIndex
208         size += 64 // m.HostIfName
209         return size
210 }
211 func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
212         var buf *codec.Buffer
213         if b == nil {
214                 buf = codec.NewBuffer(make([]byte, m.Size()))
215         } else {
216                 buf = codec.NewBuffer(b)
217         }
218         buf.EncodeUint32(uint32(m.SwIfIndex))
219         buf.EncodeString(m.HostIfName, 64)
220         return buf.Bytes(), nil
221 }
222 func (m *AfPacketDetails) Unmarshal(b []byte) error {
223         buf := codec.NewBuffer(b)
224         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
225         m.HostIfName = buf.DecodeString(64)
226         return nil
227 }
228
229 // AfPacketDump defines message 'af_packet_dump'.
230 type AfPacketDump struct{}
231
232 func (m *AfPacketDump) Reset()               { *m = AfPacketDump{} }
233 func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
234 func (*AfPacketDump) GetCrcString() string   { return "51077d14" }
235 func (*AfPacketDump) GetMessageType() api.MessageType {
236         return api.RequestMessage
237 }
238
239 func (m *AfPacketDump) Size() int {
240         if m == nil {
241                 return 0
242         }
243         var size int
244         return size
245 }
246 func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
247         var buf *codec.Buffer
248         if b == nil {
249                 buf = codec.NewBuffer(make([]byte, m.Size()))
250         } else {
251                 buf = codec.NewBuffer(b)
252         }
253         return buf.Bytes(), nil
254 }
255 func (m *AfPacketDump) Unmarshal(b []byte) error {
256         return nil
257 }
258
259 // AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'.
260 type AfPacketSetL4CksumOffload struct {
261         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
262         Set       bool                           `binapi:"bool,name=set" json:"set,omitempty"`
263 }
264
265 func (m *AfPacketSetL4CksumOffload) Reset()               { *m = AfPacketSetL4CksumOffload{} }
266 func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
267 func (*AfPacketSetL4CksumOffload) GetCrcString() string   { return "319cd5c8" }
268 func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
269         return api.RequestMessage
270 }
271
272 func (m *AfPacketSetL4CksumOffload) Size() int {
273         if m == nil {
274                 return 0
275         }
276         var size int
277         size += 4 // m.SwIfIndex
278         size += 1 // m.Set
279         return size
280 }
281 func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
282         var buf *codec.Buffer
283         if b == nil {
284                 buf = codec.NewBuffer(make([]byte, m.Size()))
285         } else {
286                 buf = codec.NewBuffer(b)
287         }
288         buf.EncodeUint32(uint32(m.SwIfIndex))
289         buf.EncodeBool(m.Set)
290         return buf.Bytes(), nil
291 }
292 func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error {
293         buf := codec.NewBuffer(b)
294         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
295         m.Set = buf.DecodeBool()
296         return nil
297 }
298
299 // AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'.
300 type AfPacketSetL4CksumOffloadReply struct {
301         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
302 }
303
304 func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
305 func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
306         return "af_packet_set_l4_cksum_offload_reply"
307 }
308 func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
309 func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
310         return api.ReplyMessage
311 }
312
313 func (m *AfPacketSetL4CksumOffloadReply) Size() int {
314         if m == nil {
315                 return 0
316         }
317         var size int
318         size += 4 // m.Retval
319         return size
320 }
321 func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
322         var buf *codec.Buffer
323         if b == nil {
324                 buf = codec.NewBuffer(make([]byte, m.Size()))
325         } else {
326                 buf = codec.NewBuffer(b)
327         }
328         buf.EncodeUint32(uint32(m.Retval))
329         return buf.Bytes(), nil
330 }
331 func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
332         buf := codec.NewBuffer(b)
333         m.Retval = int32(buf.DecodeUint32())
334         return nil
335 }
336
337 func init() { file_af_packet_binapi_init() }
338 func file_af_packet_binapi_init() {
339         api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f")
340         api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f")
341         api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648")
342         api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804")
343         api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042")
344         api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14")
345         api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8")
346         api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804")
347 }
348
349 // Messages returns list of all messages in this module.
350 func AllMessages() []api.Message {
351         return []api.Message{
352                 (*AfPacketCreate)(nil),
353                 (*AfPacketCreateReply)(nil),
354                 (*AfPacketDelete)(nil),
355                 (*AfPacketDeleteReply)(nil),
356                 (*AfPacketDetails)(nil),
357                 (*AfPacketDump)(nil),
358                 (*AfPacketSetL4CksumOffload)(nil),
359                 (*AfPacketSetL4CksumOffloadReply)(nil),
360         }
361 }