aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/server.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-25 10:47:06 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-25 10:56:03 +0200
commit08ee3cab641f367b642bc29f6540de6be85226bd (patch)
tree887f517cbec643ab90c5647d76c26e7fb024b8cc /src/server.h
parentmsg: add msg_dump_unknown (diff)
downloadcimple-08ee3cab641f367b642bc29f6540de6be85226bd.tar.gz
cimple-08ee3cab641f367b642bc29f6540de6be85226bd.zip
net: rework API
First, rename all API functions so that they start with net_. Second, abstract the basic TCP server functionality into tcp_server.c. This includes reworking net_accept so that it's a simple blocking operation, and putting the callback stuff to tcp_server.c. Also, the server now uses detached threads instead of fork(), since I want connection handlers to share memory.
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server.h b/src/server.h
index 8a46314..11c409b 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1,12 +1,14 @@
#ifndef __SERVER_H__
#define __SERVER_H__
+#include "tcp_server.h"
+
struct settings {
const char *port;
};
struct server {
- int fd;
+ struct tcp_server tcp_server;
};
int server_create(struct server *, const struct settings *);