Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / 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/internal/testbinapi/binapi2001/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         WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, 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) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) {
31         out := new(IPNeighborAddDelReply)
32         err := c.conn.Invoke(ctx, in, out)
33         if err != nil {
34                 return nil, err
35         }
36         return out, api.RetvalToVPPApiError(out.Retval)
37 }
38
39 func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) {
40         out := new(IPNeighborConfigReply)
41         err := c.conn.Invoke(ctx, in, out)
42         if err != nil {
43                 return nil, err
44         }
45         return out, api.RetvalToVPPApiError(out.Retval)
46 }
47
48 func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) {
49         stream, err := c.conn.NewStream(ctx)
50         if err != nil {
51                 return nil, err
52         }
53         x := &serviceClient_IPNeighborDumpClient{stream}
54         if err := x.Stream.SendMsg(in); err != nil {
55                 return nil, err
56         }
57         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
58                 return nil, err
59         }
60         return x, nil
61 }
62
63 type RPCService_IPNeighborDumpClient interface {
64         Recv() (*IPNeighborDetails, error)
65         api.Stream
66 }
67
68 type serviceClient_IPNeighborDumpClient struct {
69         api.Stream
70 }
71
72 func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) {
73         msg, err := c.Stream.RecvMsg()
74         if err != nil {
75                 return nil, err
76         }
77         switch m := msg.(type) {
78         case *IPNeighborDetails:
79                 return m, nil
80         case *vpe.ControlPingReply:
81                 err = c.Stream.Close()
82                 if err != nil {
83                         return nil, err
84                 }
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) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) {
92         out := new(WantIPNeighborEventsReply)
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 }