github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/vhost_user/vhost_user_rpc.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 3 package vhost_user 4 5 import ( 6 "context" 7 "fmt" 8 "io" 9 10 memclnt "github.com/networkservicemesh/govpp/binapi/memclnt" 11 api "go.fd.io/govpp/api" 12 ) 13 14 // RPCService defines RPC service vhost_user. 15 type RPCService interface { 16 CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) 17 CreateVhostUserIfV2(ctx context.Context, in *CreateVhostUserIfV2) (*CreateVhostUserIfV2Reply, error) 18 DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) 19 ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) 20 ModifyVhostUserIfV2(ctx context.Context, in *ModifyVhostUserIfV2) (*ModifyVhostUserIfV2Reply, error) 21 SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) 22 } 23 24 type serviceClient struct { 25 conn api.Connection 26 } 27 28 func NewServiceClient(conn api.Connection) RPCService { 29 return &serviceClient{conn} 30 } 31 32 func (c *serviceClient) CreateVhostUserIf(ctx context.Context, in *CreateVhostUserIf) (*CreateVhostUserIfReply, error) { 33 out := new(CreateVhostUserIfReply) 34 err := c.conn.Invoke(ctx, in, out) 35 if err != nil { 36 return nil, err 37 } 38 return out, api.RetvalToVPPApiError(out.Retval) 39 } 40 41 func (c *serviceClient) CreateVhostUserIfV2(ctx context.Context, in *CreateVhostUserIfV2) (*CreateVhostUserIfV2Reply, error) { 42 out := new(CreateVhostUserIfV2Reply) 43 err := c.conn.Invoke(ctx, in, out) 44 if err != nil { 45 return nil, err 46 } 47 return out, api.RetvalToVPPApiError(out.Retval) 48 } 49 50 func (c *serviceClient) DeleteVhostUserIf(ctx context.Context, in *DeleteVhostUserIf) (*DeleteVhostUserIfReply, error) { 51 out := new(DeleteVhostUserIfReply) 52 err := c.conn.Invoke(ctx, in, out) 53 if err != nil { 54 return nil, err 55 } 56 return out, api.RetvalToVPPApiError(out.Retval) 57 } 58 59 func (c *serviceClient) ModifyVhostUserIf(ctx context.Context, in *ModifyVhostUserIf) (*ModifyVhostUserIfReply, error) { 60 out := new(ModifyVhostUserIfReply) 61 err := c.conn.Invoke(ctx, in, out) 62 if err != nil { 63 return nil, err 64 } 65 return out, api.RetvalToVPPApiError(out.Retval) 66 } 67 68 func (c *serviceClient) ModifyVhostUserIfV2(ctx context.Context, in *ModifyVhostUserIfV2) (*ModifyVhostUserIfV2Reply, error) { 69 out := new(ModifyVhostUserIfV2Reply) 70 err := c.conn.Invoke(ctx, in, out) 71 if err != nil { 72 return nil, err 73 } 74 return out, api.RetvalToVPPApiError(out.Retval) 75 } 76 77 func (c *serviceClient) SwInterfaceVhostUserDump(ctx context.Context, in *SwInterfaceVhostUserDump) (RPCService_SwInterfaceVhostUserDumpClient, error) { 78 stream, err := c.conn.NewStream(ctx) 79 if err != nil { 80 return nil, err 81 } 82 x := &serviceClient_SwInterfaceVhostUserDumpClient{stream} 83 if err := x.Stream.SendMsg(in); err != nil { 84 return nil, err 85 } 86 if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { 87 return nil, err 88 } 89 return x, nil 90 } 91 92 type RPCService_SwInterfaceVhostUserDumpClient interface { 93 Recv() (*SwInterfaceVhostUserDetails, error) 94 api.Stream 95 } 96 97 type serviceClient_SwInterfaceVhostUserDumpClient struct { 98 api.Stream 99 } 100 101 func (c *serviceClient_SwInterfaceVhostUserDumpClient) Recv() (*SwInterfaceVhostUserDetails, error) { 102 msg, err := c.Stream.RecvMsg() 103 if err != nil { 104 return nil, err 105 } 106 switch m := msg.(type) { 107 case *SwInterfaceVhostUserDetails: 108 return m, nil 109 case *memclnt.ControlPingReply: 110 err = c.Stream.Close() 111 if err != nil { 112 return nil, err 113 } 114 return nil, io.EOF 115 default: 116 return nil, fmt.Errorf("unexpected message: %T %v", m, m) 117 } 118 }