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