f77555cb7940f66d3aa48cd7dca33e9f00e33cff
[govpp.git] / binapi / memif / memif.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 memif contains generated bindings for API file memif.api.
7 //
8 // Contents:
9 //   2 enums
10 //  10 messages
11 //
12 package memif
13
14 import (
15         "strconv"
16
17         api "git.fd.io/govpp.git/api"
18         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
19         interface_types "git.fd.io/govpp.git/binapi/interface_types"
20         codec "git.fd.io/govpp.git/codec"
21 )
22
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
28
29 const (
30         APIFile    = "memif"
31         APIVersion = "3.0.0"
32         VersionCrc = 0x1a1c95b8
33 )
34
35 // MemifMode defines enum 'memif_mode'.
36 type MemifMode uint32
37
38 const (
39         MEMIF_MODE_API_ETHERNET    MemifMode = 0
40         MEMIF_MODE_API_IP          MemifMode = 1
41         MEMIF_MODE_API_PUNT_INJECT MemifMode = 2
42 )
43
44 var (
45         MemifMode_name = map[uint32]string{
46                 0: "MEMIF_MODE_API_ETHERNET",
47                 1: "MEMIF_MODE_API_IP",
48                 2: "MEMIF_MODE_API_PUNT_INJECT",
49         }
50         MemifMode_value = map[string]uint32{
51                 "MEMIF_MODE_API_ETHERNET":    0,
52                 "MEMIF_MODE_API_IP":          1,
53                 "MEMIF_MODE_API_PUNT_INJECT": 2,
54         }
55 )
56
57 func (x MemifMode) String() string {
58         s, ok := MemifMode_name[uint32(x)]
59         if ok {
60                 return s
61         }
62         return "MemifMode(" + strconv.Itoa(int(x)) + ")"
63 }
64
65 // MemifRole defines enum 'memif_role'.
66 type MemifRole uint32
67
68 const (
69         MEMIF_ROLE_API_MASTER MemifRole = 0
70         MEMIF_ROLE_API_SLAVE  MemifRole = 1
71 )
72
73 var (
74         MemifRole_name = map[uint32]string{
75                 0: "MEMIF_ROLE_API_MASTER",
76                 1: "MEMIF_ROLE_API_SLAVE",
77         }
78         MemifRole_value = map[string]uint32{
79                 "MEMIF_ROLE_API_MASTER": 0,
80                 "MEMIF_ROLE_API_SLAVE":  1,
81         }
82 )
83
84 func (x MemifRole) String() string {
85         s, ok := MemifRole_name[uint32(x)]
86         if ok {
87                 return s
88         }
89         return "MemifRole(" + strconv.Itoa(int(x)) + ")"
90 }
91
92 // MemifCreate defines message 'memif_create'.
93 type MemifCreate struct {
94         Role       MemifRole                 `binapi:"memif_role,name=role" json:"role,omitempty"`
95         Mode       MemifMode                 `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
96         RxQueues   uint8                     `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"`
97         TxQueues   uint8                     `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"`
98         ID         uint32                    `binapi:"u32,name=id" json:"id,omitempty"`
99         SocketID   uint32                    `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
100         RingSize   uint32                    `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
101         BufferSize uint16                    `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
102         NoZeroCopy bool                      `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"`
103         HwAddr     ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
104         Secret     string                    `binapi:"string[24],name=secret" json:"secret,omitempty"`
105 }
106
107 func (m *MemifCreate) Reset()               { *m = MemifCreate{} }
108 func (*MemifCreate) GetMessageName() string { return "memif_create" }
109 func (*MemifCreate) GetCrcString() string   { return "b1b25061" }
110 func (*MemifCreate) GetMessageType() api.MessageType {
111         return api.RequestMessage
112 }
113
114 func (m *MemifCreate) Size() (size int) {
115         if m == nil {
116                 return 0
117         }
118         size += 4     // m.Role
119         size += 4     // m.Mode
120         size += 1     // m.RxQueues
121         size += 1     // m.TxQueues
122         size += 4     // m.ID
123         size += 4     // m.SocketID
124         size += 4     // m.RingSize
125         size += 2     // m.BufferSize
126         size += 1     // m.NoZeroCopy
127         size += 1 * 6 // m.HwAddr
128         size += 24    // m.Secret
129         return size
130 }
131 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
132         if b == nil {
133                 b = make([]byte, m.Size())
134         }
135         buf := codec.NewBuffer(b)
136         buf.EncodeUint32(uint32(m.Role))
137         buf.EncodeUint32(uint32(m.Mode))
138         buf.EncodeUint8(m.RxQueues)
139         buf.EncodeUint8(m.TxQueues)
140         buf.EncodeUint32(m.ID)
141         buf.EncodeUint32(m.SocketID)
142         buf.EncodeUint32(m.RingSize)
143         buf.EncodeUint16(m.BufferSize)
144         buf.EncodeBool(m.NoZeroCopy)
145         buf.EncodeBytes(m.HwAddr[:], 6)
146         buf.EncodeString(m.Secret, 24)
147         return buf.Bytes(), nil
148 }
149 func (m *MemifCreate) Unmarshal(b []byte) error {
150         buf := codec.NewBuffer(b)
151         m.Role = MemifRole(buf.DecodeUint32())
152         m.Mode = MemifMode(buf.DecodeUint32())
153         m.RxQueues = buf.DecodeUint8()
154         m.TxQueues = buf.DecodeUint8()
155         m.ID = buf.DecodeUint32()
156         m.SocketID = buf.DecodeUint32()
157         m.RingSize = buf.DecodeUint32()
158         m.BufferSize = buf.DecodeUint16()
159         m.NoZeroCopy = buf.DecodeBool()
160         copy(m.HwAddr[:], buf.DecodeBytes(6))
161         m.Secret = buf.DecodeString(24)
162         return nil
163 }
164
165 // MemifCreateReply defines message 'memif_create_reply'.
166 type MemifCreateReply struct {
167         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
168         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
169 }
170
171 func (m *MemifCreateReply) Reset()               { *m = MemifCreateReply{} }
172 func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" }
173 func (*MemifCreateReply) GetCrcString() string   { return "5383d31f" }
174 func (*MemifCreateReply) GetMessageType() api.MessageType {
175         return api.ReplyMessage
176 }
177
178 func (m *MemifCreateReply) Size() (size int) {
179         if m == nil {
180                 return 0
181         }
182         size += 4 // m.Retval
183         size += 4 // m.SwIfIndex
184         return size
185 }
186 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
187         if b == nil {
188                 b = make([]byte, m.Size())
189         }
190         buf := codec.NewBuffer(b)
191         buf.EncodeInt32(m.Retval)
192         buf.EncodeUint32(uint32(m.SwIfIndex))
193         return buf.Bytes(), nil
194 }
195 func (m *MemifCreateReply) Unmarshal(b []byte) error {
196         buf := codec.NewBuffer(b)
197         m.Retval = buf.DecodeInt32()
198         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
199         return nil
200 }
201
202 // MemifDelete defines message 'memif_delete'.
203 type MemifDelete struct {
204         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
205 }
206
207 func (m *MemifDelete) Reset()               { *m = MemifDelete{} }
208 func (*MemifDelete) GetMessageName() string { return "memif_delete" }
209 func (*MemifDelete) GetCrcString() string   { return "f9e6675e" }
210 func (*MemifDelete) GetMessageType() api.MessageType {
211         return api.RequestMessage
212 }
213
214 func (m *MemifDelete) Size() (size int) {
215         if m == nil {
216                 return 0
217         }
218         size += 4 // m.SwIfIndex
219         return size
220 }
221 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
222         if b == nil {
223                 b = make([]byte, m.Size())
224         }
225         buf := codec.NewBuffer(b)
226         buf.EncodeUint32(uint32(m.SwIfIndex))
227         return buf.Bytes(), nil
228 }
229 func (m *MemifDelete) Unmarshal(b []byte) error {
230         buf := codec.NewBuffer(b)
231         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
232         return nil
233 }
234
235 // MemifDeleteReply defines message 'memif_delete_reply'.
236 type MemifDeleteReply struct {
237         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
238 }
239
240 func (m *MemifDeleteReply) Reset()               { *m = MemifDeleteReply{} }
241 func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" }
242 func (*MemifDeleteReply) GetCrcString() string   { return "e8d4e804" }
243 func (*MemifDeleteReply) GetMessageType() api.MessageType {
244         return api.ReplyMessage
245 }
246
247 func (m *MemifDeleteReply) Size() (size int) {
248         if m == nil {
249                 return 0
250         }
251         size += 4 // m.Retval
252         return size
253 }
254 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
255         if b == nil {
256                 b = make([]byte, m.Size())
257         }
258         buf := codec.NewBuffer(b)
259         buf.EncodeInt32(m.Retval)
260         return buf.Bytes(), nil
261 }
262 func (m *MemifDeleteReply) Unmarshal(b []byte) error {
263         buf := codec.NewBuffer(b)
264         m.Retval = buf.DecodeInt32()
265         return nil
266 }
267
268 // MemifDetails defines message 'memif_details'.
269 type MemifDetails struct {
270         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
271         HwAddr     ethernet_types.MacAddress      `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
272         ID         uint32                         `binapi:"u32,name=id" json:"id,omitempty"`
273         Role       MemifRole                      `binapi:"memif_role,name=role" json:"role,omitempty"`
274         Mode       MemifMode                      `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
275         ZeroCopy   bool                           `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"`
276         SocketID   uint32                         `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
277         RingSize   uint32                         `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
278         BufferSize uint16                         `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
279         Flags      interface_types.IfStatusFlags  `binapi:"if_status_flags,name=flags" json:"flags,omitempty"`
280         IfName     string                         `binapi:"string[64],name=if_name" json:"if_name,omitempty"`
281 }
282
283 func (m *MemifDetails) Reset()               { *m = MemifDetails{} }
284 func (*MemifDetails) GetMessageName() string { return "memif_details" }
285 func (*MemifDetails) GetCrcString() string   { return "d0382c4c" }
286 func (*MemifDetails) GetMessageType() api.MessageType {
287         return api.ReplyMessage
288 }
289
290 func (m *MemifDetails) Size() (size int) {
291         if m == nil {
292                 return 0
293         }
294         size += 4     // m.SwIfIndex
295         size += 1 * 6 // m.HwAddr
296         size += 4     // m.ID
297         size += 4     // m.Role
298         size += 4     // m.Mode
299         size += 1     // m.ZeroCopy
300         size += 4     // m.SocketID
301         size += 4     // m.RingSize
302         size += 2     // m.BufferSize
303         size += 4     // m.Flags
304         size += 64    // m.IfName
305         return size
306 }
307 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
308         if b == nil {
309                 b = make([]byte, m.Size())
310         }
311         buf := codec.NewBuffer(b)
312         buf.EncodeUint32(uint32(m.SwIfIndex))
313         buf.EncodeBytes(m.HwAddr[:], 6)
314         buf.EncodeUint32(m.ID)
315         buf.EncodeUint32(uint32(m.Role))
316         buf.EncodeUint32(uint32(m.Mode))
317         buf.EncodeBool(m.ZeroCopy)
318         buf.EncodeUint32(m.SocketID)
319         buf.EncodeUint32(m.RingSize)
320         buf.EncodeUint16(m.BufferSize)
321         buf.EncodeUint32(uint32(m.Flags))
322         buf.EncodeString(m.IfName, 64)
323         return buf.Bytes(), nil
324 }
325 func (m *MemifDetails) Unmarshal(b []byte) error {
326         buf := codec.NewBuffer(b)
327         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
328         copy(m.HwAddr[:], buf.DecodeBytes(6))
329         m.ID = buf.DecodeUint32()
330         m.Role = MemifRole(buf.DecodeUint32())
331         m.Mode = MemifMode(buf.DecodeUint32())
332         m.ZeroCopy = buf.DecodeBool()
333         m.SocketID = buf.DecodeUint32()
334         m.RingSize = buf.DecodeUint32()
335         m.BufferSize = buf.DecodeUint16()
336         m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32())
337         m.IfName = buf.DecodeString(64)
338         return nil
339 }
340
341 // MemifDump defines message 'memif_dump'.
342 type MemifDump struct{}
343
344 func (m *MemifDump) Reset()               { *m = MemifDump{} }
345 func (*MemifDump) GetMessageName() string { return "memif_dump" }
346 func (*MemifDump) GetCrcString() string   { return "51077d14" }
347 func (*MemifDump) GetMessageType() api.MessageType {
348         return api.RequestMessage
349 }
350
351 func (m *MemifDump) Size() (size int) {
352         if m == nil {
353                 return 0
354         }
355         return size
356 }
357 func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
358         if b == nil {
359                 b = make([]byte, m.Size())
360         }
361         buf := codec.NewBuffer(b)
362         return buf.Bytes(), nil
363 }
364 func (m *MemifDump) Unmarshal(b []byte) error {
365         return nil
366 }
367
368 // MemifSocketFilenameAddDel defines message 'memif_socket_filename_add_del'.
369 type MemifSocketFilenameAddDel struct {
370         IsAdd          bool   `binapi:"bool,name=is_add" json:"is_add,omitempty"`
371         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
372         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"`
373 }
374
375 func (m *MemifSocketFilenameAddDel) Reset()               { *m = MemifSocketFilenameAddDel{} }
376 func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" }
377 func (*MemifSocketFilenameAddDel) GetCrcString() string   { return "a2ce1a10" }
378 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType {
379         return api.RequestMessage
380 }
381
382 func (m *MemifSocketFilenameAddDel) Size() (size int) {
383         if m == nil {
384                 return 0
385         }
386         size += 1   // m.IsAdd
387         size += 4   // m.SocketID
388         size += 108 // m.SocketFilename
389         return size
390 }
391 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
392         if b == nil {
393                 b = make([]byte, m.Size())
394         }
395         buf := codec.NewBuffer(b)
396         buf.EncodeBool(m.IsAdd)
397         buf.EncodeUint32(m.SocketID)
398         buf.EncodeString(m.SocketFilename, 108)
399         return buf.Bytes(), nil
400 }
401 func (m *MemifSocketFilenameAddDel) Unmarshal(b []byte) error {
402         buf := codec.NewBuffer(b)
403         m.IsAdd = buf.DecodeBool()
404         m.SocketID = buf.DecodeUint32()
405         m.SocketFilename = buf.DecodeString(108)
406         return nil
407 }
408
409 // MemifSocketFilenameAddDelReply defines message 'memif_socket_filename_add_del_reply'.
410 type MemifSocketFilenameAddDelReply struct {
411         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
412 }
413
414 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
415 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
416         return "memif_socket_filename_add_del_reply"
417 }
418 func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" }
419 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType {
420         return api.ReplyMessage
421 }
422
423 func (m *MemifSocketFilenameAddDelReply) Size() (size int) {
424         if m == nil {
425                 return 0
426         }
427         size += 4 // m.Retval
428         return size
429 }
430 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
431         if b == nil {
432                 b = make([]byte, m.Size())
433         }
434         buf := codec.NewBuffer(b)
435         buf.EncodeInt32(m.Retval)
436         return buf.Bytes(), nil
437 }
438 func (m *MemifSocketFilenameAddDelReply) Unmarshal(b []byte) error {
439         buf := codec.NewBuffer(b)
440         m.Retval = buf.DecodeInt32()
441         return nil
442 }
443
444 // MemifSocketFilenameDetails defines message 'memif_socket_filename_details'.
445 type MemifSocketFilenameDetails struct {
446         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
447         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"`
448 }
449
450 func (m *MemifSocketFilenameDetails) Reset()               { *m = MemifSocketFilenameDetails{} }
451 func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" }
452 func (*MemifSocketFilenameDetails) GetCrcString() string   { return "7ff326f7" }
453 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType {
454         return api.ReplyMessage
455 }
456
457 func (m *MemifSocketFilenameDetails) Size() (size int) {
458         if m == nil {
459                 return 0
460         }
461         size += 4   // m.SocketID
462         size += 108 // m.SocketFilename
463         return size
464 }
465 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
466         if b == nil {
467                 b = make([]byte, m.Size())
468         }
469         buf := codec.NewBuffer(b)
470         buf.EncodeUint32(m.SocketID)
471         buf.EncodeString(m.SocketFilename, 108)
472         return buf.Bytes(), nil
473 }
474 func (m *MemifSocketFilenameDetails) Unmarshal(b []byte) error {
475         buf := codec.NewBuffer(b)
476         m.SocketID = buf.DecodeUint32()
477         m.SocketFilename = buf.DecodeString(108)
478         return nil
479 }
480
481 // MemifSocketFilenameDump defines message 'memif_socket_filename_dump'.
482 type MemifSocketFilenameDump struct{}
483
484 func (m *MemifSocketFilenameDump) Reset()               { *m = MemifSocketFilenameDump{} }
485 func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" }
486 func (*MemifSocketFilenameDump) GetCrcString() string   { return "51077d14" }
487 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType {
488         return api.RequestMessage
489 }
490
491 func (m *MemifSocketFilenameDump) Size() (size int) {
492         if m == nil {
493                 return 0
494         }
495         return size
496 }
497 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
498         if b == nil {
499                 b = make([]byte, m.Size())
500         }
501         buf := codec.NewBuffer(b)
502         return buf.Bytes(), nil
503 }
504 func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error {
505         return nil
506 }
507
508 func init() { file_memif_binapi_init() }
509 func file_memif_binapi_init() {
510         api.RegisterMessage((*MemifCreate)(nil), "memif_create_b1b25061")
511         api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f")
512         api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e")
513         api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804")
514         api.RegisterMessage((*MemifDetails)(nil), "memif_details_d0382c4c")
515         api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14")
516         api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10")
517         api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804")
518         api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif_socket_filename_details_7ff326f7")
519         api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif_socket_filename_dump_51077d14")
520 }
521
522 // Messages returns list of all messages in this module.
523 func AllMessages() []api.Message {
524         return []api.Message{
525                 (*MemifCreate)(nil),
526                 (*MemifCreateReply)(nil),
527                 (*MemifDelete)(nil),
528                 (*MemifDeleteReply)(nil),
529                 (*MemifDetails)(nil),
530                 (*MemifDump)(nil),
531                 (*MemifSocketFilenameAddDel)(nil),
532                 (*MemifSocketFilenameAddDelReply)(nil),
533                 (*MemifSocketFilenameDetails)(nil),
534                 (*MemifSocketFilenameDump)(nil),
535         }
536 }