index 2fabad513b06e5c156c021617262606de628c7f2..3819e3f07ce953309c73265a8f81c82a9fd5e924 100644 (file)
* message body depends on the message type. Both, the message type and length
* are stored in an unsigned 32bit integer in network byte-order.
*
+ * Any strings in the message body may not include a zero byte.
+ *
* 1 3 4 6
* 0 6 2 8 4
* +-------------------------------+-------------------------------+
*
* 0 32 64
* +---------------+---------------+
- * | message type | length |
+ * | OK | len(msg) |
* +---------------+---------------+
* | optional status message ... |
*/
*
* 0 32 64
* +---------------+---------------+
- * | message type | length |
+ * | ERROR | len(msg) |
* +---------------+---------------+
* | error message ... |
*/
*
* 0 32 64
* +---------------+---------------+
- * | message type | length |
+ * | LOG | length |
* +---------------+---------------+
* | log priority | log message |
* +---------------+ |
* contain the type of the data and the result encoded as a JSON string.
* The type is the same as the command code of the respective command (see
* below) and is stored as an unsigned 32bit integer in network
- * byte-order. The result may be empty (but the type is still included).
+ * byte-order. The result may be empty (but the type is still included) if
+ * the query did not return any result. The type and the result message
+ * are empty on empty commands.
*
* 0 32 64
* +---------------+---------------+
- * | message type | length |
+ * | DATA | length |
* +---------------+---------------+
* | result type | result ... |
* +---------------+ |
/*
* CONNECTION_PING:
* Check if the current connection is still alive. The server will reply
- * with CONNECTION_OK if it was able to handle the command.
+ * with CONNECTION_OK and an empty message body if it was able to handle
+ * the command.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | PING | 0 |
+ * +---------------+---------------+
*/
CONNECTION_PING,
* the server using special messages specific to the authentication
* method. The server does not send any asynchronous messages before
* startup is complete.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | STARTUP | len(username) |
+ * +---------------+---------------+
+ * | username ... |
*/
CONNECTION_STARTUP,
* CONNECTION_QUERY:
* Execute a query in the server. The message body shall include a single
* query command as a text string. Multiple commands are ignored by the
- * server entirely.
+ * server entirely to protect against injection attacks.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | QUERY | len(query) |
+ * +---------------+---------------+
+ * | query string ... |
*/
CONNECTION_QUERY,
/*
* CONNECTION_FETCH:
* Execute the 'FETCH' command in the server. The message body shall
- * include the hostname of the host to be retrieved.
+ * include the type and the identifier of the object to be retrieved.
+ * Hosts are identified by their name. Other types are not supported yet.
+ * The type is encoded as a 32bit integer in network byte-order.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | FETCH | length |
+ * +---------------+---------------+
+ * | object type | identifier |
+ * +---------------+ |
+ * | ... |
*/
CONNECTION_FETCH,
/*
* CONNECTION_LIST:
- * Execute the 'LIST' command in the server.
+ * Execute the 'LIST' command in the server. The message body may include
+ * the type of the objects to be listed, encoded as a 32bit integer in
+ * network byte-order. The response includes all hosts and the respective
+ * child objects. By default, all hosts are listed.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | LIST | length |
+ * +---------------+---------------+
+ * | [object type] |
+ * +---------------+
*/
CONNECTION_LIST,
/*
* CONNECTION_LOOKUP:
* Execute the 'LOOKUP' command in the server. The message body shall
- * include the conditional expression of the 'MATCHING' clause.
+ * include the type of the objects to look up and a string representing
+ * the conditional expression of the 'MATCHING' clause. The type is
+ * encoded as a 32bit integer in network byte-order.
+ *
+ * 0 32 64
+ * +---------------+---------------+
+ * | LOOKUP | length |
+ * +---------------+---------------+
+ * | object type | matching |
+ * +---------------+ |
+ * | clause ... |
*/
CONNECTION_LOOKUP,
* Command subcomponents.
*/
+ /*
+ * CONNECTION_MATCHER:
+ * A parsed matcher. Only used internally.
+ */
+ CONNECTION_MATCHER = 100,
+
/*
* CONNECTION_EXPR:
* A parsed expression. Only used internally.
*/
- CONNECTION_EXPR = 100,
+ CONNECTION_EXPR,
} sdb_conn_state_t;
#ifdef __cplusplus