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