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