summaryrefslogtreecommitdiffstats
path: root/src/ncmd.h
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-04-17 21:02:35 -0400
committerrsiddharth <s@ricketyspace.net>2020-04-17 21:02:35 -0400
commitb924fc2f66d46ee10aa3b800a6521d3940919f9f (patch)
tree130a19d8211874e3ba01203af0d2332506106be4 /src/ncmd.h
parent1bab8e87d3875f672e7c36d10aea9e05f657c664 (diff)
nserver/ -> ./
Diffstat (limited to 'src/ncmd.h')
-rw-r--r--src/ncmd.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/ncmd.h b/src/ncmd.h
new file mode 100644
index 0000000..025a06f
--- /dev/null
+++ b/src/ncmd.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright © 2020 rsiddharth <s@ricketyspace.net>
+ */
+
+#ifndef _ncmd_h
+#define _ncmd_h
+
+#include <string.h>
+
+#include <bstrlib.h>
+#include <dbg.h>
+#include <protocol.h>
+
+#define CMD_MIN_SIZE 5
+#define CMD_MAX_SIZE 120
+#define RSP_SIZE 200
+
+enum FUNCTIONS {
+ NS_CREATE,
+ NS_SAMPLE,
+ NS_MEAN,
+ NS_DUMP,
+ NS_DELETE,
+ NS_LIST,
+ NS_STORE,
+ NS_LOAD,
+ NS_NOP = -1
+};
+
+int sanitize(char *cmd);
+int check_cmd(char *cmd, char *err);
+
+struct bstrList *cmd_parts(char *cmd);
+
+int find_function(struct bstrList *cmd_parts);
+int call_function(int func, struct bstrList *cmd_parts, char *out);
+
+int process(char *cmd, char *out);
+
+#endif