aboutsummaryrefslogtreecommitdiff
path: root/client/libacron/apps/helloworld/net.h
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-07-23 13:29:24 -0700
committerTrumeet <yuuta@yuuta.moe>2022-07-23 13:29:24 -0700
commitdf85b736cea32bd04e4a80042b9b3c67642d57ba (patch)
tree002d2aa14a31ac7e2cd210e78157a449ac96fb35 /client/libacron/apps/helloworld/net.h
parent34c53bc3d396934df94431f7b76972180b1b0a8c (diff)
downloadacron-df85b736cea32bd04e4a80042b9b3c67642d57ba.tar
acron-df85b736cea32bd04e4a80042b9b3c67642d57ba.tar.gz
acron-df85b736cea32bd04e4a80042b9b3c67642d57ba.tar.bz2
acron-df85b736cea32bd04e4a80042b9b3c67642d57ba.zip
refactor(acronc): rename acronc to helloworld
Signed-off-by: Trumeet <yuuta@yuuta.moe>
Diffstat (limited to 'client/libacron/apps/helloworld/net.h')
-rw-r--r--client/libacron/apps/helloworld/net.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/client/libacron/apps/helloworld/net.h b/client/libacron/apps/helloworld/net.h
new file mode 100644
index 0000000..1a49709
--- /dev/null
+++ b/client/libacron/apps/helloworld/net.h
@@ -0,0 +1,45 @@
+/*
+ * Created by yuuta on 7/23/22.
+ */
+
+#ifndef ACRONC_NET_H
+#define ACRONC_NET_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef WIN32
+#include <winsock2.h>
+
+#else
+
+#define SOCKET int
+
+#endif
+
+#define NET_CLOSED -2
+#define NET_TIMEOUT -1
+
+int net_connect(const char *host,
+ uint16_t port,
+ SOCKET *sock);
+
+int net_read(const SOCKET *sock,
+ void *buffer,
+ size_t length,
+ size_t *read,
+ unsigned int timeout);
+
+int net_send(const SOCKET *sock,
+ const void *buffer,
+ size_t len);
+
+void net_close(const SOCKET *sock);
+
+int net_init(void);
+
+void net_free(void);
+
+char *net_strerror(int errnum);
+
+#endif /* ACRONC_NET_H */