34 lines
662 B
C
34 lines
662 B
C
#ifndef LANDER_HTTP_LOOP
|
|
#define LANDER_HTTP_LOOP
|
|
|
|
#include "event_loop.h"
|
|
#include "http_req.h"
|
|
#include "trie.h"
|
|
|
|
/*
|
|
* Global context passed to every connection using the same pointer
|
|
*/
|
|
typedef struct http_loop_gctx {
|
|
Trie *trie;
|
|
} http_loop_gctx;
|
|
|
|
http_loop_gctx *http_loop_gctx_init();
|
|
|
|
/*
|
|
* Invidivual context initialized for every connection
|
|
*/
|
|
typedef struct http_loop_ctx {
|
|
http_request req;
|
|
http_loop_gctx *g;
|
|
} http_loop_ctx;
|
|
|
|
http_loop_ctx *http_loop_ctx_init(http_loop_gctx *g);
|
|
|
|
void http_loop_ctx_free(http_loop_ctx *ctx);
|
|
|
|
bool http_loop_handle_request(event_loop_conn *conn);
|
|
|
|
event_loop *http_loop_init(http_loop_gctx *gctx);
|
|
|
|
#endif
|