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

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package sr
     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 sr.
    15  type RPCService interface {
    16  	SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error)
    17  	SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error)
    18  	SrLocalsidsWithPacketStatsDump(ctx context.Context, in *SrLocalsidsWithPacketStatsDump) (RPCService_SrLocalsidsWithPacketStatsDumpClient, error)
    19  	SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) (RPCService_SrPoliciesDumpClient, error)
    20  	SrPoliciesWithSlIndexDump(ctx context.Context, in *SrPoliciesWithSlIndexDump) (RPCService_SrPoliciesWithSlIndexDumpClient, error)
    21  	SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error)
    22  	SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error)
    23  	SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error)
    24  	SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error)
    25  	SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error)
    26  	SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error)
    27  	SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error)
    28  }
    29  
    30  type serviceClient struct {
    31  	conn api.Connection
    32  }
    33  
    34  func NewServiceClient(conn api.Connection) RPCService {
    35  	return &serviceClient{conn}
    36  }
    37  
    38  func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) {
    39  	out := new(SrLocalsidAddDelReply)
    40  	err := c.conn.Invoke(ctx, in, out)
    41  	if err != nil {
    42  		return nil, err
    43  	}
    44  	return out, api.RetvalToVPPApiError(out.Retval)
    45  }
    46  
    47  func (c *serviceClient) SrLocalsidsDump(ctx context.Context, in *SrLocalsidsDump) (RPCService_SrLocalsidsDumpClient, error) {
    48  	stream, err := c.conn.NewStream(ctx)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	x := &serviceClient_SrLocalsidsDumpClient{stream}
    53  	if err := x.Stream.SendMsg(in); err != nil {
    54  		return nil, err
    55  	}
    56  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
    57  		return nil, err
    58  	}
    59  	return x, nil
    60  }
    61  
    62  type RPCService_SrLocalsidsDumpClient interface {
    63  	Recv() (*SrLocalsidsDetails, error)
    64  	api.Stream
    65  }
    66  
    67  type serviceClient_SrLocalsidsDumpClient struct {
    68  	api.Stream
    69  }
    70  
    71  func (c *serviceClient_SrLocalsidsDumpClient) Recv() (*SrLocalsidsDetails, error) {
    72  	msg, err := c.Stream.RecvMsg()
    73  	if err != nil {
    74  		return nil, err
    75  	}
    76  	switch m := msg.(type) {
    77  	case *SrLocalsidsDetails:
    78  		return m, nil
    79  	case *memclnt.ControlPingReply:
    80  		err = c.Stream.Close()
    81  		if err != nil {
    82  			return nil, err
    83  		}
    84  		return nil, io.EOF
    85  	default:
    86  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
    87  	}
    88  }
    89  
    90  func (c *serviceClient) SrLocalsidsWithPacketStatsDump(ctx context.Context, in *SrLocalsidsWithPacketStatsDump) (RPCService_SrLocalsidsWithPacketStatsDumpClient, error) {
    91  	stream, err := c.conn.NewStream(ctx)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	x := &serviceClient_SrLocalsidsWithPacketStatsDumpClient{stream}
    96  	if err := x.Stream.SendMsg(in); err != nil {
    97  		return nil, err
    98  	}
    99  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   100  		return nil, err
   101  	}
   102  	return x, nil
   103  }
   104  
   105  type RPCService_SrLocalsidsWithPacketStatsDumpClient interface {
   106  	Recv() (*SrLocalsidsWithPacketStatsDetails, error)
   107  	api.Stream
   108  }
   109  
   110  type serviceClient_SrLocalsidsWithPacketStatsDumpClient struct {
   111  	api.Stream
   112  }
   113  
   114  func (c *serviceClient_SrLocalsidsWithPacketStatsDumpClient) Recv() (*SrLocalsidsWithPacketStatsDetails, error) {
   115  	msg, err := c.Stream.RecvMsg()
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	switch m := msg.(type) {
   120  	case *SrLocalsidsWithPacketStatsDetails:
   121  		return m, nil
   122  	case *memclnt.ControlPingReply:
   123  		err = c.Stream.Close()
   124  		if err != nil {
   125  			return nil, err
   126  		}
   127  		return nil, io.EOF
   128  	default:
   129  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   130  	}
   131  }
   132  
   133  func (c *serviceClient) SrPoliciesDump(ctx context.Context, in *SrPoliciesDump) (RPCService_SrPoliciesDumpClient, error) {
   134  	stream, err := c.conn.NewStream(ctx)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	x := &serviceClient_SrPoliciesDumpClient{stream}
   139  	if err := x.Stream.SendMsg(in); err != nil {
   140  		return nil, err
   141  	}
   142  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   143  		return nil, err
   144  	}
   145  	return x, nil
   146  }
   147  
   148  type RPCService_SrPoliciesDumpClient interface {
   149  	Recv() (*SrPoliciesDetails, error)
   150  	api.Stream
   151  }
   152  
   153  type serviceClient_SrPoliciesDumpClient struct {
   154  	api.Stream
   155  }
   156  
   157  func (c *serviceClient_SrPoliciesDumpClient) Recv() (*SrPoliciesDetails, error) {
   158  	msg, err := c.Stream.RecvMsg()
   159  	if err != nil {
   160  		return nil, err
   161  	}
   162  	switch m := msg.(type) {
   163  	case *SrPoliciesDetails:
   164  		return m, nil
   165  	case *memclnt.ControlPingReply:
   166  		err = c.Stream.Close()
   167  		if err != nil {
   168  			return nil, err
   169  		}
   170  		return nil, io.EOF
   171  	default:
   172  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   173  	}
   174  }
   175  
   176  func (c *serviceClient) SrPoliciesWithSlIndexDump(ctx context.Context, in *SrPoliciesWithSlIndexDump) (RPCService_SrPoliciesWithSlIndexDumpClient, error) {
   177  	stream, err := c.conn.NewStream(ctx)
   178  	if err != nil {
   179  		return nil, err
   180  	}
   181  	x := &serviceClient_SrPoliciesWithSlIndexDumpClient{stream}
   182  	if err := x.Stream.SendMsg(in); err != nil {
   183  		return nil, err
   184  	}
   185  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   186  		return nil, err
   187  	}
   188  	return x, nil
   189  }
   190  
   191  type RPCService_SrPoliciesWithSlIndexDumpClient interface {
   192  	Recv() (*SrPoliciesWithSlIndexDetails, error)
   193  	api.Stream
   194  }
   195  
   196  type serviceClient_SrPoliciesWithSlIndexDumpClient struct {
   197  	api.Stream
   198  }
   199  
   200  func (c *serviceClient_SrPoliciesWithSlIndexDumpClient) Recv() (*SrPoliciesWithSlIndexDetails, error) {
   201  	msg, err := c.Stream.RecvMsg()
   202  	if err != nil {
   203  		return nil, err
   204  	}
   205  	switch m := msg.(type) {
   206  	case *SrPoliciesWithSlIndexDetails:
   207  		return m, nil
   208  	case *memclnt.ControlPingReply:
   209  		err = c.Stream.Close()
   210  		if err != nil {
   211  			return nil, err
   212  		}
   213  		return nil, io.EOF
   214  	default:
   215  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   216  	}
   217  }
   218  
   219  func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) {
   220  	out := new(SrPolicyAddReply)
   221  	err := c.conn.Invoke(ctx, in, out)
   222  	if err != nil {
   223  		return nil, err
   224  	}
   225  	return out, api.RetvalToVPPApiError(out.Retval)
   226  }
   227  
   228  func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) {
   229  	out := new(SrPolicyDelReply)
   230  	err := c.conn.Invoke(ctx, in, out)
   231  	if err != nil {
   232  		return nil, err
   233  	}
   234  	return out, api.RetvalToVPPApiError(out.Retval)
   235  }
   236  
   237  func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) {
   238  	out := new(SrPolicyModReply)
   239  	err := c.conn.Invoke(ctx, in, out)
   240  	if err != nil {
   241  		return nil, err
   242  	}
   243  	return out, api.RetvalToVPPApiError(out.Retval)
   244  }
   245  
   246  func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) {
   247  	out := new(SrSetEncapHopLimitReply)
   248  	err := c.conn.Invoke(ctx, in, out)
   249  	if err != nil {
   250  		return nil, err
   251  	}
   252  	return out, api.RetvalToVPPApiError(out.Retval)
   253  }
   254  
   255  func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) {
   256  	out := new(SrSetEncapSourceReply)
   257  	err := c.conn.Invoke(ctx, in, out)
   258  	if err != nil {
   259  		return nil, err
   260  	}
   261  	return out, api.RetvalToVPPApiError(out.Retval)
   262  }
   263  
   264  func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) {
   265  	out := new(SrSteeringAddDelReply)
   266  	err := c.conn.Invoke(ctx, in, out)
   267  	if err != nil {
   268  		return nil, err
   269  	}
   270  	return out, api.RetvalToVPPApiError(out.Retval)
   271  }
   272  
   273  func (c *serviceClient) SrSteeringPolDump(ctx context.Context, in *SrSteeringPolDump) (RPCService_SrSteeringPolDumpClient, error) {
   274  	stream, err := c.conn.NewStream(ctx)
   275  	if err != nil {
   276  		return nil, err
   277  	}
   278  	x := &serviceClient_SrSteeringPolDumpClient{stream}
   279  	if err := x.Stream.SendMsg(in); err != nil {
   280  		return nil, err
   281  	}
   282  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   283  		return nil, err
   284  	}
   285  	return x, nil
   286  }
   287  
   288  type RPCService_SrSteeringPolDumpClient interface {
   289  	Recv() (*SrSteeringPolDetails, error)
   290  	api.Stream
   291  }
   292  
   293  type serviceClient_SrSteeringPolDumpClient struct {
   294  	api.Stream
   295  }
   296  
   297  func (c *serviceClient_SrSteeringPolDumpClient) Recv() (*SrSteeringPolDetails, error) {
   298  	msg, err := c.Stream.RecvMsg()
   299  	if err != nil {
   300  		return nil, err
   301  	}
   302  	switch m := msg.(type) {
   303  	case *SrSteeringPolDetails:
   304  		return m, nil
   305  	case *memclnt.ControlPingReply:
   306  		err = c.Stream.Close()
   307  		if err != nil {
   308  			return nil, err
   309  		}
   310  		return nil, io.EOF
   311  	default:
   312  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   313  	}
   314  }