summaryrefslogtreecommitdiff
path: root/event-httpd.h
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2021-04-16 14:01:05 +0100
committerRussell King <rmk@armlinux.org.uk>2021-04-16 14:01:05 +0100
commit9d7b0311d5948fca09b19dbe27e5f506e2e303e0 (patch)
tree1accaf615f2f744232fceed6a9a8ceca6cde7c53 /event-httpd.h
event-httpd: add event httpd support
Add event httpd, which is a small and basic http server designed to provide server sent events to clients. The server accepts updates through a simple "UPDATE" method which are then broadcast to clients listening using the "GET" method. Signed-off-by: Russell King <rmk@armlinux.org.uk>
Diffstat (limited to 'event-httpd.h')
-rw-r--r--event-httpd.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/event-httpd.h b/event-httpd.h
new file mode 100644
index 0000000..7818bd5
--- /dev/null
+++ b/event-httpd.h
@@ -0,0 +1,28 @@
+// Copyright (C) 2021 Russell King.
+// Licensed under GPL version 2. See COPYING.
+#ifndef MINI_HTTPD_H
+#define MINI_HTTPD_H
+
+struct client {
+ GSocketConnection *conn;
+ GDataInputStream *data;
+ GOutputStream *out;
+ GInputStream *in;
+
+ gboolean forwarded;
+ gboolean can_chunk;
+ char *request;
+ char *uri;
+ char *query;
+ char *version;
+
+ struct resource *resource;
+ void *resource_data;
+};
+
+void close_client(struct client *c);
+void respond_header(struct client *c, int error_code, const char *reason,
+ const char *headers);
+void respond_chunk(struct client *c, GString *s);
+
+#endif