summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-02-27 18:40:58 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-02-27 18:40:58 -0800
commit6f4ce69fc86b9272472ae356f8fa98eca7833c88 (patch)
tree8113264695747f920a352d2416ad2452410f2627 /stream.h
parentf589076e26aa831e3e7effed243860debd6f7f6a (diff)
downloadtxr-6f4ce69fc86b9272472ae356f8fa98eca7833c88.tar.gz
txr-6f4ce69fc86b9272472ae356f8fa98eca7833c88.tar.bz2
txr-6f4ce69fc86b9272472ae356f8fa98eca7833c88.zip
Socket streams know their connected peer address.
* stream.c (struct stdio_handle): New member, peer. (stdio_stream_mark): Mark the new member. (sock_peer, sock_set_peer): New functions. (stream_init): Registered sock-peer intrinsic. * stream.h (sock_peer, sock_set_peer): Declared. * socket.c (sock_connect): If the connect is successful, then store the address into the stream as the peer.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/stream.h b/stream.h
index 28d7ea70..148e6950 100644
--- a/stream.h
+++ b/stream.h
@@ -117,6 +117,8 @@ val stream_fd(val stream);
#if HAVE_SOCKETS
val sock_family(val stream);
val sock_type(val stream);
+val sock_peer(val stream);
+val sock_set_peer(val stream, val peer);
#endif
val make_string_input_stream(val);
val make_string_byte_input_stream(val);