From 58da9ac6e691a8c660eb8ca838a154e11da0db68 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Wed, 22 Jul 2020 04:40:55 +0200 Subject: Fix binapigen decoding and minor improvements - fixed allocating byte slices before copying decoded data - simplified encoding functions - several minor improvements Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2 Signed-off-by: Ondrej Fabry --- internal/testbinapi/binapi2001/lb/lb_rpc.ba.go | 163 +++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 internal/testbinapi/binapi2001/lb/lb_rpc.ba.go (limited to 'internal/testbinapi/binapi2001/lb/lb_rpc.ba.go') diff --git a/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go b/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go new file mode 100644 index 0000000..3375e9c --- /dev/null +++ b/internal/testbinapi/binapi2001/lb/lb_rpc.ba.go @@ -0,0 +1,163 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package lb + +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 lb. +type RPCService interface { + LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) + LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) + LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) + LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) + LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) + LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error) + LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) + LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) { + out := new(LbAddDelAsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) { + out := new(LbAddDelIntfNat4Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) { + out := new(LbAddDelIntfNat6Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) { + out := new(LbAddDelVipReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LbAsDumpClient{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_LbAsDumpClient interface { + Recv() (*LbAsDetails, error) + api.Stream +} + +type serviceClient_LbAsDumpClient struct { + api.Stream +} + +func (c *serviceClient_LbAsDumpClient) Recv() (*LbAsDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LbAsDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error) { + out := new(LbConfReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) { + out := new(LbFlushVipReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_LbVipDumpClient{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_LbVipDumpClient interface { + Recv() (*LbVipDetails, error) + api.Stream +} + +type serviceClient_LbVipDumpClient struct { + api.Stream +} + +func (c *serviceClient_LbVipDumpClient) Recv() (*LbVipDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *LbVipDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} -- cgit 1.2.3-korg