github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/map/map_rpc.ba.go (about)

     1  // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
     2  
     3  package maps
     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 map.
    15  type RPCService interface {
    16  	MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error)
    17  	MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error)
    18  	MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error)
    19  	MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error)
    20  	MapDomainsGet(ctx context.Context, in *MapDomainsGet) (RPCService_MapDomainsGetClient, error)
    21  	MapIfEnableDisable(ctx context.Context, in *MapIfEnableDisable) (*MapIfEnableDisableReply, error)
    22  	MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error)
    23  	MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error)
    24  	MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error)
    25  	MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error)
    26  	MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error)
    27  	MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error)
    28  	MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error)
    29  	MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error)
    30  	MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error)
    31  	MapSummaryStats(ctx context.Context, in *MapSummaryStats) (*MapSummaryStatsReply, error)
    32  }
    33  
    34  type serviceClient struct {
    35  	conn api.Connection
    36  }
    37  
    38  func NewServiceClient(conn api.Connection) RPCService {
    39  	return &serviceClient{conn}
    40  }
    41  
    42  func (c *serviceClient) MapAddDelRule(ctx context.Context, in *MapAddDelRule) (*MapAddDelRuleReply, error) {
    43  	out := new(MapAddDelRuleReply)
    44  	err := c.conn.Invoke(ctx, in, out)
    45  	if err != nil {
    46  		return nil, err
    47  	}
    48  	return out, api.RetvalToVPPApiError(out.Retval)
    49  }
    50  
    51  func (c *serviceClient) MapAddDomain(ctx context.Context, in *MapAddDomain) (*MapAddDomainReply, error) {
    52  	out := new(MapAddDomainReply)
    53  	err := c.conn.Invoke(ctx, in, out)
    54  	if err != nil {
    55  		return nil, err
    56  	}
    57  	return out, api.RetvalToVPPApiError(out.Retval)
    58  }
    59  
    60  func (c *serviceClient) MapDelDomain(ctx context.Context, in *MapDelDomain) (*MapDelDomainReply, error) {
    61  	out := new(MapDelDomainReply)
    62  	err := c.conn.Invoke(ctx, in, out)
    63  	if err != nil {
    64  		return nil, err
    65  	}
    66  	return out, api.RetvalToVPPApiError(out.Retval)
    67  }
    68  
    69  func (c *serviceClient) MapDomainDump(ctx context.Context, in *MapDomainDump) (RPCService_MapDomainDumpClient, error) {
    70  	stream, err := c.conn.NewStream(ctx)
    71  	if err != nil {
    72  		return nil, err
    73  	}
    74  	x := &serviceClient_MapDomainDumpClient{stream}
    75  	if err := x.Stream.SendMsg(in); err != nil {
    76  		return nil, err
    77  	}
    78  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
    79  		return nil, err
    80  	}
    81  	return x, nil
    82  }
    83  
    84  type RPCService_MapDomainDumpClient interface {
    85  	Recv() (*MapDomainDetails, error)
    86  	api.Stream
    87  }
    88  
    89  type serviceClient_MapDomainDumpClient struct {
    90  	api.Stream
    91  }
    92  
    93  func (c *serviceClient_MapDomainDumpClient) Recv() (*MapDomainDetails, error) {
    94  	msg, err := c.Stream.RecvMsg()
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	switch m := msg.(type) {
    99  	case *MapDomainDetails:
   100  		return m, nil
   101  	case *memclnt.ControlPingReply:
   102  		err = c.Stream.Close()
   103  		if err != nil {
   104  			return nil, err
   105  		}
   106  		return nil, io.EOF
   107  	default:
   108  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   109  	}
   110  }
   111  
   112  func (c *serviceClient) MapDomainsGet(ctx context.Context, in *MapDomainsGet) (RPCService_MapDomainsGetClient, error) {
   113  	stream, err := c.conn.NewStream(ctx)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	x := &serviceClient_MapDomainsGetClient{stream}
   118  	if err := x.Stream.SendMsg(in); err != nil {
   119  		return nil, err
   120  	}
   121  	return x, nil
   122  }
   123  
   124  type RPCService_MapDomainsGetClient interface {
   125  	Recv() (*MapDomainDetails, *MapDomainsGetReply, error)
   126  	api.Stream
   127  }
   128  
   129  type serviceClient_MapDomainsGetClient struct {
   130  	api.Stream
   131  }
   132  
   133  func (c *serviceClient_MapDomainsGetClient) Recv() (*MapDomainDetails, *MapDomainsGetReply, error) {
   134  	msg, err := c.Stream.RecvMsg()
   135  	if err != nil {
   136  		return nil, nil, err
   137  	}
   138  	switch m := msg.(type) {
   139  	case *MapDomainDetails:
   140  		return m, nil, nil
   141  	case *MapDomainsGetReply:
   142  		if err := api.RetvalToVPPApiError(m.Retval); err != nil {
   143  			c.Stream.Close()
   144  			return nil, m, err
   145  		}
   146  		err = c.Stream.Close()
   147  		if err != nil {
   148  			return nil, m, err
   149  		}
   150  		return nil, m, io.EOF
   151  	default:
   152  		return nil, nil, fmt.Errorf("unexpected message: %T %v", m, m)
   153  	}
   154  }
   155  
   156  func (c *serviceClient) MapIfEnableDisable(ctx context.Context, in *MapIfEnableDisable) (*MapIfEnableDisableReply, error) {
   157  	out := new(MapIfEnableDisableReply)
   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) MapParamAddDelPreResolve(ctx context.Context, in *MapParamAddDelPreResolve) (*MapParamAddDelPreResolveReply, error) {
   166  	out := new(MapParamAddDelPreResolveReply)
   167  	err := c.conn.Invoke(ctx, in, out)
   168  	if err != nil {
   169  		return nil, err
   170  	}
   171  	return out, api.RetvalToVPPApiError(out.Retval)
   172  }
   173  
   174  func (c *serviceClient) MapParamGet(ctx context.Context, in *MapParamGet) (*MapParamGetReply, error) {
   175  	out := new(MapParamGetReply)
   176  	err := c.conn.Invoke(ctx, in, out)
   177  	if err != nil {
   178  		return nil, err
   179  	}
   180  	return out, api.RetvalToVPPApiError(out.Retval)
   181  }
   182  
   183  func (c *serviceClient) MapParamSetFragmentation(ctx context.Context, in *MapParamSetFragmentation) (*MapParamSetFragmentationReply, error) {
   184  	out := new(MapParamSetFragmentationReply)
   185  	err := c.conn.Invoke(ctx, in, out)
   186  	if err != nil {
   187  		return nil, err
   188  	}
   189  	return out, api.RetvalToVPPApiError(out.Retval)
   190  }
   191  
   192  func (c *serviceClient) MapParamSetICMP(ctx context.Context, in *MapParamSetICMP) (*MapParamSetICMPReply, error) {
   193  	out := new(MapParamSetICMPReply)
   194  	err := c.conn.Invoke(ctx, in, out)
   195  	if err != nil {
   196  		return nil, err
   197  	}
   198  	return out, api.RetvalToVPPApiError(out.Retval)
   199  }
   200  
   201  func (c *serviceClient) MapParamSetICMP6(ctx context.Context, in *MapParamSetICMP6) (*MapParamSetICMP6Reply, error) {
   202  	out := new(MapParamSetICMP6Reply)
   203  	err := c.conn.Invoke(ctx, in, out)
   204  	if err != nil {
   205  		return nil, err
   206  	}
   207  	return out, api.RetvalToVPPApiError(out.Retval)
   208  }
   209  
   210  func (c *serviceClient) MapParamSetSecurityCheck(ctx context.Context, in *MapParamSetSecurityCheck) (*MapParamSetSecurityCheckReply, error) {
   211  	out := new(MapParamSetSecurityCheckReply)
   212  	err := c.conn.Invoke(ctx, in, out)
   213  	if err != nil {
   214  		return nil, err
   215  	}
   216  	return out, api.RetvalToVPPApiError(out.Retval)
   217  }
   218  
   219  func (c *serviceClient) MapParamSetTCP(ctx context.Context, in *MapParamSetTCP) (*MapParamSetTCPReply, error) {
   220  	out := new(MapParamSetTCPReply)
   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) MapParamSetTrafficClass(ctx context.Context, in *MapParamSetTrafficClass) (*MapParamSetTrafficClassReply, error) {
   229  	out := new(MapParamSetTrafficClassReply)
   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) MapRuleDump(ctx context.Context, in *MapRuleDump) (RPCService_MapRuleDumpClient, error) {
   238  	stream, err := c.conn.NewStream(ctx)
   239  	if err != nil {
   240  		return nil, err
   241  	}
   242  	x := &serviceClient_MapRuleDumpClient{stream}
   243  	if err := x.Stream.SendMsg(in); err != nil {
   244  		return nil, err
   245  	}
   246  	if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
   247  		return nil, err
   248  	}
   249  	return x, nil
   250  }
   251  
   252  type RPCService_MapRuleDumpClient interface {
   253  	Recv() (*MapRuleDetails, error)
   254  	api.Stream
   255  }
   256  
   257  type serviceClient_MapRuleDumpClient struct {
   258  	api.Stream
   259  }
   260  
   261  func (c *serviceClient_MapRuleDumpClient) Recv() (*MapRuleDetails, error) {
   262  	msg, err := c.Stream.RecvMsg()
   263  	if err != nil {
   264  		return nil, err
   265  	}
   266  	switch m := msg.(type) {
   267  	case *MapRuleDetails:
   268  		return m, nil
   269  	case *memclnt.ControlPingReply:
   270  		err = c.Stream.Close()
   271  		if err != nil {
   272  			return nil, err
   273  		}
   274  		return nil, io.EOF
   275  	default:
   276  		return nil, fmt.Errorf("unexpected message: %T %v", m, m)
   277  	}
   278  }
   279  
   280  func (c *serviceClient) MapSummaryStats(ctx context.Context, in *MapSummaryStats) (*MapSummaryStatsReply, error) {
   281  	out := new(MapSummaryStatsReply)
   282  	err := c.conn.Invoke(ctx, in, out)
   283  	if err != nil {
   284  		return nil, err
   285  	}
   286  	return out, api.RetvalToVPPApiError(out.Retval)
   287  }