|
libmongo-client 0.1.4
|
Implementation of the MongoDB Wire Protocol. More...
#include <glib.h>#include <string.h>#include <stdarg.h>#include <errno.h>#include "bson.h"#include "mongo-wire.h"#include "libmongo-private.h"
Go to the source code of this file.
Data Structures | |
| struct | mongo_packet |
| An opaque Mongo Packet on the wire. More... | |
Enumerations | |
| enum | mongo_wire_opcode { OP_REPLY = 1, OP_MSG = 1000, OP_UPDATE = 2001, OP_INSERT = 2002, OP_RESERVED = 2003, OP_QUERY = 2004, OP_GET_MORE = 2005, OP_DELETE = 2006, OP_KILL_CURSORS = 2007 } |
Functions | |
| mongo_packet * | mongo_wire_packet_new (void) |
| Create an empty packet. | |
| gboolean | mongo_wire_packet_get_header (const mongo_packet *p, mongo_packet_header *header) |
| Get the header data of a packet. | |
| gboolean | mongo_wire_packet_get_header_raw (const mongo_packet *p, mongo_packet_header *header) |
| gboolean | mongo_wire_packet_set_header (mongo_packet *p, const mongo_packet_header *header) |
| Set the header data of a packet. | |
| gboolean | mongo_wire_packet_set_header_raw (mongo_packet *p, const mongo_packet_header *header) |
| gint32 | mongo_wire_packet_get_data (const mongo_packet *p, const guint8 **data) |
| Get the data part of a packet. | |
| gboolean | mongo_wire_packet_set_data (mongo_packet *p, const guint8 *data, gint32 size) |
| Set the data part of a packet. | |
| void | mongo_wire_packet_free (mongo_packet *p) |
| Free up a mongo packet. | |
| mongo_packet * | mongo_wire_cmd_update (gint32 id, const gchar *ns, gint32 flags, const bson *selector, const bson *update) |
| Construct an update command. | |
| mongo_packet * | mongo_wire_cmd_insert_n (gint32 id, const gchar *ns, gint32 n, const bson **docs) |
| Construct an insert command with N documents. | |
| mongo_packet * | mongo_wire_cmd_insert (gint32 id, const gchar *ns,...) |
| Construct an insert command. | |
| mongo_packet * | mongo_wire_cmd_query (gint32 id, const gchar *ns, gint32 flags, gint32 skip, gint32 ret, const bson *query, const bson *sel) |
| Construct a query command. | |
| mongo_packet * | mongo_wire_cmd_get_more (gint32 id, const gchar *ns, gint32 ret, gint64 cursor_id) |
| Construct a get more command. | |
| mongo_packet * | mongo_wire_cmd_delete (gint32 id, const gchar *ns, gint32 flags, const bson *sel) |
| Construct a delete command. | |
| mongo_packet * | mongo_wire_cmd_kill_cursors_va (gint32 id, gint32 n, va_list ap) |
| mongo_packet * | mongo_wire_cmd_kill_cursors (gint32 id, gint32 n,...) |
| Construct a kill cursors command. | |
| mongo_packet * | mongo_wire_cmd_custom (gint32 id, const gchar *db, gint32 flags, const bson *command) |
| Construct a custom command. | |
| gboolean | mongo_wire_reply_packet_get_header (const mongo_packet *p, mongo_reply_packet_header *hdr) |
| Get the header of a reply packet. | |
| gboolean | mongo_wire_reply_packet_get_data (const mongo_packet *p, const guint8 **data) |
| Get the full data part of a reply packet. | |
| gboolean | mongo_wire_reply_packet_get_nth_document (const mongo_packet *p, gint32 n, bson **doc) |
| Get the Nth document from a reply packet. | |
Implementation of the MongoDB Wire Protocol.
Definition in file mongo-wire.c.
| enum mongo_wire_opcode |
Mongo command opcodes.
Definition at line 47 of file mongo-wire.c.
| mongo_packet* mongo_wire_cmd_kill_cursors_va | ( | gint32 | id, |
| gint32 | n, | ||
| va_list | ap | ||
| ) |
Construct a kill cursors command, using a va_list.
| id | is the sequence id. |
| n | is the number of cursors to delete. |
| ap | is the va_list of cursors to kill. |
Definition at line 467 of file mongo-wire.c.

| gboolean mongo_wire_packet_get_header_raw | ( | const mongo_packet * | p, |
| mongo_packet_header * | header | ||
| ) |
Get the header data of a packet, without conversion.
Retrieve the mongo packet's header data, but do not convert the values from little-endian. Use only when the source has the data in the right byte order already.
| p | is the packet which header we seek. |
| header | is a pointer to a variable which will hold the data. |
Definition at line 88 of file mongo-wire.c.

| gboolean mongo_wire_packet_set_header_raw | ( | mongo_packet * | p, |
| const mongo_packet_header * | header | ||
| ) |
Set the header data of a packet, without conversion.
Override the mongo packet's header data, but do not convert the values from little-endian. Use only when the source has the data in the right byte order already.
| p | is the packet whose header we want to override. |
| header | is the header structure to use. |
Definition at line 131 of file mongo-wire.c.

1.7.4