Loading...
Searching...
No Matches
Reply handling
Mongo Wire Protocol
Collaboration diagram for Reply handling:

## Data Structures

struct | mongo_reply_packet_header
| Mongo reply packet header. More...

## Enumerations

enum | { MONGO_REPLY_FLAG_NO_CURSOR = 0x1 , MONGO_REPLY_FLAG_QUERY_FAIL = 0x2 , MONGO_REPLY_FLAG_AWAITCAPABLE = 0x8 }
| Flags the server can set in replies. More...

## Functions

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.

## Detailed Description

## Enumeration Type Documentation

## anonymous enum

anonymous enum

Flags the server can set in replies.

Enumerator
MONGO_REPLY_FLAG_NO_CURSOR | Set when get_more is called but the cursor id is invalid.
MONGO_REPLY_FLAG_QUERY_FAIL | Set when the query failed.
MONGO_REPLY_FLAG_AWAITCAPABLE | Set when the server suppots the AwaitData query option. If not set, the client should sleep a little between get_more calls on a tailable cursor. On Mongo >= 1.6, this flag is always set.

## Function Documentation

## mongo_wire_reply_packet_get_data()

gboolean mongo_wire_reply_packet_get_data | ( | const mongo_packet * | p,
|  | const guint8 ** | data )

Get the full data part of a reply packet.

The result will include the full, unparsed data part of the reply.

Parameters

  p | is the packet to retrieve the data from.
  data | is a pointer to a variable where the replys data can be stored.

Note
  The data variable will point to an internal structure, which must not be freed or modified.

Returns
  TRUE on success, FALSE otherwise.

## mongo_wire_reply_packet_get_header()

gboolean mongo_wire_reply_packet_get_header | ( | const mongo_packet * | p,
|  | mongo_reply_packet_header * | hdr )

Get the header of a reply packet.

Parameters

  p | is the packet to retrieve the reply header from.
  hdr | is a pointer to a variable where the reply header will be stored.

Note
  It is the responsibility of the caller to allocate space for the header.

Returns
  TRUE on success, FALSE otherwise.

## mongo_wire_reply_packet_get_nth_document()

gboolean mongo_wire_reply_packet_get_nth_document | ( | const mongo_packet * | p,
|  | gint32 | n,
|  | bson ** | doc )

Get the Nth document from a reply packet.

Parameters

  p | is the packet to retrieve a document from.
  n | is the number of the document to retrieve.
  doc | is a pointer to a variable to hold the BSON document.

Note
  The doc variable will be a newly allocated object, it is the responsibility of the caller to free it once it is not needed anymore.

Returns
  TRUE on success, FALSE otherwise.