summaryrefslogtreecommitdiff
path: root/include/uci/internals
diff options
context:
space:
mode:
Diffstat (limited to 'include/uci/internals')
-rw-r--r--include/uci/internals/command.h21
-rw-r--r--include/uci/internals/response.h24
2 files changed, 45 insertions, 0 deletions
diff --git a/include/uci/internals/command.h b/include/uci/internals/command.h
new file mode 100644
index 0000000..2994b04
--- /dev/null
+++ b/include/uci/internals/command.h
@@ -0,0 +1,21 @@
+#ifndef UCI_COMMAND_H
+#define UCI_COMMAND_H
+
+#define MAX_TOKEN_SIZE 32
+
+typedef struct {
+ char root[MAX_TOKEN_SIZE];
+ int args_count;
+ int args_capacity;
+ char* args;
+ bool empty;
+} uci_cmd_t;
+
+uci_cmd_t uci_cmd_init();
+void uci_cmd_add(uci_cmd_t *cmd, const char *token);
+void uci_cmd_set_root(uci_cmd_t *cmd, const char *token);
+void uci_cmd_append_arg(uci_cmd_t *cmd, const char *token);
+char *uci_cmd_get_arg(uci_cmd_t cmd, int i);
+void uci_cmd_deinit(uci_cmd_t cmd);
+
+#endif // UCI_COMMAND_H
diff --git a/include/uci/internals/response.h b/include/uci/internals/response.h
new file mode 100644
index 0000000..a0a6e99
--- /dev/null
+++ b/include/uci/internals/response.h
@@ -0,0 +1,24 @@
+#ifndef UCI_RESPONSE_H
+#define UCI_RESPONSE_H
+
+#include "uci/internals/command.h"
+#include "uci/state.h"
+
+enum {
+ UCI_STATE_INITIAL,
+ UCI_STATE_IDLE,
+ UCI_STATE_SYNC,
+ UCI_STATE_PING,
+ UCI_STATE_ACTIVE,
+ UCI_STATE_HALT,
+};
+
+void handle_uci(uci_state_t *state, uci_cmd_t cmd);
+void handle_initial(uci_state_t *state, uci_cmd_t cmd);
+void handle_idle(uci_state_t *state, uci_cmd_t cmd);
+void handle_sync(uci_state_t *state, uci_cmd_t cmd);
+void handle_ping(uci_state_t *state, uci_cmd_t cmd);
+void handle_active(uci_state_t *state, uci_cmd_t cmd);
+void handle_halt(uci_state_t *state, uci_cmd_t cmd);
+
+#endif // UCI_RESPONSE_H