index 803a195e45c31c2233e4348556368ea8b88538b3..0397e508d2eeab6f5d0fc58a9d5dbadc4496ec27 100644 (file)
} sdb_conn_node_t;
#define SDB_CONN_NODE(obj) ((sdb_conn_node_t *)(obj))
+/*
+ * sdb_conn_setup_cb is a callback function used to setup a connection. For
+ * example, it may be used to initialize session information.
+ */
+typedef int (*sdb_conn_setup_cb)(sdb_conn_t *, void *);
+
/*
* sdb_connection_enable_logging:
* Enable logging of connection-related messages to the current client
/*
* sdb_connection_accpet:
* Accept a new connection on the specified file-descriptor 'fd' and return a
- * newly allocated connection object.
+ * newly allocated connection object. If specified, the setup callback is used
+ * to setup the newly created connection. It will receive the connection
+ * object and the specified user data as its arguments.
*
* Returns:
* - 0 on success
* - a negative value else
*/
sdb_conn_t *
-sdb_connection_accept(int fd);
+sdb_connection_accept(int fd, sdb_conn_setup_cb setup, void *user_data);
/*
* sdb_connection_close:
int
sdb_connection_ping(sdb_conn_t *conn);
+/*
+ * sdb_connection_server_version:
+ * Send back the backend server version to the connected client.
+ *
+ * Returns:
+ * - 0 on success
+ * - a negative value else
+ */
+int
+sdb_connection_server_version(sdb_conn_t *conn);
+
/*
* sdb_fe_parse:
* Parse the query text specified in 'query' of length 'len' and return a list