From ad541c67761b8aa6da1566802c347cac4018d0c2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 20:50:24 +0100 Subject: Move the build sources into src/ --- src/ot_http.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/ot_http.h (limited to 'src/ot_http.h') 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 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. */ + +#ifndef OT_HTTP_H__ +#define OT_HTTP_H__ + +#include +#include +#include + +#include "ot_batch.h" +#include "ot_event.h" +#include "ot_buf.h" +#include "trackerlogic.h" + +typedef enum { + STRUCT_HTTP_FLAG_WAITINGFORTASK = 1, + STRUCT_HTTP_FLAG_GZIP = 2, + STRUCT_HTTP_FLAG_BZIP2 = 4, + STRUCT_HTTP_FLAG_ZSTD = 8, + STRUCT_HTTP_FLAG_CHUNKED = 16, + STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER = 32, + STRUCT_HTTP_FLAG_KEEPALIVE = 64, + STRUCT_HTTP_FLAG_ONSTACK = 128 +} STRUCT_HTTP_FLAG; + +struct http_data { + ot_buf request; + int interest; /* EVENT_IN and EVENT_OUT as asked for */ + ot_batch *batch; + ot_ip6 ip; + STRUCT_HTTP_FLAG flag; +}; + +/* What this connection is waiting for: EVENT_IN, EVENT_OUT, or nothing */ +void http_interest_set(const int64_t s, struct http_data *cookie, int what); + +/* Close a connection and release everything that belongs to it */ +void http_close(const int64_t s); + +/* Promote a stack cookie to a heap one, for persistence and for handing it + over to the event loop or to another thread. Does nothing to one that is + already on the heap. Returns the connection's state, or NULL. */ +struct http_data *http_adopt(const int64_t s); + +ssize_t http_handle_request(const int64_t s, struct ot_workstruct *ws); +ssize_t http_sendiovecdata(const int64_t s, struct ot_workstruct *ws, size_t iovec_entries, struct iovec *iovector, int is_partial); +ssize_t http_issue_error(const int64_t s, struct ot_workstruct *ws, int code); + +extern const char *g_stats_path; +extern ssize_t g_stats_path_len; + +#endif -- cgit v1.3