diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-08-25 10:59:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-08-25 10:59:00 +0000 |
commit | 9cbff87bf9b68c08242b1a6a79221311dc157fc0 (patch) | |
tree | 6dacb93610d32de7f16e71765874fe2fb6e3a704 /src/include | |
parent | 3d0444f9e6d64d6bc6b109cb743b9e08abcada0e (diff) | |
download | gnunet-9cbff87bf9b68c08242b1a6a79221311dc157fc0.tar.gz gnunet-9cbff87bf9b68c08242b1a6a79221311dc157fc0.zip |
hxing
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_bio_lib.h | 26 | ||||
-rw-r--r-- | src/include/gnunet_fs_service.h | 36 |
2 files changed, 50 insertions, 12 deletions
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h index 02b04570e..2765b4695 100644 --- a/src/include/gnunet_bio_lib.h +++ b/src/include/gnunet_bio_lib.h | |||
@@ -71,12 +71,12 @@ int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | |||
71 | * @param what describes what is being read (for error message creation) | 71 | * @param what describes what is being read (for error message creation) |
72 | * @param result the buffer to write the result to | 72 | * @param result the buffer to write the result to |
73 | * @param len the number of bytes to read | 73 | * @param len the number of bytes to read |
74 | * @return len on success, GNUNET_SYSERR on failure | 74 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
75 | */ | 75 | */ |
76 | ssize_t GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | 76 | int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, |
77 | const char *what, | 77 | const char *what, |
78 | void *result, | 78 | void *result, |
79 | size_t len); | 79 | size_t len); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Read 0-terminated string from a file. | 82 | * Read 0-terminated string from a file. |
@@ -85,11 +85,13 @@ ssize_t GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
85 | * @param what describes what is being read (for error message creation) | 85 | * @param what describes what is being read (for error message creation) |
86 | * @param result the buffer to store a pointer to the (allocated) string to | 86 | * @param result the buffer to store a pointer to the (allocated) string to |
87 | * (note that *result could be set to NULL as well) | 87 | * (note that *result could be set to NULL as well) |
88 | * @param maxLen maximum allowed length for the string | ||
88 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 89 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
89 | */ | 90 | */ |
90 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | 91 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, |
91 | const char *what, | 92 | const char *what, |
92 | char **result); | 93 | char **result, |
94 | size_t maxLen); | ||
93 | 95 | ||
94 | 96 | ||
95 | /** | 97 | /** |
@@ -198,9 +200,9 @@ int GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h); | |||
198 | * @param n number of bytes to write | 200 | * @param n number of bytes to write |
199 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 201 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
200 | */ | 202 | */ |
201 | ssize_t GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | 203 | int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, |
202 | const void *buffer, | 204 | const void *buffer, |
203 | size_t n); | 205 | size_t n); |
204 | 206 | ||
205 | 207 | ||
206 | /** | 208 | /** |
@@ -244,7 +246,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
244 | * @param h hande to open file | 246 | * @param h hande to open file |
245 | * @param f double to write (must be a variable) | 247 | * @param f double to write (must be a variable) |
246 | */ | 248 | */ |
247 | #define GNUNET_BIO_write_float(h, f) (sizeof(double) == GNUNET_BIO_write (h, &f, sizeof(double))) | 249 | #define GNUNET_BIO_write_double(h, f) (sizeof(double) == GNUNET_BIO_write (h, &f, sizeof(double))) |
248 | 250 | ||
249 | 251 | ||
250 | /** | 252 | /** |
@@ -254,7 +256,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
254 | * @param i address of 32-bit integer to write | 256 | * @param i address of 32-bit integer to write |
255 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 257 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
256 | */ | 258 | */ |
257 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_ReadHandle *h, | 259 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, |
258 | int32_t i); | 260 | int32_t i); |
259 | 261 | ||
260 | 262 | ||
@@ -265,7 +267,7 @@ int GNUNET_BIO_write_int32 (struct GNUNET_BIO_ReadHandle *h, | |||
265 | * @param i address of 64-bit integer to write | 267 | * @param i address of 64-bit integer to write |
266 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 268 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
267 | */ | 269 | */ |
268 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_ReadHandle *h, | 270 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, |
269 | int64_t i); | 271 | int64_t i); |
270 | 272 | ||
271 | 273 | ||
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 45cd1e77e..7c6fc0549 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -1415,6 +1415,42 @@ typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls, | |||
1415 | 1415 | ||
1416 | 1416 | ||
1417 | /** | 1417 | /** |
1418 | * Recover file information structure from disk. | ||
1419 | * | ||
1420 | * @param name filename for the structure on disk | ||
1421 | * @return NULL on error | ||
1422 | */ | ||
1423 | struct GNUNET_FS_FileInformation * | ||
1424 | GNUNET_FS_file_information_recover (const char *name); | ||
1425 | |||
1426 | |||
1427 | /** | ||
1428 | * Obtain the name under which this file information | ||
1429 | * structure is stored on disk. Only works for top-level | ||
1430 | * file information structures. | ||
1431 | * | ||
1432 | * @param s structure to get the filename for | ||
1433 | * @return NULL on error, otherwise filename that | ||
1434 | * can be passed to "GNUNET_FS_file_information_recover" | ||
1435 | * to read this fi-struct from disk. | ||
1436 | */ | ||
1437 | const char * | ||
1438 | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | ||
1439 | |||
1440 | |||
1441 | /** | ||
1442 | * Synchronize this file-information struct with its mirror | ||
1443 | * on disk. Note that all internal FS-operations that change | ||
1444 | * file information data should already call "sync" internally, | ||
1445 | * so this function is likely not useful for clients. | ||
1446 | * | ||
1447 | * @param s the struct to sync | ||
1448 | */ | ||
1449 | void | ||
1450 | GNUNET_FS_file_information_sync (struct GNUNET_FS_FileInformation *s); | ||
1451 | |||
1452 | |||
1453 | /** | ||
1418 | * Create an entry for a file in a publish-structure. | 1454 | * Create an entry for a file in a publish-structure. |
1419 | * | 1455 | * |
1420 | * @param filename name of the file or directory to publish | 1456 | * @param filename name of the file or directory to publish |