Change module name to go.fd.io/govpp
[govpp.git] / binapi / l3xc / l3xc_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package l3xc
4
5 import (
6         "context"
7         "fmt"
8         "io"
9
10         api "go.fd.io/govpp/api"
11         memclnt "go.fd.io/govpp/binapi/memclnt"
12 )
13
14 // RPCService defines RPC service l3xc.
15 type RPCService interface {
16         L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error)
17         L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error)
18         L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error)
19         L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error)
20 }
21
22 type serviceClient struct {
23         conn api.Connection
24 }
25
26 func NewServiceClient(conn api.Connection) RPCService {
27         return &serviceClient{conn}
28 }
29
30 func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) {
31         out := new(L3xcDelReply)
32         err := c.conn.Invoke(ctx, in, out)
33         if err != nil {
34                 return nil, err
35         }
36         return out, api.RetvalToVPPApiError(out.Retval)
37 }
38
39 func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) {
40         stream, err := c.conn.NewStream(ctx)
41         if err != nil {
42                 return nil, err
43         }
44         x := &serviceClient_L3xcDumpClient{stream}
45         if err := x.Stream.SendMsg(in); err != nil {
46                 return nil, err
47         }
48         if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
49                 return nil, err
50         }
51         return x, nil
52 }
53
54 type RPCService_L3xcDumpClient interface {
55         Recv() (*L3xcDetails, error)
56         api.Stream
57 }
58
59 type serviceClient_L3xcDumpClient struct {
60         api.Stream
61 }
62
63 func (c *serviceClient_L3xcDumpClient) Recv() (*L3xcDetails, error) {
64         msg, err := c.Stream.RecvMsg()
65         if err != nil {
66                 return nil, err
67         }
68         switch m := msg.(type) {
69         case *L3xcDetails:
70                 return m, nil
71         case *memclnt.ControlPingReply:
72                 err = c.Stream.Close()
73                 if err != nil {
74                         return nil, err
75                 }
76                 return nil, io.EOF
77         default:
78                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
79         }
80 }
81
82 func (c *serviceClient) L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error) {
83         out := new(L3xcPluginGetVersionReply)
84         err := c.conn.Invoke(ctx, in, out)
85         if err != nil {
86                 return nil, err
87         }
88         return out, nil
89 }
90
91 func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error) {
92         out := new(L3xcUpdateReply)
93         err := c.conn.Invoke(ctx, in, out)
94         if err != nil {
95                 return nil, err
96         }
97         return out, api.RetvalToVPPApiError(out.Retval)
98 }