rpm
5.4.15
|
Go to the source code of this file.
Data Structures | |
union | _dbswap |
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) |
static int | isLegalUTF8 (const unsigned char *source, int length) |
static int | bson_string_is_db_ref (const unsigned char *string, const size_t length) |
static int | bson_validate_string (bson *b, const unsigned char *string, const size_t length, const char check_utf8, const char check_dot, const char check_dollar) |
static int | bson_check_string (bson *b, const char *string, const size_t length) |
static int | bson_check_field_name (bson *b, const char *string, const size_t length) |
static int | _bson_errprintf (const char *,...) |
static void | _bson_zero (bson *b) |
static size_t | _bson_position (const bson *b) |
__declspec (dllimport) | |
Allocate memory for a new BSON object. More... | |
static int | bson_finished_data_size (const char *data) |
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... | |
static char | hexbyte (char hex) |
int | bson_iterator_int_raw (const bson_iterator *i) |
Get the int value of the BSON object currently pointed to by the iterator. 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... | |
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... | |
static int | _bson_append_grow_stack (bson *b) |
static void | bson_append_byte (bson *b, char c) |
static void | bson_append (bson *b, const void *data, size_t len) |
static void | bson_append32 (bson *b, const void *data) |
static void | bson_append32_as_int (bson *b, int data) |
static void | bson_append64 (bson *b, const void *data) |
int | bson_ensure_space (bson *b, const size_t bytesNeeded) |
Grow a bson object. More... | |
static int | bson_append_estart (bson *b, int type, const char *name, const size_t dataSize) |
static int | bson_append_string_base (bson *b, const char *name, const char *value, size_t len, bson_type type) |
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_builder_error (bson *b) |
This method is invoked when a non-fatal bson error is encountered. 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_numstr (char *str, int i) |
Variables | |
static const int | initialBufferSize = 128 |
static const int | zero = 0 |
static const char | trailingBytesForUTF8 [256] |
const char | bson_numstrs [1000][4] |
static char | bson_shared_empty_data [] = {5,0,0,0,0} |
void *(* | bson_malloc_func )(size_t) = malloc |
void *(* | bson_realloc_func )(void *, size_t) = realloc |
void(* | bson_free_func )(void *) = free |
bson_printf_func | bson_printf = printf |
bson_fprintf_func | bson_fprintf = fprintf |
bson_sprintf_func | bson_sprintf = sprintf |
bson_printf_func | bson_errprintf = _bson_errprintf |
static int(* | oid_fuzz_func )(void) = NULL |
static int(* | oid_inc_func )(void) = NULL |
static bson_err_handler | err_handler = NULL |
__declspec | ( | dllimport | ) |
Allocate memory for a new BSON object.
Clear all errors stored on a mongo connection object.
Set an error on a mongo connection object.
Reset the error state for the connection.
Get the most recent error with the current connection.
Get the error for the last command with the current connection.
Check if the current server is a master.
Authenticate a user.
Add a database user.
Drop a collection.
Drop a database.
Run a command that accepts a simple string key and value.
Run a command that accepts a simple string key and integer value.
Run a command on a MongoDB server.
Create a capped collection.
Create an index with a single key.
Create a compound index.
Count the number of documents in a collection matching a query.
Find a single document in a MongoDB server.
Destroy a cursor object.
Iterate the cursor, returning the next item.
Return the current BSON object data as a const char*.
Set any of the available query options (e.g., MONGO_TAILABLE).
Set the number of documents to return.
Set the number of documents to skip.
Set the fields to return for this cursor.
Set the bson object specifying this cursor's query spec.
Initalize a new cursor object.
Find documents in a MongoDB server.
Free the write_concern object (specifically, the BSON that it owns).
Finish this write concern object by serializing the literal getlasterror command that will be sent to the server.
Initialize a mongo_write_concern object.
Remove a document from a MongoDB server.
Update a document in a MongoDB server.
Insert a batch of BSON documents into a MongoDB server.
Insert a BSON document into a MongoDB server.
The following functions set the attributes of the write_concern object.
The following functions get the attributes of the write_concern object.
Specify the write concern object that this connection should use by default for all writes (inserts, updates, and deletes).
Close any existing connection to the server and free all allocated memory associated with the conn object.
Close the current connection to the server.
Try reconnecting to the server using the existing connection settings.
Ensure that this connection is healthy by performing a round-trip to the server.
Set a timeout for operations on this connection.
DEPRECATED - use mongo_replica_set_client.
Connect to a replica set.
Utility function for validation database and collection names.
DEPRECATED - use mongo_replica_set_add_seed.
Add a seed node to the replica set connection object.
DEPRECATED - use mongo_replica_set_init.
Set up this connection object for connecting to a replica set.
DEPRECATED - use mongo_client.
Connect to a single MongoDB server.
Initialize a new mongo connection object.
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.
b | the BSON object. |
b | the BSON object. |
b | the BSON object to print. |
b | a BSON object |
b | the bson struct to inspect. |
bson | the raw data to print. |
depth | the depth to recurse the object.x |
it | the bson_iterator to use. |
obj | the BSON object to use. |
name | the name of the field to find. |
i | the bson_iterator to initialize. |
bson | the BSON object to associate with the iterator. |
Note that this is mostly used internally.
i | the bson_iterator to initialize. |
buffer | the buffer to point to. |
i | the iterator. |
i | the bson_iterator. |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator |
Works with bson_code, bson_codewscope, and BSON_STRING returns NULL for everything else.
i | the bson_iterator |
Calls bson_init_empty on scope if current object is not BSON_CODEWSCOPE.
i | the bson_iterator. |
scope | an uninitialized BSON object to receive the scope. |
copyData | when true, makes a copy of the scope data which will remain valid when the iterator's data buffer is deallocated. |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator |
i | the bson_iterator. |
i | the bson_iterator. |
sub | an unitialized BSON object which will become the new subobject. |
i | the bson_iterator. |
sub | the iterator to point at the BSON subobject. |
oid | the bson_oid_t destination. |
str | a null terminated string comprised of at least 24 hex chars. |
oid | the bson_oid_t source. |
str | the string representation destination. |
oid | the destination for the newly created bson_oid_t. |
func | a pointer to a function that returns an int. |
If you need thread-safety in generating object ids, you should set this function.
func | a pointer to a function that returns an int. |
oid | the bson_oid_t. |
b | the BSON object to initialize. |
b | the bson object to finalize. |
b | the bson object to destroy. |
obj | the BSON object to initialize. |
The source bson object must be in a finished state; otherwise, the copy will fail.
out | the copy destination BSON object. |
in | the copy source BSON object. |
b | the bson to append to. |
name | the key for the bson_oid_t. |
oid | the bson_oid_t to append. |
b | the bson to append to. |
name | the key for the bson_oid_t. |
b | the bson to append to. |
name | the key for the int. |
i | the int to append. |
b | the bson to append to. |
name | the key for the long. |
i | the long to append. |
b | the bson to append to. |
name | the key for the double. |
d | the double to append. |
b | the bson to append to. |
name | the key for the string. |
str | the string to append. |
b | the bson to append to. |
name | the key for the string. |
str | the string to append. |
len | the number of bytes from str to append. |
b | the bson to append to. |
name | the key for the symbol. |
str | the symbol to append. |
b | the bson to append to. |
name | the key for the symbol. |
str | the symbol to append. |
len | the number of bytes from str to append. |
b | the bson to append to. |
name | the key for the code. |
str | the code to append. |
len | the number of bytes from str to append. |
b | the bson to append to. |
name | the key for the code. |
str | the string to append. |
scope | a BSON object containing the scope. |
b | the bson to append to. |
name | the key for the code. |
str | the string to append. |
len | the number of bytes from str to append. |
scope | a BSON object containing the scope. |
b | the bson to append to. |
name | the key for the data. |
type | the binary data type. |
str | the binary data. |
len | the length of the data. |
b | the bson to append to. |
name | the key for the boolean value. |
v | the bson_bool_t to append. |
b | the bson to append to. |
name | the key for the null value. |
b | the bson to append to. |
name | the key for the undefined value. |
b | the bson to append to. |
name | the key for the maxkey value. |
b | the bson to append to. |
name | the key for the minkey value. |
b | the bson to append to. |
name | the key for the regex value. |
pattern | the regex pattern to append. |
the | regex options. |
b | the bson to append to. |
name | the key for the bson data. |
bson | the bson object to append. |
b | the bson to append to. |
name_or_null | the key for the BSON element, or NULL. |
elem | the bson_iterator. |
b | the bson to append to. |
name | the key for the timestampe value. |
ts | the bson_timestamp_t value to append. |
b | the bson to append to. |
name | the key for the date value. |
millis | the bson_date_t to append. |
b | the bson to append to. |
name | the key for the date value. |
secs | the time_t to append. |
b | the bson to append to. |
name | the name of the new object. |
b | the bson to append to. |
name | the name of the new array. |
b | the bson to append to. |
This is simply an alias for bson_append_finish_object.
b | the bson to append to. |
size | bytes to allocate. |
func | a bson_err_handler function. |
This is necessary for embedding in certain environments.
You must initialize each mongo object using this function.
conn | a mongo connection object allocated on the stack or heap. |
conn | a mongo object. |
host | a numerical network address or a network hostname. |
port | the port to connect to. |
Connect to a single MongoDB server.
conn | a mongo object. |
host | a numerical network address or a network hostname. |
port | the port to connect to. |
To connect, pass the object to mongo_replica_set_client().
conn | a mongo object. |
name | the name of the replica set to connect to. |
Set up this connection object for connecting to a replica set. To connect, pass the object to mongo_replset_connect().
conn | a mongo object. |
name | the name of the replica set to connect to. |
You must specify at least one seed node before connecting to a replica set.
conn | a mongo object. |
host | a numerical network address or a network hostname. |
port | the port to connect to. |
Add a seed node to the replica set connection object.
You must specify at least one seed node before connecting to a replica set.
conn | a mongo object. |
host | a numerical network address or a network hostname. |
port | the port to connect to. |
conn | a mongo object. |
Before passing a connection object to this function, you must already have called mongo_set_replica_set and mongo_replica_set_add_seed.
conn | a mongo object. |
Connect to a replica set.
Before passing a connection object to this function, you must already have called mongo_set_replset and mongo_replset_add_seed.
conn | a mongo object. |
This is a platform-specific feature, and only work on *nix system. You must also compile for linux to support this.
conn | a mongo object. |
millis | timeout time in milliseconds. |
conn | a mongo connection |
This function will disconnect the current socket. If you've authenticated, you'll need to re-authenticate after calling this function.
conn | a mongo object. |
After calling this function, you may call mongo_reconnect with the same connection object.
conn | a mongo object. |
You must always call this function when finished with the connection object.
conn | a mongo object. |
This value can be overridden by passing a write_concern object to any write function.
conn | a mongo object. |
write_concern | pointer to a write concern object. |
This function will fail if the supplied BSON struct is not UTF-8 or if the keys are invalid for insert (contain '.' or start with '$').
The default write concern set on the conn object will be used.
conn | a mongo object. |
ns | the namespace. |
data | the bson data. |
custom_write_concern | a write concern object that will override any write concern set on the conn object. |
This function will fail if any of the documents to be inserted is invalid.
The default write concern set on the conn object will be used.
conn | a mongo object. |
ns | the namespace. |
data | the bson data. |
num | the number of documents in data. |
custom_write_concern | a write concern object that will override any write concern set on the conn object. |
flags | flags on this batch insert. Currently, this value may be 0 or MONGO_CONTINUE_ON_ERROR, which will cause the batch insert to continue even if a given insert in the batch fails. |
The default write concern set on the conn object will be used.
conn | a mongo object. |
ns | the namespace. |
cond | the bson update query. |
op | the bson update data. |
flags | flags for the update. |
custom_write_concern | a write concern object that will override any write concern set on the conn object. |
The default write concern set on the conn object will be used.
conn | a mongo object. |
ns | the namespace. |
cond | the bson query. |
custom_write_concern | a write concern object that will override any write concern set on the conn object. |
Effectively zeroes out the struct.
You must call mongo_write_concern_destroy() to free the serialized BSON.
conn | a mongo object. |
ns | the namespace. |
query | the bson query. |
fields | a bson document of fields to be returned. |
limit | the maximum number of documents to return. |
skip | the number of documents to skip. |
options | A bitfield containing cursor options. |
cursor | |
ns | the namespace, represented as the the database name and collection name separated by a dot. e.g., "test.users" |
If your query is the empty bson object "{}", then you need not set this value.
cursor | |
query | a bson object representing the query spec. This may be either a simple query spec or a complex spec storing values for $query, $orderby, $hint, and/or $explain. See http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol for details. |
If you want to return all fields, you need not set this value.
cursor | |
fields | a bson object representing the fields to return. See http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields. |
cursor | |
skip | |
cursor | |
limit | |
cursor | |
options | a bitfield storing query options. See mongo_cursor_bitfield_t for available constants. |
This is useful for creating bson iterators with bson_iterator_init.
cursor | When successful, the returned object will be stored in cursor->current; |
cursor |
When finished with a cursor, you must pass it to this function.
cursor | the cursor to destroy. |
conn | a mongo object. |
ns | the namespace. |
query | the bson query. |
fields | a bson document of the fields to be returned. |
out | a bson document in which to put the query result. |
conn | a mongo object. |
db | the db name. |
coll | the collection name. |
query | the BSON query. |
conn | a mongo object. |
ns | the namespace. |
key | the bson index key. |
name | the optional name, use NULL to generate a default name. |
options | a bitfield for setting index options. Possibilities include MONGO_INDEX_UNIQUE, MONGO_INDEX_DROP_DUPS, MONGO_INDEX_BACKGROUND, and MONGO_INDEX_SPARSE. |
out | a bson document containing errors, if any. |
conn | a mongo object. |
ns | the namespace. |
field | the index key. |
options | index options. |
out | a BSON document containing errors, if any. |
conn | a mongo object. |
ns | the namespace (e.g., "dbname.collectioname") |
size | the size of the capped collection in bytes. |
max | the max number of documents this collection is allowed to contain. If zero, this argument will be ignored and the server will use the collection's size to age document out. If using this option, ensure that the total size can contain this number of documents. |
conn | a mongo object. |
db | the name of the database. |
command | the BSON command to run. |
out | the BSON result of the command. |
conn | a mongo object. |
db | the name of the database. |
cmd | the command to run. |
arg | the integer argument to the command. |
out | the BSON result of the command. |
conn | a mongo object. |
db | the name of the database. |
cmd | the command to run. |
arg | the string argument to the command. |
out | the BSON result of the command. |
conn | a mongo object. |
db | the name of the database to drop. |
conn | a mongo object. |
db | the name of the database. |
collection | the name of the collection to drop. |
out | a BSON document containing the result of the command. |
conn | a mongo object. |
db | the database in which to add the user. |
user | the user name |
pass | the user password |
conn | a mongo object. |
db | the database to authenticate against. |
user | the user name to authenticate. |
pass | the user's password. |
conn | a mongo object. |
out | a BSON result of the command. |
conn | a mongo object. |
db | the name of the database. |
out | a BSON object containing the error details. |
conn | a mongo object. |
db | the name of the database. |
Mostly for internal use.
conn | a mongo connection object. |
err | a driver error code of mongo_error_t. |
errstr | a string version of the error. |
errorcode | Currently errno or WSAGetLastError(). |
conn | a mongo connection object. |
Definition at line 389 of file bson.c.
References bson::stack.
|
static |
Definition at line 963 of file bson.c.
References BSON_ERROR, BSON_OK, bson_realloc(), bson::stack, bson::stackPtr, and bson::stackSize.
|
static |
Definition at line 449 of file bson.c.
References bson::cur, and bson::data.
Referenced by bson_ensure_space().
|
static |
Definition at line 933 of file bson.c.
Referenced by bson_init_finished_data(), bson_init_size(), and bson_init_unfinished_data().
|
static |
Definition at line 1000 of file bson.c.
References bson::cur, and len.
Referenced by bson_append_estart(), and bson_append_string_base().
|
static |
Definition at line 1005 of file bson.c.
References bson_little_endian32(), and bson::cur.
|
static |
Definition at line 1010 of file bson.c.
References bson_little_endian32(), and bson::cur.
Referenced by bson_append_string_base().
|
static |
Definition at line 1015 of file bson.c.
References bson_little_endian64(), and bson::cur.
|
static |
|
static |
Definition at line 1096 of file bson.c.
References BSON_ALREADY_FINISHED, bson_append(), bson_append_byte(), bson_builder_error(), bson_check_field_name(), bson_ensure_space(), BSON_ERROR, BSON_OK, bson::err, bson::finished, and len.
Referenced by bson_append_string_base().
|
static |
Definition at line 1174 of file bson.c.
References bson_append(), bson_append32_as_int(), bson_append_estart(), bson_check_string(), BSON_ERROR, BSON_OK, BSON_SIZE_OVERFLOW, and bson::err.
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 | ) |
This method is invoked when a non-fatal bson error is encountered.
Invoke the error handler, but do not exit.
Calls the error handler if available.
Definition at line 1433 of file bson.c.
References err_handler.
Referenced by bson_append_estart().
|
static |
Definition at line 236 of file bson.c.
References bson_validate_string().
Referenced by bson_append_estart().
|
static |
Definition at line 230 of file bson.c.
References bson_validate_string().
Referenced by bson_append_string_base().
int bson_ensure_space | ( | bson * | b, |
const size_t | bytesNeeded | ||
) |
Grow a bson object.
b | the bson to grow. |
bytesNeeded | the additional number of bytes needed. |
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.
ok | exits 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.
ok | exits if ok is equal to 0. |
msg | prints 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().
|
static |
Definition at line 402 of file bson.c.
References bson_little_endian32(), and i.
Referenced by bson_init_finished_data(), and bson_init_finished_data_with_copy().
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*.
b | the BSON object to initialize. |
data | the finalized raw BSON data. |
ownsData | when true, bson_destroy() will free the data block. |
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*.
b | the BSON object to initialize. |
data | the finalized raw BSON data to copy. |
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.
b | the BSON object to initialize. |
size | the initial size of the buffer. |
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( )
b | the BSON object to initialize. |
data | the raw BSON data. |
dataSize | |
ownsData | when true, bson_ensure_space() may reallocate the block and bson_destroy() will free it |
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.
i | the bson_iterator |
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.
i | the bson_iterator |
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.
i | the bson_iterator |
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.
i | the bson_iterator |
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.
i | the bson_iterator |
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 | ||
) |
Definition at line 55 of file bson.c.
References in, out, _dbswap::uc, and _dbswap::ui.
Referenced by bson_append32(), bson_append32_as_int(), bson_finished_data_size(), bson_iterator_int_raw(), mongo_data_append32(), mongo_message_send(), and mongo_read_response().
void bson_little_endian64 | ( | void * | outp, |
const void * | inp | ||
) |
Definition at line 34 of file bson.c.
References in, out, _dbswap::uc, and _dbswap::ui.
Referenced by bson_append64(), bson_iterator_double_raw(), bson_iterator_long_raw(), mongo_data_append64(), and mongo_read_response().
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.
ptr | pointer to the space to reallocate. |
size | bytes to allocate. |
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().
|
static |
Definition at line 178 of file bson.c.
Referenced by bson_validate_string().
|
static |
Definition at line 195 of file bson.c.
References BSON_ERROR, BSON_FIELD_HAS_DOT, BSON_FIELD_INIT_DOLLAR, BSON_NOT_UTF8, BSON_OK, bson_string_is_db_ref(), bson::err, isLegalUTF8(), and trailingBytesForUTF8.
Referenced by bson_check_field_name(), and bson_check_string().
|
static |
Definition at line 143 of file bson.c.
Referenced by bson_validate_string().
bson_printf_func bson_errprintf = _bson_errprintf |
Definition at line 376 of file bson.c.
Referenced by bson_fatal_msg(), mongo_connect(), mongo_env_socket_connect(), mongo_replset_add_seed(), mongo_replset_connect(), and mongo_replset_init().
bson_fprintf_func bson_fprintf = fprintf |
bson_printf_func bson_printf = printf |
void*( * bson_realloc_func)(void *, size_t) = realloc |
Definition at line 365 of file bson.c.
Referenced by bson_realloc().
bson_sprintf_func bson_sprintf = sprintf |
Definition at line 373 of file bson.c.
Referenced by _get_host_port(), bson_numstr(), mongo_env_socket_connect(), and mongo_validate_ns().
|
static |
Definition at line 1389 of file bson.c.
Referenced by bson_builder_error(), and bson_fatal_msg().
|
static |
Definition at line 120 of file bson.c.
Referenced by bson_validate_string().
|
static |
Definition at line 111 of file bson.c.
Referenced by rpmcliImportPubkey(), rpmgitCmdInit(), and wrSignature().