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