go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/binapi/vpp2106/arp/arp_rpc.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package arp
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"io"
     9  
    10  	api "go.fd.io/govpp/api"
    11  	vpe "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2106/vpe"
    12  )
    13  
    14  // RPCService defines RPC service arp.
    15  type RPCService interface {
    16  	ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error)
    17  	ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error)
    18  	ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error)
    19  	ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error)
    20  }
    21  
    22  type serviceClient struct {
    23  	conn api.Connection
    24  }
    25  
    26  func NewServiceClient(conn api.Connection) RPCService {
    27  	return &serviceClient{conn}
    28  }
    29  
    30  func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) {
    31  	out := new(ProxyArpAddDelReply)
    32  	err := c.conn.Invoke(ctx, in, out)
    33  	if err != nil {
    34  		return nil, err
    35  	}
    36  	return out, api.RetvalToVPPApiError(out.Retval)
    37  }
    38  
    39  func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) {
    40  	stream, err := c.conn.NewStream(ctx)
    41  	if err != nil {
    42  		return nil, err
    43  	}
    44  	x := &serviceClient_ProxyArpDumpClient{stream}
    45  	if err := x.Stream.SendMsg(in); err != nil {
    46  		return nil, err
    47  	}
    48  	if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
    49  		return nil, err
    50  	}
    51  	return x, nil
    52  }
    53  
    54  type RPCService_ProxyArpDumpClient interface {
    55  	Recv() (*ProxyArpDetails, error)
    56  	api.Stream
    57  }
    58  
    59  type serviceClient_ProxyArpDumpClient struct {
    60  	api.Stream
    61  }
    62  
    63  func (c *serviceClient_ProxyArpDumpClient) Recv() (*ProxyArpDetails, error) {
    64  	msg, err := c.Stream.RecvMsg()
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	switch m := msg.(type) {
    69  	case *ProxyArpDetails:
    70  		return m, nil
    71  	case *vpe.ControlPingReply:
    72  		err = c.Stream.Close()
    73  		if err != nil {
    74  			return nil, err
    75  		}
    76  		return nil, io.EOF
    77  	default:
    78  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
    79  	}
    80  }
    81  
    82  func (c *serviceClient) ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error) {
    83  	stream, err := c.conn.NewStream(ctx)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	x := &serviceClient_ProxyArpIntfcDumpClient{stream}
    88  	if err := x.Stream.SendMsg(in); err != nil {
    89  		return nil, err
    90  	}
    91  	if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
    92  		return nil, err
    93  	}
    94  	return x, nil
    95  }
    96  
    97  type RPCService_ProxyArpIntfcDumpClient interface {
    98  	Recv() (*ProxyArpIntfcDetails, error)
    99  	api.Stream
   100  }
   101  
   102  type serviceClient_ProxyArpIntfcDumpClient struct {
   103  	api.Stream
   104  }
   105  
   106  func (c *serviceClient_ProxyArpIntfcDumpClient) Recv() (*ProxyArpIntfcDetails, error) {
   107  	msg, err := c.Stream.RecvMsg()
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	switch m := msg.(type) {
   112  	case *ProxyArpIntfcDetails:
   113  		return m, nil
   114  	case *vpe.ControlPingReply:
   115  		err = c.Stream.Close()
   116  		if err != nil {
   117  			return nil, err
   118  		}
   119  		return nil, io.EOF
   120  	default:
   121  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   122  	}
   123  }
   124  
   125  func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) {
   126  	out := new(ProxyArpIntfcEnableDisableReply)
   127  	err := c.conn.Invoke(ctx, in, out)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	return out, api.RetvalToVPPApiError(out.Retval)
   132  }