diff options
author | ZoRo <dos21h@gmail.com> | 2017-02-08 22:39:58 +0000 |
---|---|---|
committer | ZoRo <dos21h@gmail.com> | 2017-02-08 22:39:58 +0000 |
commit | abfd02fc7233734ffcc3c396efcbedddfba49727 (patch) | |
tree | fdc01c94c36aa93967f09f53b5a72f3b8d4bf074 /mq_cmd.h | |
parent | 0397a4c9dee0300e0ee843fe85aa4c2d77630758 (diff) | |
download | agni-abfd02fc7233734ffcc3c396efcbedddfba49727.tar.gz agni-abfd02fc7233734ffcc3c396efcbedddfba49727.zip |
Updated command parser. Event loop now support test commands
Diffstat (limited to 'mq_cmd.h')
-rw-r--r-- | mq_cmd.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -14,15 +14,32 @@ typedef struct mq_cmd size_t sz; } mq_cmd; +/* +BASIC oprations over structure, create,destroy,get data +*/ mq_cmd* mq_cmd_create(int id, char *cmd, size_t cmd_sz, char *param, size_t param_sz); +//create new command from string, can set id, parsed id could be different mq_cmd* mq_cmd_creates(char *str, size_t sz, int id); -int mq_cmd_id(mq_cmd *cmd, int *id); -char* mq_cmd_cmd(mq_cmd *cmd, char **buf, size_t *sz); +//parse param from buffer +int mq_cmd_id(mq_cmd *cmd); +//parse command from buffer +int mq_cmd_cmd(mq_cmd *cmd, char **buf, size_t *sz); +//parse command param from buffer int mq_cmd_param(mq_cmd *cmd, char **param, size_t *sz); +//return buffer size size_t mq_cmd_size(mq_cmd *cmd); char *mq_cmd_buf(mq_cmd *cmd); void mq_cmd_free(mq_cmd *mq); +/* +ADVANCED opeartions over data +*/ +//compare with some values +//0 - same, -1 not same values +int mq_cmd_o_cmp_param(mq_cmd *cmd, char *str); +int mq_cmd_o_cmp_cmd( mq_cmd *cmd, char *str); +int mq_cmd_o_cmp_id( mq_cmd *cmd, int id); + #define CMD_CREATE(ID,CMD,PARAM) mq_cmd_create(ID,CMD,strlen(CMD),PARAM,strlen(PARAM)); |