#ifndef __AGNI_MQ_CMD_H #define __AGNI_MQ_CMD_H #include #include #include #include "debug.h" typedef struct mq_cmd { int id; char *buf; size_t sz; } mq_cmd; mq_cmd* mq_cmd_create(int id, char *cmd, size_t cmd_sz, char *param, size_t param_sz); mq_cmd* mq_cmd_creates(char *str, size_t sz); int mq_cmd_id(mq_cmd *cmd, int *id); char* mq_cmd_cmd(mq_cmd *cmd, char **buf, size_t *sz); int mq_cmd_param(mq_cmd *cmd, char **param, size_t *sz); size_t mq_cmd_size(mq_cmd *cmd); char *mq_cmd_buf(mq_cmd *cmd); void mq_cmd_free(mq_cmd *mq); #define CMD_CREATE(ID,CMD,PARAM) mq_cmd_create(ID,CMD,strlen(CMD),PARAM,strlen(PARAM)); #define CMD_FREE(CMD_T) mq_cmd_free(CMD_T); #endif