regenerate binapi
[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         WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error)
24 }
25
26 type serviceClient struct {
27         conn api.Connection
28 }
29
30 func NewServiceClient(conn api.Connection) RPCService {
31         return &serviceClient{conn}
32 }
33
34 func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) {
35         out := new(IPNeighborAddDelReply)
36         err := c.conn.Invoke(ctx, in, out)
37         if err != nil {
38                 return nil, err
39         }
40         return out, api.RetvalToVPPApiError(out.Retval)
41 }
42
43 func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) {
44         out := new(IPNeighborConfigReply)
45         err := c.conn.Invoke(ctx, in, out)
46         if err != nil {
47                 return nil, err
48         }
49         return out, api.RetvalToVPPApiError(out.Retval)
50 }
51
52 func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) {
53         stream, err := c.conn.NewStream(ctx)
54         if err != nil {
55                 return nil, err
56         }
57         x := &serviceClient_IPNeighborDumpClient{stream}
58         if err := x.Stream.SendMsg(in); err != nil {
59                 return nil, err
60         }
61         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
62                 return nil, err
63         }
64         return x, nil
65 }
66
67 type RPCService_IPNeighborDumpClient interface {
68         Recv() (*IPNeighborDetails, error)
69         api.Stream
70 }
71
72 type serviceClient_IPNeighborDumpClient struct {
73         api.Stream
74 }
75
76 func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) {
77         msg, err := c.Stream.RecvMsg()
78         if err != nil {
79                 return nil, err
80         }
81         switch m := msg.(type) {
82         case *IPNeighborDetails:
83                 return m, nil
84         case *vpe.ControlPingReply:
85                 return nil, io.EOF
86         default:
87                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
88         }
89 }
90
91 func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error) {
92         out := new(IPNeighborFlushReply)
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 }
99
100 func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) {
101         out := new(IPNeighborReplaceBeginReply)
102         err := c.conn.Invoke(ctx, in, out)
103         if err != nil {
104                 return nil, err
105         }
106         return out, api.RetvalToVPPApiError(out.Retval)
107 }
108
109 func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) {
110         out := new(IPNeighborReplaceEndReply)
111         err := c.conn.Invoke(ctx, in, out)
112         if err != nil {
113                 return nil, err
114         }
115         return out, api.RetvalToVPPApiError(out.Retval)
116 }
117
118 func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) {
119         out := new(WantIPNeighborEventsReply)
120         err := c.conn.Invoke(ctx, in, out)
121         if err != nil {
122                 return nil, err
123         }
124         return out, api.RetvalToVPPApiError(out.Retval)
125 }
126
127 func (c *serviceClient) WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error) {
128         out := new(WantIPNeighborEventsV2Reply)
129         err := c.conn.Invoke(ctx, in, out)
130         if err != nil {
131                 return nil, err
132         }
133         return out, api.RetvalToVPPApiError(out.Retval)
134 }