Commit | Line | Data |
---|---|---|
84004dbf RS |
1 | /* |
2 | Copyright (C) 2010 by Ronnie Sahlberg <ronniesahlberg@gmail.com> | |
3 | ||
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU Lesser General Public License as published by | |
6 | the Free Software Foundation; either version 2.1 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public License | |
15 | along with this program; if not, see <http://www.gnu.org/licenses/>. | |
16 | */ | |
17 | /* | |
18 | * This is the lowlevel interface to access NFS resources. | |
19 | * Through this interface you have access to the full gamut of nfs and nfs related | |
20 | * protocol as well as the XDR encoded/decoded structures. | |
21 | */ | |
22 | #include <stdint.h> | |
8704724f RS |
23 | #include <rpc/rpc.h> |
24 | #include <rpc/auth.h> | |
84004dbf RS |
25 | |
26 | struct rpc_data { | |
27 | int size; | |
28 | unsigned char *data; | |
29 | }; | |
30 | ||
31 | struct rpc_context; | |
32 | struct rpc_context *rpc_init_context(void); | |
33 | void rpc_destroy_context(struct rpc_context *rpc); | |
34 | ||
8704724f | 35 | void rpc_set_auth(struct rpc_context *rpc, AUTH *auth); |
84004dbf RS |
36 | |
37 | int rpc_get_fd(struct rpc_context *rpc); | |
38 | int rpc_which_events(struct rpc_context *rpc); | |
39 | int rpc_service(struct rpc_context *rpc, int revents); | |
40 | char *rpc_get_error(struct rpc_context *rpc); | |
83aa785d | 41 | int rpc_queue_length(struct rpc_context *rpc); |
84004dbf | 42 | |
fa3c25be RS |
43 | /* Utility function to get an RPC context from a NFS context. Useful for doing low level NFSACL |
44 | * calls on a NFS context. | |
45 | */ | |
46 | struct rpc_context *nfs_get_rpc_context(struct nfs_context *nfs); | |
47 | ||
48 | /* This function returns the nfs_fh3 structure from a nfsfh structure. | |
49 | This allows to use a file onened with nfs_open() together with low-level | |
50 | rpc functions that thake a nfs filehandle | |
51 | */ | |
52 | struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh); | |
84004dbf RS |
53 | |
54 | #define RPC_STATUS_SUCCESS 0 | |
55 | #define RPC_STATUS_ERROR 1 | |
56 | #define RPC_STATUS_CANCEL 2 | |
57 | ||
84004dbf RS |
58 | /* |
59 | * Async connection to the tcp port at server:port. | |
60 | * Function returns | |
61 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
62 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
63 | * | |
64 | * When the callback is invoked, status indicates the result: | |
65 | * RPC_STATUS_SUCCESS : The tcp connection was successfully established. | |
66 | * data is NULL. | |
67 | * RPC_STATUS_ERROR : The connection failed to establish. | |
68 | * data is the erro string. | |
69 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
70 | * : data is NULL. | |
71 | */ | |
72 | int rpc_connect_async(struct rpc_context *rpc, const char *server, int port, rpc_cb cb, void *private_data); | |
73 | /* | |
74 | * When disconnecting a connection in flight. All commands in flight will be called with the callback | |
75 | * and status RPC_STATUS_ERROR. Data will be the error string for the disconnection. | |
76 | */ | |
77 | int rpc_disconnect(struct rpc_context *rpc, char *error); | |
78 | ||
84004dbf RS |
79 | |
80 | /* | |
81 | * PORTMAP FUNCTIONS | |
82 | */ | |
83 | ||
84 | /* | |
85 | * Call PORTMAPPER/NULL | |
86 | * Function returns | |
87 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
88 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
89 | * | |
90 | * When the callback is invoked, status indicates the result: | |
91 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. | |
92 | * data is NULL. | |
93 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. | |
94 | * data is the error string. | |
95 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
96 | * data is NULL. | |
97 | */ | |
98 | int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
99 | ||
100 | ||
101 | /* | |
102 | * Call PORTMAPPER/GETPORT. | |
103 | * Function returns | |
104 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
105 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
106 | * | |
107 | * When the callback is invoked, status indicates the result: | |
108 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. | |
109 | * data is a (uint32_t *), containing the port returned. | |
110 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. | |
111 | * data is the error string. | |
112 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
113 | * data is NULL. | |
114 | */ | |
5c6b1176 | 115 | int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data); |
84004dbf | 116 | |
1fbe4080 RS |
117 | /* |
118 | * Call PORTMAPPER/SET | |
119 | * Function returns | |
120 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
121 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
122 | * | |
123 | * When the callback is invoked, status indicates the result: | |
124 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. | |
125 | * data is a (uint32_t *), containing status | |
126 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. | |
127 | * data is the error string. | |
128 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
129 | * data is NULL. | |
130 | */ | |
131 | int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data); | |
132 | ||
133 | /* | |
134 | * Call PORTMAPPER/UNSET | |
135 | * Function returns | |
136 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
137 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
138 | * | |
139 | * When the callback is invoked, status indicates the result: | |
140 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon. | |
141 | * data is a (uint32_t *), containing status | |
142 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. | |
143 | * data is the error string. | |
144 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
145 | * data is NULL. | |
146 | */ | |
147 | int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data); | |
84004dbf | 148 | |
fd59fd0d RS |
149 | /* |
150 | * Call PORTMAPPER/CALLIT. | |
151 | * Function returns | |
152 | * 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked. | |
153 | * <0 : An error occured when trying to set up the connection. The callback will not be invoked. | |
154 | * | |
155 | * When the callback is invoked, status indicates the result: | |
156 | * RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon | |
157 | * data is a 'pmap_call_result' pointer. | |
158 | * RPC_STATUS_ERROR : An error occured when trying to contact the portmapper. | |
159 | * data is the error string. | |
160 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
161 | * data is NULL. | |
162 | */ | |
163 | int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, const char *data, int datalen, rpc_cb cb, void *private_data); | |
84004dbf RS |
164 | |
165 | /* | |
166 | * MOUNT FUNCTIONS | |
167 | */ | |
168 | char *mountstat3_to_str(int stat); | |
169 | int mountstat3_to_errno(int error); | |
170 | ||
171 | /* | |
172 | * Call MOUNT/NULL | |
173 | * Function returns | |
174 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
175 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
176 | * | |
177 | * When the callback is invoked, status indicates the result: | |
178 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
179 | * data is NULL. | |
180 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. | |
181 | * data is the error string. | |
182 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
183 | * data is NULL. | |
184 | */ | |
185 | int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
186 | ||
187 | /* | |
188 | * Call MOUNT/MNT | |
189 | * Function returns | |
190 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
191 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
192 | * | |
193 | * When the callback is invoked, status indicates the result: | |
194 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
195 | * data is union mountres3. | |
196 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. | |
197 | * data is the error string. | |
198 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
199 | * data is NULL. | |
200 | */ | |
201 | int rpc_mount_mnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); | |
202 | ||
203 | /* | |
204 | * Call MOUNT/DUMP | |
205 | * Function returns | |
206 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
207 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
208 | * | |
209 | * When the callback is invoked, status indicates the result: | |
210 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
211 | * data is a mountlist. | |
212 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. | |
213 | * data is the error string. | |
214 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
215 | * data is NULL. | |
216 | */ | |
217 | int rpc_mount_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
218 | ||
219 | /* | |
220 | * Call MOUNT/UMNT | |
221 | * Function returns | |
222 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
223 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
224 | * | |
225 | * When the callback is invoked, status indicates the result: | |
226 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
227 | * data NULL. | |
228 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. | |
229 | * data is the error string. | |
230 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
231 | * data is NULL. | |
232 | */ | |
233 | int rpc_mount_umnt_async(struct rpc_context *rpc, rpc_cb cb, char *export, void *private_data); | |
234 | ||
235 | /* | |
236 | * Call MOUNT/UMNTALL | |
237 | * Function returns | |
238 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
239 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
240 | * | |
241 | * When the callback is invoked, status indicates the result: | |
242 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
243 | * data NULL. | |
244 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. | |
245 | * data is the error string. | |
246 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
247 | * data is NULL. | |
248 | */ | |
249 | int rpc_mount_umntall_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
250 | ||
251 | /* | |
252 | * Call MOUNT/EXPORT | |
7f0242ca RS |
253 | * NOTE: You must include 'libnfs-raw-mount.h' to get the definitions of the |
254 | * returned structures. | |
255 | * | |
84004dbf RS |
256 | * Function returns |
257 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
258 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
259 | * | |
260 | * When the callback is invoked, status indicates the result: | |
261 | * RPC_STATUS_SUCCESS : We got a successful response from the mount daemon. | |
7f0242ca RS |
262 | * data is a pointer to an exports pointer: |
263 | * exports export = *(exports *)data; | |
84004dbf RS |
264 | * RPC_STATUS_ERROR : An error occured when trying to contact the mount daemon. |
265 | * data is the error string. | |
266 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
267 | * data is NULL. | |
268 | */ | |
269 | int rpc_mount_export_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
270 | ||
271 | ||
272 | ||
273 | ||
274 | /* | |
275 | * NFS FUNCTIONS | |
276 | */ | |
277 | struct nfs_fh3; | |
278 | char *nfsstat3_to_str(int error); | |
279 | int nfsstat3_to_errno(int error); | |
280 | ||
281 | /* | |
282 | * Call NFS/NULL | |
283 | * Function returns | |
284 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
285 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
286 | * | |
287 | * When the callback is invoked, status indicates the result: | |
288 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
289 | * data is NULL. | |
290 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
291 | * data is the error string. | |
292 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
293 | * data is NULL. | |
294 | */ | |
295 | int rpc_nfs_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
296 | ||
297 | /* | |
298 | * Call NFS/GETATTR | |
299 | * Function returns | |
300 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
301 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
302 | * | |
303 | * When the callback is invoked, status indicates the result: | |
304 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
305 | * data is GETATTR3res | |
306 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
307 | * data is the error string. | |
308 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
309 | * data is NULL. | |
310 | */ | |
311 | int rpc_nfs_getattr_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); | |
312 | ||
313 | /* | |
314 | * Call NFS/LOOKUP | |
315 | * Function returns | |
316 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
317 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
318 | * | |
319 | * When the callback is invoked, status indicates the result: | |
320 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
321 | * data is LOOKUP3res | |
322 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
323 | * data is the error string. | |
324 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
325 | * data is NULL. | |
326 | */ | |
327 | int rpc_nfs_lookup_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data); | |
328 | ||
329 | /* | |
330 | * Call NFS/ACCESS | |
331 | * Function returns | |
332 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
333 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
334 | * | |
335 | * When the callback is invoked, status indicates the result: | |
336 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
337 | * data is ACCESS3res | |
338 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
339 | * data is the error string. | |
340 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
341 | * data is NULL. | |
342 | */ | |
343 | int rpc_nfs_access_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, int access, void *private_data); | |
344 | ||
345 | /* | |
346 | * Call NFS/READ | |
347 | * Function returns | |
348 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
349 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
350 | * | |
351 | * When the callback is invoked, status indicates the result: | |
352 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
b426ef04 | 353 | * data is READ3res |
84004dbf RS |
354 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
355 | * data is the error string. | |
356 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
357 | * data is NULL. | |
358 | */ | |
183451cf | 359 | int rpc_nfs_read_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t offset, uint64_t count, void *private_data); |
84004dbf RS |
360 | |
361 | /* | |
362 | * Call NFS/WRITE | |
363 | * Function returns | |
364 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
365 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
366 | * | |
367 | * When the callback is invoked, status indicates the result: | |
368 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
369 | * data is WRITE3res * | |
370 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
371 | * data is the error string. | |
372 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
373 | * data is NULL. | |
374 | */ | |
183451cf | 375 | int rpc_nfs_write_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *buf, uint64_t offset, uint64_t count, int stable_how, void *private_data); |
84004dbf RS |
376 | |
377 | /* | |
378 | * Call NFS/COMMIT | |
379 | * Function returns | |
380 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
381 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
382 | * | |
383 | * When the callback is invoked, status indicates the result: | |
384 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
385 | * data is COMMIT3res * | |
386 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
387 | * data is the error string. | |
388 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
389 | * data is NULL. | |
390 | */ | |
391 | int rpc_nfs_commit_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); | |
392 | ||
393 | ||
394 | /* | |
395 | * Call NFS/SETATTR | |
396 | * Function returns | |
397 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
398 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
399 | * | |
400 | * When the callback is invoked, status indicates the result: | |
401 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
402 | * data is SETATTR3res * | |
403 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
404 | * data is the error string. | |
405 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
406 | * data is NULL. | |
407 | */ | |
408 | struct SETATTR3args; | |
409 | int rpc_nfs_setattr_async(struct rpc_context *rpc, rpc_cb cb, struct SETATTR3args *args, void *private_data); | |
410 | ||
411 | ||
412 | ||
413 | /* | |
414 | * Call NFS/MKDIR | |
415 | * Function returns | |
416 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
417 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
418 | * | |
419 | * When the callback is invoked, status indicates the result: | |
420 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
421 | * data is MKDIR3res * | |
422 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
423 | * data is the error string. | |
424 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
425 | * data is NULL. | |
426 | */ | |
7edc9026 RS |
427 | struct MKDIR3args; |
428 | int rpc_nfs_mkdir_async(struct rpc_context *rpc, rpc_cb cb, struct MKDIR3args *args, void *private_data); | |
84004dbf RS |
429 | |
430 | ||
431 | ||
432 | ||
433 | ||
434 | /* | |
435 | * Call NFS/RMDIR | |
436 | * Function returns | |
437 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
438 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
439 | * | |
440 | * When the callback is invoked, status indicates the result: | |
441 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
442 | * data is RMDIR3res * | |
443 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
444 | * data is the error string. | |
445 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
446 | * data is NULL. | |
447 | */ | |
448 | int rpc_nfs_rmdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *dir, void *private_data); | |
449 | ||
450 | ||
451 | ||
452 | ||
453 | /* | |
454 | * Call NFS/CREATE | |
455 | * Function returns | |
456 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
457 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
458 | * | |
459 | * When the callback is invoked, status indicates the result: | |
460 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
461 | * data is CREATE3res * | |
462 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
463 | * data is the error string. | |
464 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
465 | * data is NULL. | |
466 | */ | |
c985c015 RS |
467 | struct CREATE3args; |
468 | int rpc_nfs_create_async(struct rpc_context *rpc, rpc_cb cb, struct CREATE3args *args, void *private_data); | |
84004dbf RS |
469 | |
470 | ||
1ec6b50a RS |
471 | /* |
472 | * Call NFS/MKNOD | |
473 | * Function returns | |
474 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
475 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
476 | * | |
477 | * When the callback is invoked, status indicates the result: | |
478 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
479 | * data is MKNOD3res * | |
480 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
481 | * data is the error string. | |
482 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
483 | * data is NULL. | |
484 | */ | |
485 | int rpc_nfs_mknod_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *file, int mode, int major, int minor, void *private_data); | |
84004dbf RS |
486 | |
487 | ||
488 | /* | |
489 | * Call NFS/REMOVE | |
490 | * Function returns | |
491 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
492 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
493 | * | |
494 | * When the callback is invoked, status indicates the result: | |
495 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
496 | * data is REMOVE3res * | |
497 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
498 | * data is the error string. | |
499 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
500 | * data is NULL. | |
501 | */ | |
502 | int rpc_nfs_remove_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, char *name, void *private_data); | |
503 | ||
504 | ||
505 | ||
506 | /* | |
f390f181 | 507 | * Call NFS/READDIR |
84004dbf RS |
508 | * Function returns |
509 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
510 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
511 | * | |
512 | * When the callback is invoked, status indicates the result: | |
513 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
514 | * data is READDIR3res * | |
515 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
516 | * data is the error string. | |
517 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
518 | * data is NULL. | |
519 | */ | |
520 | int rpc_nfs_readdir_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data); | |
521 | ||
f390f181 RS |
522 | /* |
523 | * Call NFS/READDIRPLUS | |
524 | * Function returns | |
525 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
526 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
527 | * | |
528 | * When the callback is invoked, status indicates the result: | |
529 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
530 | * data is READDIRPLUS3res * | |
531 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
532 | * data is the error string. | |
533 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
534 | * data is NULL. | |
535 | */ | |
536 | int rpc_nfs_readdirplus_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, uint64_t cookie, char *cookieverf, int count, void *private_data); | |
537 | ||
84004dbf RS |
538 | /* |
539 | * Call NFS/FSSTAT | |
540 | * Function returns | |
541 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
542 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
543 | * | |
544 | * When the callback is invoked, status indicates the result: | |
545 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
546 | * data is FSSTAT3res | |
547 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
548 | * data is the error string. | |
549 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
550 | * data is NULL. | |
551 | */ | |
552 | int rpc_nfs_fsstat_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); | |
553 | ||
554 | ||
555 | ||
1058201e RS |
556 | /* |
557 | * Call NFS/FSINFO | |
558 | * Function returns | |
559 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
560 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
561 | * | |
562 | * When the callback is invoked, status indicates the result: | |
563 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
564 | * data is FSINFO3res | |
565 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
566 | * data is the error string. | |
567 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
568 | * data is NULL. | |
569 | */ | |
570 | int rpc_nfs_fsinfo_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *fh, void *private_data); | |
571 | ||
572 | ||
84004dbf RS |
573 | |
574 | /* | |
575 | * Call NFS/READLINK | |
576 | * Function returns | |
577 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
578 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
579 | * | |
580 | * When the callback is invoked, status indicates the result: | |
581 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
582 | * data is READLINK3res * | |
583 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
584 | * data is the error string. | |
585 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
586 | * data is NULL. | |
587 | */ | |
16104b27 RS |
588 | struct READLINK3args; |
589 | int rpc_nfs_readlink_async(struct rpc_context *rpc, rpc_cb cb, struct READLINK3args *args, void *private_data); | |
84004dbf RS |
590 | |
591 | ||
592 | ||
593 | /* | |
594 | * Call NFS/SYMLINK | |
595 | * Function returns | |
596 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
597 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
598 | * | |
599 | * When the callback is invoked, status indicates the result: | |
600 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
601 | * data is SYMLINK3res * | |
602 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
603 | * data is the error string. | |
604 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
605 | * data is NULL. | |
606 | */ | |
8e255816 RS |
607 | struct SYMLINK3args; |
608 | int rpc_nfs_symlink_async(struct rpc_context *rpc, rpc_cb cb, struct SYMLINK3args *args, void *private_data); | |
84004dbf RS |
609 | |
610 | ||
611 | /* | |
612 | * Call NFS/RENAME | |
613 | * Function returns | |
614 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
615 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
616 | * | |
617 | * When the callback is invoked, status indicates the result: | |
618 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
619 | * data is RENAME3res * | |
620 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
621 | * data is the error string. | |
622 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
623 | * data is NULL. | |
624 | */ | |
625 | int rpc_nfs_rename_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *olddir, char *oldname, struct nfs_fh3 *newdir, char *newname, void *private_data); | |
626 | ||
627 | ||
628 | ||
629 | /* | |
630 | * Call NFS/LINK | |
631 | * Function returns | |
632 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
633 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
634 | * | |
635 | * When the callback is invoked, status indicates the result: | |
636 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
637 | * data is LINK3res * | |
638 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
639 | * data is the error string. | |
640 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
641 | * data is NULL. | |
642 | */ | |
643 | int rpc_nfs_link_async(struct rpc_context *rpc, rpc_cb cb, struct nfs_fh3 *file, struct nfs_fh3 *newdir, char *newname, void *private_data); | |
644 | ||
645 | ||
646 | ||
05a777d9 RS |
647 | |
648 | /* | |
649 | * RQUOTA FUNCTIONS | |
650 | */ | |
651 | char *rquotastat_to_str(int error); | |
652 | int rquotastat_to_errno(int error); | |
653 | ||
654 | /* | |
655 | * Call RQUOTA1/NULL | |
656 | * Function returns | |
657 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
658 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
659 | * | |
660 | * When the callback is invoked, status indicates the result: | |
661 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
662 | * data is NULL. | |
663 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
664 | * data is the error string. | |
665 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
666 | * data is NULL. | |
667 | */ | |
668 | int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
669 | ||
670 | /* | |
671 | * Call RQUOTA1/GETQUOTA | |
672 | * Function returns | |
673 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
674 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
675 | * | |
676 | * When the callback is invoked, status indicates the result: | |
677 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
678 | * data is a RQUOTA1res structure. | |
679 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
680 | * data is the error string. | |
681 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
682 | * data is NULL. | |
683 | */ | |
684 | int rpc_rquota1_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); | |
19e74f5a RS |
685 | |
686 | /* | |
687 | * Call RQUOTA1/GETACTIVEQUOTA | |
688 | * Function returns | |
689 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
690 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
691 | * | |
692 | * When the callback is invoked, status indicates the result: | |
693 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
694 | * data is a RQUOTA1res structure. | |
695 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
696 | * data is the error string. | |
697 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
698 | * data is NULL. | |
699 | */ | |
700 | int rpc_rquota1_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int uid, void *private_data); | |
77c23b46 RS |
701 | |
702 | ||
703 | ||
704 | ||
705 | /* | |
706 | * Call RQUOTA2/NULL | |
707 | * Function returns | |
708 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
709 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
710 | * | |
711 | * When the callback is invoked, status indicates the result: | |
712 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
713 | * data is NULL. | |
714 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
715 | * data is the error string. | |
716 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
717 | * data is NULL. | |
718 | */ | |
719 | int rpc_rquota2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
720 | ||
721 | /* | |
722 | * Call RQUOTA2/GETQUOTA | |
723 | * Function returns | |
724 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
725 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
726 | * | |
727 | * When the callback is invoked, status indicates the result: | |
728 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
729 | * data is a RQUOTA1res structure. | |
730 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
731 | * data is the error string. | |
732 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
733 | * data is NULL. | |
734 | */ | |
735 | int rpc_rquota2_getquota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); | |
736 | ||
737 | /* | |
738 | * Call RQUOTA2/GETACTIVEQUOTA | |
739 | * Function returns | |
740 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
741 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
742 | * | |
743 | * When the callback is invoked, status indicates the result: | |
744 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
745 | * data is a RQUOTA1res structure. | |
746 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
747 | * data is the error string. | |
748 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
749 | * data is NULL. | |
750 | */ | |
751 | int rpc_rquota2_getactivequota_async(struct rpc_context *rpc, rpc_cb cb, char *export, int type, int uid, void *private_data); | |
3847f8f6 RS |
752 | |
753 | ||
754 | ||
6916a665 RS |
755 | |
756 | ||
757 | ||
758 | /* | |
759 | * NFSACL functions | |
760 | */ | |
761 | ||
3847f8f6 RS |
762 | /* |
763 | * Call NFSACL/NULL | |
764 | * Call the NULL procedure for the NFSACL | |
765 | * | |
766 | * Function returns | |
767 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
768 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
769 | * | |
770 | * When the callback is invoked, status indicates the result: | |
771 | * RPC_STATUS_SUCCESS : We got a successful response from the rquota daemon. | |
772 | * data is NULL | |
773 | * RPC_STATUS_ERROR : An error occured when trying to contact the rquota daemon. | |
774 | * data is the error string. | |
775 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
776 | * data is NULL. | |
777 | */ | |
778 | int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); | |
779 | ||
780 | /* | |
781 | * Call NFSACL/GETACL | |
782 | * | |
783 | * Function returns | |
784 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
785 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
786 | * | |
787 | * When the callback is invoked, status indicates the result: | |
fa3c25be | 788 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. |
3847f8f6 | 789 | * data is a GETACL3res pointer |
fa3c25be | 790 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. |
3847f8f6 RS |
791 | * data is the error string. |
792 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
793 | * data is NULL. | |
794 | */ | |
0118a5f0 RS |
795 | struct GETACL3args; |
796 | int rpc_nfsacl_getacl_async(struct rpc_context *rpc, rpc_cb cb, struct GETACL3args *args, void *private_data); | |
3847f8f6 | 797 | |
fa3c25be RS |
798 | |
799 | ||
800 | /* | |
801 | * Call NFSACL/SETACL | |
802 | * | |
803 | * Function returns | |
804 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
805 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
806 | * | |
807 | * When the callback is invoked, status indicates the result: | |
808 | * RPC_STATUS_SUCCESS : We got a successful response from the nfs daemon. | |
809 | * data is a SETACL3res pointer | |
810 | * RPC_STATUS_ERROR : An error occured when trying to contact the nfs daemon. | |
811 | * data is the error string. | |
812 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
813 | * data is NULL. | |
814 | */ | |
815 | struct SETACL3args; | |
816 | int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3args *args, void *private_data); | |
6916a665 RS |
817 | |
818 | ||
819 | ||
820 | ||
821 | /* | |
822 | * NLM functions | |
823 | */ | |
824 | char *nlmstat4_to_str(int stat); | |
825 | ||
826 | /* | |
827 | * Call NLM/NULL | |
828 | * Call the NULL procedure for the NLM protocol | |
829 | * | |
830 | * Function returns | |
831 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
832 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
833 | * | |
834 | * When the callback is invoked, status indicates the result: | |
835 | * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon. | |
836 | * data is NULL | |
837 | * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon. | |
838 | * data is the error string. | |
839 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
840 | * data is NULL. | |
841 | */ | |
e01ed6a2 RS |
842 | int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data); |
843 | ||
844 | /* | |
845 | * Call NLM/TEST | |
846 | * Call the TEST procedure for the NLM protocol | |
847 | * | |
848 | * Function returns | |
849 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
850 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
851 | * | |
852 | * When the callback is invoked, status indicates the result: | |
853 | * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon. | |
854 | * data is NLM4_TESTres | |
855 | * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon. | |
856 | * data is the error string. | |
857 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
858 | * data is NULL. | |
859 | */ | |
860 | struct NLM4_TESTargs; | |
861 | int rpc_nlm4_test_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_TESTargs *args, void *private_data); | |
862 | ||
a171d4da RS |
863 | /* |
864 | * Call NLM/LOCK | |
865 | * Call the LOCK procedure for the NLM protocol | |
866 | * | |
867 | * Function returns | |
868 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
869 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
870 | * | |
871 | * When the callback is invoked, status indicates the result: | |
872 | * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon. | |
873 | * data is NLM4_LOCKres | |
874 | * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon. | |
875 | * data is the error string. | |
876 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
877 | * data is NULL. | |
878 | */ | |
879 | struct NLM4_LOCKargs; | |
880 | int rpc_nlm4_lock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_LOCKargs *args, void *private_data); | |
881 | ||
882 | /* | |
883 | * Call NLM/CANCEL | |
884 | * Call the CANCEL procedure for the NLM protocol | |
885 | * | |
886 | * Function returns | |
887 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
888 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
889 | * | |
890 | * When the callback is invoked, status indicates the result: | |
891 | * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon. | |
892 | * data is NLM4_CANCres | |
893 | * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon. | |
894 | * data is the error string. | |
895 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
896 | * data is NULL. | |
897 | */ | |
898 | struct NLM4_CANCargs; | |
899 | int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCargs *args, void *private_data); | |
900 | ||
901 | /* | |
902 | * Call NLM/UNLOCK | |
903 | * Call the UNLOCK procedure for the NLM protocol | |
904 | * | |
905 | * Function returns | |
906 | * 0 : The call was initiated. The callback will be invoked when the call completes. | |
907 | * <0 : An error occured when trying to set up the call. The callback will not be invoked. | |
908 | * | |
909 | * When the callback is invoked, status indicates the result: | |
910 | * RPC_STATUS_SUCCESS : We got a successful response from the nlm daemon. | |
911 | * data is NLM4_UNLOCKres | |
912 | * RPC_STATUS_ERROR : An error occured when trying to contact the nlm daemon. | |
913 | * data is the error string. | |
914 | * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete. | |
915 | * data is NULL. | |
916 | */ | |
917 | struct NLM4_UNLOCKargs; | |
918 | int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCKargs *args, void *private_data); |