diff options
author | David Reid <dreid@apache.org> | 2000-11-08 14:47:05 +0000 |
---|---|---|
committer | David Reid <dreid@apache.org> | 2000-11-08 14:47:05 +0000 |
commit | 1a1ffca8bbeff96d6ff044de33030e9ce93a4c25 (patch) | |
tree | 7515ccc793873fa60e6bb1b77e396ff8ce6732cd /network_io/beos | |
parent | c5168fb4b147cd16c74fe2729ebe682f95361711 (diff) | |
download | apr-1a1ffca8bbeff96d6ff044de33030e9ce93a4c25.tar.gz |
This adds the APR_LOCAL/APR_REMOTE to APR and changes the apr_get/set_port
functions to use it. This is onyl the start and I'll pause a while before
I continue in case people really hate this. The patch can be backed out and
all evidence will be removed, but I think this makes maintaining/developing
the code easier in the long term.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60647 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/beos')
-rw-r--r-- | network_io/beos/sockaddr.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/network_io/beos/sockaddr.c b/network_io/beos/sockaddr.c index 75c2e5ee2..c3d727d42 100644 --- a/network_io/beos/sockaddr.c +++ b/network_io/beos/sockaddr.c @@ -58,39 +58,29 @@ #else #include "networkio.h" -apr_status_t apr_set_local_port(apr_socket_t *sock, apr_port_t port) +apr_status_t apr_set_port(apr_socket_t *sock, apr_interface_e which, apr_port_t port) { - if (!sock) { - return APR_EBADF; - } - sock->local_addr->sin_port = htons(port); - return APR_SUCCESS; -} - -apr_status_t apr_set_remote_port(apr_socket_t *sock, apr_port_t port) -{ - if (!sock) { - return APR_EBADF; - } - sock->remote_addr->sin_port = htons(port); - return APR_SUCCESS; -} - -apr_status_t apr_get_local_port(apr_port_t *port, apr_socket_t *sock) -{ - if (!sock) { + if (!sock) return APR_EBADF; - } - *port = ntohs(sock->local_addr->sin_port); + if (which == APR_LOCAL) + sock->local_addr->sin_port = htons(port); + else if (APR == APR_REMOTE) + sock->remote_addr->sin_port = htons(port); + else + return APR_EINVAL; return APR_SUCCESS; } -apr_status_t apr_get_remote_port(apr_port_t *port, apr_socket_t *sock) +apr_status_t apr_get_port(apr_port_t *port, apr_interface_e which, apr_socket_t *sock) { - if (!sock) { + if (!sock) return APR_EBADF; - } - *port = ntohs(sock->remote_addr->sin_port); + if (which == APR_LOCAL) + *port = ntohs(sock->local_addr->sin_port); + else if (which == APR_REMOTE) + *port = ntohs(sock->remote_addr->sin_port); + else + return APR_EINVAL; return APR_SUCCESS; } |