httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/apr/network_io/unix networkio.h sockets.c
Date Wed, 14 Apr 1999 21:02:18 GMT
rbb         99/04/14 14:02:12

  Modified:    apr/network_io/unix networkio.h sockets.c
  Log:
  Added sockaddr to socket structure, to help make socket type complete for
  any function that may use them.  Also added bind and listen calls.
  
  Revision  Changes    Path
  1.3       +2 -0      apache-apr/apr/network_io/unix/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/unix/networkio.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- networkio.h	1999/04/14 19:17:20	1.2
  +++ networkio.h	1999/04/14 21:02:06	1.3
  @@ -60,6 +60,8 @@
   struct socket_t {
       int socketdes;
       char *hostname;
  +    struct sockaddr_in *addr;
  +    size_t addr_len;
   };
   
   typedef fd_set sd_set_t;
  
  
  
  1.2       +28 -0     apache-apr/apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sockets.c	1999/04/13 11:49:54	1.1
  +++ sockets.c	1999/04/14 21:02:07	1.2
  @@ -69,6 +69,12 @@
       thesocket->hostname = NULL;
       thesocket->socketdes = socket(AF_INET ,SOCK_STREAM, IPPROTO_TCP);
   
  +    thesocket->addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));
  +    thesocket->addr->sin_family = AF_INET;
  +    thesocket->addr->sin_addr.s_addr = INADDR_ANY;
  +
  +    thesocket->addr_len = sizeof(thesocket->addr);
  +    
       if (thesocket->socketdes < 0) {
           return NULL;
       }
  @@ -97,4 +103,26 @@
       else {
           return APR_FAILURE;
       }
  +}
  +
  +apr_status_t apr_setport(apr_socket_t *sock, apr_uint32_t port)
  +{
  +    sock->addr->sin_port = htons((short)port);
  +    return APR_SUCCESS;
  +}
  +
  +apr_status_t apr_bind(apr_socket_t *sock)
  +{
  +    if (bind(sock->socketdes, (struct sockaddr *)sock->addr, sock->addr_len) ==
-1)
  +        return APR_FAILURE;
  +    else
  +        return APR_SUCCESS;
  +}
  +
  +apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog)
  +{
  +    if (listen(sock->socketdes, backlog) == -1)
  +        return APR_FAILURE;
  +    else
  +        return APR_SUCCESS;
   }
  
  
  

Mime
View raw message