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