rpm  5.4.15
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
bson.h File Reference

BSON Declarations. More...

#include <stdint.h>
#include <stdio.h>
#include <time.h>
Include dependency graph for bson.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bson_iterator
 
struct  bson
 
union  bson_oid_t
 
struct  bson_timestamp_t
 

Macros

#define MONGO_INLINE   static
 
#define MONGO_EXPORT   __declspec(dllimport)
 
#define MONGO_EXTERN_C_START
 
#define MONGO_EXTERN_C_END
 
#define BSON_OK   0
 
#define BSON_ERROR   -1
 

Typedefs

typedef int bson_bool_t
 
typedef int64_t bson_date_t
 
typedef void(* bson_err_handler )(const char *errmsg)
 
typedef int(* bson_printf_func )(const char *,...)
 
typedef int(* bson_fprintf_func )(FILE *, const char *,...)
 
typedef int(* bson_sprintf_func )(char *, const char *,...)
 

Enumerations

enum  bson_error_t { BSON_SIZE_OVERFLOW = (1 << 0), BSON_ALREADY_FINISHED = (1 << 4), BSON_NOT_IN_SUBOBJECT = (1 << 5), BSON_DOES_NOT_OWN_DATA = (1 << 6) }
 
enum  bson_validity_t { BSON_VALID = 0, BSON_NOT_UTF8 = (1 << 1), BSON_FIELD_HAS_DOT = (1 << 2), BSON_FIELD_INIT_DOLLAR = (1 << 3) }
 
enum  bson_binary_subtype_t {
  BSON_BIN_BINARY = 0, BSON_BIN_FUNC = 1, BSON_BIN_BINARY_OLD = 2, BSON_BIN_UUID = 3,
  BSON_BIN_MD5 = 5, BSON_BIN_USER = 128
}
 
enum  bson_type {
  BSON_EOO = 0, BSON_DOUBLE = 1, BSON_STRING = 2, BSON_OBJECT = 3,
  BSON_ARRAY = 4, BSON_BINDATA = 5, BSON_UNDEFINED = 6, BSON_OID = 7,
  BSON_BOOL = 8, BSON_DATE = 9, BSON_NULL = 10, BSON_REGEX = 11,
  BSON_DBREF = 12, BSON_CODE = 13, BSON_SYMBOL = 14, BSON_CODEWSCOPE = 15,
  BSON_INT = 16, BSON_TIMESTAMP = 17, BSON_LONG = 18, BSON_MAXKEY = 127,
  BSON_MINKEY = 255
}
 

Functions

void bson_little_endian64 (void *outp, const void *inp)
 
void bson_little_endian32 (void *outp, const void *inp)
 
void bson_big_endian64 (void *outp, const void *inp)
 
void bson_big_endian32 (void *outp, const void *inp)
 
 __declspec (dllimport) void bson_init_zero(bson *b)
 Zero a bson struct. More...
 
int bson_init_finished_data (bson *b, char *data, bson_bool_t ownsData)
 Initialize a BSON object for reading and set its data pointer to the provided char*. More...
 
int bson_init_finished_data_with_copy (bson *b, const char *data)
 Initialize a BSON object for reading and copy finalized BSON data from the provided char*. More...
 
double bson_iterator_double_raw (const bson_iterator *i)
 Get the double value of the BSON object currently pointed to by the iterator. More...
 
int bson_iterator_int_raw (const bson_iterator *i)
 Get the int value of the BSON object currently pointed to by the iterator. More...
 
int64_t bson_iterator_long_raw (const bson_iterator *i)
 Get the long value of the BSON object currently pointed to by the iterator. More...
 
bson_bool_t bson_iterator_bool_raw (const bson_iterator *i)
 Get the bson_bool_t value of the BSON object currently pointed to by the iterator. More...
 
int bson_iterator_string_len (const bson_iterator *i)
 Get the string length of the BSON object currently pointed to by the iterator. More...
 
int bson_init_size (bson *b, int size)
 Initialize a BSON object for building and allocate a data buffer of a given size. More...
 
int bson_init_unfinished_data (bson *b, char *data, int dataSize, bson_bool_t ownsData)
 Initialize a BSON object for building, using the provided char* of the given size. More...
 
int bson_ensure_space (bson *b, const size_t bytesNeeded)
 Grow a bson object. More...
 
void bson_numstr (char *str, int i)
 
void bson_incnumstr (char *str)
 
void * bson_realloc (void *ptr, size_t size)
 Changes the size of allocated memory and checks return value, exiting fatally if realloc() fails. More...
 
void bson_fatal (int ok)
 Exit fatally. More...
 
void bson_fatal_msg (int ok, const char *msg)
 Exit fatally with an error message. More...
 
void bson_builder_error (bson *b)
 Invoke the error handler, but do not exit. More...
 

Variables

int depth
 
const bsonobj
 
const bson const char * name
 
const bsonb
 
const char * buffer
 
bsonscope
 
bson bson_bool_t copyData
 
bsonsub
 
const char * str
 
const bsonin
 
const char const bson_oid_toid
 
const char const int i
 
const char const double d
 
const char const char size_t len
 
const char const char * code
 
const char const char size_t size
 
const char char type
 
const char const bson_bool_t v
 
const char const char * pattern
 
const char const char const char * opts
 
const char const bsonbson
 
const char * name_or_null
 
const char const bson_iteratorelem
 
const char bson_timestamp_tts
 
const char int time
 
const char int int increment
 
const char bson_date_t millis
 
const char time_t secs
 
void *(* bson_malloc_func )(size_t)
 
void *(* bson_realloc_func )(void *, size_t)
 
void(* bson_free_func )(void *)
 
bson_printf_func bson_printf
 
bson_fprintf_func bson_fprintf
 
bson_sprintf_func bson_sprintf
 
bson_printf_func bson_errprintf
 
const void * inp
 

Detailed Description

BSON Declarations.

Definition in file bson.h.

Macro Definition Documentation

#define BSON_ERROR   -1
#define BSON_OK   0
#define MONGO_EXPORT   __declspec(dllimport)

Definition at line 42 of file bson.h.

#define MONGO_EXTERN_C_END

Definition at line 51 of file bson.h.

#define MONGO_EXTERN_C_START

Definition at line 50 of file bson.h.

#define MONGO_INLINE   static

Definition at line 36 of file bson.h.

Typedef Documentation

typedef int bson_bool_t

Definition at line 106 of file bson.h.

typedef int64_t bson_date_t

Definition at line 134 of file bson.h.

typedef void( * bson_err_handler)(const char *errmsg)

Definition at line 1077 of file bson.h.

typedef int(* bson_fprintf_func)(FILE *, const char *,...)

Definition at line 1080 of file bson.h.

typedef int(* bson_printf_func)(const char *,...)

Definition at line 1079 of file bson.h.

typedef int(* bson_sprintf_func)(char *, const char *,...)

Definition at line 1081 of file bson.h.

Enumeration Type Documentation

Enumerator
BSON_BIN_BINARY 
BSON_BIN_FUNC 
BSON_BIN_BINARY_OLD 
BSON_BIN_UUID 
BSON_BIN_MD5 
BSON_BIN_USER 

Definition at line 73 of file bson.h.

Enumerator
BSON_SIZE_OVERFLOW 

Trying to create a BSON object larger than INT_MAX.

BSON_ALREADY_FINISHED 

Trying to modify a finished BSON object.

BSON_NOT_IN_SUBOBJECT 

Trying bson_append_finish_object() and not in sub.

BSON_DOES_NOT_OWN_DATA 

Trying to expand a BSON object which does not own its data block.

Definition at line 59 of file bson.h.

enum bson_type
Enumerator
BSON_EOO 
BSON_DOUBLE 
BSON_STRING 
BSON_OBJECT 
BSON_ARRAY 
BSON_BINDATA 
BSON_UNDEFINED 
BSON_OID 
BSON_BOOL 
BSON_DATE 
BSON_NULL 
BSON_REGEX 
BSON_DBREF 

Deprecated.

BSON_CODE 
BSON_SYMBOL 
BSON_CODEWSCOPE 
BSON_INT 
BSON_TIMESTAMP 
BSON_LONG 
BSON_MAXKEY 
BSON_MINKEY 

Definition at line 82 of file bson.h.

Enumerator
BSON_VALID 

BSON is valid and UTF-8 compliant.

BSON_NOT_UTF8 

A key or a string is not valid UTF-8.

BSON_FIELD_HAS_DOT 

Warning: key contains '.

' character.

BSON_FIELD_INIT_DOLLAR 

Warning: key starts with '$' character.

Definition at line 66 of file bson.h.

Function Documentation

__declspec ( dllimport  )

Zero a bson struct.

Cast an int64_t to double.

Set a function for error handling.

Allocates memory and checks return value, exiting fatally if malloc() fails.

Finish appending a new object or array to a bson.

Start appending a new array to a bson.

Start appending a new object to a bson.

Append a time_t value to a bson.

Append a bson_date_t value to a bson.

Append a bson_timestamp_t value to a bson.

Append a BSON element to a bson from the current point of an iterator.

Append bson data to a bson.

Append a regex value to a bson.

Append a minkey value to a bson.

Append a maxkey value to a bson.

Append an undefined value to a bson.

Append a null value to a bson.

Append a bson_bool_t to a bson.

Append binary data to a bson.

Append len bytes of code to a bson with scope.

Append code to a bson with scope.

Append len bytes of code to a bson.

Append code to a bson.

Append len bytes of a symbol to a bson.

Append a symbol to a bson.

Append len bytes of a string to a bson.

Append a string to a bson.

Append an double to a bson.

Append an long to a bson.

Append an int to a bson.

Append a bson_oid_t to a bson.

Append a previously created bson_oid_t to a bson object.

Make a complete copy of the a BSON object.

Return a pointer to an empty, shared, static BSON object.

Initialize a BSON object to an emoty object with a shared, static data buffer.

Destroy a bson object and deallocate its data buffer.

Finalize a bson object.

Initialize a BSON object for building and allocate a data buffer.

Get the time a bson_oid_t was created.

Set a function to be used to generate the incrementing part of an object id (last four bytes).

Set a function to be used to generate the second four bytes of an object id.

Create a bson_oid object.

Create a string representation of the bson_oid_t.

Create a bson_oid_t from a string.

Get a bson_iterator that on the BSON subobject.

Get the BSON subobject currently pointed to by the iterator.

Get the options of the BSON regex object currently pointed to by the iterator.

Get the value of the BSON regex object currently pointed to by the iterator.

Get the value of the BSON binary object currently pointed to by the iterator.

Get the type of the BSON binary object currently pointed to by the iterator.

Get the length of the BSON binary object currently pointed to by the iterator.

Get the time value of the BSON object currently pointed to by the iterator.

Get the date value of the BSON object currently pointed to by the iterator.

Get the code scope value of the BSON object currently pointed to by the iterator.

Get the code value of the BSON object currently pointed to by the iterator.

Get the string value of the BSON object currently pointed to by the iterator.

Get the bson_oid_t value of the BSON object currently pointed to by the iterator.

Get the boolean value of the BSON object currently pointed to by the iterator.

Get the timestamp value of the BSON object currently pointed to by the iterator.

Get the long value of the BSON object currently pointed to by the iterator.

Get the int value of the BSON object currently pointed to by the iterator.

Get the double value of the BSON object currently pointed to by the iterator.

Get the value of the BSON object currently pointed to by the iterator.

Get the key of the BSON object currently pointed to by the iterator.

Get the type of the BSON object currently pointed to by the iterator.

Point the iterator at the next BSON object.

Check to see if the bson_iterator has more data.

Initialize a bson iterator from a const char* buffer.

Initialize a bson_iterator.

Advance a bson_iterator to the named field.

Returns true if bson_data(b) {b->data} is not null; else, false.

Return a pointer to the raw buffer stored by this bson object.

Print a string representation of a BSON object.

Minimum finished size of an unfinished BSON object given current contents.

Size of a BSON object.

Deallocate a BSON object.

Allocate memory for a new BSON object.

All fields are set to zero except the stack.

Note
Mainly used internally, but can be called for safety purposes so that a later call to bson_destroy() doesn't flip out. It is safe to call this function on a NULL pointer in which case there is no effect.
Parameters
bthe BSON object to zero.
Note
After using this function, you must initialize the object using bson_init_finished_data( ), bson_init_empty( ), bson_init( ), or one of the other init functions.
Returns
a new BSON object.
Note
You must call bson_destroy( ) before calling this function.
Parameters
bthe BSON object.
Returns
the size.
Parameters
bthe BSON object.
Returns
the BSON object's minimum finished size
Parameters
bthe BSON object to print.
ba BSON object
Note
Convenience function for determining if bson data was returned by a function. Check required after calls to mongo_create_index(), mongo_create_simple_index(), mongo_cmd_get_last_error() and mongo_cmd_get_prev_error().
Parameters
bthe bson struct to inspect.
bsonthe raw data to print.
depththe depth to recurse the object.x
itthe bson_iterator to use.
objthe BSON object to use.
namethe name of the field to find.
Returns
the type of the found object or BSON_EOO if it is not found.
Parameters
ithe bson_iterator to initialize.
bsonthe BSON object to associate with the iterator.

Note that this is mostly used internally.

Parameters
ithe bson_iterator to initialize.
bufferthe buffer to point to.
ithe iterator.
Returns
returns true if there is more data.
Parameters
ithe bson_iterator.
Returns
the type of the next BSON object.
Parameters
ithe bson_iterator
Returns
the type of the current BSON object.
Parameters
ithe bson_iterator
Returns
the key of the current BSON object.
Parameters
ithe bson_iterator
Returns
the value of the current BSON object.

Works with bson_code, bson_codewscope, and BSON_STRING returns NULL for everything else.

Parameters
ithe bson_iterator
Returns
the code value of the current BSON object.

Calls bson_init_empty on scope if current object is not BSON_CODEWSCOPE.

Note
When copyData is false, the scope becomes invalid when the iterator's data buffer is deallocated. For either value of copyData, you must pass the scope object to bson_destroy when you are done using it.
Parameters
ithe bson_iterator.
scopean uninitialized BSON object to receive the scope.
copyDatawhen true, makes a copy of the scope data which will remain valid when the iterator's data buffer is deallocated.
ithe bson_iterator
Returns
the date value of the current BSON object.
Parameters
ithe bson_iterator
Returns
the time value of the current BSON object.
Parameters
ithe bson_iterator
Returns
the length of the current BSON binary object.
Parameters
ithe bson_iterator
Returns
the type of the current BSON binary object.
Parameters
ithe bson_iterator
Returns
the value of the current BSON binary object.
Parameters
ithe bson_iterator
Returns
the value of the current BSON regex object.
Parameters
ithe bson_iterator.
Returns
the options of the current BSON regex object.
Note
When copyData is 0, the subobject becomes invalid when its parent's data buffer is deallocated. For either value of copyData, you must pass the subobject to bson_destroy when you are done using it.
Parameters
ithe bson_iterator.
suban unitialized BSON object which will become the new subobject.
ithe bson_iterator.
subthe iterator to point at the BSON subobject.
oidthe bson_oid_t destination.
stra null terminated string comprised of at least 24 hex chars.
oidthe bson_oid_t source.
strthe string representation destination.
oidthe destination for the newly created bson_oid_t.
funca pointer to a function that returns an int.

If you need thread-safety in generating object ids, you should set this function.

Parameters
funca pointer to a function that returns an int.
oidthe bson_oid_t.
Note
You must initialize each new bson object using this, bson_init_finished_data( ), or one of the other init functions. When done using the BSON object, you must pass it to bson_destroy( ).
Parameters
bthe BSON object to initialize.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson object to finalize.
Returns
the standard error code. To deallocate memory, call bson_destroy on the bson object.
Parameters
bthe bson object to destroy.
Note
You must NOT modify this object's data. It is safe though not required to call bson_destroy( ) on this object.
Parameters
objthe BSON object to initialize.
Returns
BSON_OK
Note
This object is owned by the driver. You must NOT modify it and must NOT call bson_destroy( ) on it.
Returns
the shared initialized BSON object.

The source bson object must be in a finished state; otherwise, the copy will fail.

Parameters
outthe copy destination BSON object.
inthe copy source BSON object.
bthe bson to append to.
namethe key for the bson_oid_t.
oidthe bson_oid_t to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the bson_oid_t.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the int.
ithe int to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the long.
ithe long to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the double.
dthe double to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the string.
strthe string to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the string.
strthe string to append.
lenthe number of bytes from str to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the symbol.
strthe symbol to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the symbol.
strthe symbol to append.
lenthe number of bytes from str to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the code.
strthe code to append.
lenthe number of bytes from str to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the code.
strthe string to append.
scopea BSON object containing the scope.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the code.
strthe string to append.
lenthe number of bytes from str to append.
scopea BSON object containing the scope.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the data.
typethe binary data type.
strthe binary data.
lenthe length of the data.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the boolean value.
vthe bson_bool_t to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the null value.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the undefined value.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the maxkey value.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the minkey value.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the regex value.
patternthe regex pattern to append.
theregex options.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the bson data.
bsonthe bson object to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
name_or_nullthe key for the BSON element, or NULL.
elemthe bson_iterator.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the timestampe value.
tsthe bson_timestamp_t value to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the date value.
millisthe bson_date_t to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe key for the date value.
secsthe time_t to append.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe name of the new object.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
namethe name of the new array.
Returns
BSON_OK or BSON_ERROR.
Parameters
bthe bson to append to.
Returns
BSON_OK or BSON_ERROR.

This is simply an alias for bson_append_finish_object.

Parameters
bthe bson to append to.
Returns
BSON_OK or BSON_ERROR.
Parameters
sizebytes to allocate.
Returns
a pointer to the allocated memory.
See also
malloc(3)
Parameters
funca bson_err_handler function.
Returns
the old error handling function, or NULL.

This is necessary for embedding in certain environments.

void bson_big_endian32 ( void *  outp,
const void *  inp 
)

Definition at line 92 of file bson.c.

References in, out, _dbswap::uc, and _dbswap::ui.

void bson_big_endian64 ( void *  outp,
const void *  inp 
)

Definition at line 71 of file bson.c.

References in, out, _dbswap::uc, and _dbswap::ui.

void bson_builder_error ( bson b)

Invoke the error handler, but do not exit.

Parameters
bthe buffer object.

Invoke the error handler, but do not exit.

Calls the error handler if available.

Parameters

Definition at line 1433 of file bson.c.

References err_handler.

Referenced by bson_append_estart().

int bson_ensure_space ( bson b,
const size_t  bytesNeeded 
)

Grow a bson object.

Parameters
bthe bson to grow.
bytesNeededthe additional number of bytes needed.
Returns
BSON_OK or BSON_ERROR with the bson error object set. Exits if allocation fails.

Definition at line 1020 of file bson.c.

References _bson_position(), BSON_DOES_NOT_OWN_DATA, BSON_ERROR, bson_fatal_msg(), BSON_OK, bson_realloc(), BSON_SIZE_OVERFLOW, bson::cur, bson::data, bson::dataSize, bson::err, and bson::ownsData.

Referenced by bson_append_estart().

void bson_fatal ( int  ok)

Exit fatally.

Parameters
okexits if ok is equal to 0.

Definition at line 1438 of file bson.c.

References bson_fatal_msg().

void bson_fatal_msg ( int  ok,
const char *  msg 
)

Exit fatally with an error message.

Parameters
okexits if ok is equal to 0.
msgprints to stderr before exiting.

Definition at line 1442 of file bson.c.

References bson_errprintf, and err_handler.

Referenced by bson_ensure_space(), bson_fatal(), bson_realloc(), gridfile_fill_buf_from_chunk(), and mongo_cursor_op_query().

void bson_incnumstr ( char *  str)
int bson_init_finished_data ( bson b,
char *  data,
bson_bool_t  ownsData 
)

Initialize a BSON object for reading and set its data pointer to the provided char*.

Note
When done using the bson object, you must pass the object to bson_destroy( ).
Parameters
bthe BSON object to initialize.
datathe finalized raw BSON data.
ownsDatawhen true, bson_destroy() will free the data block.
Returns
BSON_OK or BSON_ERROR.

Definition at line 408 of file bson.c.

References _bson_zero(), bson_finished_data_size(), BSON_OK, bson::data, data, bson::dataSize, bson::finished, and bson::ownsData.

Referenced by mongo_cursor_next(), and mongo_cursor_op_query().

int bson_init_finished_data_with_copy ( bson b,
const char *  data 
)

Initialize a BSON object for reading and copy finalized BSON data from the provided char*.

Note
When done using the bson object, you must pass the object to bson_destroy( ).
Parameters
bthe BSON object to initialize.
datathe finalized raw BSON data to copy.
Returns
BSON_OK or BSON_ERROR.

Definition at line 417 of file bson.c.

References BSON_ERROR, bson_finished_data_size(), bson_init_size(), BSON_OK, bson::data, and bson::finished.

int bson_init_size ( bson b,
int  size 
)

Initialize a BSON object for building and allocate a data buffer of a given size.

Note
When done using the bson object, you must pass it to bson_destroy( ).
Parameters
bthe BSON object to initialize.
sizethe initial size of the buffer.
Returns
BSON_OK or BSON_ERROR.

Definition at line 941 of file bson.c.

References _bson_zero(), BSON_ERROR, BSON_OK, bson::cur, bson::data, data, bson::dataSize, bson::ownsData, and size.

Referenced by bson_init_finished_data_with_copy(), and chunk_new().

int bson_init_unfinished_data ( bson b,
char *  data,
int  dataSize,
bson_bool_t  ownsData 
)

Initialize a BSON object for building, using the provided char* of the given size.

When ownsData is true, the BSON object may reallocate the data block as needed, and bson_destroy will free it.

See also bson_init_finished_data( )

Note
When done using the BSON object, you must pass it to bson_destroy( ).
Parameters
bthe BSON object to initialize.
datathe raw BSON data.
dataSize
ownsDatawhen true, bson_ensure_space() may reallocate the block and bson_destroy() will free it
Returns
BSON_OK or BSON_ERROR.

Definition at line 955 of file bson.c.

References _bson_zero(), BSON_OK, bson::data, data, bson::dataSize, and bson::ownsData.

bson_bool_t bson_iterator_bool_raw ( const bson_iterator i)

Get the bson_bool_t value of the BSON object currently pointed to by the iterator.

Assumes the correct type is used.

Parameters
ithe bson_iterator
Returns
the value of the current BSON object.

Definition at line 756 of file bson.c.

double bson_iterator_double_raw ( const bson_iterator i)

Get the double value of the BSON object currently pointed to by the iterator.

Assumes the correct type is used.

Parameters
ithe bson_iterator
Returns
the value of the current BSON object.

Definition at line 744 of file bson.c.

References bson_little_endian64(), and out.

int bson_iterator_int_raw ( const bson_iterator i)

Get the int value of the BSON object currently pointed to by the iterator.

Assumes the correct type is used.

Parameters
ithe bson_iterator
Returns
the value of the current BSON object.

Definition at line 738 of file bson.c.

References bson_little_endian32(), and out.

Referenced by bson_iterator_string_len().

int64_t bson_iterator_long_raw ( const bson_iterator i)

Get the long value of the BSON object currently pointed to by the iterator.

Assumes the correct type is used.

Parameters
ithe bson_iterator
Returns
the value of the current BSON object.

Definition at line 750 of file bson.c.

References bson_little_endian64(), and out.

int bson_iterator_string_len ( const bson_iterator i)

Get the string length of the BSON object currently pointed to by the iterator.

Parameters
ithe bson_iterator
Returns
the length of the current BSON object.

Definition at line 853 of file bson.c.

References bson_iterator_int_raw().

Referenced by mongo_set_last_error().

void bson_little_endian32 ( void *  outp,
const void *  inp 
)
void bson_little_endian64 ( void *  outp,
const void *  inp 
)
void bson_numstr ( char *  str,
int  i 
)

Definition at line 1459 of file bson.c.

References bson_sprintf.

void* bson_realloc ( void *  ptr,
size_t  size 
)

Changes the size of allocated memory and checks return value, exiting fatally if realloc() fails.

Parameters
ptrpointer to the space to reallocate.
sizebytes to allocate.
Returns
a pointer to the allocated memory.
See also
realloc()

Definition at line 1408 of file bson.c.

References bson_fatal_msg(), and bson_realloc_func.

Referenced by _bson_append_grow_stack(), and bson_ensure_space().

Variable Documentation

const bson* b
const char const bson* bson

Definition at line 982 of file bson.h.

bson_printf_func bson_errprintf
bson_fprintf_func bson_fprintf

Definition at line 372 of file bson.c.

void( * bson_free_func)(void *)

Definition at line 366 of file bson.c.

void*( * bson_malloc_func)(size_t)

Definition at line 364 of file bson.c.

bson_printf_func bson_printf

Definition at line 370 of file bson.c.

void*( * bson_realloc_func)(void *, size_t)

Definition at line 365 of file bson.c.

Referenced by bson_realloc().

bson_sprintf_func bson_sprintf

Definition at line 373 of file bson.c.

Referenced by _get_host_port(), bson_numstr(), mongo_env_socket_connect(), and mongo_validate_ns().

const char* buffer
const char const char * code

Definition at line 882 of file bson.h.

Referenced by rpmjsRunFile(), and vrpmlog().

bson bson_bool_t copyData

Definition at line 491 of file bson.h.

const char const double d
int depth

Definition at line 258 of file bson.h.

Referenced by _rpmtsOrder(), and next_brace_sub().

const char const bson_iterator* elem

Definition at line 993 of file bson.h.

const char const int64_t i

Definition at line 778 of file bson.h.

Referenced by __crc32(), __crc64(), _orgrpmtsOrder(), _rpmtsOrder(), _tagName(), _tagType(), _tagValue(), addChangelog(), addFile(), addRelation(), addTE(), arHeaderRead(), arSetup(), avReaddir(), bin2hex(), bson_finished_data_size(), cache_decode_set(), cacheStashLatest(), checkHardLinks(), checkUnpackagedFiles(), cmd_ls(), cmd_match(), cmpArgvStr(), coder_set_compression_settings(), collectSCC(), compare(), compare_nodes(), compressFilelist(), copyEntry(), db3Acallback(), db3open(), decode_golomb(), detectSCCs(), dnlInitIterator(), dnlNextIterator(), doFoo(), doScript(), downsample_set(), encode_golomb(), fdbg(), fdFini(), fdFiniDigest(), FDGSkip(), FDGsqlTag(), FDGxmlTag(), FDGyamlTag(), fdStealDigest(), fdUpdateDigests(), Ferror(), Fileno(), findTag(), fmtBits(), fmtDBT(), formatValue(), fpLookupList(), fpLookupSubdir(), freeArgs(), freeFormat(), freeGlobs(), freeItems(), freeSl(), freeSt(), fsmCommitLinks(), fsmMakeLinks(), fsmMapAttrs(), fsmMapFContext(), fsmMapPath(), fsmMkdirs(), fsmStage(), ftpReq(), ftsCachePrint(), ftsCacheUpdate(), genCpioListAndHeader(), getFilesystemList(), getMachineInfo(), getSource(), glob(), globfree(), gridfile_load_from_chunks(), gridfs_find_query(), handleOneTrigger(), handleOverlappedFiles(), hasSqlType(), hdr_subscript(), headerCheck(), headerLoad(), headerScrub(), headerSizeof(), headerUnload(), headerVerifyInfo(), hGetColor(), htFini(), htGetKeys(), IDTXfree(), IDTXglob(), ignoreDep(), initGlobs(), initSourceHeader(), insertionsort(), intFormat(), iosmCommitLinks(), iosmMakeLinks(), iosmMapAttrs(), iosmMapFContext(), iosmMapPath(), iosmMkdirs(), iosmStage(), loadDBT(), localeTag(), machAddEquiv(), machCacheEntryVisit(), machCacheFindEntry(), main(), map_html_tags(), mapNextIterator(), message_filters(), mireApply(), mireSkip(), missingokTag(), mongo_insert_batch(), mtreeSWalk(), mtreeVisitF(), needswhatTag(), odbcDumpColAttrs(), odbcDumpEnvAttr(), odbcDumpInfo(), odbcDumpStmt(), odbcPrint(), orgrpmAddRelation(), packageBinaries(), parse_options(), parseForLang(), parseFormat(), pcregrep(), pgpCRC(), pgpGrab(), pgpHashAlgoStringToNumber(), pgpHexCvt(), pgpPrtComment(), pgpPrtPkts(), pgpPrtPubkeyParams(), pgpPrtSeckeyParams(), pgpPrtSigParams(), pgpPrtSubType(), pgpStashKeyid(), pkgUnpackagedSubdirs(), PRCOsqlTag(), PRCOxmlTag(), PRCOyamlTag(), prefix_array(), prepFetchVerbose(), printHash(), printNewSpecfile(), processBinaryFile(), processPackageFiles(), providePackageNVR(), rdSignature(), rebuildCompatTables(), relocateFileList(), removeSillyDeps(), rpm_mergesort(), rpm_rb_raise(), rpmalAllFileSatisfiesDepend(), rpmalFini(), rpmalMakeIndex(), rpmbagAdd(), rpmbagDel(), rpmbcExportPubkey(), rpmbfIntersect(), rpmbfUnion(), rpmcliImportPubkeys(), rpmcliInit(), rpmcliInstallElementPath(), rpmcliInstallSuggests(), rpmdbTriggerGlobs(), rpmDigestFinal(), rpmdsCpuinfo(), rpmdsELF(), rpmdsNew(), rpmdsNext(), rpmdsSearch(), rpmdsSetIx(), rpmDumpMacroTable(), rpmEVRparse(), rpmfcApply(), rpmfcExpandAppend(), rpmfcExpandRegexps(), rpmfcGenerateDepends(), rpmfcHelper(), rpmfcMatchRegexps(), rpmfcSCRIPT(), rpmfi_Digest(), rpmfi_FDigest_get(), rpmfiBuildFNames(), rpmfiDupeRelocations(), rpmfiFNBF(), rpmfiNew(), rpmfiNext(), rpmfiOpendir(), rpmfiSetFX(), rpmfiStat(), rpmFreeFilesystems(), rpmFreeMacros(), rpmFreeRpmrc(), rpmGetFilesystemUsage(), rpmGetMacroEntries(), rpmgitCmdDiff(), rpmgitCmdInit(), rpmgitInfo(), rpmgitNew(), rpmGlob(), rpmhdrLoadTag(), rpmhkpValidate(), rpmHmacInit(), rpmhookArgsParse(), rpmhookTableRehash(), rpmInitMacros(), rpmInstallSourcePackage(), rpmioInit(), rpmLoadMacroFile(), rpmLoadMacros(), rpmlogClose(), rpmlogPrint(), rpmmc_list(), rpmmiGrowBasename(), rpmmiInit(), rpmmiPrune(), rpmmiSort(), rpmnsProbe(), rpmnsProbeSignature(), rpmPlatformScore(), rpmps_subscript(), rpmpsFini(), rpmpsNextIterator(), rpmpsPrint(), rpmQueryVerify(), rpmrbLoadClasses(), rpmReadPackageManifest(), rpmrepoInitPopt(), rpmReSign(), rpmRollback(), rpmsetCmp(), rpmsetFini(), rpmsetFinish(), rpmShowRC(), rpmsmRun(), rpmsquirrelNew(), rpmswInit(), rpmteChain(), rpmteColorDS(), rpmtpmDump(), rpmts_Check(), rpmts_IDTXglob(), rpmts_IDTXload(), rpmtsAddFingerprints(), rpmtsCheckDSIProblems(), rpmtsCheckInstalledFiles(), rpmtsCloseSDB(), rpmtsFindBaseNamesInDB(), rpmtsInitDSI(), rpmtsLoadNVRA(), rpmtsOpenSDB(), rpmtsPrepare(), rpmtsSanityCheck(), rpmtsSkipFiles(), rpmtsSolve(), rpmvfNew(), rpmzInit(), rpnFormat(), runImmedTriggers(), runScript(), runTriggersLoop(), setup(), shownode(), showQueryPackage(), showVerifyPackage(), signalsCaught(), singleSprintf(), sortMacroTable(), spec_get_macros(), sql_bind_key(), sql_step(), statFormat(), strsubFormat(), tag2uuidv5(), tagStoreFree(), tagSwab(), tarHeaderRead(), tarHeaderWriteBlock(), tblName(), timeCheck(), triggercondsTag(), triggertypeTag(), uniqv(), unsatisfiedDepend(), urlFind(), urlFreeCache(), uuidFormat(), valueMakeInteger(), vfs_parse_ls_lga(), whatneedsTag(), writeLinkedFile(), XpoptDupArgv(), and yamlstrcpy().

const bson* in
const char int int increment

Definition at line 1005 of file bson.h.

const void * inp

Definition at line 1157 of file bson.h.

const char char const char size_t len
const char bson_date_t millis

Definition at line 1017 of file bson.h.

Referenced by mongo_set_op_timeout().

const char const bson const char * name

Definition at line 269 of file bson.h.

const char* name_or_null

Definition at line 993 of file bson.h.

const bson* obj

Definition at line 269 of file bson.h.

Referenced by hdrLoad(), rpmgitCmdCommit(), rpmgitRead(), rpmmc_alloc(), rpmps_alloc(), and rpmte_alloc().

const char const bson_oid_t* oid

Definition at line 757 of file bson.h.

Referenced by rpmgitInfo(), rpmgitOid(), rpmgitRead(), rpmgitWalk(), and rpmgitWrite().

const char const char const char* opts
const char const char* pattern
const char const char size_t const bson * scope

Definition at line 491 of file bson.h.

const char time_t secs

Definition at line 1028 of file bson.h.

Referenced by dateToTimet(), fdFgets(), fdReadable(), fdWritable(), and tvsub().

const char const char size_t size
const char char const char * str

Definition at line 576 of file bson.h.

const char int time
const char bson_timestamp_t* ts
const char char type
const char const bson_bool_t v