summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-06 16:36:58 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-03-06 16:36:58 -0800
commite396824ed2d6514a62302c5e5591cacfbb8cd29b (patch)
treeebae64c34700f4e9aa46292f6797f5ad189ec91d /stream.h
parent59b9b5d4f8499b45deaec7cc89ca7d3a54a9c215 (diff)
downloadtxr-e396824ed2d6514a62302c5e5591cacfbb8cd29b.tar.gz
txr-e396824ed2d6514a62302c5e5591cacfbb8cd29b.tar.bz2
txr-e396824ed2d6514a62302c5e5591cacfbb8cd29b.zip
Special implementation of dgram socket streams.
* socket.c (struct dgram_stream): New struct. (make_dgram_sock_stream, dgram_print, dgram_mark, dgram_destroy, dgram_overflow, dgram_put_byte_callback, dgram_put_string, dgram_put_char, dgram_put_byte, dgram_get_byte_callback, dgram_get_char, dgram_get_byte, dgram_unget_char, dgram_unget_byte, dgram_flush, dgram_close, dgram_get_prop, dgram_get_fd, dgram_get_sock_family, dgram_get_sock_type, dgram_get_sock_peer, dgram_set_sock_peer, dgram_get_error, dgram_get_error_str, dgram_clear_error): New static functions. (dgram_strm_ops): New static structure. (sock_listen): Check against datagram sockets which have a peer; otherwise a no-op for datagram sockets. (sock_accept): Special logic for dgram sockets. (open_sockfd): Function moved here from stream.c, and augmented to open dgram stream for dgram sockets. (open_socket): Function moved here from stream.c. (sock_load_init): Fill in some operations in dgram_strm_ops. * stream.c (generic_get_line, make_sock_stream, errno_to_string): Statics become external. (open_sockfd, open_socket): Functions removed from here, moved to socket.c. * stream.h (generic_get_line, make_sock_stream, errno_to_string): Declared.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/stream.h b/stream.h
index c874d96e..011fcb38 100644
--- a/stream.h
+++ b/stream.h
@@ -125,12 +125,15 @@ void stream_mark_op(val stream);
void stream_destroy_op(val stream);
val normalize_mode(struct stdio_mode *m, val mode_str);
val set_mode_props(const struct stdio_mode m, val stream);
+val generic_get_line(val stream);
+val errno_to_string(val err);
val make_null_stream(void);
val make_stdio_stream(FILE *, val descr);
val make_tail_stream(FILE *, val descr);
val make_pipe_stream(FILE *, val descr);
val stream_fd(val stream);
#if HAVE_SOCKETS
+val make_sock_stream(FILE *f, val family, val type);
val sock_family(val stream);
val sock_type(val stream);
val sock_peer(val stream);