diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-14 16:21:21 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-14 16:21:21 +0200 |
commit | f58ed35f0b73e933b6dd1f98472941c1d5d7ce9c (patch) | |
tree | c547ca4338fe04f4117b390eec6c855c9c3abef6 /shared/protocol.h | |
parent | 137f62eb368101dd0371f0c54e1a4a2a7be48890 (diff) |
request handler function executed
Diffstat (limited to 'shared/protocol.h')
-rw-r--r-- | shared/protocol.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/shared/protocol.h b/shared/protocol.h index 3082af4..a19fe48 100644 --- a/shared/protocol.h +++ b/shared/protocol.h @@ -115,16 +115,19 @@ ws_s_bin* ws_protocol_req_last_records(unsigned int record_amount); * command, and returns the response string * * @param parsed_cmd complete parsed command from ws_protocol_parse_* - * - * @return ws_s_bin containing response string + * @param response response struct with uninitialized pointer to msg */ -ws_s_bin* ws_protocol_res_last_records(ws_s_protocol_parsed_cmd* parsed_cmd); +void ws_protocol_res_last_records(ws_s_protocol_parsed_cmd* parsed_cmd, ws_s_protocol_response* response); +/** @brief cmd codes (used to call handlers) */ typedef enum { + WS_PROTOCOL_CMD_UNKNOWN = -1, + WS_PROTOCOL_CMD_LAST_RECORDS = 0, } ws_e_protocol_cmd; -static ws_s_bin* (*g_ws_protocol_res_handlers[WS_PROTOCOL_CMD_AMOUNT])(ws_s_protocol_parsed_cmd* parsed_cmd) = { +/** @brief response handlers, called when a command is parsed */ +static void (*g_ws_protocol_res_handlers[WS_PROTOCOL_CMD_AMOUNT])(ws_s_protocol_parsed_cmd*, ws_s_protocol_response*) = { [WS_PROTOCOL_CMD_LAST_RECORDS] = &ws_protocol_res_last_records }; |