aboutsummaryrefslogtreecommitdiffstats
path: root/include/dbs/event.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/dbs/event.h')
-rw-r--r--include/dbs/event.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/dbs/event.h b/include/dbs/event.h
new file mode 100644
index 0000000..6be3378
--- /dev/null
+++ b/include/dbs/event.h
@@ -0,0 +1,20 @@
+#ifndef __EVENT_H
+#define __EVENT_H
+
+#include <dbs/init.h>
+
+enum Event {
+#define E(ev_name, _) ev_name,
+#include <dbs/bits/events.h>
+#undef E
+};
+
+int ev_set_handler(enum Event event, int (*ev_handler)(cJSON*));
+
+#define declare_event(event, handler) \
+ void __decl_##event_##handler() { \
+ ev_set_handler(event, handler); \
+ } \
+ l3_initcall(__decl_##event_##handler)
+
+#endif