GNUnet  0.10.x
Data Structures | Macros | Functions
bio.c File Reference

functions for buffering IO More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for bio.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_BIO_ReadHandle
 Handle for buffered reading. More...
 
struct  GNUNET_BIO_WriteHandle
 Handle for buffered writing. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-bio",__VA_ARGS__)
 
#define PATH_MAX   4096
 Assumed maximum path length (for source file names). More...
 
#define BIO_BUFFER_SIZE   65536
 Size for I/O buffers. More...
 
#define MAX_META_DATA   (1024 * 1024)
 Maximum size allowed for meta data written/read from disk. More...
 

Functions

struct GNUNET_BIO_ReadHandleGNUNET_BIO_read_open (const char *fn)
 Open a file for reading. More...
 
int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg)
 Close an open file. More...
 
int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what, void *result, size_t len)
 Read the contents of a binary file into a buffer. More...
 
int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, void *result, size_t len)
 Read the contents of a binary file into a buffer. More...
 
int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what, char **result, size_t max_length)
 Read 0-terminated string from a file. More...
 
int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, struct GNUNET_CONTAINER_MetaData **result)
 Read metadata container from a file. More...
 
int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, int32_t *i)
 Read an (u)int32_t. More...
 
int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, int64_t *i)
 Read an (u)int64_t. More...
 
struct GNUNET_BIO_WriteHandleGNUNET_BIO_write_open (const char *fn)
 Open a file for writing. More...
 
int GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h)
 Close an open file for writing. More...
 
int GNUNET_BIO_flush (struct GNUNET_BIO_WriteHandle *h)
 Force a buffered writer to flush its buffer. More...
 
int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, size_t n)
 Write a buffer to a file. More...
 
int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s)
 Write a string to a file. More...
 
int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, const struct GNUNET_CONTAINER_MetaData *m)
 Write metadata container to a file. More...
 
int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, int32_t i)
 Write an (u)int32_t. More...
 
int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, int64_t i)
 Write an (u)int64_t. More...
 

Detailed Description

functions for buffering IO

Author
Christian Grothoff

Definition in file bio.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-bio",__VA_ARGS__)

Definition at line 28 of file bio.c.

◆ PATH_MAX

#define PATH_MAX   4096

Assumed maximum path length (for source file names).

Definition at line 34 of file bio.c.

Referenced by GNUNET_BIO_read_fn().

◆ BIO_BUFFER_SIZE

#define BIO_BUFFER_SIZE   65536

Size for I/O buffers.

Definition at line 41 of file bio.c.

Referenced by GNUNET_BIO_read_open(), and GNUNET_BIO_write_open().

◆ MAX_META_DATA

#define MAX_META_DATA   (1024 * 1024)

Maximum size allowed for meta data written/read from disk.

File-sharing limits to 64k, so this should be rather generous.

Definition at line 47 of file bio.c.

Referenced by GNUNET_BIO_read_meta_data(), and GNUNET_BIO_write_meta_data().