74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
#ifndef LANDER
|
|
#define LANDER
|
|
|
|
#include "http_loop.h"
|
|
#include "lsm/store.h"
|
|
|
|
extern http_route lander_routes[6];
|
|
|
|
typedef struct lander_gctx {
|
|
const char *data_dir;
|
|
Trie *trie;
|
|
lsm_store *store;
|
|
|
|
} lander_gctx;
|
|
|
|
typedef struct lander_ctx {
|
|
lsm_entry_handle *entry;
|
|
uint64_t remaining_data;
|
|
} lander_ctx;
|
|
|
|
typedef enum lander_attr_type : uint8_t {
|
|
lander_attr_type_entry_type = 0,
|
|
lander_attr_type_content_type = 1,
|
|
lander_attr_type_url = 2,
|
|
} lander_attr_type;
|
|
|
|
typedef enum lander_entry_type : uint8_t {
|
|
lander_entry_type_redirect = 0,
|
|
lander_entry_type_paste = 1,
|
|
lander_entry_type_file = 2,
|
|
} lander_entry_type;
|
|
|
|
void *lander_gctx_init();
|
|
|
|
void *lander_ctx_init();
|
|
|
|
void lander_ctx_reset(lander_ctx *ctx);
|
|
|
|
void lander_ctx_free(lander_ctx *ctx);
|
|
|
|
bool lander_get_index(event_loop_conn *conn);
|
|
|
|
bool lander_get_entry(event_loop_conn *conn);
|
|
|
|
bool lander_post_redirect(event_loop_conn *conn);
|
|
|
|
bool lander_post_paste(event_loop_conn *conn);
|
|
|
|
bool lander_post_paste_lsm(event_loop_conn *conn);
|
|
|
|
bool lander_post_redirect_lsm(event_loop_conn *conn);
|
|
|
|
bool lander_stream_body_to_entry(event_loop_conn *conn);
|
|
|
|
bool lander_stream_body_to_client(event_loop_conn *conn);
|
|
|
|
bool lander_get_entry_lsm(event_loop_conn *conn);
|
|
|
|
bool lander_post_redirect_body_to_attr(event_loop_conn *conn);
|
|
|
|
bool lander_remove_entry(event_loop_conn *conn);
|
|
|
|
bool lander_post_file_lsm(event_loop_conn *conn);
|
|
|
|
/**
|
|
* Parse any custom headers and add them as attributes to the context's LSM
|
|
* entry
|
|
*/
|
|
bool lander_headers_to_attrs(event_loop_conn *conn);
|
|
|
|
bool lander_attrs_to_headers(event_loop_conn *conn);
|
|
|
|
#endif
|