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