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