93673526d3ff734f4690e9579fba702d68a067a6
[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
6 // Package af_packet contains generated bindings for API file af_packet.api.
7 //
8 // Contents:
9 //   8 messages
10 //
11 package af_packet
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         codec "git.fd.io/govpp.git/codec"
18 )
19
20 // This is a compile-time assertion to ensure that this generated file
21 // is compatible with the GoVPP api package it is being compiled against.
22 // A compilation error at this line likely means your copy of the
23 // GoVPP api package needs to be updated.
24 const _ = api.GoVppAPIPackageIsVersion2
25
26 const (
27         APIFile    = "af_packet"
28         APIVersion = "2.0.0"
29         VersionCrc = 0xe0b6c022
30 )
31
32 // AfPacketCreate defines message 'af_packet_create'.
33 type AfPacketCreate struct {
34         HwAddr          ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
35         UseRandomHwAddr bool                      `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
36         HostIfName      string                    `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
37 }
38
39 func (m *AfPacketCreate) Reset()               { *m = AfPacketCreate{} }
40 func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" }
41 func (*AfPacketCreate) GetCrcString() string   { return "a190415f" }
42 func (*AfPacketCreate) GetMessageType() api.MessageType {
43         return api.RequestMessage
44 }
45
46 func (m *AfPacketCreate) Size() (size int) {
47         if m == nil {
48                 return 0
49         }
50         size += 1 * 6 // m.HwAddr
51         size += 1     // m.UseRandomHwAddr
52         size += 64    // m.HostIfName
53         return size
54 }
55 func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
56         if b == nil {
57                 b = make([]byte, m.Size())
58         }
59         buf := codec.NewBuffer(b)
60         buf.EncodeBytes(m.HwAddr[:], 6)
61         buf.EncodeBool(m.UseRandomHwAddr)
62         buf.EncodeString(m.HostIfName, 64)
63         return buf.Bytes(), nil
64 }
65 func (m *AfPacketCreate) Unmarshal(b []byte) error {
66         buf := codec.NewBuffer(b)
67         copy(m.HwAddr[:], buf.DecodeBytes(6))
68         m.UseRandomHwAddr = buf.DecodeBool()
69         m.HostIfName = buf.DecodeString(64)
70         return nil
71 }
72
73 // AfPacketCreateReply defines message 'af_packet_create_reply'.
74 type AfPacketCreateReply struct {
75         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
76         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
77 }
78
79 func (m *AfPacketCreateReply) Reset()               { *m = AfPacketCreateReply{} }
80 func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
81 func (*AfPacketCreateReply) GetCrcString() string   { return "5383d31f" }
82 func (*AfPacketCreateReply) GetMessageType() api.MessageType {
83         return api.ReplyMessage
84 }
85
86 func (m *AfPacketCreateReply) Size() (size int) {
87         if m == nil {
88                 return 0
89         }
90         size += 4 // m.Retval
91         size += 4 // m.SwIfIndex
92         return size
93 }
94 func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
95         if b == nil {
96                 b = make([]byte, m.Size())
97         }
98         buf := codec.NewBuffer(b)
99         buf.EncodeInt32(m.Retval)
100         buf.EncodeUint32(uint32(m.SwIfIndex))
101         return buf.Bytes(), nil
102 }
103 func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
104         buf := codec.NewBuffer(b)
105         m.Retval = buf.DecodeInt32()
106         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
107         return nil
108 }
109
110 // AfPacketDelete defines message 'af_packet_delete'.
111 type AfPacketDelete struct {
112         HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
113 }
114
115 func (m *AfPacketDelete) Reset()               { *m = AfPacketDelete{} }
116 func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
117 func (*AfPacketDelete) GetCrcString() string   { return "863fa648" }
118 func (*AfPacketDelete) GetMessageType() api.MessageType {
119         return api.RequestMessage
120 }
121
122 func (m *AfPacketDelete) Size() (size int) {
123         if m == nil {
124                 return 0
125         }
126         size += 64 // m.HostIfName
127         return size
128 }
129 func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
130         if b == nil {
131                 b = make([]byte, m.Size())
132         }
133         buf := codec.NewBuffer(b)
134         buf.EncodeString(m.HostIfName, 64)
135         return buf.Bytes(), nil
136 }
137 func (m *AfPacketDelete) Unmarshal(b []byte) error {
138         buf := codec.NewBuffer(b)
139         m.HostIfName = buf.DecodeString(64)
140         return nil
141 }
142
143 // AfPacketDeleteReply defines message 'af_packet_delete_reply'.
144 type AfPacketDeleteReply struct {
145         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
146 }
147
148 func (m *AfPacketDeleteReply) Reset()               { *m = AfPacketDeleteReply{} }
149 func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
150 func (*AfPacketDeleteReply) GetCrcString() string   { return "e8d4e804" }
151 func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
152         return api.ReplyMessage
153 }
154
155 func (m *AfPacketDeleteReply) Size() (size int) {
156         if m == nil {
157                 return 0
158         }
159         size += 4 // m.Retval
160         return size
161 }
162 func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
163         if b == nil {
164                 b = make([]byte, m.Size())
165         }
166         buf := codec.NewBuffer(b)
167         buf.EncodeInt32(m.Retval)
168         return buf.Bytes(), nil
169 }
170 func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
171         buf := codec.NewBuffer(b)
172         m.Retval = buf.DecodeInt32()
173         return nil
174 }
175
176 // AfPacketDetails defines message 'af_packet_details'.
177 type AfPacketDetails struct {
178         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
179         HostIfName string                         `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"`
180 }
181
182 func (m *AfPacketDetails) Reset()               { *m = AfPacketDetails{} }
183 func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
184 func (*AfPacketDetails) GetCrcString() string   { return "58c7c042" }
185 func (*AfPacketDetails) GetMessageType() api.MessageType {
186         return api.ReplyMessage
187 }
188
189 func (m *AfPacketDetails) Size() (size int) {
190         if m == nil {
191                 return 0
192         }
193         size += 4  // m.SwIfIndex
194         size += 64 // m.HostIfName
195         return size
196 }
197 func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
198         if b == nil {
199                 b = make([]byte, m.Size())
200         }
201         buf := codec.NewBuffer(b)
202         buf.EncodeUint32(uint32(m.SwIfIndex))
203         buf.EncodeString(m.HostIfName, 64)
204         return buf.Bytes(), nil
205 }
206 func (m *AfPacketDetails) Unmarshal(b []byte) error {
207         buf := codec.NewBuffer(b)
208         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
209         m.HostIfName = buf.DecodeString(64)
210         return nil
211 }
212
213 // AfPacketDump defines message 'af_packet_dump'.
214 type AfPacketDump struct{}
215
216 func (m *AfPacketDump) Reset()               { *m = AfPacketDump{} }
217 func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
218 func (*AfPacketDump) GetCrcString() string   { return "51077d14" }
219 func (*AfPacketDump) GetMessageType() api.MessageType {
220         return api.RequestMessage
221 }
222
223 func (m *AfPacketDump) Size() (size int) {
224         if m == nil {
225                 return 0
226         }
227         return size
228 }
229 func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
230         if b == nil {
231                 b = make([]byte, m.Size())
232         }
233         buf := codec.NewBuffer(b)
234         return buf.Bytes(), nil
235 }
236 func (m *AfPacketDump) Unmarshal(b []byte) error {
237         return nil
238 }
239
240 // AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'.
241 type AfPacketSetL4CksumOffload struct {
242         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
243         Set       bool                           `binapi:"bool,name=set" json:"set,omitempty"`
244 }
245
246 func (m *AfPacketSetL4CksumOffload) Reset()               { *m = AfPacketSetL4CksumOffload{} }
247 func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
248 func (*AfPacketSetL4CksumOffload) GetCrcString() string   { return "319cd5c8" }
249 func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
250         return api.RequestMessage
251 }
252
253 func (m *AfPacketSetL4CksumOffload) Size() (size int) {
254         if m == nil {
255                 return 0
256         }
257         size += 4 // m.SwIfIndex
258         size += 1 // m.Set
259         return size
260 }
261 func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
262         if b == nil {
263                 b = make([]byte, m.Size())
264         }
265         buf := codec.NewBuffer(b)
266         buf.EncodeUint32(uint32(m.SwIfIndex))
267         buf.EncodeBool(m.Set)
268         return buf.Bytes(), nil
269 }
270 func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error {
271         buf := codec.NewBuffer(b)
272         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
273         m.Set = buf.DecodeBool()
274         return nil
275 }
276
277 // AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'.
278 type AfPacketSetL4CksumOffloadReply struct {
279         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
280 }
281
282 func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
283 func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
284         return "af_packet_set_l4_cksum_offload_reply"
285 }
286 func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
287 func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
288         return api.ReplyMessage
289 }
290
291 func (m *AfPacketSetL4CksumOffloadReply) Size() (size int) {
292         if m == nil {
293                 return 0
294         }
295         size += 4 // m.Retval
296         return size
297 }
298 func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
299         if b == nil {
300                 b = make([]byte, m.Size())
301         }
302         buf := codec.NewBuffer(b)
303         buf.EncodeInt32(m.Retval)
304         return buf.Bytes(), nil
305 }
306 func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
307         buf := codec.NewBuffer(b)
308         m.Retval = buf.DecodeInt32()
309         return nil
310 }
311
312 func init() { file_af_packet_binapi_init() }
313 func file_af_packet_binapi_init() {
314         api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f")
315         api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f")
316         api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648")
317         api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804")
318         api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042")
319         api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14")
320         api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8")
321         api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804")
322 }
323
324 // Messages returns list of all messages in this module.
325 func AllMessages() []api.Message {
326         return []api.Message{
327                 (*AfPacketCreate)(nil),
328                 (*AfPacketCreateReply)(nil),
329                 (*AfPacketDelete)(nil),
330                 (*AfPacketDeleteReply)(nil),
331                 (*AfPacketDetails)(nil),
332                 (*AfPacketDump)(nil),
333                 (*AfPacketSetL4CksumOffload)(nil),
334                 (*AfPacketSetL4CksumOffloadReply)(nil),
335         }
336 }