summaryrefslogtreecommitdiff
path: root/source4/lib/socket/socket.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-03 13:20:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:28 -0500
commit1692bbf2e267eabd7099f0b6153da0c7cf209d1d (patch)
treeb3a223d81b78e980c7a4c764485d2a1312601f93 /source4/lib/socket/socket.c
parentff27722fea7fb1727ffeadd3efffb15965a754ed (diff)
downloadsamba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.tar.gz
samba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.tar.bz2
samba-1692bbf2e267eabd7099f0b6153da0c7cf209d1d.zip
r7227: added a socket_pending() call to abstract away the FIONREAD ioctl. It
will be interesting to see if this causes any portability problems, as it is a less commonly used call. (This used to be commit f6993db31d93059c70b44a23005ba444e205870f)
Diffstat (limited to 'source4/lib/socket/socket.c')
-rw-r--r--source4/lib/socket/socket.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 13d1640f51..dd3175468d 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -235,6 +235,22 @@ NTSTATUS socket_sendto(struct socket_context *sock,
return sock->ops->fn_sendto(sock, blob, sendlen, flags, dest_addr, dest_port);
}
+
+/*
+ ask for the number of bytes in a pending incoming datagram
+*/
+NTSTATUS socket_pending(struct socket_context *sock, size_t *npending)
+{
+ if (sock->type != SOCKET_TYPE_DGRAM) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ if (!sock->ops->fn_pending) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return sock->ops->fn_pending(sock, npending);
+}
+
+
NTSTATUS socket_set_option(struct socket_context *sock, const char *option, const char *val)
{
if (!sock->ops->fn_set_option) {