From 0ede4f54f0b667836ce133d4ae586334c53b0fe0 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 15 Sep 2014 19:44:13 +0200 Subject: [PATCH] frontend/proto: Let CONNECTION_DATA not replace CONNECTION_ERROR. Instead, reserve some space for groups of status/state codes and then use a new number / block for CONNECTION_DATA. --- src/include/frontend/proto.h | 46 +++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/include/frontend/proto.h b/src/include/frontend/proto.h index c006c49..feac946 100644 --- a/src/include/frontend/proto.h +++ b/src/include/frontend/proto.h @@ -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 @@ -109,6 +95,28 @@ typedef enum { * | 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 +199,7 @@ typedef enum { * CONNECTION_EXPR: * A parsed expression. Only used internally. */ - CONNECTION_EXPR, + CONNECTION_EXPR = 100, } sdb_conn_state_t; #ifdef __cplusplus -- 2.30.2