diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 22:18:47 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-03-26 22:18:47 -0600 |
commit | 6ab74d74ee6dc1663b66d0a9a0471f63ade5659a (patch) | |
tree | b579303cc5df38191ee9e8ad63793fbe4c867c02 /libhw_cr/host_include/libhw/host_net.h | |
parent | 9f2e2e96321f14da97adda618a7e4721cbb9791c (diff) | |
parent | 865bb702f828784a0225b5eae9ed8803094140d5 (diff) |
Merge branch 'lukeshu/9p-read-iovec'
Diffstat (limited to 'libhw_cr/host_include/libhw/host_net.h')
-rw-r--r-- | libhw_cr/host_include/libhw/host_net.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libhw_cr/host_include/libhw/host_net.h b/libhw_cr/host_include/libhw/host_net.h new file mode 100644 index 0000000..fced229 --- /dev/null +++ b/libhw_cr/host_include/libhw/host_net.h @@ -0,0 +1,44 @@ +/* libhw/host_net.h - <libhw/generic/net.h> implementation for hosted glibc + * + * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#ifndef _LIBHW_HOST_NET_H_ +#define _LIBHW_HOST_NET_H_ + +#include <stdint.h> /* for uint16_6 */ + +#include <libmisc/private.h> + +#include <libhw/generic/net.h> + +struct _hostnet_tcp_conn { + BEGIN_PRIVATE(LIBHW_HOST_NET_H) + int fd; + uint64_t read_deadline_ns; + END_PRIVATE(LIBHW_HOST_NET_H) +}; +LO_IMPLEMENTATION_H(net_stream_conn, struct _hostnet_tcp_conn, hostnet_tcp) + +struct hostnet_tcp_listener { + BEGIN_PRIVATE(LIBHW_HOST_NET_H) + int fd; + struct _hostnet_tcp_conn active_conn; + END_PRIVATE(LIBHW_HOST_NET_H) +}; +LO_IMPLEMENTATION_H(net_stream_listener, struct hostnet_tcp_listener, hostnet_tcplist) + +void hostnet_tcp_listener_init(struct hostnet_tcp_listener *self, uint16_t port); + +struct hostnet_udp_conn { + BEGIN_PRIVATE(LIBHW_HOST_NET_H) + int fd; + uint64_t read_deadline_ns; + END_PRIVATE(LIBHW_HOST_NET_H) +}; +LO_IMPLEMENTATION_H(net_packet_conn, struct hostnet_udp_conn, hostnet_udp) + +void hostnet_udp_conn_init(struct hostnet_udp_conn *self, uint16_t port); + +#endif /* _LIBHW_HOST_NET_H_ */ |