Fix parsing API with removed CRC for types and unions
[govpp.git] / examples / binapi / memif / memif.ba.go
1 // Code generated by GoVPP binapi-generator. DO NOT EDIT.
2 // source: /usr/share/vpp/api/plugins/memif.api.json
3
4 /*
5 Package memif is a generated from VPP binary API module 'memif'.
6
7  The memif module consists of:
8          10 messages
9           5 services
10 */
11 package memif
12
13 import api "git.fd.io/govpp.git/api"
14 import bytes "bytes"
15 import context "context"
16 import strconv "strconv"
17 import struc "github.com/lunixbochs/struc"
18
19 // Reference imports to suppress errors if they are not otherwise used.
20 var _ = api.RegisterMessage
21 var _ = bytes.NewBuffer
22 var _ = context.Background
23 var _ = strconv.Itoa
24 var _ = struc.Pack
25
26 // This is a compile-time assertion to ensure that this generated file
27 // is compatible with the GoVPP api package it is being compiled against.
28 // A compilation error at this line likely means your copy of the
29 // GoVPP api package needs to be updated.
30 const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package
31
32 const (
33         // ModuleName is the name of this module.
34         ModuleName = "memif"
35         // APIVersion is the API version of this module.
36         APIVersion = "2.0.0"
37         // VersionCrc is the CRC of this module.
38         VersionCrc = 0x31b42e17
39 )
40
41 /* Messages */
42
43 // MemifCreate represents VPP binary API message 'memif_create':
44 type MemifCreate struct {
45         Role       uint8
46         Mode       uint8
47         RxQueues   uint8
48         TxQueues   uint8
49         ID         uint32
50         SocketID   uint32
51         Secret     []byte `struc:"[24]byte"`
52         RingSize   uint32
53         BufferSize uint16
54         HwAddr     []byte `struc:"[6]byte"`
55 }
56
57 func (*MemifCreate) GetMessageName() string {
58         return "memif_create"
59 }
60 func (*MemifCreate) GetCrcString() string {
61         return "6597cdb2"
62 }
63 func (*MemifCreate) GetMessageType() api.MessageType {
64         return api.RequestMessage
65 }
66
67 // MemifCreateReply represents VPP binary API message 'memif_create_reply':
68 type MemifCreateReply struct {
69         Retval    int32
70         SwIfIndex uint32
71 }
72
73 func (*MemifCreateReply) GetMessageName() string {
74         return "memif_create_reply"
75 }
76 func (*MemifCreateReply) GetCrcString() string {
77         return "fda5941f"
78 }
79 func (*MemifCreateReply) GetMessageType() api.MessageType {
80         return api.ReplyMessage
81 }
82
83 // MemifDelete represents VPP binary API message 'memif_delete':
84 type MemifDelete struct {
85         SwIfIndex uint32
86 }
87
88 func (*MemifDelete) GetMessageName() string {
89         return "memif_delete"
90 }
91 func (*MemifDelete) GetCrcString() string {
92         return "529cb13f"
93 }
94 func (*MemifDelete) GetMessageType() api.MessageType {
95         return api.RequestMessage
96 }
97
98 // MemifDeleteReply represents VPP binary API message 'memif_delete_reply':
99 type MemifDeleteReply struct {
100         Retval int32
101 }
102
103 func (*MemifDeleteReply) GetMessageName() string {
104         return "memif_delete_reply"
105 }
106 func (*MemifDeleteReply) GetCrcString() string {
107         return "e8d4e804"
108 }
109 func (*MemifDeleteReply) GetMessageType() api.MessageType {
110         return api.ReplyMessage
111 }
112
113 // MemifDetails represents VPP binary API message 'memif_details':
114 type MemifDetails struct {
115         SwIfIndex   uint32
116         IfName      []byte `struc:"[64]byte"`
117         HwAddr      []byte `struc:"[6]byte"`
118         ID          uint32
119         Role        uint8
120         Mode        uint8
121         SocketID    uint32
122         RingSize    uint32
123         BufferSize  uint16
124         AdminUpDown uint8
125         LinkUpDown  uint8
126 }
127
128 func (*MemifDetails) GetMessageName() string {
129         return "memif_details"
130 }
131 func (*MemifDetails) GetCrcString() string {
132         return "4f5a3397"
133 }
134 func (*MemifDetails) GetMessageType() api.MessageType {
135         return api.ReplyMessage
136 }
137
138 // MemifDump represents VPP binary API message 'memif_dump':
139 type MemifDump struct{}
140
141 func (*MemifDump) GetMessageName() string {
142         return "memif_dump"
143 }
144 func (*MemifDump) GetCrcString() string {
145         return "51077d14"
146 }
147 func (*MemifDump) GetMessageType() api.MessageType {
148         return api.RequestMessage
149 }
150
151 // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del':
152 type MemifSocketFilenameAddDel struct {
153         IsAdd          uint8
154         SocketID       uint32
155         SocketFilename []byte `struc:"[128]byte"`
156 }
157
158 func (*MemifSocketFilenameAddDel) GetMessageName() string {
159         return "memif_socket_filename_add_del"
160 }
161 func (*MemifSocketFilenameAddDel) GetCrcString() string {
162         return "30e3929d"
163 }
164 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType {
165         return api.RequestMessage
166 }
167
168 // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply':
169 type MemifSocketFilenameAddDelReply struct {
170         Retval int32
171 }
172
173 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
174         return "memif_socket_filename_add_del_reply"
175 }
176 func (*MemifSocketFilenameAddDelReply) GetCrcString() string {
177         return "e8d4e804"
178 }
179 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType {
180         return api.ReplyMessage
181 }
182
183 // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details':
184 type MemifSocketFilenameDetails struct {
185         SocketID       uint32
186         SocketFilename []byte `struc:"[128]byte"`
187 }
188
189 func (*MemifSocketFilenameDetails) GetMessageName() string {
190         return "memif_socket_filename_details"
191 }
192 func (*MemifSocketFilenameDetails) GetCrcString() string {
193         return "e347e32f"
194 }
195 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType {
196         return api.ReplyMessage
197 }
198
199 // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump':
200 type MemifSocketFilenameDump struct{}
201
202 func (*MemifSocketFilenameDump) GetMessageName() string {
203         return "memif_socket_filename_dump"
204 }
205 func (*MemifSocketFilenameDump) GetCrcString() string {
206         return "51077d14"
207 }
208 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType {
209         return api.RequestMessage
210 }
211
212 func init() {
213         api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate")
214         api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply")
215         api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete")
216         api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply")
217         api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails")
218         api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump")
219         api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel")
220         api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply")
221         api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
222         api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
223 }
224
225 // Messages returns list of all messages in this module.
226 func AllMessages() []api.Message {
227         return []api.Message{
228                 (*MemifCreate)(nil),
229                 (*MemifCreateReply)(nil),
230                 (*MemifDelete)(nil),
231                 (*MemifDeleteReply)(nil),
232                 (*MemifDetails)(nil),
233                 (*MemifDump)(nil),
234                 (*MemifSocketFilenameAddDel)(nil),
235                 (*MemifSocketFilenameAddDelReply)(nil),
236                 (*MemifSocketFilenameDetails)(nil),
237                 (*MemifSocketFilenameDump)(nil),
238         }
239 }
240
241 // Service represents VPP binary API services in memif module.
242 type Service interface {
243         DumpMemif(ctx context.Context, in *MemifDump) ([]*MemifDetails, error)
244         DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error)
245         MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error)
246         MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error)
247         MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error)
248 }
249
250 type service struct {
251         ch api.Channel
252 }
253
254 func NewService(ch api.Channel) Service {
255         return &service{ch}
256 }
257
258 func (c *service) DumpMemif(ctx context.Context, in *MemifDump) ([]*MemifDetails, error) {
259         var dump []*MemifDetails
260         req := c.ch.SendMultiRequest(in)
261         for {
262                 m := new(MemifDetails)
263                 stop, err := req.ReceiveReply(m)
264                 if stop {
265                         break
266                 }
267                 if err != nil {
268                         return nil, err
269                 }
270                 dump = append(dump, m)
271         }
272         return dump, nil
273 }
274
275 func (c *service) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) ([]*MemifSocketFilenameDetails, error) {
276         var dump []*MemifSocketFilenameDetails
277         req := c.ch.SendMultiRequest(in)
278         for {
279                 m := new(MemifSocketFilenameDetails)
280                 stop, err := req.ReceiveReply(m)
281                 if stop {
282                         break
283                 }
284                 if err != nil {
285                         return nil, err
286                 }
287                 dump = append(dump, m)
288         }
289         return dump, nil
290 }
291
292 func (c *service) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) {
293         out := new(MemifCreateReply)
294         err := c.ch.SendRequest(in).ReceiveReply(out)
295         if err != nil {
296                 return nil, err
297         }
298         return out, nil
299 }
300
301 func (c *service) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) {
302         out := new(MemifDeleteReply)
303         err := c.ch.SendRequest(in).ReceiveReply(out)
304         if err != nil {
305                 return nil, err
306         }
307         return out, nil
308 }
309
310 func (c *service) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) {
311         out := new(MemifSocketFilenameAddDelReply)
312         err := c.ch.SendRequest(in).ReceiveReply(out)
313         if err != nil {
314                 return nil, err
315         }
316         return out, nil
317 }