Format generated Go source code in-process
[govpp.git] / examples / binapi / memif / memif.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // source: /usr/share/vpp/api/plugins/memif.api.json
3
4 /*
5 Package memif is a generated VPP binary API for 'memif' module.
6
7 It consists of:
8           8 enums
9           2 aliases
10          10 messages
11           5 services
12 */
13 package memif
14
15 import (
16         "bytes"
17         "context"
18         "io"
19         "strconv"
20
21         api "git.fd.io/govpp.git/api"
22         struc "github.com/lunixbochs/struc"
23
24         ethernet_types "git.fd.io/govpp.git/examples/binapi/ethernet_types"
25         interface_types "git.fd.io/govpp.git/examples/binapi/interface_types"
26 )
27
28 const (
29         // ModuleName is the name of this module.
30         ModuleName = "memif"
31         // APIVersion is the API version of this module.
32         APIVersion = "3.0.0"
33         // VersionCrc is the CRC of this module.
34         VersionCrc = 0x88dc56c9
35 )
36
37 type IfStatusFlags = interface_types.IfStatusFlags
38
39 type IfType = interface_types.IfType
40
41 type LinkDuplex = interface_types.LinkDuplex
42
43 // MemifMode represents VPP binary API enum 'memif_mode'.
44 type MemifMode uint32
45
46 const (
47         MEMIF_MODE_API_ETHERNET    MemifMode = 0
48         MEMIF_MODE_API_IP          MemifMode = 1
49         MEMIF_MODE_API_PUNT_INJECT MemifMode = 2
50 )
51
52 var MemifMode_name = map[uint32]string{
53         0: "MEMIF_MODE_API_ETHERNET",
54         1: "MEMIF_MODE_API_IP",
55         2: "MEMIF_MODE_API_PUNT_INJECT",
56 }
57
58 var MemifMode_value = map[string]uint32{
59         "MEMIF_MODE_API_ETHERNET":    0,
60         "MEMIF_MODE_API_IP":          1,
61         "MEMIF_MODE_API_PUNT_INJECT": 2,
62 }
63
64 func (x MemifMode) String() string {
65         s, ok := MemifMode_name[uint32(x)]
66         if ok {
67                 return s
68         }
69         return strconv.Itoa(int(x))
70 }
71
72 // MemifRole represents VPP binary API enum 'memif_role'.
73 type MemifRole uint32
74
75 const (
76         MEMIF_ROLE_API_MASTER MemifRole = 0
77         MEMIF_ROLE_API_SLAVE  MemifRole = 1
78 )
79
80 var MemifRole_name = map[uint32]string{
81         0: "MEMIF_ROLE_API_MASTER",
82         1: "MEMIF_ROLE_API_SLAVE",
83 }
84
85 var MemifRole_value = map[string]uint32{
86         "MEMIF_ROLE_API_MASTER": 0,
87         "MEMIF_ROLE_API_SLAVE":  1,
88 }
89
90 func (x MemifRole) String() string {
91         s, ok := MemifRole_name[uint32(x)]
92         if ok {
93                 return s
94         }
95         return strconv.Itoa(int(x))
96 }
97
98 type MtuProto = interface_types.MtuProto
99
100 type RxMode = interface_types.RxMode
101
102 type SubIfFlags = interface_types.SubIfFlags
103
104 type InterfaceIndex = interface_types.InterfaceIndex
105
106 type MacAddress = ethernet_types.MacAddress
107
108 // MemifCreate represents VPP binary API message 'memif_create'.
109 type MemifCreate struct {
110         Role       MemifRole
111         Mode       MemifMode
112         RxQueues   uint8
113         TxQueues   uint8
114         ID         uint32
115         SocketID   uint32
116         RingSize   uint32
117         BufferSize uint16
118         NoZeroCopy bool
119         HwAddr     MacAddress
120         Secret     string `struc:"[24]byte"`
121 }
122
123 func (m *MemifCreate) Reset()                        { *m = MemifCreate{} }
124 func (*MemifCreate) GetMessageName() string          { return "memif_create" }
125 func (*MemifCreate) GetCrcString() string            { return "b1b25061" }
126 func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage }
127
128 // MemifCreateReply represents VPP binary API message 'memif_create_reply'.
129 type MemifCreateReply struct {
130         Retval    int32
131         SwIfIndex InterfaceIndex
132 }
133
134 func (m *MemifCreateReply) Reset()                        { *m = MemifCreateReply{} }
135 func (*MemifCreateReply) GetMessageName() string          { return "memif_create_reply" }
136 func (*MemifCreateReply) GetCrcString() string            { return "5383d31f" }
137 func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage }
138
139 // MemifDelete represents VPP binary API message 'memif_delete'.
140 type MemifDelete struct {
141         SwIfIndex InterfaceIndex
142 }
143
144 func (m *MemifDelete) Reset()                        { *m = MemifDelete{} }
145 func (*MemifDelete) GetMessageName() string          { return "memif_delete" }
146 func (*MemifDelete) GetCrcString() string            { return "f9e6675e" }
147 func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage }
148
149 // MemifDeleteReply represents VPP binary API message 'memif_delete_reply'.
150 type MemifDeleteReply struct {
151         Retval int32
152 }
153
154 func (m *MemifDeleteReply) Reset()                        { *m = MemifDeleteReply{} }
155 func (*MemifDeleteReply) GetMessageName() string          { return "memif_delete_reply" }
156 func (*MemifDeleteReply) GetCrcString() string            { return "e8d4e804" }
157 func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage }
158
159 // MemifDetails represents VPP binary API message 'memif_details'.
160 type MemifDetails struct {
161         SwIfIndex  InterfaceIndex
162         HwAddr     MacAddress
163         ID         uint32
164         Role       MemifRole
165         Mode       MemifMode
166         ZeroCopy   bool
167         SocketID   uint32
168         RingSize   uint32
169         BufferSize uint16
170         Flags      IfStatusFlags
171         IfName     string `struc:"[64]byte"`
172 }
173
174 func (m *MemifDetails) Reset()                        { *m = MemifDetails{} }
175 func (*MemifDetails) GetMessageName() string          { return "memif_details" }
176 func (*MemifDetails) GetCrcString() string            { return "d0382c4c" }
177 func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
178
179 // MemifDump represents VPP binary API message 'memif_dump'.
180 type MemifDump struct{}
181
182 func (m *MemifDump) Reset()                        { *m = MemifDump{} }
183 func (*MemifDump) GetMessageName() string          { return "memif_dump" }
184 func (*MemifDump) GetCrcString() string            { return "51077d14" }
185 func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage }
186
187 // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'.
188 type MemifSocketFilenameAddDel struct {
189         IsAdd          bool
190         SocketID       uint32
191         SocketFilename string `struc:"[108]byte"`
192 }
193
194 func (m *MemifSocketFilenameAddDel) Reset()                        { *m = MemifSocketFilenameAddDel{} }
195 func (*MemifSocketFilenameAddDel) GetMessageName() string          { return "memif_socket_filename_add_del" }
196 func (*MemifSocketFilenameAddDel) GetCrcString() string            { return "a2ce1a10" }
197 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage }
198
199 // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'.
200 type MemifSocketFilenameAddDelReply struct {
201         Retval int32
202 }
203
204 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
205 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
206         return "memif_socket_filename_add_del_reply"
207 }
208 func (*MemifSocketFilenameAddDelReply) GetCrcString() string            { return "e8d4e804" }
209 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage }
210
211 // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'.
212 type MemifSocketFilenameDetails struct {
213         SocketID       uint32
214         SocketFilename string `struc:"[108]byte"`
215 }
216
217 func (m *MemifSocketFilenameDetails) Reset()                        { *m = MemifSocketFilenameDetails{} }
218 func (*MemifSocketFilenameDetails) GetMessageName() string          { return "memif_socket_filename_details" }
219 func (*MemifSocketFilenameDetails) GetCrcString() string            { return "7ff326f7" }
220 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
221
222 // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'.
223 type MemifSocketFilenameDump struct{}
224
225 func (m *MemifSocketFilenameDump) Reset()                        { *m = MemifSocketFilenameDump{} }
226 func (*MemifSocketFilenameDump) GetMessageName() string          { return "memif_socket_filename_dump" }
227 func (*MemifSocketFilenameDump) GetCrcString() string            { return "51077d14" }
228 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage }
229
230 func init() {
231         api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate")
232         api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply")
233         api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete")
234         api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply")
235         api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails")
236         api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump")
237         api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel")
238         api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply")
239         api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
240         api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
241 }
242
243 // Messages returns list of all messages in this module.
244 func AllMessages() []api.Message {
245         return []api.Message{
246                 (*MemifCreate)(nil),
247                 (*MemifCreateReply)(nil),
248                 (*MemifDelete)(nil),
249                 (*MemifDeleteReply)(nil),
250                 (*MemifDetails)(nil),
251                 (*MemifDump)(nil),
252                 (*MemifSocketFilenameAddDel)(nil),
253                 (*MemifSocketFilenameAddDelReply)(nil),
254                 (*MemifSocketFilenameDetails)(nil),
255                 (*MemifSocketFilenameDump)(nil),
256         }
257 }
258
259 // RPCService represents RPC service API for memif module.
260 type RPCService interface {
261         DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error)
262         DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error)
263         MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error)
264         MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error)
265         MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error)
266 }
267
268 type serviceClient struct {
269         ch api.Channel
270 }
271
272 func NewServiceClient(ch api.Channel) RPCService {
273         return &serviceClient{ch}
274 }
275
276 func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) {
277         stream := c.ch.SendMultiRequest(in)
278         x := &serviceClient_DumpMemifClient{stream}
279         return x, nil
280 }
281
282 type RPCService_DumpMemifClient interface {
283         Recv() (*MemifDetails, error)
284 }
285
286 type serviceClient_DumpMemifClient struct {
287         api.MultiRequestCtx
288 }
289
290 func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) {
291         m := new(MemifDetails)
292         stop, err := c.MultiRequestCtx.ReceiveReply(m)
293         if err != nil {
294                 return nil, err
295         }
296         if stop {
297                 return nil, io.EOF
298         }
299         return m, nil
300 }
301
302 func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) {
303         stream := c.ch.SendMultiRequest(in)
304         x := &serviceClient_DumpMemifSocketFilenameClient{stream}
305         return x, nil
306 }
307
308 type RPCService_DumpMemifSocketFilenameClient interface {
309         Recv() (*MemifSocketFilenameDetails, error)
310 }
311
312 type serviceClient_DumpMemifSocketFilenameClient struct {
313         api.MultiRequestCtx
314 }
315
316 func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) {
317         m := new(MemifSocketFilenameDetails)
318         stop, err := c.MultiRequestCtx.ReceiveReply(m)
319         if err != nil {
320                 return nil, err
321         }
322         if stop {
323                 return nil, io.EOF
324         }
325         return m, nil
326 }
327
328 func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) {
329         out := new(MemifCreateReply)
330         err := c.ch.SendRequest(in).ReceiveReply(out)
331         if err != nil {
332                 return nil, err
333         }
334         return out, nil
335 }
336
337 func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) {
338         out := new(MemifDeleteReply)
339         err := c.ch.SendRequest(in).ReceiveReply(out)
340         if err != nil {
341                 return nil, err
342         }
343         return out, nil
344 }
345
346 func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) {
347         out := new(MemifSocketFilenameAddDelReply)
348         err := c.ch.SendRequest(in).ReceiveReply(out)
349         if err != nil {
350                 return nil, err
351         }
352         return out, nil
353 }
354
355 // This is a compile-time assertion to ensure that this generated file
356 // is compatible with the GoVPP api package it is being compiled against.
357 // A compilation error at this line likely means your copy of the
358 // GoVPP api package needs to be updated.
359 const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package
360
361 // Reference imports to suppress errors if they are not otherwise used.
362 var _ = api.RegisterMessage
363 var _ = bytes.NewBuffer
364 var _ = context.Background
365 var _ = io.Copy
366 var _ = strconv.Itoa
367 var _ = struc.Pack