httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/os2 sockopt.c
Date Tue, 14 Nov 2000 14:31:41 GMT
bjh         00/11/14 06:31:41

  Modified:    src/lib/apr/network_io/os2 sockopt.c
  Log:
  OS/2: Convert apr_get_remote_hostname() to apr_get_hostname(), supporting both
  remote & local query.
  
  Revision  Changes    Path
  1.18      +11 -5     apache-2.0/src/lib/apr/network_io/os2/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/os2/sockopt.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- sockopt.c	2000/08/22 15:09:22	1.17
  +++ sockopt.c	2000/11/14 14:31:40	1.18
  @@ -148,12 +148,20 @@
   
   
   
  -apr_status_t apr_get_remote_hostname(char **name, apr_socket_t *sock)
  +apr_status_t apr_get_hostname(char **name, apr_interface_e which, apr_socket_t *sock)
   {
       struct hostent *hptr;
  +    apr_in_addr_t sa_ptr;
   
  -    hptr = gethostbyaddr((char *)&(sock->remote_addr->sin_addr),
  -                         sizeof(struct in_addr), AF_INET);
  +    if (which == APR_LOCAL)
  +        sa_ptr = sock->local_addr->sin_addr;
  +    else if (which == APR_REMOTE)
  +        sa_ptr = sock->remote_addr->sin_addr;
  +    else
  +        return APR_EINVAL;
  +
  +    hptr = gethostbyaddr((char *)&sa_ptr, sizeof(struct in_addr), AF_INET);
  +
       if (hptr != NULL) {
           *name = apr_pstrdup(sock->cntxt, hptr->h_name);
           if (*name) {
  @@ -165,5 +173,3 @@
       /* XXX - Is this threadsafe? */
       return h_errno;
   }
  -
  -
  
  
  

Mime
View raw message