aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/protocol.h b/src/protocol.h
new file mode 100644
index 0000000..de7cb3a
--- /dev/null
+++ b/src/protocol.h
@@ -0,0 +1,30 @@
+#ifndef BOKF_PROTOCOL_H
+#define BOKF_PROTOCOL_H
+
+#include <sqlite3.h>
+#include <stdint.h>
+
+#include "sessions.h"
+#include "yyjson.h"
+
+struct req {
+ sqlite3 *db;
+ yyjson_mut_doc *rdoc;
+ const char *id;
+ const char *cmd;
+ struct session *sess;
+ int64_t org_id;
+ int has_org;
+ int is_admin;
+ const char *role;
+ int dry_run;
+ yyjson_val *args;
+ const char *err_code;
+ char err_msg[512];
+ yyjson_mut_val *err_details;
+};
+
+/* Returns a malloc'd response line (no trailing newline). */
+char *protocol_handle_line(sqlite3 *db, const char *line, size_t len);
+
+#endif