apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/test client.c
Date Wed, 02 May 2001 02:32:50 GMT
trawick     01/05/01 19:32:49

  Modified:    include  apr_network_io.h
               network_io/os2 sockets.c
               network_io/unix sa_common.c sockets.c
               network_io/win32 sockets.c
               test     client.c
  Log:
  Add a family field to apr_sockaddr_t so there is a straightforward place
  to look to find the address family.  (Yes, it could be found in
  addr->sa.sin.sin_family even if it was not an AF_INET socket but that
  isn't so friendly.)
  
  Also, try fairly hard to get the port field filled out properly.
  
  Revision  Changes    Path
  1.102     +2 -0      apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_network_io.h,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- apr_network_io.h	2001/04/03 01:09:51	1.101
  +++ apr_network_io.h	2001/05/02 02:32:44	1.102
  @@ -176,6 +176,8 @@
       char *servname;
       /** The numeric port */
       apr_port_t port;
  +    /** The family */
  +    apr_int32_t family;
       union {
           /** IPv4 sockaddr structure */
           struct sockaddr_in sin;
  
  
  
  1.41      +3 -1      apr/network_io/os2/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/os2/sockets.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- sockets.c	2001/02/16 04:16:01	1.40
  +++ sockets.c	2001/05/02 02:32:45	1.41
  @@ -85,7 +85,9 @@
   
   static void set_socket_vars(apr_socket_t *sock, int family)
   {
  +    sock->local_addr->family = family;
       sock->local_addr->sa.sin.sin_family = family;
  +    sock->remote_addr->family = family;
       sock->remote_addr->sa.sin.sin_family = family;
   
       if (family == AF_INET) {
  @@ -222,7 +224,7 @@
       if ((*new)->socketdes < 0) {
           return APR_OS2_STATUS(sock_errno());
       }
  -
  +    (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
       apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
                           socket_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS;
  
  
  
  1.33      +4 -0      apr/network_io/unix/sa_common.c
  
  Index: sa_common.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- sa_common.c	2001/03/15 21:54:59	1.32
  +++ sa_common.c	2001/05/02 02:32:46	1.33
  @@ -74,6 +74,7 @@
   APR_DECLARE(apr_status_t) apr_sockaddr_port_set(apr_sockaddr_t *sockaddr,
                                          apr_port_t port)
   {
  +    sockaddr->port = port;
       /* XXX IPv6: assumes sin_port and sin6_port at same offset */
       sockaddr->sa.sin.sin_port = htons(port);
       return APR_SUCCESS;
  @@ -137,6 +138,9 @@
   
   static void set_sockaddr_vars(apr_sockaddr_t *addr, int family)
   {
  +    addr->family = family;
  +    /* XXX IPv6: assumes sin_port and sin6_port at same offset */
  +    addr->port = ntohs(addr->sa.sin.sin_port);
       addr->sa.sin.sin_family = family;
   
       if (family == APR_INET) {
  
  
  
  1.74      +3 -1      apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- sockets.c	2001/04/05 18:56:08	1.73
  +++ sockets.c	2001/05/02 02:32:47	1.74
  @@ -75,7 +75,9 @@
   static void set_socket_vars(apr_socket_t *sock, int family, int type)
   {
       sock->type = type;
  +    sock->local_addr->family = family;
       sock->local_addr->sa.sin.sin_family = family;
  +    sock->remote_addr->family = family;
       sock->remote_addr->sa.sin.sin_family = family;
   
       if (family == APR_INET) {
  @@ -224,7 +226,7 @@
           (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin6.sin6_addr;
       }
   #endif
  -
  +    (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
       if (sock->local_port_unknown) {
           /* not likely for a listening socket, but theoretically possible :) */
           (*new)->local_port_unknown = 1;
  
  
  
  1.55      +3 -1      apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockets.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- sockets.c	2001/04/12 13:47:02	1.54
  +++ sockets.c	2001/05/02 02:32:48	1.55
  @@ -75,7 +75,9 @@
   static void set_socket_vars(apr_socket_t *sock, int family, int type)
   {
       sock->type = type;
  +    sock->local_addr->family = family;
       sock->local_addr->sa.sin.sin_family = family;
  +    sock->remote_addr->family = family;
       sock->remote_addr->sa.sin.sin_family = family;
   
       if (family == AF_INET) {
  @@ -248,7 +250,7 @@
           (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin6.sin6_addr;
       }
   #endif
  -
  +    (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
       if (sock->local_port_unknown) {
           /* not likely for a listening socket, but theoretically possible :) */
           (*new)->local_port_unknown = 1;
  
  
  
  1.28      +1 -1      apr/test/client.c
  
  Index: client.c
  ===================================================================
  RCS file: /home/cvs/apr/test/client.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- client.c	2001/03/31 18:56:50	1.27
  +++ client.c	2001/05/02 02:32:49	1.28
  @@ -115,7 +115,7 @@
       fprintf(stdout,"OK\n");
   
       fprintf(stdout, "\tClient:  Creating new socket.......");
  -    if (apr_socket_create(&sock, remote_sa->sa.sin.sin_family, SOCK_STREAM,
  +    if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM,
                             context) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't create socket\n");
           exit(-1);
  
  
  

Mime
View raw message