diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-03-31 07:57:00 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-03-31 07:57:00 +0000 |
commit | d9b28412815535466995692a3de78e03b68d73f9 (patch) | |
tree | 96efba7e296c65a12c6c7712ec2502254efb5e2d /network_io | |
parent | 1ce7ad2b58b9822972cb8971d6bcb48bb51f8448 (diff) | |
download | libapr-d9b28412815535466995692a3de78e03b68d73f9.tar.gz |
Hmmm... can't stand unimplemented features - needs review by the
FirstBill though!
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61406 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/win32/sendrecv.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index 59827bd50..8bd7c9d4c 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -69,6 +69,8 @@ * bytes. */ #define MAX_SEGMENT_SIZE 65536 + + APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) { @@ -91,6 +93,7 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, return APR_SUCCESS; } + APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) { @@ -115,6 +118,7 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, } + APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, apr_int32_t nvec, apr_int32_t *nbytes) @@ -147,6 +151,61 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, *nbytes = dwBytes; return APR_SUCCESS; } + + +APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) +{ + apr_ssize_t rv; + + rv = sendto(sock->sock, buf, (*len), flags, + (const struct sockaddr*)&where->sa, + where->salen); + if (rv == SOCKET_ERROR) { + *len = 0; + return apr_get_netos_error(); + } + + *len = rv; + return APR_SUCCESS; +} + + +APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, + char *buf, apr_size_t *len) +{ + apr_ssize_t rv; + apr_status_t err; + + if (from == NULL){ + return APR_ENOMEM; + /* Not sure if this is correct. Maybe we should just allocate + the memory?? + */ + } + + rv = recvfrom(sock->sock, buf, (*len), flags, + (struct sockaddr*)&from->sa, &from->salen); + if (rv == SOCKET_ERROR) { + (*len) = 0; + return apr_get_netos_error(); + } + + if (err) { + return errno; + } + + (*len) = rv; + if (rv == 0) + return APR_EOF; + + return APR_SUCCESS; +} + + static void collapse_iovec(char **buf, int *len, struct iovec *iovec, int numvec, apr_pool_t *p) { int ptr = 0; @@ -169,6 +228,8 @@ static void collapse_iovec(char **buf, int *len, struct iovec *iovec, int numvec } } } + + #if APR_HAS_SENDFILE /* *#define WAIT_FOR_EVENT |