aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
new file mode 100644
index 0000000..31150e8
--- /dev/null
+++ b/src/net.h
@@ -0,0 +1,20 @@
+#ifndef __NET_H__
+#define __NET_H__
+
+#include <stdlib.h>
+
+int bind_to_port(const char *port);
+
+typedef int (*connection_handler)(int fd, void *arg);
+int accept_connection(int fd, connection_handler, void *arg);
+
+int connect_to_host(const char *host, const char *port);
+
+int send_all(int fd, const void *, size_t);
+int send_buf(int fd, const void *, size_t);
+
+int recv_all(int fd, void *, size_t);
+int recv_buf(int fd, void **, size_t *);
+int recv_static(int fd, void *, size_t);
+
+#endif