feat(lnm): wrote part of context code
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
e04f6e170e
commit
d119f85260
4 changed files with 94 additions and 2 deletions
|
|
@ -18,16 +18,26 @@ typedef enum lnm_step_err {
|
|||
lnm_step_err_done = 0,
|
||||
lnm_step_err_io_needed,
|
||||
lnm_step_err_close,
|
||||
lnm_step_err_res,
|
||||
} lnm_step_err;
|
||||
|
||||
typedef lnm_step_err (*lnm_http_step_fn)(lnm_http_conn *conn);
|
||||
|
||||
typedef lnm_err (*lnm_http_ctx_init_fn)(void **c_ctx, void *gctx);
|
||||
|
||||
typedef void (*lnm_http_ctx_reset_fn)(void *c_ctx);
|
||||
|
||||
typedef void (*lnm_http_ctx_free_fn)(void *c_ctx);
|
||||
|
||||
/**
|
||||
* Initialize a new `lnm_http_loop`.
|
||||
*
|
||||
* @param out where to store pointer to new `lnm_http_loop`
|
||||
*/
|
||||
lnm_err lnm_http_loop_init(lnm_http_loop **out);
|
||||
lnm_err lnm_http_loop_init(lnm_http_loop **out, void *c_gctx,
|
||||
lnm_http_ctx_init_fn ctx_init,
|
||||
lnm_http_ctx_reset_fn ctx_reset,
|
||||
lnm_http_ctx_free_fn ctx_free);
|
||||
|
||||
/**
|
||||
* Append the given step fn to the step.
|
||||
|
|
@ -82,6 +92,9 @@ typedef struct lnm_http_loop_gctx {
|
|||
lnm_http_route **arr;
|
||||
size_t len;
|
||||
} routes;
|
||||
lnm_http_ctx_init_fn ctx_init;
|
||||
lnm_http_ctx_reset_fn ctx_reset;
|
||||
lnm_http_ctx_free_fn ctx_free;
|
||||
void *c;
|
||||
} lnm_http_loop_gctx;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue