86589dd146efecb7afb5fc896e95b0142567a626
[govpp.git] / binapi / ip_neighbor / ip_neighbor_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package ip_neighbor
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  ip_neighbor.
14 type RPCService interface {
15         IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error)
16         IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error)
17         IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error)
18         IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error)
19         IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error)
20         IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error)
21         WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error)
22 }
23
24 type serviceClient struct {
25         conn api.Connection
26 }
27
28 func NewServiceClient(conn api.Connection) RPCService {
29         return &serviceClient{conn}
30 }
31
32 func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) {
33         out := new(IPNeighborAddDelReply)
34         err := c.conn.Invoke(ctx, in, out)
35         if err != nil {
36                 return nil, err
37         }
38         return out, nil
39 }
40
41 func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) {
42         out := new(IPNeighborConfigReply)
43         err := c.conn.Invoke(ctx, in, out)
44         if err != nil {
45                 return nil, err
46         }
47         return out, nil
48 }
49
50 func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) {
51         stream, err := c.conn.NewStream(ctx)
52         if err != nil {
53                 return nil, err
54         }
55         x := &serviceClient_IPNeighborDumpClient{stream}
56         if err := x.Stream.SendMsg(in); err != nil {
57                 return nil, err
58         }
59         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
60                 return nil, err
61         }
62         return x, nil
63 }
64
65 type RPCService_IPNeighborDumpClient interface {
66         Recv() (*IPNeighborDetails, error)
67         api.Stream
68 }
69
70 type serviceClient_IPNeighborDumpClient struct {
71         api.Stream
72 }
73
74 func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) {
75         msg, err := c.Stream.RecvMsg()
76         if err != nil {
77                 return nil, err
78         }
79         switch m := msg.(type) {
80         case *IPNeighborDetails:
81                 return m, nil
82         case *vpe.ControlPingReply:
83                 return nil, io.EOF
84         default:
85                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
86         }
87 }
88
89 func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error) {
90         out := new(IPNeighborFlushReply)
91         err := c.conn.Invoke(ctx, in, out)
92         if err != nil {
93                 return nil, err
94         }
95         return out, nil
96 }
97
98 func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) {
99         out := new(IPNeighborReplaceBeginReply)
100         err := c.conn.Invoke(ctx, in, out)
101         if err != nil {
102                 return nil, err
103         }
104         return out, nil
105 }
106
107 func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) {
108         out := new(IPNeighborReplaceEndReply)
109         err := c.conn.Invoke(ctx, in, out)
110         if err != nil {
111                 return nil, err
112         }
113         return out, nil
114 }
115
116 func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) {
117         out := new(WantIPNeighborEventsReply)
118         err := c.conn.Invoke(ctx, in, out)
119         if err != nil {
120                 return nil, err
121         }
122         return out, nil
123 }