feat(lnm): wrote rest of event loop
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
8a3be2b07c
commit
f79ba2818c
5 changed files with 141 additions and 7 deletions
|
|
@ -22,6 +22,7 @@ typedef enum {
|
|||
lnm_err_failed_alloc,
|
||||
lnm_err_failed_network,
|
||||
lnm_err_failed_poll,
|
||||
lnm_err_not_setup,
|
||||
} lnm_err;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ typedef struct {
|
|||
struct {
|
||||
char buf[LNM_LOOP_BUF_SIZE];
|
||||
size_t size;
|
||||
size_t written;
|
||||
} w;
|
||||
} lnm_loop_conn;
|
||||
|
||||
typedef struct {
|
||||
int listen_fd;
|
||||
struct {
|
||||
lnm_loop_conn **arr;
|
||||
size_t len;
|
||||
|
|
@ -40,12 +40,16 @@ typedef struct {
|
|||
void *gctx;
|
||||
lnm_err (*ctx_init)(void **out, void *gctx);
|
||||
void (*ctx_free)(void *ctx);
|
||||
void (*data_read)(lnm_loop_conn *conn);
|
||||
void (*data_write)(lnm_loop_conn *conn);
|
||||
} lnm_loop;
|
||||
|
||||
lnm_err lnm_loop_init(lnm_loop **out, void *gctx,
|
||||
lnm_err (*ctx_init)(void **out, void *gctx),
|
||||
void (*ctx_free)(void *ctx));
|
||||
|
||||
lnm_err lnm_loop_run(lnm_loop *l, uint16_t port);
|
||||
lnm_err lnm_loop_setup(lnm_loop *l, uint16_t port);
|
||||
|
||||
lnm_err lnm_loop_run(lnm_loop *l);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue