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 server.c testsockets.c
Date Fri, 05 Dec 2003 01:02:31 GMT
trawick     2003/12/04 17:02:31

  Modified:    .        CHANGES
               include  apr_network_io.h
               network_io/unix sockaddr.c
               test     client.c server.c testsockets.c
  Log:
  axe apr_sockaddr_port_set() and apr_sockaddr_port_get() from APR
  1.0 API
  
  Revision  Changes    Path
  1.446     +2 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.445
  retrieving revision 1.446
  diff -u -r1.445 -r1.446
  --- CHANGES	3 Dec 2003 12:36:42 -0000	1.445
  +++ CHANGES	5 Dec 2003 01:02:31 -0000	1.446
  @@ -77,6 +77,8 @@
        apr_shutdown                 -> apr_socket_shutdown
        apr_signal_get_description   -> apr_signal_description_get
        apr_sockaddr_ip_set          -> apr_sockaddr_info_get
  +     apr_sockaddr_port_get        -> (access directly)
  +     apr_sockaddr_port_set        -> apr_sockaddr_info_get
        apr_socket_create_ex         -> apr_socket_create
        apr_socket_set_inherit       -> apr_socket_inherit_set
        apr_socket_unset_inherit     -> apr_socket_inherit_unset
  
  
  
  1.151     +0 -16     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.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- apr_network_io.h	3 Dec 2003 12:36:42 -0000	1.150
  +++ apr_network_io.h	5 Dec 2003 01:02:31 -0000	1.151
  @@ -678,22 +678,6 @@
                                                 apr_socket_t *sock);
    
   /**
  - * Set the port in an APR socket address.
  - * @param sockaddr The socket address to set.
  - * @param port The port to be stored in the socket address.
  - */
  -APR_DECLARE(apr_status_t) apr_sockaddr_port_set(apr_sockaddr_t *sockaddr,
  -                                                apr_port_t port);
  -
  -/**
  - * Return the port in an APR socket address.
  - * @param port The port from the socket address.
  - * @param sockaddr The socket address to reference.
  - */
  -APR_DECLARE(apr_status_t) apr_sockaddr_port_get(apr_port_t *port,
  -                                                apr_sockaddr_t *sockaddr);
  -
  -/**
    * Return the IP address (in numeric address string format) in
    * an APR socket address.  APR will allocate storage for the IP address 
    * string from the pool of the apr_sockaddr_t.
  
  
  
  1.47      +0 -16     apr/network_io/unix/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- sockaddr.c	3 Dec 2003 12:36:42 -0000	1.46
  +++ sockaddr.c	5 Dec 2003 01:02:31 -0000	1.47
  @@ -136,22 +136,6 @@
       }
   }
   
  -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;
  -}
  -
  -APR_DECLARE(apr_status_t) apr_sockaddr_port_get(apr_port_t *port,
  -                                       apr_sockaddr_t *sockaddr)
  -{
  -    *port = sockaddr->port;
  -    return APR_SUCCESS;
  -}
  -
   APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr,
                                            apr_sockaddr_t *sockaddr)
   {
  
  
  
  1.40      +2 -2      apr/test/client.c
  
  Index: client.c
  ===================================================================
  RCS file: /home/cvs/apr/test/client.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- client.c	3 Sep 2003 14:43:53 -0000	1.39
  +++ client.c	5 Dec 2003 01:02:31 -0000	1.40
  @@ -140,10 +140,10 @@
   
       apr_socket_addr_get(&remote_sa, APR_REMOTE, sock);
       apr_sockaddr_ip_get(&remote_ipaddr, remote_sa);
  -    apr_sockaddr_port_get(&remote_port, remote_sa);
  +    remote_port = remote_sa->port;
       apr_socket_addr_get(&local_sa, APR_LOCAL, sock);
       apr_sockaddr_ip_get(&local_ipaddr, local_sa);
  -    apr_sockaddr_port_get(&local_port, local_sa);
  +    local_port = local_sa->port;
       fprintf(stdout, "\tClient socket: %s:%u -> %s:%u\n", local_ipaddr, local_port, remote_ipaddr,
remote_port);
   
       fprintf(stdout, "\tClient:  Trying to send data over socket.......");
  
  
  
  1.42      +13 -16    apr/test/server.c
  
  Index: server.c
  ===================================================================
  RCS file: /home/cvs/apr/test/server.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- server.c	22 Nov 2003 00:05:26 -0000	1.41
  +++ server.c	5 Dec 2003 01:02:31 -0000	1.42
  @@ -74,7 +74,7 @@
       apr_pollfd_t fdsock;
       char datasend[STRLEN];
       char datarecv[STRLEN] = "Recv data test";
  -    const char *bind_to_ipaddr = NULL;
  +    const char *bind_to_ipaddr = APR_ANYADDR;
       char *local_ipaddr, *remote_ipaddr;
       apr_port_t local_port, remote_port;
       apr_sockaddr_t *localsa = NULL, *remotesa;
  @@ -104,16 +104,18 @@
           exit(-1);
       }
   
  -    if (bind_to_ipaddr) {
  -        /* First, parse/resolve ipaddr so we know what address family of
  -         * socket we need.  We'll use the returned sockaddr later when
  -         * we bind.
  -         */
  -        APR_TEST_SUCCESS(rv, "Preparing sockaddr", 
  -            apr_sockaddr_info_get(&localsa, bind_to_ipaddr, APR_UNSPEC, 8021, 0, context))
  -        family = localsa->family;
  +    if (!bind_to_ipaddr) {
  +        bind_to_ipaddr = APR_LOCAL;
       }
   
  +    /* First, parse/resolve ipaddr so we know what address family of
  +     * socket we need.  We'll use the returned sockaddr later when
  +     * we bind.
  +     */
  +    APR_TEST_SUCCESS(rv, "Preparing sockaddr", 
  +            apr_sockaddr_info_get(&localsa, bind_to_ipaddr, APR_UNSPEC, 8021, 0, context))
  +    family = localsa->family;
  +
       APR_TEST_SUCCESS(rv, "Creating new socket", 
           apr_socket_create(&sock, family, SOCK_STREAM, APR_PROTO_TCP, context))
   
  @@ -123,11 +125,6 @@
       APR_TEST_SUCCESS(rv, "Setting option APR_SO_REUSEADDR",
           apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1))
   
  -    if (!localsa) {
  -        apr_socket_addr_get(&localsa, APR_LOCAL, sock);
  -        apr_sockaddr_port_set(localsa, 8021);
  -    }
  -
       APR_TEST_SUCCESS(rv, "Binding socket to port",
           apr_socket_bind(sock, localsa))
       
  @@ -172,10 +169,10 @@
       }
       apr_socket_addr_get(&remotesa, APR_REMOTE, sock2);
       apr_sockaddr_ip_get(&remote_ipaddr, remotesa);
  -    apr_sockaddr_port_get(&remote_port, remotesa);
  +    remote_port = remotesa->port;
       apr_socket_addr_get(&localsa, APR_LOCAL, sock2);
       apr_sockaddr_ip_get(&local_ipaddr, localsa);
  -    apr_sockaddr_port_get(&local_port, localsa);
  +    local_port = localsa->port;
       fprintf(stdout, "Server socket: %s:%u -> %s:%u\n", local_ipaddr, 
               local_port, remote_ipaddr, remote_port);
   
  
  
  
  1.12      +1 -1      apr/test/testsockets.c
  
  Index: testsockets.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsockets.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- testsockets.c	30 Nov 2003 16:47:29 -0000	1.11
  +++ testsockets.c	5 Dec 2003 01:02:31 -0000	1.12
  @@ -172,7 +172,7 @@
       CuAssertStrEquals(tc, "APR_INET, SOCK_DGRAM", recvbuf);
   
       apr_sockaddr_ip_get(&ip_addr, from);
  -    apr_sockaddr_port_get(&fromport, from);
  +    fromport = from->port;
       CuAssertStrEquals(tc, US, ip_addr);
       CuAssertIntEquals(tc, 7771, fromport);
   
  
  
  

Mime
View raw message