091ed53f3401e0091e91cbd942eaa1d3292ff93c
[govpp.git] / binapi / vhost_user / vhost_user_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package vhost_user
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  vhost_user.
14 type RPCService interface {
15         CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error)
16         DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error)
17         ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error)
18         SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, 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) CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) {
30         out := new(CreateVhostUserIfReply)
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) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) {
39         out := new(DeleteVhostUserIfReply)
40         err := c.conn.Invoke(ctx, in, out)
41         if err != nil {
42                 return nil, err
43         }
44         return out, nil
45 }
46
47 func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) {
48         out := new(ModifyVhostUserIfReply)
49         err := c.conn.Invoke(ctx, in, out)
50         if err != nil {
51                 return nil, err
52         }
53         return out, nil
54 }
55
56 func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) {
57         stream, err := c.conn.NewStream(ctx)
58         if err != nil {
59                 return nil, err
60         }
61         x := &serviceClient_SwInterfaceVhostUserDumpClient{stream}
62         if err := x.Stream.SendMsg(in); err != nil {
63                 return nil, err
64         }
65         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
66                 return nil, err
67         }
68         return x, nil
69 }
70
71 type RPCService_SwInterfaceVhostUserDumpClient interface {
72         Recv() (*SwInterfaceVhostUserDetails, error)
73         api.Stream
74 }
75
76 type serviceClient_SwInterfaceVhostUserDumpClient struct {
77         api.Stream
78 }
79
80 func (c *serviceClient_SwInterfaceVhostUserDumpClient) Recv() (*SwInterfaceVhostUserDetails, error) {
81         msg, err := c.Stream.RecvMsg()
82         if err != nil {
83                 return nil, err
84         }
85         switch m := msg.(type) {
86         case *SwInterfaceVhostUserDetails:
87                 return m, nil
88         case *vpe.ControlPingReply:
89                 return nil, io.EOF
90         default:
91                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
92         }
93 }