Improve binapi generator
[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 // source: /usr/share/vpp/api/plugins/memif.api.json
6
7 // Package memif contains generated bindings for API file memif.api.
8 //
9 // Contents:
10 //   2 enums
11 //  10 messages
12 //
13 package memif
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         codec "git.fd.io/govpp.git/codec"
20         "strconv"
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() int {
115         if m == nil {
116                 return 0
117         }
118         var size int
119         size += 4     // m.Role
120         size += 4     // m.Mode
121         size += 1     // m.RxQueues
122         size += 1     // m.TxQueues
123         size += 4     // m.ID
124         size += 4     // m.SocketID
125         size += 4     // m.RingSize
126         size += 2     // m.BufferSize
127         size += 1     // m.NoZeroCopy
128         size += 1 * 6 // m.HwAddr
129         size += 24    // m.Secret
130         return size
131 }
132 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
133         var buf *codec.Buffer
134         if b == nil {
135                 buf = codec.NewBuffer(make([]byte, m.Size()))
136         } else {
137                 buf = codec.NewBuffer(b)
138         }
139         buf.EncodeUint32(uint32(m.Role))
140         buf.EncodeUint32(uint32(m.Mode))
141         buf.EncodeUint8(uint8(m.RxQueues))
142         buf.EncodeUint8(uint8(m.TxQueues))
143         buf.EncodeUint32(uint32(m.ID))
144         buf.EncodeUint32(uint32(m.SocketID))
145         buf.EncodeUint32(uint32(m.RingSize))
146         buf.EncodeUint16(uint16(m.BufferSize))
147         buf.EncodeBool(m.NoZeroCopy)
148         buf.EncodeBytes(m.HwAddr[:], 6)
149         buf.EncodeString(m.Secret, 24)
150         return buf.Bytes(), nil
151 }
152 func (m *MemifCreate) Unmarshal(b []byte) error {
153         buf := codec.NewBuffer(b)
154         m.Role = MemifRole(buf.DecodeUint32())
155         m.Mode = MemifMode(buf.DecodeUint32())
156         m.RxQueues = buf.DecodeUint8()
157         m.TxQueues = buf.DecodeUint8()
158         m.ID = buf.DecodeUint32()
159         m.SocketID = buf.DecodeUint32()
160         m.RingSize = buf.DecodeUint32()
161         m.BufferSize = buf.DecodeUint16()
162         m.NoZeroCopy = buf.DecodeBool()
163         copy(m.HwAddr[:], buf.DecodeBytes(6))
164         m.Secret = buf.DecodeString(24)
165         return nil
166 }
167
168 // MemifCreateReply defines message 'memif_create_reply'.
169 type MemifCreateReply struct {
170         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
171         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
172 }
173
174 func (m *MemifCreateReply) Reset()               { *m = MemifCreateReply{} }
175 func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" }
176 func (*MemifCreateReply) GetCrcString() string   { return "5383d31f" }
177 func (*MemifCreateReply) GetMessageType() api.MessageType {
178         return api.ReplyMessage
179 }
180
181 func (m *MemifCreateReply) Size() int {
182         if m == nil {
183                 return 0
184         }
185         var size int
186         size += 4 // m.Retval
187         size += 4 // m.SwIfIndex
188         return size
189 }
190 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
191         var buf *codec.Buffer
192         if b == nil {
193                 buf = codec.NewBuffer(make([]byte, m.Size()))
194         } else {
195                 buf = codec.NewBuffer(b)
196         }
197         buf.EncodeUint32(uint32(m.Retval))
198         buf.EncodeUint32(uint32(m.SwIfIndex))
199         return buf.Bytes(), nil
200 }
201 func (m *MemifCreateReply) Unmarshal(b []byte) error {
202         buf := codec.NewBuffer(b)
203         m.Retval = int32(buf.DecodeUint32())
204         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
205         return nil
206 }
207
208 // MemifDelete defines message 'memif_delete'.
209 type MemifDelete struct {
210         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
211 }
212
213 func (m *MemifDelete) Reset()               { *m = MemifDelete{} }
214 func (*MemifDelete) GetMessageName() string { return "memif_delete" }
215 func (*MemifDelete) GetCrcString() string   { return "f9e6675e" }
216 func (*MemifDelete) GetMessageType() api.MessageType {
217         return api.RequestMessage
218 }
219
220 func (m *MemifDelete) Size() int {
221         if m == nil {
222                 return 0
223         }
224         var size int
225         size += 4 // m.SwIfIndex
226         return size
227 }
228 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
229         var buf *codec.Buffer
230         if b == nil {
231                 buf = codec.NewBuffer(make([]byte, m.Size()))
232         } else {
233                 buf = codec.NewBuffer(b)
234         }
235         buf.EncodeUint32(uint32(m.SwIfIndex))
236         return buf.Bytes(), nil
237 }
238 func (m *MemifDelete) Unmarshal(b []byte) error {
239         buf := codec.NewBuffer(b)
240         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
241         return nil
242 }
243
244 // MemifDeleteReply defines message 'memif_delete_reply'.
245 type MemifDeleteReply struct {
246         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
247 }
248
249 func (m *MemifDeleteReply) Reset()               { *m = MemifDeleteReply{} }
250 func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" }
251 func (*MemifDeleteReply) GetCrcString() string   { return "e8d4e804" }
252 func (*MemifDeleteReply) GetMessageType() api.MessageType {
253         return api.ReplyMessage
254 }
255
256 func (m *MemifDeleteReply) Size() int {
257         if m == nil {
258                 return 0
259         }
260         var size int
261         size += 4 // m.Retval
262         return size
263 }
264 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
265         var buf *codec.Buffer
266         if b == nil {
267                 buf = codec.NewBuffer(make([]byte, m.Size()))
268         } else {
269                 buf = codec.NewBuffer(b)
270         }
271         buf.EncodeUint32(uint32(m.Retval))
272         return buf.Bytes(), nil
273 }
274 func (m *MemifDeleteReply) Unmarshal(b []byte) error {
275         buf := codec.NewBuffer(b)
276         m.Retval = int32(buf.DecodeUint32())
277         return nil
278 }
279
280 // MemifDetails defines message 'memif_details'.
281 type MemifDetails struct {
282         SwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
283         HwAddr     ethernet_types.MacAddress      `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
284         ID         uint32                         `binapi:"u32,name=id" json:"id,omitempty"`
285         Role       MemifRole                      `binapi:"memif_role,name=role" json:"role,omitempty"`
286         Mode       MemifMode                      `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
287         ZeroCopy   bool                           `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"`
288         SocketID   uint32                         `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
289         RingSize   uint32                         `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
290         BufferSize uint16                         `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
291         Flags      interface_types.IfStatusFlags  `binapi:"if_status_flags,name=flags" json:"flags,omitempty"`
292         IfName     string                         `binapi:"string[64],name=if_name" json:"if_name,omitempty"`
293 }
294
295 func (m *MemifDetails) Reset()               { *m = MemifDetails{} }
296 func (*MemifDetails) GetMessageName() string { return "memif_details" }
297 func (*MemifDetails) GetCrcString() string   { return "d0382c4c" }
298 func (*MemifDetails) GetMessageType() api.MessageType {
299         return api.ReplyMessage
300 }
301
302 func (m *MemifDetails) Size() int {
303         if m == nil {
304                 return 0
305         }
306         var size int
307         size += 4     // m.SwIfIndex
308         size += 1 * 6 // m.HwAddr
309         size += 4     // m.ID
310         size += 4     // m.Role
311         size += 4     // m.Mode
312         size += 1     // m.ZeroCopy
313         size += 4     // m.SocketID
314         size += 4     // m.RingSize
315         size += 2     // m.BufferSize
316         size += 4     // m.Flags
317         size += 64    // m.IfName
318         return size
319 }
320 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
321         var buf *codec.Buffer
322         if b == nil {
323                 buf = codec.NewBuffer(make([]byte, m.Size()))
324         } else {
325                 buf = codec.NewBuffer(b)
326         }
327         buf.EncodeUint32(uint32(m.SwIfIndex))
328         buf.EncodeBytes(m.HwAddr[:], 6)
329         buf.EncodeUint32(uint32(m.ID))
330         buf.EncodeUint32(uint32(m.Role))
331         buf.EncodeUint32(uint32(m.Mode))
332         buf.EncodeBool(m.ZeroCopy)
333         buf.EncodeUint32(uint32(m.SocketID))
334         buf.EncodeUint32(uint32(m.RingSize))
335         buf.EncodeUint16(uint16(m.BufferSize))
336         buf.EncodeUint32(uint32(m.Flags))
337         buf.EncodeString(m.IfName, 64)
338         return buf.Bytes(), nil
339 }
340 func (m *MemifDetails) Unmarshal(b []byte) error {
341         buf := codec.NewBuffer(b)
342         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
343         copy(m.HwAddr[:], buf.DecodeBytes(6))
344         m.ID = buf.DecodeUint32()
345         m.Role = MemifRole(buf.DecodeUint32())
346         m.Mode = MemifMode(buf.DecodeUint32())
347         m.ZeroCopy = buf.DecodeBool()
348         m.SocketID = buf.DecodeUint32()
349         m.RingSize = buf.DecodeUint32()
350         m.BufferSize = buf.DecodeUint16()
351         m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32())
352         m.IfName = buf.DecodeString(64)
353         return nil
354 }
355
356 // MemifDump defines message 'memif_dump'.
357 type MemifDump struct{}
358
359 func (m *MemifDump) Reset()               { *m = MemifDump{} }
360 func (*MemifDump) GetMessageName() string { return "memif_dump" }
361 func (*MemifDump) GetCrcString() string   { return "51077d14" }
362 func (*MemifDump) GetMessageType() api.MessageType {
363         return api.RequestMessage
364 }
365
366 func (m *MemifDump) Size() int {
367         if m == nil {
368                 return 0
369         }
370         var size int
371         return size
372 }
373 func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
374         var buf *codec.Buffer
375         if b == nil {
376                 buf = codec.NewBuffer(make([]byte, m.Size()))
377         } else {
378                 buf = codec.NewBuffer(b)
379         }
380         return buf.Bytes(), nil
381 }
382 func (m *MemifDump) Unmarshal(b []byte) error {
383         return nil
384 }
385
386 // MemifSocketFilenameAddDel defines message 'memif_socket_filename_add_del'.
387 type MemifSocketFilenameAddDel struct {
388         IsAdd          bool   `binapi:"bool,name=is_add" json:"is_add,omitempty"`
389         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
390         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"`
391 }
392
393 func (m *MemifSocketFilenameAddDel) Reset()               { *m = MemifSocketFilenameAddDel{} }
394 func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" }
395 func (*MemifSocketFilenameAddDel) GetCrcString() string   { return "a2ce1a10" }
396 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType {
397         return api.RequestMessage
398 }
399
400 func (m *MemifSocketFilenameAddDel) Size() int {
401         if m == nil {
402                 return 0
403         }
404         var size int
405         size += 1   // m.IsAdd
406         size += 4   // m.SocketID
407         size += 108 // m.SocketFilename
408         return size
409 }
410 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
411         var buf *codec.Buffer
412         if b == nil {
413                 buf = codec.NewBuffer(make([]byte, m.Size()))
414         } else {
415                 buf = codec.NewBuffer(b)
416         }
417         buf.EncodeBool(m.IsAdd)
418         buf.EncodeUint32(uint32(m.SocketID))
419         buf.EncodeString(m.SocketFilename, 108)
420         return buf.Bytes(), nil
421 }
422 func (m *MemifSocketFilenameAddDel) Unmarshal(b []byte) error {
423         buf := codec.NewBuffer(b)
424         m.IsAdd = buf.DecodeBool()
425         m.SocketID = buf.DecodeUint32()
426         m.SocketFilename = buf.DecodeString(108)
427         return nil
428 }
429
430 // MemifSocketFilenameAddDelReply defines message 'memif_socket_filename_add_del_reply'.
431 type MemifSocketFilenameAddDelReply struct {
432         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
433 }
434
435 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
436 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
437         return "memif_socket_filename_add_del_reply"
438 }
439 func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" }
440 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType {
441         return api.ReplyMessage
442 }
443
444 func (m *MemifSocketFilenameAddDelReply) Size() int {
445         if m == nil {
446                 return 0
447         }
448         var size int
449         size += 4 // m.Retval
450         return size
451 }
452 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
453         var buf *codec.Buffer
454         if b == nil {
455                 buf = codec.NewBuffer(make([]byte, m.Size()))
456         } else {
457                 buf = codec.NewBuffer(b)
458         }
459         buf.EncodeUint32(uint32(m.Retval))
460         return buf.Bytes(), nil
461 }
462 func (m *MemifSocketFilenameAddDelReply) Unmarshal(b []byte) error {
463         buf := codec.NewBuffer(b)
464         m.Retval = int32(buf.DecodeUint32())
465         return nil
466 }
467
468 // MemifSocketFilenameDetails defines message 'memif_socket_filename_details'.
469 type MemifSocketFilenameDetails struct {
470         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
471         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"`
472 }
473
474 func (m *MemifSocketFilenameDetails) Reset()               { *m = MemifSocketFilenameDetails{} }
475 func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" }
476 func (*MemifSocketFilenameDetails) GetCrcString() string   { return "7ff326f7" }
477 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType {
478         return api.ReplyMessage
479 }
480
481 func (m *MemifSocketFilenameDetails) Size() int {
482         if m == nil {
483                 return 0
484         }
485         var size int
486         size += 4   // m.SocketID
487         size += 108 // m.SocketFilename
488         return size
489 }
490 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
491         var buf *codec.Buffer
492         if b == nil {
493                 buf = codec.NewBuffer(make([]byte, m.Size()))
494         } else {
495                 buf = codec.NewBuffer(b)
496         }
497         buf.EncodeUint32(uint32(m.SocketID))
498         buf.EncodeString(m.SocketFilename, 108)
499         return buf.Bytes(), nil
500 }
501 func (m *MemifSocketFilenameDetails) Unmarshal(b []byte) error {
502         buf := codec.NewBuffer(b)
503         m.SocketID = buf.DecodeUint32()
504         m.SocketFilename = buf.DecodeString(108)
505         return nil
506 }
507
508 // MemifSocketFilenameDump defines message 'memif_socket_filename_dump'.
509 type MemifSocketFilenameDump struct{}
510
511 func (m *MemifSocketFilenameDump) Reset()               { *m = MemifSocketFilenameDump{} }
512 func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" }
513 func (*MemifSocketFilenameDump) GetCrcString() string   { return "51077d14" }
514 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType {
515         return api.RequestMessage
516 }
517
518 func (m *MemifSocketFilenameDump) Size() int {
519         if m == nil {
520                 return 0
521         }
522         var size int
523         return size
524 }
525 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
526         var buf *codec.Buffer
527         if b == nil {
528                 buf = codec.NewBuffer(make([]byte, m.Size()))
529         } else {
530                 buf = codec.NewBuffer(b)
531         }
532         return buf.Bytes(), nil
533 }
534 func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error {
535         return nil
536 }
537
538 func init() { file_memif_binapi_init() }
539 func file_memif_binapi_init() {
540         api.RegisterMessage((*MemifCreate)(nil), "memif_create_b1b25061")
541         api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f")
542         api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e")
543         api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804")
544         api.RegisterMessage((*MemifDetails)(nil), "memif_details_d0382c4c")
545         api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14")
546         api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10")
547         api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804")
548         api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif_socket_filename_details_7ff326f7")
549         api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif_socket_filename_dump_51077d14")
550 }
551
552 // Messages returns list of all messages in this module.
553 func AllMessages() []api.Message {
554         return []api.Message{
555                 (*MemifCreate)(nil),
556                 (*MemifCreateReply)(nil),
557                 (*MemifDelete)(nil),
558                 (*MemifDeleteReply)(nil),
559                 (*MemifDetails)(nil),
560                 (*MemifDump)(nil),
561                 (*MemifSocketFilenameAddDel)(nil),
562                 (*MemifSocketFilenameAddDelReply)(nil),
563                 (*MemifSocketFilenameDetails)(nil),
564                 (*MemifSocketFilenameDump)(nil),
565         }
566 }