46 #include <sys/types.h> 74 #define BSON_MAXNAME 32 79 #define BSON_BUF_INCREMENT 128 285 size_t size,
const void *
data);
struct bson_decoder_s * bson_decoder_t
__EXPORT int bson_encoder_init_buf(bson_encoder_t encoder, void *buf, unsigned bufsize)
Initialze the encoder for writing to a buffer.
__EXPORT int bson_encoder_append_double(bson_encoder_t encoder, const char *name, double value)
Append a double to the encoded stream.
bson_binary_subtype_t subtype
__EXPORT size_t bson_decoder_data_pending(bson_decoder_t decoder)
Report copyable data size.
#define BSON_MAXNAME
Maximum node name length.
struct bson_node_s * bson_node_t
Node structure passed to the callback.
Node structure passed to the callback.
__EXPORT int bson_encoder_init_file(bson_encoder_t encoder, int fd)
Initialze the encoder for writing to a file.
int(* bson_decoder_callback)(bson_decoder_t decoder, void *priv, bson_node_t node)
Node callback.
__EXPORT void * bson_encoder_buf_data(bson_encoder_t encoder)
Get a pointer to the encoded object buffer.
__EXPORT int bson_decoder_copy_data(bson_decoder_t decoder, void *buf)
Copy node data.
__EXPORT int bson_encoder_fini(bson_encoder_t encoder)
Finalise the encoded stream.
__EXPORT int bson_decoder_init_buf(bson_decoder_t decoder, void *buf, unsigned bufsize, bson_decoder_callback callback, void *priv)
Initialise the decoder to read from a buffer in memory.
__EXPORT int bson_decoder_init_file(bson_decoder_t decoder, int fd, bson_decoder_callback callback, void *priv)
Initialise the decoder to read from a file.
struct bson_encoder_s * bson_encoder_t
Encoder state structure.
bson_type_t
subset of the BSON node types we might care about
__EXPORT int bson_encoder_init_buf_file(bson_encoder_t encoder, int fd, void *buf, unsigned bufsize)
Initialze the encoder for writing to a file.
__EXPORT int bson_encoder_append_binary(bson_encoder_t encoder, const char *name, bson_binary_subtype_t subtype, size_t size, const void *data)
Append a binary blob to the encoded stream.
bson_decoder_callback callback
__EXPORT int bson_encoder_append_string(bson_encoder_t encoder, const char *name, const char *string)
Append a string to the encoded stream.
__EXPORT int bson_encoder_buf_size(bson_encoder_t encoder)
Fetch the size of the encoded object; only valid for buffer operations.
enum bson_binary_subtype bson_binary_subtype_t
__EXPORT int bson_encoder_append_int(bson_encoder_t encoder, const char *name, int64_t value)
Append an integer to the encoded stream.
__EXPORT int bson_encoder_append_bool(bson_encoder_t encoder, const char *name, bool value)
Append a boolean to the encoded stream.
__EXPORT int bson_decoder_next(bson_decoder_t decoder)
Process the next node from the stream and invoke the callback.