Buffered binary disk IO (with endianness conversion) More...
Data Structures | |
struct | GNUNET_BIO_ReadSpec |
Structure specifying a reading operation on an IO handle. More... | |
struct | GNUNET_BIO_WriteSpec |
Structure specifying a writing operation on an IO handle. More... | |
Macros | |
#define | GNUNET_BIO_LIB_H |
#define | GNUNET_BIO_read_spec_end() { NULL, NULL, NULL, NULL, 0 } |
End of specifications marker. More... | |
#define | GNUNET_BIO_write_spec_end() { NULL, NULL, NULL, NULL, 0 } |
End of specifications marker. More... | |
Typedefs | |
typedef int(* | GNUNET_BIO_ReadHandler) (void *cls, struct GNUNET_BIO_ReadHandle *h, const char *what, void *target, size_t target_size) |
Function used to deserialize data read from h and store it into target. More... | |
typedef int(* | GNUNET_BIO_WriteHandler) (void *cls, struct GNUNET_BIO_WriteHandle *h, const char *what, void *source, size_t source_size) |
Function used to serialize data from a buffer and write it to h. More... | |
Functions | |
struct GNUNET_BIO_ReadHandle * | GNUNET_BIO_read_open_file (const char *fn) |
Open a file for reading. More... | |
struct GNUNET_BIO_ReadHandle * | GNUNET_BIO_read_open_buffer (void *buffer, size_t size) |
Create a handle from an existing allocated buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg) |
Close an open handle. More... | |
void | GNUNET_BIO_read_set_error (struct GNUNET_BIO_ReadHandle *h, const char *emsg) |
Set read error to handle. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what, void *result, size_t len) |
Read some contents into a buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what, char **result, size_t max_length) |
Read 0-terminated string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_float (struct GNUNET_BIO_ReadHandle *h, const char *what, float *f) |
Read a float. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_double (struct GNUNET_BIO_ReadHandle *h, const char *what, double *f) |
Read a double. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_int32 (struct GNUNET_BIO_ReadHandle *h, const char *what, int32_t *i) |
Read an (u)int32_t. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_int64 (struct GNUNET_BIO_ReadHandle *h, const char *what, int64_t *i) |
Read an (u)int64_t. More... | |
struct GNUNET_BIO_WriteHandle * | GNUNET_BIO_write_open_file (const char *fn) |
Open a file for writing. More... | |
struct GNUNET_BIO_WriteHandle * | GNUNET_BIO_write_open_buffer (void) |
Create a handle backed by an in-memory buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h) |
Force a file-based buffered writer to flush its buffer. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_get_buffer_contents (struct GNUNET_BIO_WriteHandle *h, char **emsg, void **contents, size_t *size) |
Get the IO handle's contents. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h, char **emsg) |
Close an IO handle. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const char *what, const void *buffer, size_t n) |
Write a buffer to a handle. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *what, const char *s) |
Write a 0-terminated string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_float (struct GNUNET_BIO_WriteHandle *h, const char *what, float f) |
Write a float. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_double (struct GNUNET_BIO_WriteHandle *h, const char *what, double f) |
Write a double. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, const char *what, int32_t i) |
Write an (u)int32_t. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, const char *what, int64_t i) |
Write an (u)int64_t. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_object (const char *what, void *result, size_t size) |
Create the specification to read a certain amount of bytes. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_string (const char *what, char **result, size_t max_length) |
Create the specification to read a 0-terminated string. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_int32 (const char *what, int32_t *i) |
Create the specification to read an (u)int32_t. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_int64 (const char *what, int64_t *i) |
Create the specification to read an (u)int64_t. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_float (const char *what, float *f) |
Create the specification to read a float. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_BIO_read_spec_double (const char *what, double *f) |
Create the specification to read a double. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_read_spec_commit (struct GNUNET_BIO_ReadHandle *h, struct GNUNET_BIO_ReadSpec *rs) |
Execute the read specifications in order. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_object (const char *what, void *source, size_t size) |
Create the specification to read some bytes. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_string (const char *what, const char *s) |
Create the specification to write a 0-terminated string. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_int32 (const char *what, int32_t *i) |
Create the specification to write an (u)int32_t. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_int64 (const char *what, int64_t *i) |
Create the specification to write an (u)int64_t. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_float (const char *what, float *f) |
Create the specification to write a float. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_BIO_write_spec_double (const char *what, double *f) |
Create the specification to write an double. More... | |
enum GNUNET_GenericReturnValue | GNUNET_BIO_write_spec_commit (struct GNUNET_BIO_WriteHandle *h, struct GNUNET_BIO_WriteSpec *ws) |
Execute the write specifications in order. More... | |
Buffered binary disk IO (with endianness conversion)
#define GNUNET_BIO_LIB_H |
Definition at line 42 of file gnunet_bio_lib.h.
#define GNUNET_BIO_read_spec_end | ( | ) | { NULL, NULL, NULL, NULL, 0 } |
End of specifications marker.
Definition at line 407 of file gnunet_bio_lib.h.
#define GNUNET_BIO_write_spec_end | ( | ) | { NULL, NULL, NULL, NULL, 0 } |
End of specifications marker.
Definition at line 555 of file gnunet_bio_lib.h.
typedef int(* GNUNET_BIO_ReadHandler) (void *cls, struct GNUNET_BIO_ReadHandle *h, const char *what, void *target, size_t target_size) |
Function used to deserialize data read from h and store it into target.
cls | closure (can be NULL) |
h | the IO handle to read from |
what | what is being read (for error message creation) |
target | where to store the data |
target_size | how many bytes can be written in target can be 0 if the size is unknown or is not fixed |
Definition at line 363 of file gnunet_bio_lib.h.
typedef int(* GNUNET_BIO_WriteHandler) (void *cls, struct GNUNET_BIO_WriteHandle *h, const char *what, void *source, size_t source_size) |
Function used to serialize data from a buffer and write it to h.
cls | closure (can be NULL) |
h | the IO handle to write to |
what | what is being written (for error message creation) |
source | the data to write |
source_size | how many bytes should be written |
Definition at line 511 of file gnunet_bio_lib.h.
struct GNUNET_BIO_ReadHandle * GNUNET_BIO_read_open_file | ( | const char * | fn | ) |
Open a file for reading.
fn | file name to be opened |
Definition at line 114 of file bio.c.
References BIO_BUFFER_SIZE, GNUNET_DISK_FileHandle::fd, GNUNET_BIO_ReadHandle::fd, GNUNET_DISK_file_open(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_malloc, h, and IO_FILE.
Referenced by deserialize_download_file(), deserialize_publish_file(), deserialize_search_file(), deserialize_search_result(), deserialize_subdownload(), deserialize_unindex_file(), get_read_handle(), load(), load_hostlist_file(), load_state(), read_index_list(), and read_update_information_graph().
struct GNUNET_BIO_ReadHandle * GNUNET_BIO_read_open_buffer | ( | void * | buffer, |
size_t | size | ||
) |
Create a handle from an existing allocated buffer.
buffer | the buffer to use as source |
size | the total size in bytes of the buffer |
Definition at line 139 of file bio.c.
References GNUNET_BIO_ReadHandle::buffer, GNUNET_new, h, IO_BUFFER, and size.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_close | ( | struct GNUNET_BIO_ReadHandle * | h, |
char ** | emsg | ||
) |
Close an open handle.
Reports if any errors reading from the file were encountered.
h | file handle |
emsg | set to the error message |
Reports if any errors reading from the file were encountered.
h | file handle |
emsg | set to the (allocated) error message if the handle has an error message, the return value is GNUNET_SYSERR |
Definition at line 162 of file bio.c.
References GNUNET_BIO_ReadHandle::emsg, GNUNET_DISK_file_close(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, h, IO_BUFFER, and IO_FILE.
Referenced by deserialize_download_file(), deserialize_file_information(), deserialize_publish_file(), deserialize_search_file(), deserialize_search_result(), deserialize_subdownload(), deserialize_unindex_file(), load(), load_hostlist_file(), load_state(), read_index_list(), and read_update_information_graph().
void GNUNET_BIO_read_set_error | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | emsg | ||
) |
Set read error to handle.
h | the handle |
emsg | the message |
Definition at line 187 of file bio.c.
References GNUNET_BIO_ReadHandle::emsg, GNUNET_assert, GNUNET_strdup, and h.
Referenced by GNUNET_FS_read_meta_data().
enum GNUNET_GenericReturnValue GNUNET_BIO_read | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
void * | result, | ||
size_t | len | ||
) |
Read some contents into a buffer.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
result | the buffer to write the result to |
len | the number of bytes to read |
Definition at line 291 of file bio.c.
References _, GNUNET_asprintf(), GNUNET_OK, GNUNET_SYSERR, h, IO_BUFFER, IO_FILE, read_from_buffer(), read_from_file(), and result.
Referenced by deserialize_fi_node(), deserialize_publish_file(), deserialize_search(), deserialize_search_result(), deserialize_unindex_file(), GNUNET_BIO_read_int32(), GNUNET_BIO_read_int64(), GNUNET_BIO_read_string(), GNUNET_FS_read_meta_data(), load(), read_download_request(), read_index_list(), and read_spec_handler_object().
enum GNUNET_GenericReturnValue GNUNET_BIO_read_string | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
char ** | result, | ||
size_t | max_length | ||
) |
Read 0-terminated string.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
result | where to store the pointer to the (allocated) string (note that *result could be set to NULL as well) |
max_length | maximum allowed length for the string |
Definition at line 330 of file bio.c.
References _, GNUNET_asprintf(), GNUNET_BIO_read(), GNUNET_BIO_read_int32(), GNUNET_free, GNUNET_malloc, GNUNET_OK, GNUNET_SYSERR, h, and result.
Referenced by deserialize_download(), deserialize_fi_node(), deserialize_search(), deserialize_search_result(), deserialize_unindex_file(), load_hostlist_file(), read_index_list(), and read_spec_handler_string().
enum GNUNET_GenericReturnValue GNUNET_BIO_read_float | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
float * | f | ||
) |
Read a float.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
f | address of float to read |
Definition at line 392 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_read_int32(), and h.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_double | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
double * | f | ||
) |
Read a double.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
f | address of double to read |
Definition at line 409 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_read_int64(), and h.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_int32 | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
int32_t * | i | ||
) |
Read an (u)int32_t.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
i | where to store the data |
Definition at line 427 of file bio.c.
References GNUNET_BIO_read(), GNUNET_OK, GNUNET_SYSERR, and h.
Referenced by deserialize_download(), deserialize_fi_node(), deserialize_search(), deserialize_search_result(), deserialize_unindex_file(), GNUNET_BIO_read_float(), GNUNET_BIO_read_string(), GNUNET_FS_read_meta_data(), load_state(), read_download_request(), read_spec_handler_int32(), and read_update_information_graph().
enum GNUNET_GenericReturnValue GNUNET_BIO_read_int64 | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
int64_t * | i | ||
) |
Read an (u)int64_t.
h | the IO handle to read from |
what | describes what is being read (for error message creation) |
i | where to store the data |
Definition at line 449 of file bio.c.
References GNUNET_BIO_read(), GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, and h.
Referenced by deserialize_fi_node(), deserialize_unindex_file(), GNUNET_BIO_read_double(), read_spec_handler_int64(), and read_start_time().
struct GNUNET_BIO_WriteHandle * GNUNET_BIO_write_open_file | ( | const char * | fn | ) |
Open a file for writing.
fn | name of the file to be opened |
Definition at line 508 of file bio.c.
References BIO_BUFFER_SIZE, GNUNET_DISK_FileHandle::fd, GNUNET_BIO_WriteHandle::fd, GNUNET_DISK_file_open(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_TRUNCATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_malloc, and h.
Referenced by get_write_handle(), get_write_handle_in_dir(), GNUNET_FS_download_sync_(), run(), save(), save_hostlist_file(), save_state(), write_index_list(), and write_update_information_graph().
struct GNUNET_BIO_WriteHandle * GNUNET_BIO_write_open_buffer | ( | void | ) |
Create a handle backed by an in-memory buffer.
Definition at line 535 of file bio.c.
References GNUNET_malloc, GNUNET_new, h, and IO_BUFFER.
enum GNUNET_GenericReturnValue GNUNET_BIO_flush | ( | struct GNUNET_BIO_WriteHandle * | h | ) |
Force a file-based buffered writer to flush its buffer.
If the handle does not use a file, this function returns GNUNET_OK without doing anything.
h | the IO handle |
Definition at line 607 of file bio.c.
References GNUNET_asprintf(), GNUNET_DISK_file_close(), GNUNET_DISK_file_write(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, h, IO_FILE, and ret.
Referenced by GNUNET_BIO_write_close(), GNUNET_BIO_write_spec_commit(), and write_to_file().
enum GNUNET_GenericReturnValue GNUNET_BIO_get_buffer_contents | ( | struct GNUNET_BIO_WriteHandle * | h, |
char ** | emsg, | ||
void ** | contents, | ||
size_t * | size | ||
) |
Get the IO handle's contents.
If the handle doesn't use an in-memory buffer, this function returns GNUNET_SYSERR.
h | the IO handle |
emsg | set to the (allocated) error message if the handle has an error message the return value is GNUNET_SYSERR |
contents | where to store the pointer to the handle's contents |
size | where to store the size of contents |
Definition at line 643 of file bio.c.
References GNUNET_BIO_WriteHandle::emsg, GNUNET_buffer_reap(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, h, IO_BUFFER, ret, and size.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_close | ( | struct GNUNET_BIO_WriteHandle * | h, |
char ** | emsg | ||
) |
Close an IO handle.
If the handle was using a file, the file will be closed.
h | file handle |
emsg | set to the (allocated) error message if the handle has an error message, the return value is GNUNET_SYSERR |
Definition at line 556 of file bio.c.
References GNUNET_BIO_WriteHandle::emsg, GNUNET_BIO_flush(), GNUNET_buffer_clear(), GNUNET_DISK_file_close(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, h, IO_BUFFER, and IO_FILE.
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_search_sync_(), GNUNET_FS_unindex_sync_(), save(), save_hostlist_file(), save_state(), shutdown_task(), write_index_list(), and write_update_information_graph().
enum GNUNET_GenericReturnValue GNUNET_BIO_write | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
const void * | buffer, | ||
size_t | n | ||
) |
Write a buffer to a handle.
h | the IO handle to write to |
what | what is being written (for error message creation) |
buffer | the data to write |
n | number of bytes to write |
Definition at line 750 of file bio.c.
References _, GNUNET_BIO_WriteHandle::buffer, GNUNET_asprintf(), GNUNET_OK, GNUNET_SYSERR, h, IO_BUFFER, IO_FILE, write_to_buffer(), and write_to_file().
Referenced by copy_from_reader(), GNUNET_BIO_write_int32(), GNUNET_BIO_write_int64(), GNUNET_BIO_write_string(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_search_sync_(), GNUNET_FS_unindex_sync_(), GNUNET_FS_write_meta_data(), save(), write_download_request(), write_index_list(), and write_spec_handler_object().
enum GNUNET_GenericReturnValue GNUNET_BIO_write_string | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
const char * | s | ||
) |
Write a 0-terminated string.
h | the IO handle to write to |
what | what is being written (for error message creation) |
s | string to write (can be NULL) |
Definition at line 787 of file bio.c.
References _, GNUNET_BIO_write(), GNUNET_BIO_write_int32(), GNUNET_OK, GNUNET_SYSERR, and h.
Referenced by GNUNET_FS_file_information_sync_(), GNUNET_FS_search_sync_(), GNUNET_FS_unindex_sync_(), write_index_list(), and write_spec_handler_string().
enum GNUNET_GenericReturnValue GNUNET_BIO_write_float | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
float | f | ||
) |
Write a float.
h | the IO handle to write to |
what | what is being written (for error message creation) |
f | float to write (must be a variable) |
h | the IO handle to write to |
what | what is being written (for error message creation) |
f | float to write |
Definition at line 810 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_write_int32(), and h.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_double | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
double | f | ||
) |
Write a double.
h | the IO handle to write to |
what | what is being written (for error message creation) |
f | double to write (must be a variable) |
h | the IO handle to write to |
what | what is being written (for error message creation) |
f | double to write |
Definition at line 827 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_write_int64(), and h.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_int32 | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
int32_t | i | ||
) |
Write an (u)int32_t.
h | the IO handle to write to |
what | what is being written (for error message creation) |
i | 32-bit integer to write |
Definition at line 845 of file bio.c.
References GNUNET_BIO_write(), and h.
Referenced by GNUNET_BIO_write_float(), GNUNET_BIO_write_string(), GNUNET_FS_search_sync_(), GNUNET_FS_write_meta_data(), save_state(), write_spec_handler_int32(), and write_update_information_graph().
enum GNUNET_GenericReturnValue GNUNET_BIO_write_int64 | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
int64_t | i | ||
) |
Write an (u)int64_t.
h | the IO handle to write to |
what | what is being written (for error message creation) |
i | 64-bit integer to write |
Definition at line 865 of file bio.c.
References GNUNET_BIO_write(), GNUNET_htonll(), and h.
Referenced by GNUNET_BIO_write_double(), GNUNET_FS_file_information_sync_(), handle_p2p_estimate(), write_spec_handler_int64(), and write_start_time().
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_object | ( | const char * | what, |
void * | result, | ||
size_t | len | ||
) |
Create the specification to read a certain amount of bytes.
what | describes what is being read (for error message creation) |
result | the buffer to write the result to |
len | the number of bytes to read |
Definition at line 906 of file bio.c.
References read_spec_handler_object(), result, GNUNET_BIO_ReadSpec::rh, and GNUNET_BIO_ReadSpec::what.
Referenced by load_state().
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_string | ( | const char * | what, |
char ** | result, | ||
size_t | max_length | ||
) |
Create the specification to read a 0-terminated string.
what | describes what is being read (for error message creation) |
result | where to store the pointer to the (allocated) string (note that *result could be set to NULL as well) |
max_length | maximum allowed length for the string |
Definition at line 954 of file bio.c.
References read_spec_handler_string(), result, and GNUNET_BIO_ReadSpec::rh.
Referenced by deserialize_download(), deserialize_publish_file(), load_state(), and read_update_information_graph().
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_int32 | ( | const char * | what, |
int32_t * | i | ||
) |
Create the specification to read an (u)int32_t.
what | describes what is being read (for error message creation) |
i | where to store the data |
Definition at line 999 of file bio.c.
References read_spec_handler_int32(), and GNUNET_BIO_ReadSpec::rh.
Referenced by deserialize_publish_file(), load_hostlist_file(), and read_download_request().
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_int64 | ( | const char * | what, |
int64_t * | i | ||
) |
Create the specification to read an (u)int64_t.
what | describes what is being read (for error message creation) |
i | where to store the data |
Definition at line 1043 of file bio.c.
References read_spec_handler_int64(), and GNUNET_BIO_ReadSpec::rh.
Referenced by deserialize_download(), load_hostlist_file(), and read_download_request().
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_float | ( | const char * | what, |
float * | f | ||
) |
Create the specification to read a float.
what | describes what is being read (for error message creation) |
f | address of float to read |
Definition at line 1064 of file bio.c.
References removetrailingwhitespace::f, read_spec_handler_int32(), GNUNET_BIO_ReadSpec::rh, and size.
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_double | ( | const char * | what, |
double * | f | ||
) |
Create the specification to read a double.
what | describes what is being read (for error message creation) |
f | address of double to read |
Definition at line 1084 of file bio.c.
References removetrailingwhitespace::f, read_spec_handler_int64(), GNUNET_BIO_ReadSpec::rh, and size.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_spec_commit | ( | struct GNUNET_BIO_ReadHandle * | h, |
struct GNUNET_BIO_ReadSpec * | rs | ||
) |
Execute the read specifications in order.
h | the IO handle to read from |
rs | array of read specs the last element must be GNUNET_BIO_read_spec_end |
Definition at line 1106 of file bio.c.
References GNUNET_BIO_ReadSpec::cls, GNUNET_OK, h, ret, GNUNET_BIO_ReadSpec::rh, size, GNUNET_BIO_ReadSpec::target, and GNUNET_BIO_ReadSpec::what.
Referenced by deserialize_download(), deserialize_publish_file(), load_hostlist_file(), load_state(), read_download_request(), and read_update_information_graph().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_object | ( | const char * | what, |
void * | source, | ||
size_t | size | ||
) |
Create the specification to read some bytes.
what | describes what is being written (for error message creation) |
source | the data to write |
size | how many bytes should be written |
Definition at line 1152 of file bio.c.
References size, source, GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_object().
Referenced by GNUNET_FS_file_information_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_unindex_sync_(), and write_item().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_string | ( | const char * | what, |
const char * | s | ||
) |
Create the specification to write a 0-terminated string.
what | describes what is being read (for error message creation) |
s | string to write (can be NULL) |
Definition at line 1199 of file bio.c.
References GNUNET_BIO_WriteSpec::source_size, GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_string().
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_unindex_sync_(), save_hostlist_file(), write_item(), and write_update_information_graph().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_int32 | ( | const char * | what, |
int32_t * | i | ||
) |
Create the specification to write an (u)int32_t.
what | describes what is being written (for error message creation) |
i | pointer to a 32-bit integer |
Definition at line 1244 of file bio.c.
References GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_int32().
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_unindex_sync_(), save_hostlist_file(), and write_download_request().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_int64 | ( | const char * | what, |
int64_t * | i | ||
) |
Create the specification to write an (u)int64_t.
what | describes what is being written (for error message creation) |
i | pointer to a 64-bit integer |
Definition at line 1289 of file bio.c.
References GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_int64().
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_unindex_sync_(), save_hostlist_file(), and write_download_request().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_float | ( | const char * | what, |
float * | f | ||
) |
Create the specification to write a float.
what | describes what is being written (for error message creation) |
f | pointer to a float |
Definition at line 1312 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_WriteSpec::source_size, GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_int32().
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_double | ( | const char * | what, |
double * | f | ||
) |
Create the specification to write an double.
what | describes what is being written (for error message creation) |
f | pointer to a double |
Definition at line 1334 of file bio.c.
References removetrailingwhitespace::f, GNUNET_BIO_WriteSpec::source_size, GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_int64().
enum GNUNET_GenericReturnValue GNUNET_BIO_write_spec_commit | ( | struct GNUNET_BIO_WriteHandle * | h, |
struct GNUNET_BIO_WriteSpec * | ws | ||
) |
Execute the write specifications in order.
h | the IO handle to write to |
ws | array of write specs the last element must be GNUNET_BIO_write_spec_end |
Definition at line 1357 of file bio.c.
References GNUNET_BIO_WriteSpec::cls, GNUNET_BIO_flush(), GNUNET_OK, h, IO_FILE, ret, source, GNUNET_BIO_WriteSpec::source_size, GNUNET_BIO_WriteSpec::wh, and GNUNET_BIO_WriteSpec::what.
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_unindex_sync_(), save_hostlist_file(), write_download_request(), write_item(), and write_update_information_graph().