/usr/include/mongo-client/mongo-client.h is in libmongo-client-dev 0.1.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | /* mongo-client.h - libmongo-client user API
* Copyright 2011 Gergely Nagy <algernon@balabit.hu>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** @file src/mongo-client.h
* MongoDB client API public header.
*/
#ifndef LIBMONGO_CLIENT_H
#define LIBMONGO_CLIENT_H 1
#include <bson.h>
#include <mongo-wire.h>
#include <glib.h>
G_BEGIN_DECLS
/** @defgroup mongo_client Mongo Client
*
* @addtogroup mongo_client
* @{
*/
/** Opaque MongoDB connection object type. */
typedef struct _mongo_connection mongo_connection;
/** Connect to a MongoDB server.
*
* Connects to a single MongoDB server.
*
* @param host is the IP address of the server.
* @param port is the port to connect to.
*
* @returns A newly allocated mongo_connection object or NULL on
* error. It is the responsibility of the caller to free it once it is
* not used anymore.
*/
mongo_connection *mongo_connect (const char *host, int port);
/** Disconnect from a MongoDB server.
*
* @param conn is the connection object to disconnect from.
*
* @note This also frees up the object.
*/
void mongo_disconnect (mongo_connection *conn);
/** Sends an assembled command packet to MongoDB.
*
* @param conn is the connection to use for sending.
* @param p is the packet to send.
*
* @returns TRUE on success, when the whole packet was sent, FALSE
* otherwise.
*/
gboolean mongo_packet_send (mongo_connection *conn, const mongo_packet *p);
/** Receive a packet from MongoDB.
*
* @param conn is the connection to use for receiving.
*
* @returns A response packet, or NULL upon error.
*/
mongo_packet *mongo_packet_recv (mongo_connection *conn);
/** Get the last requestID from a connection object.
*
* @param conn is the connection to get the requestID from.
*
* @returns The last requestID used, or -1 on error.
*/
gint32 mongo_connection_get_requestid (const mongo_connection *conn);
/** Set a timeout for read/write operations on a connection
*
* On systems that support it, set a timeout for read/write operations
* on a socket.
*
* @param conn is the connection to set a timeout on.
* @param timeout is the timeout to set, in milliseconds.
*
* @returns TRUE on success, FALSE otherwise.
*
* @note The timeout is not preserved accross reconnects, if using the
* Sync API, however. It only applies to the active connection, and
* nothing else.
*/
gboolean mongo_connection_set_timeout (mongo_connection *conn, gint timeout);
/** @} */
G_END_DECLS
#endif
|