bab3b229399153a065a52aa67ac5d24283109fc4
[govpp.git] / binapi / ipip / ipip_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package ipip
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  ipip.
14 type RPCService interface {
15         Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error)
16         Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error)
17         IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error)
18         IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error)
19         IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, 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) Ipip6rdAddTunnel(ctx context.Context, in *Ipip6rdAddTunnel) (*Ipip6rdAddTunnelReply, error) {
31         out := new(Ipip6rdAddTunnelReply)
32         err := c.conn.Invoke(ctx, in, out)
33         if err != nil {
34                 return nil, err
35         }
36         return out, nil
37 }
38
39 func (c *serviceClient) Ipip6rdDelTunnel(ctx context.Context, in *Ipip6rdDelTunnel) (*Ipip6rdDelTunnelReply, error) {
40         out := new(Ipip6rdDelTunnelReply)
41         err := c.conn.Invoke(ctx, in, out)
42         if err != nil {
43                 return nil, err
44         }
45         return out, nil
46 }
47
48 func (c *serviceClient) IpipAddTunnel(ctx context.Context, in *IpipAddTunnel) (*IpipAddTunnelReply, error) {
49         out := new(IpipAddTunnelReply)
50         err := c.conn.Invoke(ctx, in, out)
51         if err != nil {
52                 return nil, err
53         }
54         return out, nil
55 }
56
57 func (c *serviceClient) IpipDelTunnel(ctx context.Context, in *IpipDelTunnel) (*IpipDelTunnelReply, error) {
58         out := new(IpipDelTunnelReply)
59         err := c.conn.Invoke(ctx, in, out)
60         if err != nil {
61                 return nil, err
62         }
63         return out, nil
64 }
65
66 func (c *serviceClient) IpipTunnelDump(ctx context.Context, in *IpipTunnelDump) (RPCService_IpipTunnelDumpClient, error) {
67         stream, err := c.conn.NewStream(ctx)
68         if err != nil {
69                 return nil, err
70         }
71         x := &serviceClient_IpipTunnelDumpClient{stream}
72         if err := x.Stream.SendMsg(in); err != nil {
73                 return nil, err
74         }
75         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
76                 return nil, err
77         }
78         return x, nil
79 }
80
81 type RPCService_IpipTunnelDumpClient interface {
82         Recv() (*IpipTunnelDetails, error)
83         api.Stream
84 }
85
86 type serviceClient_IpipTunnelDumpClient struct {
87         api.Stream
88 }
89
90 func (c *serviceClient_IpipTunnelDumpClient) Recv() (*IpipTunnelDetails, error) {
91         msg, err := c.Stream.RecvMsg()
92         if err != nil {
93                 return nil, err
94         }
95         switch m := msg.(type) {
96         case *IpipTunnelDetails:
97                 return m, nil
98         case *vpe.ControlPingReply:
99                 return nil, io.EOF
100         default:
101                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
102         }
103 }