summaryrefslogtreecommitdiff
path: root/code/fe310/eos/sock.h
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2019-10-19 19:40:32 +0200
committerUros Majstorovic <majstor@majstor.org>2019-10-19 19:40:32 +0200
commit3cbb9793bf5645f400545aeef904a48fe5dca64c (patch)
treea961a55b16d841d9dad8a573f0f6ec2514f8bd51 /code/fe310/eos/sock.h
parent97968cb17dee6d1d0e68149fe2fb71362cdc5851 (diff)
network sockets added
Diffstat (limited to 'code/fe310/eos/sock.h')
-rw-r--r--code/fe310/eos/sock.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/code/fe310/eos/sock.h b/code/fe310/eos/sock.h
new file mode 100644
index 0000000..8e9717d
--- /dev/null
+++ b/code/fe310/eos/sock.h
@@ -0,0 +1,24 @@
+#include <stdint.h>
+
+#define EOS_SOCK_MTYPE_PKT 0
+#define EOS_SOCK_MTYPE_OPEN_DGRAM 1
+#define EOS_SOCK_MTYPE_CLOSE 127
+
+#define EOS_SOCK_MAX_SOCK 2
+
+#define EOS_SOCK_SIZE_UDP_HDR 8
+
+#define EOS_IPv4_ADDR_SIZE 4
+
+typedef struct EOSNetAddr {
+ unsigned char host[EOS_IPv4_ADDR_SIZE];
+ uint16_t port;
+} EOSNetAddr;
+
+typedef void (*eos_sock_fptr_t) (unsigned char *, uint16_t);
+
+int eos_sock_open_udp(void);
+void eos_sock_close(int sock);
+int eos_sock_sendto(int sock, unsigned char *buffer, uint16_t size, unsigned char more, EOSNetAddr *addr);
+void eos_sock_getfrom(unsigned char *buffer, EOSNetAddr *addr);
+void eos_sock_set_handler(int sock, eos_sock_fptr_t handler, uint8_t flags);