summaryrefslogtreecommitdiff
path: root/libhw_generic/include/libhw/generic/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'libhw_generic/include/libhw/generic/net.h')
-rw-r--r--libhw_generic/include/libhw/generic/net.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/libhw_generic/include/libhw/generic/net.h b/libhw_generic/include/libhw/generic/net.h
index 0386e12..d70034e 100644
--- a/libhw_generic/include/libhw/generic/net.h
+++ b/libhw_generic/include/libhw/generic/net.h
@@ -13,7 +13,6 @@
#include <stdint.h> /* for uint{n}_t} */
#include <sys/types.h> /* for ssize_t */
-#include <libobj/obj.h>
#include <libhw/generic/io.h>
/* Errnos *********************************************************************/
@@ -69,13 +68,13 @@ lo_interface net_stream_conn;
/** \
* The net_stream_conn returned from accept() may still be \
* valid after the listener is closed. \
- * \
- * Return 0 on success, -errno on error. \
*/ \
- LO_FUNC(int, close)
+ LO_NEST(io_closer)
LO_INTERFACE(net_stream_listener)
#define net_stream_conn_LO_IFACE \
+ LO_NEST(io_bidi_closer) \
+ \
/** \
* Return bytes-read on success, 0 on EOF, -errno on error; a \
* short read is *not* an error. \
@@ -103,12 +102,7 @@ LO_INTERFACE(net_stream_listener)
* expensive to implement), so if you have concurrent writers then you \
* should arrange for a mutex to protect the connection. \
*/ \
- LO_FUNC(ssize_t, write, void *buf, size_t count) \
- \
- /** \
- * Return 0 on success, -errno on error. \
- */ \
- LO_FUNC(int, close, bool rd, bool wr)
+ LO_FUNC(ssize_t, write, void *buf, size_t count)
LO_INTERFACE(net_stream_conn)
/* Packets (e.g. UDP) *********************************************************/
@@ -117,7 +111,7 @@ LO_INTERFACE(net_stream_conn)
LO_FUNC(ssize_t, sendto, \
void *buf, size_t len, \
struct net_ip4_addr node, uint16_t port) \
- \
+ \
/** \
* @return The full length of the message, which may be more \
* than the given `len` (as if the Linux MSG_TRUNC flag were \
@@ -126,11 +120,11 @@ LO_INTERFACE(net_stream_conn)
LO_FUNC(ssize_t, recvfrom, \
void *buf, size_t len, \
struct net_ip4_addr *ret_node, uint16_t *ret_port) \
- \
- LO_FUNC(void, set_read_deadline, \
+ \
+ LO_FUNC(void, set_recv_deadline, \
uint64_t ns_since_boot) \
- \
- LO_FUNC(int, close)
+ \
+ LO_NEST(io_closer)
LO_INTERFACE(net_packet_conn)
/* Interfaces *****************************************************************/
@@ -145,7 +139,7 @@ struct net_iface_config {
LO_FUNC(struct net_eth_addr , hwaddr ) \
LO_FUNC(void , ifup , struct net_iface_config) \
LO_FUNC(void , ifdown ) \
- \
+ \
LO_FUNC(lo_interface net_stream_listener, tcp_listen, uint16_t local_port) \
LO_FUNC(lo_interface net_stream_conn , tcp_dial , struct net_ip4_addr remote_node, uint16_t remote_port) \
LO_FUNC(lo_interface net_packet_conn , udp_conn , uint16_t local_port)