summaryrefslogtreecommitdiff
path: root/network_io/beos
diff options
context:
space:
mode:
authorDavid Reid <dreid@apache.org>2000-11-03 19:24:16 +0000
committerDavid Reid <dreid@apache.org>2000-11-03 19:24:16 +0000
commitd67753a245dcc5961c9047f27b70af8071df85b9 (patch)
treec20fe979936887c5c03b5b4f22b364f0e8499660 /network_io/beos
parent81e0ce2b7c5dd0b9497473f86013358520d364fb (diff)
downloadapr-d67753a245dcc5961c9047f27b70af8071df85b9.tar.gz
I'm not sure I really like this as it smacks of code duplication with
apr_get_remote_hostname, so maybe they should be combined? Anyway, I haven't added the function to Win32/OS2 as I can't test there, but it shouldn't be hard! Once all platforms have this we can remove another of the raw sockaddr references in http_core. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60632 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/beos')
-rw-r--r--network_io/beos/sockopt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/network_io/beos/sockopt.c b/network_io/beos/sockopt.c
index d6d3656e6..fe3086fd2 100644
--- a/network_io/beos/sockopt.c
+++ b/network_io/beos/sockopt.c
@@ -144,6 +144,25 @@ apr_status_t apr_gethostname(char * buf, int len, apr_pool_t *cont)
}
}
+apr_status_t apr_get_local_hostname(char **name, apr_socket_t *sock)
+{
+ struct hostent *hptr;
+
+ hptr = gethostbyaddr((char *)&(sock->local_addr->sin_addr),
+ sizeof(struct in_addr), AF_INET);
+ if (hptr != NULL) {
+ *name = apr_pstrdup(sock->cntxt, hptr->h_name);
+ if (*name) {
+ return APR_SUCCESS;
+ }
+ return APR_ENOMEM;
+ }
+
+ /* XXX - Is this threadsafe? - manoj */
+ /* on BeOS h_errno is a global... */
+ return h_errno;
+}
+
apr_status_t apr_get_remote_hostname(char **name, apr_socket_t *sock)
{
struct hostent *hptr;