summaryrefslogtreecommitdiff
path: root/mq_cmd.h
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2016-12-15 19:17:14 +0000
committerZoRo <dos21h@gmail.com>2016-12-15 19:17:14 +0000
commita588aa017512d3cc70dde6627d1218020e755259 (patch)
treea070cd171d18f3efbaedb7cfa0f9d54e2bb3b362 /mq_cmd.h
downloadagni-a588aa017512d3cc70dde6627d1218020e755259.tar.gz
agni-a588aa017512d3cc70dde6627d1218020e755259.zip
Initial commit
Diffstat (limited to 'mq_cmd.h')
-rw-r--r--mq_cmd.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/mq_cmd.h b/mq_cmd.h
new file mode 100644
index 0000000..ef255d9
--- /dev/null
+++ b/mq_cmd.h
@@ -0,0 +1,29 @@
+#ifndef __AGNI_MQ_CMD_H
+#define __AGNI_MQ_CMD_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.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);
+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 \ No newline at end of file