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

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package ip_neighbor
     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 ip_neighbor.
    15  type RPCService interface {
    16  	IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error)
    17  	IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error)
    18  	IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error)
    19  	IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error)
    20  	IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error)
    21  	IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error)
    22  	WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error)
    23  	WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error)
    24  }
    25  
    26  type serviceClient struct {
    27  	conn api.Connection
    28  }
    29  
    30  func NewServiceClient(conn api.Connection) RPCService {
    31  	return &serviceClient{conn}
    32  }
    33  
    34  func (c *serviceClient) IPNeighborAddDel(ctx context.Context, in *IPNeighborAddDel) (*IPNeighborAddDelReply, error) {
    35  	out := new(IPNeighborAddDelReply)
    36  	err := c.conn.Invoke(ctx, in, out)
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  	return out, api.RetvalToVPPApiError(out.Retval)
    41  }
    42  
    43  func (c *serviceClient) IPNeighborConfig(ctx context.Context, in *IPNeighborConfig) (*IPNeighborConfigReply, error) {
    44  	out := new(IPNeighborConfigReply)
    45  	err := c.conn.Invoke(ctx, in, out)
    46  	if err != nil {
    47  		return nil, err
    48  	}
    49  	return out, api.RetvalToVPPApiError(out.Retval)
    50  }
    51  
    52  func (c *serviceClient) IPNeighborDump(ctx context.Context, in *IPNeighborDump) (RPCService_IPNeighborDumpClient, error) {
    53  	stream, err := c.conn.NewStream(ctx)
    54  	if err != nil {
    55  		return nil, err
    56  	}
    57  	x := &serviceClient_IPNeighborDumpClient{stream}
    58  	if err := x.Stream.SendMsg(in); err != nil {
    59  		return nil, err
    60  	}
    61  	if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
    62  		return nil, err
    63  	}
    64  	return x, nil
    65  }
    66  
    67  type RPCService_IPNeighborDumpClient interface {
    68  	Recv() (*IPNeighborDetails, error)
    69  	api.Stream
    70  }
    71  
    72  type serviceClient_IPNeighborDumpClient struct {
    73  	api.Stream
    74  }
    75  
    76  func (c *serviceClient_IPNeighborDumpClient) Recv() (*IPNeighborDetails, error) {
    77  	msg, err := c.Stream.RecvMsg()
    78  	if err != nil {
    79  		return nil, err
    80  	}
    81  	switch m := msg.(type) {
    82  	case *IPNeighborDetails:
    83  		return m, nil
    84  	case *vpe.ControlPingReply:
    85  		err = c.Stream.Close()
    86  		if err != nil {
    87  			return nil, err
    88  		}
    89  		return nil, io.EOF
    90  	default:
    91  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
    92  	}
    93  }
    94  
    95  func (c *serviceClient) IPNeighborFlush(ctx context.Context, in *IPNeighborFlush) (*IPNeighborFlushReply, error) {
    96  	out := new(IPNeighborFlushReply)
    97  	err := c.conn.Invoke(ctx, in, out)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	return out, api.RetvalToVPPApiError(out.Retval)
   102  }
   103  
   104  func (c *serviceClient) IPNeighborReplaceBegin(ctx context.Context, in *IPNeighborReplaceBegin) (*IPNeighborReplaceBeginReply, error) {
   105  	out := new(IPNeighborReplaceBeginReply)
   106  	err := c.conn.Invoke(ctx, in, out)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return out, api.RetvalToVPPApiError(out.Retval)
   111  }
   112  
   113  func (c *serviceClient) IPNeighborReplaceEnd(ctx context.Context, in *IPNeighborReplaceEnd) (*IPNeighborReplaceEndReply, error) {
   114  	out := new(IPNeighborReplaceEndReply)
   115  	err := c.conn.Invoke(ctx, in, out)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return out, api.RetvalToVPPApiError(out.Retval)
   120  }
   121  
   122  func (c *serviceClient) WantIPNeighborEvents(ctx context.Context, in *WantIPNeighborEvents) (*WantIPNeighborEventsReply, error) {
   123  	out := new(WantIPNeighborEventsReply)
   124  	err := c.conn.Invoke(ctx, in, out)
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  	return out, api.RetvalToVPPApiError(out.Retval)
   129  }
   130  
   131  func (c *serviceClient) WantIPNeighborEventsV2(ctx context.Context, in *WantIPNeighborEventsV2) (*WantIPNeighborEventsV2Reply, error) {
   132  	out := new(WantIPNeighborEventsV2Reply)
   133  	err := c.conn.Invoke(ctx, in, out)
   134  	if err != nil {
   135  		return nil, err
   136  	}
   137  	return out, api.RetvalToVPPApiError(out.Retval)
   138  }