github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/bfd/bfd_rpc.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package bfd
     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 bfd.
    15  type RPCService interface {
    16  	BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error)
    17  	BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error)
    18  	BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error)
    19  	BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error)
    20  	BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error)
    21  	BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error)
    22  	BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error)
    23  	BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error)
    24  	BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error)
    25  	BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error)
    26  	BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error)
    27  	BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error)
    28  	BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error)
    29  	BfdUDPUpd(ctx context.Context, in *BfdUDPUpd) (*BfdUDPUpdReply, error)
    30  	WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error)
    31  }
    32  
    33  type serviceClient struct {
    34  	conn api.Connection
    35  }
    36  
    37  func NewServiceClient(conn api.Connection) RPCService {
    38  	return &serviceClient{conn}
    39  }
    40  
    41  func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) {
    42  	out := new(BfdAuthDelKeyReply)
    43  	err := c.conn.Invoke(ctx, in, out)
    44  	if err != nil {
    45  		return nil, err
    46  	}
    47  	return out, api.RetvalToVPPApiError(out.Retval)
    48  }
    49  
    50  func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) {
    51  	stream, err := c.conn.NewStream(ctx)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	x := &serviceClient_BfdAuthKeysDumpClient{stream}
    56  	if err := x.Stream.SendMsg(in); err != nil {
    57  		return nil, err
    58  	}
    59  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
    60  		return nil, err
    61  	}
    62  	return x, nil
    63  }
    64  
    65  type RPCService_BfdAuthKeysDumpClient interface {
    66  	Recv() (*BfdAuthKeysDetails, error)
    67  	api.Stream
    68  }
    69  
    70  type serviceClient_BfdAuthKeysDumpClient struct {
    71  	api.Stream
    72  }
    73  
    74  func (c *serviceClient_BfdAuthKeysDumpClient) Recv() (*BfdAuthKeysDetails, error) {
    75  	msg, err := c.Stream.RecvMsg()
    76  	if err != nil {
    77  		return nil, err
    78  	}
    79  	switch m := msg.(type) {
    80  	case *BfdAuthKeysDetails:
    81  		return m, nil
    82  	case *memclnt.ControlPingReply:
    83  		err = c.Stream.Close()
    84  		if err != nil {
    85  			return nil, err
    86  		}
    87  		return nil, io.EOF
    88  	default:
    89  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
    90  	}
    91  }
    92  
    93  func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) {
    94  	out := new(BfdAuthSetKeyReply)
    95  	err := c.conn.Invoke(ctx, in, out)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return out, api.RetvalToVPPApiError(out.Retval)
   100  }
   101  
   102  func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) {
   103  	out := new(BfdUDPAddReply)
   104  	err := c.conn.Invoke(ctx, in, out)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return out, api.RetvalToVPPApiError(out.Retval)
   109  }
   110  
   111  func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) {
   112  	out := new(BfdUDPAuthActivateReply)
   113  	err := c.conn.Invoke(ctx, in, out)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return out, api.RetvalToVPPApiError(out.Retval)
   118  }
   119  
   120  func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) {
   121  	out := new(BfdUDPAuthDeactivateReply)
   122  	err := c.conn.Invoke(ctx, in, out)
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  	return out, api.RetvalToVPPApiError(out.Retval)
   127  }
   128  
   129  func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) {
   130  	out := new(BfdUDPDelReply)
   131  	err := c.conn.Invoke(ctx, in, out)
   132  	if err != nil {
   133  		return nil, err
   134  	}
   135  	return out, api.RetvalToVPPApiError(out.Retval)
   136  }
   137  
   138  func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) {
   139  	out := new(BfdUDPDelEchoSourceReply)
   140  	err := c.conn.Invoke(ctx, in, out)
   141  	if err != nil {
   142  		return nil, err
   143  	}
   144  	return out, api.RetvalToVPPApiError(out.Retval)
   145  }
   146  
   147  func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) {
   148  	out := new(BfdUDPGetEchoSourceReply)
   149  	err := c.conn.Invoke(ctx, in, out)
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	return out, api.RetvalToVPPApiError(out.Retval)
   154  }
   155  
   156  func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) {
   157  	out := new(BfdUDPModReply)
   158  	err := c.conn.Invoke(ctx, in, out)
   159  	if err != nil {
   160  		return nil, err
   161  	}
   162  	return out, api.RetvalToVPPApiError(out.Retval)
   163  }
   164  
   165  func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) {
   166  	stream, err := c.conn.NewStream(ctx)
   167  	if err != nil {
   168  		return nil, err
   169  	}
   170  	x := &serviceClient_BfdUDPSessionDumpClient{stream}
   171  	if err := x.Stream.SendMsg(in); err != nil {
   172  		return nil, err
   173  	}
   174  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   175  		return nil, err
   176  	}
   177  	return x, nil
   178  }
   179  
   180  type RPCService_BfdUDPSessionDumpClient interface {
   181  	Recv() (*BfdUDPSessionDetails, error)
   182  	api.Stream
   183  }
   184  
   185  type serviceClient_BfdUDPSessionDumpClient struct {
   186  	api.Stream
   187  }
   188  
   189  func (c *serviceClient_BfdUDPSessionDumpClient) Recv() (*BfdUDPSessionDetails, error) {
   190  	msg, err := c.Stream.RecvMsg()
   191  	if err != nil {
   192  		return nil, err
   193  	}
   194  	switch m := msg.(type) {
   195  	case *BfdUDPSessionDetails:
   196  		return m, nil
   197  	case *memclnt.ControlPingReply:
   198  		err = c.Stream.Close()
   199  		if err != nil {
   200  			return nil, err
   201  		}
   202  		return nil, io.EOF
   203  	default:
   204  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   205  	}
   206  }
   207  
   208  func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) {
   209  	out := new(BfdUDPSessionSetFlagsReply)
   210  	err := c.conn.Invoke(ctx, in, out)
   211  	if err != nil {
   212  		return nil, err
   213  	}
   214  	return out, api.RetvalToVPPApiError(out.Retval)
   215  }
   216  
   217  func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) {
   218  	out := new(BfdUDPSetEchoSourceReply)
   219  	err := c.conn.Invoke(ctx, in, out)
   220  	if err != nil {
   221  		return nil, err
   222  	}
   223  	return out, api.RetvalToVPPApiError(out.Retval)
   224  }
   225  
   226  func (c *serviceClient) BfdUDPUpd(ctx context.Context, in *BfdUDPUpd) (*BfdUDPUpdReply, error) {
   227  	out := new(BfdUDPUpdReply)
   228  	err := c.conn.Invoke(ctx, in, out)
   229  	if err != nil {
   230  		return nil, err
   231  	}
   232  	return out, api.RetvalToVPPApiError(out.Retval)
   233  }
   234  
   235  func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) {
   236  	out := new(WantBfdEventsReply)
   237  	err := c.conn.Invoke(ctx, in, out)
   238  	if err != nil {
   239  		return nil, err
   240  	}
   241  	return out, api.RetvalToVPPApiError(out.Retval)
   242  }