fa4f45503f871904bc99b8d217929067903d42d1
[govpp.git] / binapi / vrrp / vrrp_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package vrrp
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 vrrp.
15 type RPCService interface {
16         VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error)
17         VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error)
18         VrrpVrPeerDump(ctx context.Context, in *VrrpVrPeerDump) (RPCService_VrrpVrPeerDumpClient, error)
19         VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) (*VrrpVrSetPeersReply, error)
20         VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error)
21         VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error)
22         VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error)
23         WantVrrpVrEvents(ctx context.Context, in *WantVrrpVrEvents) (*WantVrrpVrEventsReply, 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) VrrpVrAddDel(ctx context.Context, in *VrrpVrAddDel) (*VrrpVrAddDelReply, error) {
35         out := new(VrrpVrAddDelReply)
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) VrrpVrDump(ctx context.Context, in *VrrpVrDump) (RPCService_VrrpVrDumpClient, error) {
44         stream, err := c.conn.NewStream(ctx)
45         if err != nil {
46                 return nil, err
47         }
48         x := &serviceClient_VrrpVrDumpClient{stream}
49         if err := x.Stream.SendMsg(in); err != nil {
50                 return nil, err
51         }
52         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
53                 return nil, err
54         }
55         return x, nil
56 }
57
58 type RPCService_VrrpVrDumpClient interface {
59         Recv() (*VrrpVrDetails, error)
60         api.Stream
61 }
62
63 type serviceClient_VrrpVrDumpClient struct {
64         api.Stream
65 }
66
67 func (c *serviceClient_VrrpVrDumpClient) Recv() (*VrrpVrDetails, error) {
68         msg, err := c.Stream.RecvMsg()
69         if err != nil {
70                 return nil, err
71         }
72         switch m := msg.(type) {
73         case *VrrpVrDetails:
74                 return m, nil
75         case *vpe.ControlPingReply:
76                 return nil, io.EOF
77         default:
78                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
79         }
80 }
81
82 func (c *serviceClient) VrrpVrPeerDump(ctx context.Context, in *VrrpVrPeerDump) (RPCService_VrrpVrPeerDumpClient, error) {
83         stream, err := c.conn.NewStream(ctx)
84         if err != nil {
85                 return nil, err
86         }
87         x := &serviceClient_VrrpVrPeerDumpClient{stream}
88         if err := x.Stream.SendMsg(in); err != nil {
89                 return nil, err
90         }
91         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
92                 return nil, err
93         }
94         return x, nil
95 }
96
97 type RPCService_VrrpVrPeerDumpClient interface {
98         Recv() (*VrrpVrPeerDetails, error)
99         api.Stream
100 }
101
102 type serviceClient_VrrpVrPeerDumpClient struct {
103         api.Stream
104 }
105
106 func (c *serviceClient_VrrpVrPeerDumpClient) Recv() (*VrrpVrPeerDetails, error) {
107         msg, err := c.Stream.RecvMsg()
108         if err != nil {
109                 return nil, err
110         }
111         switch m := msg.(type) {
112         case *VrrpVrPeerDetails:
113                 return m, nil
114         case *vpe.ControlPingReply:
115                 return nil, io.EOF
116         default:
117                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
118         }
119 }
120
121 func (c *serviceClient) VrrpVrSetPeers(ctx context.Context, in *VrrpVrSetPeers) (*VrrpVrSetPeersReply, error) {
122         out := new(VrrpVrSetPeersReply)
123         err := c.conn.Invoke(ctx, in, out)
124         if err != nil {
125                 return nil, err
126         }
127         return out, api.RetvalToVPPApiError(out.Retval)
128 }
129
130 func (c *serviceClient) VrrpVrStartStop(ctx context.Context, in *VrrpVrStartStop) (*VrrpVrStartStopReply, error) {
131         out := new(VrrpVrStartStopReply)
132         err := c.conn.Invoke(ctx, in, out)
133         if err != nil {
134                 return nil, err
135         }
136         return out, api.RetvalToVPPApiError(out.Retval)
137 }
138
139 func (c *serviceClient) VrrpVrTrackIfAddDel(ctx context.Context, in *VrrpVrTrackIfAddDel) (*VrrpVrTrackIfAddDelReply, error) {
140         out := new(VrrpVrTrackIfAddDelReply)
141         err := c.conn.Invoke(ctx, in, out)
142         if err != nil {
143                 return nil, err
144         }
145         return out, api.RetvalToVPPApiError(out.Retval)
146 }
147
148 func (c *serviceClient) VrrpVrTrackIfDump(ctx context.Context, in *VrrpVrTrackIfDump) (RPCService_VrrpVrTrackIfDumpClient, error) {
149         stream, err := c.conn.NewStream(ctx)
150         if err != nil {
151                 return nil, err
152         }
153         x := &serviceClient_VrrpVrTrackIfDumpClient{stream}
154         if err := x.Stream.SendMsg(in); err != nil {
155                 return nil, err
156         }
157         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
158                 return nil, err
159         }
160         return x, nil
161 }
162
163 type RPCService_VrrpVrTrackIfDumpClient interface {
164         Recv() (*VrrpVrTrackIfDetails, error)
165         api.Stream
166 }
167
168 type serviceClient_VrrpVrTrackIfDumpClient struct {
169         api.Stream
170 }
171
172 func (c *serviceClient_VrrpVrTrackIfDumpClient) Recv() (*VrrpVrTrackIfDetails, error) {
173         msg, err := c.Stream.RecvMsg()
174         if err != nil {
175                 return nil, err
176         }
177         switch m := msg.(type) {
178         case *VrrpVrTrackIfDetails:
179                 return m, nil
180         case *vpe.ControlPingReply:
181                 return nil, io.EOF
182         default:
183                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
184         }
185 }
186
187 func (c *serviceClient) WantVrrpVrEvents(ctx context.Context, in *WantVrrpVrEvents) (*WantVrrpVrEventsReply, error) {
188         out := new(WantVrrpVrEventsReply)
189         err := c.conn.Invoke(ctx, in, out)
190         if err != nil {
191                 return nil, err
192         }
193         return out, api.RetvalToVPPApiError(out.Retval)
194 }