summaryrefslogtreecommitdiff
path: root/src/commands.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.h')
-rw-r--r--src/commands.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/commands.h b/src/commands.h
new file mode 100644
index 0000000..d04affc
--- /dev/null
+++ b/src/commands.h
@@ -0,0 +1,33 @@
+#ifndef BOKF_COMMANDS_H
+#define BOKF_COMMANDS_H
+
+#include <stddef.h>
+
+#include "protocol.h"
+
+enum cmd_perm {
+ PERM_PUBLIC = 0,
+ PERM_READ,
+ PERM_WRITE,
+ PERM_OWNER,
+ PERM_ADMIN
+};
+
+struct command {
+ const char *name;
+ const char *summary;
+ enum cmd_perm perm;
+ int need_org;
+ int mutating;
+ int dry_run;
+ yyjson_mut_val *(*fn)(struct req *r);
+};
+
+extern const struct command g_commands[];
+extern const size_t g_commands_count;
+
+const struct command *command_find(const char *name);
+const char *perm_name(enum cmd_perm p);
+const char *perm_scope(enum cmd_perm p);
+
+#endif