diff options
Diffstat (limited to 'internal/testbinapi/binapi2001/pipe/pipe_rpc.ba.go')
-rw-r--r-- | internal/testbinapi/binapi2001/pipe/pipe_rpc.ba.go | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/internal/testbinapi/binapi2001/pipe/pipe_rpc.ba.go b/internal/testbinapi/binapi2001/pipe/pipe_rpc.ba.go new file mode 100644 index 0000000..ce2037d --- /dev/null +++ b/internal/testbinapi/binapi2001/pipe/pipe_rpc.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package pipe + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" + "io" +) + +// RPCService defines RPC service pipe. +type RPCService interface { + PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) + PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) + PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) PipeCreate(ctx context.Context, in *PipeCreate) (*PipeCreateReply, error) { + out := new(PipeCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PipeDelete(ctx context.Context, in *PipeDelete) (*PipeDeleteReply, error) { + out := new(PipeDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PipeDump(ctx context.Context, in *PipeDump) (RPCService_PipeDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PipeDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PipeDumpClient interface { + Recv() (*PipeDetails, error) + api.Stream +} + +type serviceClient_PipeDumpClient struct { + api.Stream +} + +func (c *serviceClient_PipeDumpClient) Recv() (*PipeDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PipeDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} |