2023-05-29 21:46:05 +02:00
|
|
|
#ifndef LANDER
|
|
|
|
#define LANDER
|
|
|
|
|
|
|
|
#include "http_loop.h"
|
2023-11-03 14:10:14 +01:00
|
|
|
#include "lsm/store.h"
|
2023-05-29 21:46:05 +02:00
|
|
|
|
2023-05-30 10:17:46 +02:00
|
|
|
extern http_route lander_routes[4];
|
2023-05-29 23:26:15 +02:00
|
|
|
|
2023-10-30 21:14:06 +01:00
|
|
|
typedef struct lander_gctx {
|
|
|
|
const char *data_dir;
|
|
|
|
Trie *trie;
|
2023-11-03 14:10:14 +01:00
|
|
|
lsm_store *store;
|
|
|
|
|
2023-10-30 21:14:06 +01:00
|
|
|
} lander_gctx;
|
|
|
|
|
|
|
|
typedef struct lander_ctx {
|
2023-11-03 14:10:14 +01:00
|
|
|
lsm_entry_handle *entry;
|
|
|
|
uint64_t remaining_data;
|
2023-10-30 21:14:06 +01:00
|
|
|
} lander_ctx;
|
|
|
|
|
2023-11-08 13:42:46 +01:00
|
|
|
typedef enum lander_attr_type : uint8_t {
|
|
|
|
lander_attr_type_entry_type = 0,
|
|
|
|
lander_attr_type_content_type = 1,
|
|
|
|
lander_attr_type_url = 2,
|
2023-11-08 12:25:47 +01:00
|
|
|
} lander_attr_type;
|
|
|
|
|
2023-11-09 21:07:51 +01:00
|
|
|
typedef enum lander_entry_type : uint8_t {
|
2023-11-03 14:10:14 +01:00
|
|
|
lander_entry_type_redirect = 0,
|
|
|
|
lander_entry_type_paste = 1,
|
|
|
|
} lander_entry_type;
|
|
|
|
|
2023-10-30 21:14:06 +01:00
|
|
|
void *lander_gctx_init();
|
|
|
|
|
|
|
|
void *lander_ctx_init();
|
|
|
|
|
|
|
|
void lander_ctx_reset(lander_ctx *ctx);
|
|
|
|
|
|
|
|
void lander_ctx_free(lander_ctx *ctx);
|
|
|
|
|
2023-05-30 09:37:40 +02:00
|
|
|
bool lander_get_index(event_loop_conn *conn);
|
|
|
|
|
|
|
|
bool lander_get_entry(event_loop_conn *conn);
|
|
|
|
|
2023-05-29 23:26:15 +02:00
|
|
|
bool lander_post_redirect(event_loop_conn *conn);
|
2023-05-29 21:46:05 +02:00
|
|
|
|
2023-05-30 10:17:46 +02:00
|
|
|
bool lander_post_paste(event_loop_conn *conn);
|
|
|
|
|
2023-11-03 14:10:14 +01:00
|
|
|
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);
|
|
|
|
|
2023-11-08 11:19:33 +01:00
|
|
|
bool lander_post_redirect_body_to_attr(event_loop_conn *conn);
|
|
|
|
|
2023-05-29 21:46:05 +02:00
|
|
|
#endif
|