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