Code

frontend/proto: Include the log priority in LOG messages.
[sysdb.git] / src / include / frontend / proto.h
index c006c49afef15284c98d7da909b5654c8217952b..2fabad513b06e5c156c021617262606de628c7f2 100644 (file)
@@ -51,6 +51,10 @@ extern "C" {
 
 /* status codes returned to a client */
 typedef enum {
+       /*
+        * Generic status and log messages.
+        */
+
        /*
         * CONNECTION_OK:
         * Indicates that a command was successful. The message body will usually
@@ -65,24 +69,6 @@ typedef enum {
         */
        CONNECTION_OK = 0,
 
-       /*
-        * CONNECTION_DATA:
-        * Indicates that a data query was successful. The message body will
-        * 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).
-        *
-        * 0               32              64
-        * +---------------+---------------+
-        * | message type  | length        |
-        * +---------------+---------------+
-        * | result type   | result ...    |
-        * +---------------+               |
-        * | ...                           |
-        */
-       CONNECTION_DATA,
-
        /*
         * CONNECTION_ERROR:
         * Indicates that a command has failed. The message body will contain a
@@ -99,16 +85,40 @@ typedef enum {
        /*
         * CONNECTION_LOG:
         * Indicates an asynchronous log message. The message body will contain
-        * the message string providing informational or warning logs. Log
-        * messages may be sent to the client any time.
+        * the log priority (see utils/error.h) and message. Log messages may be
+        * sent to the client any time.
         *
         * 0               32              64
         * +---------------+---------------+
         * | message type  | length        |
         * +---------------+---------------+
-        * | log message ...               |
+        * | log priority  | log message   |
+        * +---------------+               |
+        * | ...                           |
         */
        CONNECTION_LOG,
+
+       /*
+        * Query-result specific messages.
+        */
+
+       /*
+        * CONNECTION_DATA:
+        * Indicates that a data query was successful. The message body will
+        * 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).
+        *
+        * 0               32              64
+        * +---------------+---------------+
+        * | message type  | length        |
+        * +---------------+---------------+
+        * | result type   | result ...    |
+        * +---------------+               |
+        * | ...                           |
+        */
+       CONNECTION_DATA = 100,
 } sdb_conn_status_t;
 
 /* accepted commands / state of the connection */
@@ -191,7 +201,7 @@ typedef enum {
         * CONNECTION_EXPR:
         * A parsed expression. Only used internally.
         */
-       CONNECTION_EXPR,
+       CONNECTION_EXPR = 100,
 } sdb_conn_state_t;
 
 #ifdef __cplusplus