768519c287aa385a0c35ea75dc784397b4761c04
[govpp.git] / binapi / nat66 / nat66_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package nat66
4
5 import (
6         "context"
7         "fmt"
8         "io"
9
10         api "git.fd.io/govpp.git/api"
11         memclnt "git.fd.io/govpp.git/binapi/memclnt"
12 )
13
14 // RPCService defines RPC service nat66.
15 type RPCService interface {
16         Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error)
17         Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error)
18         Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error)
19         Nat66PluginEnableDisable(ctx context.Context, in *Nat66PluginEnableDisable) (*Nat66PluginEnableDisableReply, error)
20         Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error)
21 }
22
23 type serviceClient struct {
24         conn api.Connection
25 }
26
27 func NewServiceClient(conn api.Connection) RPCService {
28         return &serviceClient{conn}
29 }
30
31 func (c *serviceClient) Nat66AddDelInterface(ctx context.Context, in *Nat66AddDelInterface) (*Nat66AddDelInterfaceReply, error) {
32         out := new(Nat66AddDelInterfaceReply)
33         err := c.conn.Invoke(ctx, in, out)
34         if err != nil {
35                 return nil, err
36         }
37         return out, api.RetvalToVPPApiError(out.Retval)
38 }
39
40 func (c *serviceClient) Nat66AddDelStaticMapping(ctx context.Context, in *Nat66AddDelStaticMapping) (*Nat66AddDelStaticMappingReply, error) {
41         out := new(Nat66AddDelStaticMappingReply)
42         err := c.conn.Invoke(ctx, in, out)
43         if err != nil {
44                 return nil, err
45         }
46         return out, api.RetvalToVPPApiError(out.Retval)
47 }
48
49 func (c *serviceClient) Nat66InterfaceDump(ctx context.Context, in *Nat66InterfaceDump) (RPCService_Nat66InterfaceDumpClient, error) {
50         stream, err := c.conn.NewStream(ctx)
51         if err != nil {
52                 return nil, err
53         }
54         x := &serviceClient_Nat66InterfaceDumpClient{stream}
55         if err := x.Stream.SendMsg(in); err != nil {
56                 return nil, err
57         }
58         if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
59                 return nil, err
60         }
61         return x, nil
62 }
63
64 type RPCService_Nat66InterfaceDumpClient interface {
65         Recv() (*Nat66InterfaceDetails, error)
66         api.Stream
67 }
68
69 type serviceClient_Nat66InterfaceDumpClient struct {
70         api.Stream
71 }
72
73 func (c *serviceClient_Nat66InterfaceDumpClient) Recv() (*Nat66InterfaceDetails, error) {
74         msg, err := c.Stream.RecvMsg()
75         if err != nil {
76                 return nil, err
77         }
78         switch m := msg.(type) {
79         case *Nat66InterfaceDetails:
80                 return m, nil
81         case *memclnt.ControlPingReply:
82                 err = c.Stream.Close()
83                 if err != nil {
84                         return nil, err
85                 }
86                 return nil, io.EOF
87         default:
88                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
89         }
90 }
91
92 func (c *serviceClient) Nat66PluginEnableDisable(ctx context.Context, in *Nat66PluginEnableDisable) (*Nat66PluginEnableDisableReply, error) {
93         out := new(Nat66PluginEnableDisableReply)
94         err := c.conn.Invoke(ctx, in, out)
95         if err != nil {
96                 return nil, err
97         }
98         return out, api.RetvalToVPPApiError(out.Retval)
99 }
100
101 func (c *serviceClient) Nat66StaticMappingDump(ctx context.Context, in *Nat66StaticMappingDump) (RPCService_Nat66StaticMappingDumpClient, error) {
102         stream, err := c.conn.NewStream(ctx)
103         if err != nil {
104                 return nil, err
105         }
106         x := &serviceClient_Nat66StaticMappingDumpClient{stream}
107         if err := x.Stream.SendMsg(in); err != nil {
108                 return nil, err
109         }
110         if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
111                 return nil, err
112         }
113         return x, nil
114 }
115
116 type RPCService_Nat66StaticMappingDumpClient interface {
117         Recv() (*Nat66StaticMappingDetails, error)
118         api.Stream
119 }
120
121 type serviceClient_Nat66StaticMappingDumpClient struct {
122         api.Stream
123 }
124
125 func (c *serviceClient_Nat66StaticMappingDumpClient) Recv() (*Nat66StaticMappingDetails, error) {
126         msg, err := c.Stream.RecvMsg()
127         if err != nil {
128                 return nil, err
129         }
130         switch m := msg.(type) {
131         case *Nat66StaticMappingDetails:
132                 return m, nil
133         case *memclnt.ControlPingReply:
134                 err = c.Stream.Close()
135                 if err != nil {
136                         return nil, err
137                 }
138                 return nil, io.EOF
139         default:
140                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
141         }
142 }