Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / session / session_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package session
4
5 import (
6         "context"
7         "fmt"
8         "io"
9
10         api "git.fd.io/govpp.git/api"
11         vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe"
12 )
13
14 // RPCService defines RPC service session.
15 type RPCService interface {
16         AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error)
17         AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error)
18         AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error)
19         AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error)
20         AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error)
21         AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error)
22         ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error)
23         ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error)
24         ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error)
25         ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error)
26         BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error)
27         BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error)
28         ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error)
29         ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error)
30         DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error)
31         MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error)
32         SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error)
33         SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error)
34         SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error)
35         UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error)
36         UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error)
37         UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error)
38 }
39
40 type serviceClient struct {
41         conn api.Connection
42 }
43
44 func NewServiceClient(conn api.Connection) RPCService {
45         return &serviceClient{conn}
46 }
47
48 func (c *serviceClient) AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) {
49         out := new(AppAddCertKeyPairReply)
50         err := c.conn.Invoke(ctx, in, out)
51         if err != nil {
52                 return nil, err
53         }
54         return out, api.RetvalToVPPApiError(out.Retval)
55 }
56
57 func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) {
58         out := new(AppAttachReply)
59         err := c.conn.Invoke(ctx, in, out)
60         if err != nil {
61                 return nil, err
62         }
63         return out, api.RetvalToVPPApiError(out.Retval)
64 }
65
66 func (c *serviceClient) AppCutThroughRegistrationAdd(ctx context.Context, in *AppCutThroughRegistrationAdd) (*AppCutThroughRegistrationAddReply, error) {
67         out := new(AppCutThroughRegistrationAddReply)
68         err := c.conn.Invoke(ctx, in, out)
69         if err != nil {
70                 return nil, err
71         }
72         return out, api.RetvalToVPPApiError(out.Retval)
73 }
74
75 func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) {
76         out := new(AppDelCertKeyPairReply)
77         err := c.conn.Invoke(ctx, in, out)
78         if err != nil {
79                 return nil, err
80         }
81         return out, api.RetvalToVPPApiError(out.Retval)
82 }
83
84 func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) {
85         out := new(AppNamespaceAddDelReply)
86         err := c.conn.Invoke(ctx, in, out)
87         if err != nil {
88                 return nil, err
89         }
90         return out, api.RetvalToVPPApiError(out.Retval)
91 }
92
93 func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) {
94         out := new(AppWorkerAddDelReply)
95         err := c.conn.Invoke(ctx, in, out)
96         if err != nil {
97                 return nil, err
98         }
99         return out, api.RetvalToVPPApiError(out.Retval)
100 }
101
102 func (c *serviceClient) ApplicationAttach(ctx context.Context, in *ApplicationAttach) (*ApplicationAttachReply, error) {
103         out := new(ApplicationAttachReply)
104         err := c.conn.Invoke(ctx, in, out)
105         if err != nil {
106                 return nil, err
107         }
108         return out, api.RetvalToVPPApiError(out.Retval)
109 }
110
111 func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) {
112         out := new(ApplicationDetachReply)
113         err := c.conn.Invoke(ctx, in, out)
114         if err != nil {
115                 return nil, err
116         }
117         return out, api.RetvalToVPPApiError(out.Retval)
118 }
119
120 func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) {
121         out := new(ApplicationTLSCertAddReply)
122         err := c.conn.Invoke(ctx, in, out)
123         if err != nil {
124                 return nil, err
125         }
126         return out, api.RetvalToVPPApiError(out.Retval)
127 }
128
129 func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) {
130         out := new(ApplicationTLSKeyAddReply)
131         err := c.conn.Invoke(ctx, in, out)
132         if err != nil {
133                 return nil, err
134         }
135         return out, api.RetvalToVPPApiError(out.Retval)
136 }
137
138 func (c *serviceClient) BindSock(ctx context.Context, in *BindSock) (*BindSockReply, error) {
139         out := new(BindSockReply)
140         err := c.conn.Invoke(ctx, in, out)
141         if err != nil {
142                 return nil, err
143         }
144         return out, api.RetvalToVPPApiError(out.Retval)
145 }
146
147 func (c *serviceClient) BindURI(ctx context.Context, in *BindURI) (*BindURIReply, error) {
148         out := new(BindURIReply)
149         err := c.conn.Invoke(ctx, in, out)
150         if err != nil {
151                 return nil, err
152         }
153         return out, api.RetvalToVPPApiError(out.Retval)
154 }
155
156 func (c *serviceClient) ConnectSock(ctx context.Context, in *ConnectSock) (*ConnectSockReply, error) {
157         out := new(ConnectSockReply)
158         err := c.conn.Invoke(ctx, in, out)
159         if err != nil {
160                 return nil, err
161         }
162         return out, api.RetvalToVPPApiError(out.Retval)
163 }
164
165 func (c *serviceClient) ConnectURI(ctx context.Context, in *ConnectURI) (*ConnectURIReply, error) {
166         out := new(ConnectURIReply)
167         err := c.conn.Invoke(ctx, in, out)
168         if err != nil {
169                 return nil, err
170         }
171         return out, api.RetvalToVPPApiError(out.Retval)
172 }
173
174 func (c *serviceClient) DisconnectSession(ctx context.Context, in *DisconnectSession) (*DisconnectSessionReply, error) {
175         out := new(DisconnectSessionReply)
176         err := c.conn.Invoke(ctx, in, out)
177         if err != nil {
178                 return nil, err
179         }
180         return out, api.RetvalToVPPApiError(out.Retval)
181 }
182
183 func (c *serviceClient) MapAnotherSegment(ctx context.Context, in *MapAnotherSegment) (*MapAnotherSegmentReply, error) {
184         out := new(MapAnotherSegmentReply)
185         err := c.conn.Invoke(ctx, in, out)
186         if err != nil {
187                 return nil, err
188         }
189         return out, api.RetvalToVPPApiError(out.Retval)
190 }
191
192 func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) {
193         out := new(SessionEnableDisableReply)
194         err := c.conn.Invoke(ctx, in, out)
195         if err != nil {
196                 return nil, err
197         }
198         return out, api.RetvalToVPPApiError(out.Retval)
199 }
200
201 func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) {
202         out := new(SessionRuleAddDelReply)
203         err := c.conn.Invoke(ctx, in, out)
204         if err != nil {
205                 return nil, err
206         }
207         return out, api.RetvalToVPPApiError(out.Retval)
208 }
209
210 func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) {
211         stream, err := c.conn.NewStream(ctx)
212         if err != nil {
213                 return nil, err
214         }
215         x := &serviceClient_SessionRulesDumpClient{stream}
216         if err := x.Stream.SendMsg(in); err != nil {
217                 return nil, err
218         }
219         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
220                 return nil, err
221         }
222         return x, nil
223 }
224
225 type RPCService_SessionRulesDumpClient interface {
226         Recv() (*SessionRulesDetails, error)
227         api.Stream
228 }
229
230 type serviceClient_SessionRulesDumpClient struct {
231         api.Stream
232 }
233
234 func (c *serviceClient_SessionRulesDumpClient) Recv() (*SessionRulesDetails, error) {
235         msg, err := c.Stream.RecvMsg()
236         if err != nil {
237                 return nil, err
238         }
239         switch m := msg.(type) {
240         case *SessionRulesDetails:
241                 return m, nil
242         case *vpe.ControlPingReply:
243                 err = c.Stream.Close()
244                 if err != nil {
245                         return nil, err
246                 }
247                 return nil, io.EOF
248         default:
249                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
250         }
251 }
252
253 func (c *serviceClient) UnbindSock(ctx context.Context, in *UnbindSock) (*UnbindSockReply, error) {
254         out := new(UnbindSockReply)
255         err := c.conn.Invoke(ctx, in, out)
256         if err != nil {
257                 return nil, err
258         }
259         return out, api.RetvalToVPPApiError(out.Retval)
260 }
261
262 func (c *serviceClient) UnbindURI(ctx context.Context, in *UnbindURI) (*UnbindURIReply, error) {
263         out := new(UnbindURIReply)
264         err := c.conn.Invoke(ctx, in, out)
265         if err != nil {
266                 return nil, err
267         }
268         return out, api.RetvalToVPPApiError(out.Retval)
269 }
270
271 func (c *serviceClient) UnmapSegment(ctx context.Context, in *UnmapSegment) (*UnmapSegmentReply, error) {
272         out := new(UnmapSegmentReply)
273         err := c.conn.Invoke(ctx, in, out)
274         if err != nil {
275                 return nil, err
276         }
277         return out, api.RetvalToVPPApiError(out.Retval)
278 }