summaryrefslogtreecommitdiff
path: root/src/ot_http.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ot_http.h')
-rw-r--r--src/ot_http.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/ot_http.h b/src/ot_http.h
new file mode 100644
index 0000000..fb56c64
--- /dev/null
+++ b/src/ot_http.h
@@ -0,0 +1,53 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
4#ifndef OT_HTTP_H__
5#define OT_HTTP_H__
6
7#include <stdint.h>
8#include <sys/types.h>
9#include <sys/uio.h>
10
11#include "ot_batch.h"
12#include "ot_event.h"
13#include "ot_buf.h"
14#include "trackerlogic.h"
15
16typedef enum {
17 STRUCT_HTTP_FLAG_WAITINGFORTASK = 1,
18 STRUCT_HTTP_FLAG_GZIP = 2,
19 STRUCT_HTTP_FLAG_BZIP2 = 4,
20 STRUCT_HTTP_FLAG_ZSTD = 8,
21 STRUCT_HTTP_FLAG_CHUNKED = 16,
22 STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER = 32,
23 STRUCT_HTTP_FLAG_KEEPALIVE = 64,
24 STRUCT_HTTP_FLAG_ONSTACK = 128
25} STRUCT_HTTP_FLAG;
26
27struct http_data {
28 ot_buf request;
29 int interest; /* EVENT_IN and EVENT_OUT as asked for */
30 ot_batch *batch;
31 ot_ip6 ip;
32 STRUCT_HTTP_FLAG flag;
33};
34
35/* What this connection is waiting for: EVENT_IN, EVENT_OUT, or nothing */
36void http_interest_set(const int64_t s, struct http_data *cookie, int what);
37
38/* Close a connection and release everything that belongs to it */
39void http_close(const int64_t s);
40
41/* Promote a stack cookie to a heap one, for persistence and for handing it
42 over to the event loop or to another thread. Does nothing to one that is
43 already on the heap. Returns the connection's state, or NULL. */
44struct http_data *http_adopt(const int64_t s);
45
46ssize_t http_handle_request(const int64_t s, struct ot_workstruct *ws);
47ssize_t http_sendiovecdata(const int64_t s, struct ot_workstruct *ws, size_t iovec_entries, struct iovec *iovector, int is_partial);
48ssize_t http_issue_error(const int64_t s, struct ot_workstruct *ws, int code);
49
50extern const char *g_stats_path;
51extern ssize_t g_stats_path_len;
52
53#endif