summaryrefslogtreecommitdiff
path: root/libhw/host_include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-27 23:22:01 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-27 23:49:37 -0600
commit88adb90f5e805bea27e619fd5209ef58dbff6fd1 (patch)
treec3e24877b40ce183f1d72f6e064b0478ecf92207 /libhw/host_include
parent89761191a98f7dce4d1049b9a84c3d645378222a (diff)
Factor out a libhw
Diffstat (limited to 'libhw/host_include')
-rw-r--r--libhw/host_include/libhw/host_net.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/libhw/host_include/libhw/host_net.h b/libhw/host_include/libhw/host_net.h
new file mode 100644
index 0000000..c74f0bd
--- /dev/null
+++ b/libhw/host_include/libhw/host_net.h
@@ -0,0 +1,37 @@
+/* libhw/host_net.h - <libhw/generic/net.h> implementation for hosted glibc
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-Licence-Identifier: AGPL-3.0-or-later
+ */
+
+#ifndef _LIBHW_HOST_NET_H_
+#define _LIBHW_HOST_NET_H_
+
+#include <stdint.h> /* for uint16_6 */
+
+#include <libhw/generic/net.h>
+
+struct _hostnet_tcp_conn {
+ implements_net_stream_conn;
+
+ int fd;
+};
+
+struct hostnet_tcp_listener {
+ implements_net_stream_listener;
+
+ int fd;
+ struct _hostnet_tcp_conn active_conn;
+};
+
+void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port);
+
+struct hostnet_udp_conn {
+ implements_net_packet_conn;
+
+ int fd;
+};
+
+void hostnet_udp_conn_init(struct hostnet_udp_conn *self, uint16_t port);
+
+#endif /* _LIBHW_HOST_NET_H_ */