74940a2f5d2e0b81eb20e5d5d7ca53093e1fa1cc
[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         api "git.fd.io/govpp.git/api"
9         vpe "git.fd.io/govpp.git/binapi/vpe"
10         "io"
11 )
12
13 // RPCService defines RPC service  l3xc.
14 type RPCService interface {
15         L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error)
16         L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error)
17         L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error)
18         L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error)
19 }
20
21 type serviceClient struct {
22         conn api.Connection
23 }
24
25 func NewServiceClient(conn api.Connection) RPCService {
26         return &serviceClient{conn}
27 }
28
29 func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) {
30         out := new(L3xcDelReply)
31         err := c.conn.Invoke(ctx, in, out)
32         if err != nil {
33                 return nil, err
34         }
35         return out, nil
36 }
37
38 func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) {
39         stream, err := c.conn.NewStream(ctx)
40         if err != nil {
41                 return nil, err
42         }
43         x := &serviceClient_L3xcDumpClient{stream}
44         if err := x.Stream.SendMsg(in); err != nil {
45                 return nil, err
46         }
47         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
48                 return nil, err
49         }
50         return x, nil
51 }
52
53 type RPCService_L3xcDumpClient interface {
54         Recv() (*L3xcDetails, error)
55         api.Stream
56 }
57
58 type serviceClient_L3xcDumpClient struct {
59         api.Stream
60 }
61
62 func (c *serviceClient_L3xcDumpClient) Recv() (*L3xcDetails, error) {
63         msg, err := c.Stream.RecvMsg()
64         if err != nil {
65                 return nil, err
66         }
67         switch m := msg.(type) {
68         case *L3xcDetails:
69                 return m, nil
70         case *vpe.ControlPingReply:
71                 return nil, io.EOF
72         default:
73                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
74         }
75 }
76
77 func (c *serviceClient) L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error) {
78         out := new(L3xcPluginGetVersionReply)
79         err := c.conn.Invoke(ctx, in, out)
80         if err != nil {
81                 return nil, err
82         }
83         return out, nil
84 }
85
86 func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error) {
87         out := new(L3xcUpdateReply)
88         err := c.conn.Invoke(ctx, in, out)
89         if err != nil {
90                 return nil, err
91         }
92         return out, nil
93 }