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