commit f08ce15036f28d3b846c5cda72ca44c5e4bfe28b
parent 2c0ae0ae4a70c9946ff4d03d716743d8760e4d56
Author: Yersa Nordman <yersa@finwo.nl>
Date: Wed, 26 Jul 2023 22:26:58 +0200
Added fnet_step and fnet_main outline
Diffstat:
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/fnet.c b/src/fnet.c
@@ -37,7 +37,7 @@ struct fnet_t * fnet_listen(const char *address, uint16_t port, struct fnet_conn
// Check if we support the protocol
switch(options->proto) {
case FNET_PROTO_TCP:
- // TODO: something
+ // Intentionally empty
break;
default:
fprintf(stderr, "fnet_listen: unknown protocol\n");
@@ -72,6 +72,9 @@ void fnet_process(struct fnet_t *connection) {
}
}
+
+
+
void fnet_write(struct fnet_t *connection, struct buf *buf) {
struct fnet_internal_t *conn = (struct fnet_internal_t *)connection;
@@ -109,6 +112,18 @@ void fnet_free(struct fnet_t *connection) {
free(conn);
}
+void fnet_step() {
+ // TODO: process all open fnet instances
+}
+
+void fnet_main() {
+ while(1) {
+ // TODO: handle kill signal?
+ fnet_step();
+ }
+}
+
+
#ifdef __cplusplus
} // extern "C"
diff --git a/src/fnet.h b/src/fnet.h
@@ -49,6 +49,9 @@ void fnet_write(struct fnet_t *connection, struct buf *buf);
void fnet_close(struct fnet_t *connection);
void fnet_free(struct fnet_t *connection);
+void fnet_step();
+void fnet_main();
+
#ifdef __cplusplus
}
#endif