diff options
author | thommay <thommay@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-20 03:50:23 +0000 |
---|---|---|
committer | thommay <thommay@13f79535-47bb-0310-9956-ffa450edef68> | 2002-11-20 03:50:23 +0000 |
commit | 96a516ce915baab6aeac8564383d7203def7ca42 (patch) | |
tree | 970704b99664fde6f1803a70c4287a9326c2b7c4 /network_io | |
parent | f50ebd72d64ef2df0165d62d139dbfb0b70c3b4d (diff) | |
download | libapr-96a516ce915baab6aeac8564383d7203def7ca42.tar.gz |
*) Renames done (deprecated functions wrapped):
apr_filename_of_pathname -> apr_filepath_name_get
apr_get_groupid -> apr_gid_get
apr_get_groupname -> apr_gid_name_get
apr_compare_groups -> apr_gid_compare
apr_parse_addr_port -> apr_port_addr_parse
apr_shutdown -> apr_socket_shutdown
apr_bind -> apr_socket_bind
apr_listen -> apr_socket_listen
apr_accept -> apr_socket_accept
apr_connect -> apr_socket_connect
apr_send -> apr_socket_send
apr_sendv -> apr_socket_sendv
apr_sendto -> apr_socket_sendto
apr_implode_gmt -> apr_time_exp_gmt_get
apr_get_home_directory -> apr_uid_homepath_get
apr_get_userid -> apr_uid_get
apr_current_userid -> apr_uid_current
apr_compare_users -> apr_uid_compare
apr_get_username -> apr_uid_name_get
apr_recvfrom -> apr_socket_recvfrom
apr_sendfile -> apr_socket_sendfile
apr_recv -> apr_socket_recv
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@64043 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/beos/sendrecv.c | 64 | ||||
-rw-r--r-- | network_io/os2/sendrecv.c | 32 | ||||
-rw-r--r-- | network_io/os2/sendrecv_udp.c | 14 | ||||
-rw-r--r-- | network_io/os2/sockets.c | 48 | ||||
-rw-r--r-- | network_io/os2/sockopt.c | 4 | ||||
-rw-r--r-- | network_io/unix/sendrecv.c | 160 | ||||
-rw-r--r-- | network_io/unix/sockets.c | 43 | ||||
-rw-r--r-- | network_io/unix/sockopt.c | 1 | ||||
-rw-r--r-- | network_io/win32/sendrecv.c | 108 | ||||
-rw-r--r-- | network_io/win32/sockets.c | 48 | ||||
-rw-r--r-- | network_io/win32/sockopt.c | 1 |
11 files changed, 406 insertions, 117 deletions
diff --git a/network_io/beos/sendrecv.c b/network_io/beos/sendrecv.c index 3762befbb..19dc63d90 100644 --- a/network_io/beos/sendrecv.c +++ b/network_io/beos/sendrecv.c @@ -95,7 +95,8 @@ apr_status_t apr_wait_for_io_or_timeout(apr_socket_t *sock, int for_read) #define SEND_WAIT APR_USEC_PER_SEC / 10 -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -128,7 +129,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -160,15 +162,18 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *le /* BeOS doesn't have writev for sockets so we use the following instead... */ -APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { *len = vec[0].iov_len; - return apr_send(sock, vec[0].iov_base, len); + return apr_socket_send(sock, vec[0].iov_base, len); } -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_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -200,9 +205,10 @@ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, 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_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -243,4 +249,42 @@ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return APR_SUCCESS; } +/* deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t * sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} + +/* deprecated */ +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) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* deprecated */ +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) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} + #endif diff --git a/network_io/os2/sendrecv.c b/network_io/os2/sendrecv.c index e3631dadf..6a28e9c52 100644 --- a/network_io/os2/sendrecv.c +++ b/network_io/os2/sendrecv.c @@ -59,7 +59,8 @@ #include "apr_lib.h" #include <sys/time.h> -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; int fds, err = 0; @@ -98,7 +99,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, apr_size -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; int fds, err = 0; @@ -137,7 +139,9 @@ APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, apr_size_t *le -APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, apr_int32_t nvec, apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { apr_status_t rv; struct iovec *tmpvec; @@ -183,3 +187,25 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, const struct iovec *vec, *len = rv; return APR_SUCCESS; } + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} diff --git a/network_io/os2/sendrecv_udp.c b/network_io/os2/sendrecv_udp.c index 4010a083a..4667b9278 100644 --- a/network_io/os2/sendrecv_udp.c +++ b/network_io/os2/sendrecv_udp.c @@ -61,8 +61,10 @@ #include <sys/time.h> -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_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; int serrno; @@ -137,3 +139,11 @@ APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return APR_SUCCESS; } + +/* deprecated */ +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) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} diff --git a/network_io/os2/sockets.c b/network_io/os2/sockets.c index 9a704b8f4..90eda2bd4 100644 --- a/network_io/os2/sockets.c +++ b/network_io/os2/sockets.c @@ -151,7 +151,8 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int return apr_socket_create_ex(new, family, type, 0, cont); } -APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { if (shutdown(thesocket->socketdes, how) == 0) { return APR_SUCCESS; @@ -167,7 +168,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, + apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, @@ -179,7 +181,8 @@ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, + apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return APR_OS2_STATUS(sock_errno()); @@ -187,7 +190,9 @@ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, + apr_socket_t *sock, + apr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -217,7 +222,8 @@ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, apr return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, + apr_sockaddr_t *sa) { if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, sa->salen) < 0) && @@ -313,3 +319,35 @@ APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *th APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup) APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup) + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock, backlog); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) +{ + return apr_socket_accept(new, sock, connection_context); +} + +/* deprecated */ +APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/os2/sockopt.c b/network_io/os2/sockopt.c index 3ecc1aa02..0623e6ce7 100644 --- a/network_io/os2/sockopt.c +++ b/network_io/os2/sockopt.c @@ -170,7 +170,8 @@ APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) +APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, + apr_pool_t *cont) { if (gethostname(buf, len) == -1) { buf[0] = '\0'; @@ -182,4 +183,3 @@ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, apr_pool_t } return APR_SUCCESS; } - diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 521ab533a..ac6e19714 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -65,7 +65,8 @@ #include <sys/sysctl.h> #endif -apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -98,20 +99,20 @@ do_select: return errno; } if (sock->timeout && rv < *len) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } (*len) = rv; return APR_SUCCESS; } -apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) { apr_ssize_t rv; apr_status_t arv; if (sock->netmask & APR_INCOMPLETE_READ) { - sock->netmask &= ~APR_INCOMPLETE_READ; - goto do_select; + sock->netmask &= ~APR_INCOMPLETE_READ; + goto do_select; } do { @@ -121,7 +122,7 @@ apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout != 0) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + arv = apr_wait_for_io_or_timeout(NULL, sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -137,7 +138,7 @@ do_select: return errno; } if (sock->timeout && rv < *len) { - sock->netmask |= APR_INCOMPLETE_READ; + sock->netmask |= APR_INCOMPLETE_READ; } (*len) = rv; if (rv == 0) { @@ -146,8 +147,9 @@ do_select: return APR_SUCCESS; } -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_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -179,9 +181,9 @@ apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, return APR_SUCCESS; } -apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -216,8 +218,8 @@ apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, } #ifdef HAVE_WRITEV -apr_status_t apr_sendv(apr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) +apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) { apr_ssize_t rv; apr_size_t requested_len = 0; @@ -256,7 +258,7 @@ do_select: return errno; } if (sock->timeout && rv < requested_len) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } (*len) = rv; return APR_SUCCESS; @@ -275,9 +277,9 @@ static apr_hdtr_t no_hdtr; #if defined(__linux__) && defined(HAVE_WRITEV) -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { off_t off = *offset; int rv, nbytes = 0, total_hdrbytes, i; @@ -300,9 +302,10 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } /* Now write the headers */ - arv = apr_sendv(sock, hdtr->headers, hdtr->numheaders, &hdrbytes); + arv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + &hdrbytes); if (arv != APR_SUCCESS) { - *len = 0; + *len = 0; return errno; } nbytes += hdrbytes; @@ -327,10 +330,10 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } do { - rv = sendfile(sock->socketdes, /* socket */ - file->filedes, /* open file descriptor of the file to be sent */ - &off, /* where in the file to start */ - *len /* number of bytes to send */ + rv = sendfile(sock->socketdes, /* socket */ + file->filedes, /* open file descriptor of the file to be sent */ + &off, /* where in the file to start */ + *len /* number of bytes to send */ ); } while (rv == -1 && errno == EINTR); @@ -338,23 +341,23 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout > 0) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); - if (arv != APR_SUCCESS) { - *len = 0; - return arv; - } + arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + if (arv != APR_SUCCESS) { + *len = 0; + return arv; + } else { do { - rv = sendfile(sock->socketdes, /* socket */ - file->filedes, /* open file descriptor of the file to be sent */ - &off, /* where in the file to start */ - *len); /* number of bytes to send */ + rv = sendfile(sock->socketdes, /* socket */ + file->filedes, /* open file descriptor of the file to be sent */ + &off, /* where in the file to start */ + *len); /* number of bytes to send */ } while (rv == -1 && errno == EINTR); } } if (rv == -1) { - *len = nbytes; + *len = nbytes; rv = errno; apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; @@ -389,10 +392,11 @@ do_select: /* Now write the footers */ if (hdtr->numtrailers > 0) { apr_size_t trbytes; - arv = apr_sendv(sock, hdtr->trailers, hdtr->numtrailers, &trbytes); + arv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + &trbytes); nbytes += trbytes; if (arv != APR_SUCCESS) { - *len = nbytes; + *len = nbytes; rv = errno; apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; @@ -455,10 +459,11 @@ static int include_hdrs_in_length(void) return 1; #endif } + /* Release 3.1 or greater */ -apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, apr_size_t * len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, + apr_hdtr_t * hdtr, apr_off_t * offset, + apr_size_t * len, apr_int32_t flags) { off_t nbytes = 0; int rv, i; @@ -588,9 +593,9 @@ apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, * if nbytes == 0, the rest of the file (from offset) is sent */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { int i; apr_ssize_t rc; @@ -700,7 +705,7 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, } if (rc == -1) { - *len = 0; + *len = 0; return errno; } @@ -719,9 +724,9 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, * AIX - version 4.3.2 with APAR IX85388, or version 4.3.3 and above * OS/390 - V2R7 and above */ -apr_status_t apr_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, apr_size_t * len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, + apr_hdtr_t * hdtr, apr_off_t * offset, + apr_size_t * len, apr_int32_t flags) { int i, ptr, rv = 0; void * hbuf=NULL, * tbuf=NULL; @@ -865,9 +870,9 @@ do_select: * 111298-01, 108529-09, 109473-06, 109235-04, 108996-02, 111296-01, 109026-04, * 108992-13 */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) { apr_status_t rv, arv; apr_size_t nbytes; @@ -980,7 +985,7 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Update how much we sent */ *len = nbytes; if (sock->timeout && (*len < requested_len)) { - sock->netmask |= APR_INCOMPLETE_WRITE; + sock->netmask |= APR_INCOMPLETE_WRITE; } return APR_SUCCESS; } @@ -996,14 +1001,59 @@ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, * apr_sendfile() doesn't work on the platform; * this dummy version is just to get exports.c to compile/link */ -apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags); /* avoid warning for no proto */ +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags); + /* avoid warning for no proto */ + +apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) +{ + return APR_ENOTIMPL; +} +#endif +/* deprecated */ +apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len) +{ + return apr_socket_send(sock, buf, len); +} + +/* deprecated */ +#ifdef HAVE_WRITEV +apr_status_t apr_sendv(apr_socket_t * sock, const struct iovec *vec, + apr_int32_t nvec, apr_size_t *len) +{ + return apr_socket_sendv(sock, vec, nvec, len); +} +#endif + +/* deprecated */ +apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, apr_size_t *len) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* deprecated */ +apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, + apr_int32_t flags, char *buf, + apr_size_t *len) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* deprecated */ apr_status_t apr_sendfile(apr_socket_t *sock, apr_file_t *file, apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, apr_int32_t flags) { - return APR_ENOTIMPL; + return apr_socket_sendfile(sock, file, hdtr, offset, len, flags); +} + +/* deprecated */ +apr_status_t apr_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); } -#endif diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index f442cdabb..2dc1bcd14 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -152,7 +152,8 @@ apr_status_t apr_socket_create(apr_socket_t **new, int family, int type, return apr_socket_create_ex(new, family, type, 0, cont); } -apr_status_t apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { return (shutdown(thesocket->socketdes, how) == -1) ? errno : APR_SUCCESS; } @@ -162,7 +163,7 @@ apr_status_t apr_socket_close(apr_socket_t *thesocket) return apr_pool_cleanup_run(thesocket->cntxt, thesocket, socket_cleanup); } -apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { @@ -178,7 +179,7 @@ apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) +apr_status_t apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return errno; @@ -186,7 +187,8 @@ apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) +apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -256,7 +258,7 @@ apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *conn return APR_SUCCESS; } -apr_status_t apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { int rc; @@ -392,3 +394,34 @@ apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup) APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup) + +/* deprecated */ +apr_status_t apr_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* deprecated */ +apr_status_t apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* deprecated */ +apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock, backlog); +} + +/* deprecated */ +apr_status_t apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *connection_context) +{ + return apr_socket_accept(new, sock, connection_context); +} + +/* deprecated */ +apr_status_t apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index 31024a8aa..86f7db8dc 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -396,4 +396,3 @@ apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, return APR_SUCCESS; } #endif - diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index a9f8a4189..a32336e4c 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -65,16 +65,17 @@ /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client * in one call of TransmitFile. This number must be small enough to give the * slowest client time to receive the data before the socket timeout triggers. - * The same problem can exist with apr_send(). In that case, we rely on the - * application to adjust socket timeouts and max send segment sizes appropriately. - * For example, Apache will in most cases call apr_send() with less than 8193 - * bytes. + * The same problem can exist with apr_socket_send(). In that case, we rely on + * the application to adjust socket timeouts and max send segment + * sizes appropriately. + * For example, Apache will in most cases call apr_socket_send() with less + * than 8193 bytes. */ #define MAX_SEGMENT_SIZE 65536 #define WSABUF_ON_STACK 50 -APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -101,8 +102,8 @@ APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, } -APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -130,9 +131,9 @@ 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_size_t *nbytes) +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *nbytes) { apr_status_t rc = APR_SUCCESS; apr_ssize_t rv; @@ -171,9 +172,10 @@ APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, } -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_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, + apr_sockaddr_t *where, + apr_int32_t flags, const char *buf, + apr_size_t *len) { apr_ssize_t rv; @@ -190,10 +192,10 @@ APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where, } -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_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, + apr_socket_t *sock, + apr_int32_t flags, + char *buf, apr_size_t *len) { apr_ssize_t rv; @@ -253,8 +255,8 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, */ /* - * apr_status_t apr_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, - * apr_off_t *, apr_size_t *, apr_int32_t flags) + * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, + * apr_off_t *, apr_size_t *, apr_int32_t flags) * Send a file from an open file descriptor to a socket, along with * optional headers and trailers * arg 1) The socket to which we're writing @@ -264,9 +266,12 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, * arg 5) Number of bytes to send out of the file * arg 6) APR flags that are mapped to OS specific flags */ -APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, - apr_size_t *len, apr_int32_t flags) +APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, + apr_file_t *file, + apr_hdtr_t *hdtr, + apr_off_t *offset, + apr_size_t *len, + apr_int32_t flags) { apr_status_t status = APR_SUCCESS; apr_ssize_t rv; @@ -293,13 +298,15 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { - rv = apr_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); + rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; } if (hdtr->numtrailers) { - rv = apr_sendv(sock, hdtr->trailers, hdtr->numtrailers, &nbytes); + rv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; @@ -438,7 +445,8 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, /* Mark the socket as disconnected, but do not close it. * Note: The application must have stored the socket prior to making - * the call to apr_sendfile in order to either reuse it or close it. + * the call to apr_socket_sendfile in order to either reuse it + * or close it. */ if (disconnected) { sock->disconnected = 1; @@ -451,4 +459,52 @@ APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, #endif return status; } + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file, + apr_hdtr_t *hdtr, apr_off_t *offset, + apr_size_t *len, apr_int32_t flags) +{ + return apr_socket_sendfile(sock, file, hdtr, offset, len, flags); +} + #endif + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf, + apr_size_t *len) +{ + return apr_socket_send(sock. buf, len); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock, + const struct iovec *vec, + apr_int32_t nvec, apr_size_t *nbytes) +{ + return apr_socket_sendv(sock, vec, nvec, nbytes); +} + +/* Deprecated */ +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) +{ + return apr_socket_sendto(sock, where, flags, buf, len); +} + +/* Deprecated */ +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) +{ + return apr_socket_recvfrom(from, sock, flags, buf, len); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf, + apr_size_t *len) +{ + return apr_socket_recv(sock, buf, len); +} diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c index 528a408a6..5bd0a133a 100644 --- a/network_io/win32/sockets.c +++ b/network_io/win32/sockets.c @@ -185,8 +185,8 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, return apr_socket_create_ex(new, family, type, 0, cont); } -APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how) +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) { int winhow = 0; @@ -222,7 +222,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, + apr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, @@ -238,7 +239,8 @@ APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, + apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == SOCKET_ERROR) return apr_get_netos_error(); @@ -246,8 +248,8 @@ APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, - apr_pool_t *p) +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, + apr_socket_t *sock, apr_pool_t *p) { SOCKET s; struct sockaddr sa; @@ -323,7 +325,8 @@ APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, + apr_sockaddr_t *sa) { apr_status_t rv; @@ -504,3 +507,34 @@ APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *socket) { apr_socket_inherit_unset(socket); } +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket, + apr_shutdown_how_e how) +{ + return apr_socket_shutdown(thesocket, how); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_bind(sock, sa); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_listen(apr_socket_t *sock, apr_int32_t backlog) +{ + return apr_socket_listen(sock. backlog); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new, apr_socket_t *sock, + apr_pool_t *p) +{ + return apr_socket_accept(new, sock, p); +} + +/* Deprecated */ +APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +{ + return apr_socket_connect(sock, sa); +} diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index c326f9dae..a60e01743 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -290,4 +290,3 @@ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, return APR_SUCCESS; } - |