apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/network_io/win32 poll.c sendrecv.c sockaddr.c sockets.c
Date Tue, 04 Jun 2002 04:50:44 GMT
wrowe       2002/06/03 21:50:44

  Modified:    include/arch/win32 networkio.h
               network_io/win32 poll.c sendrecv.c sockaddr.c sockets.c
  Log:
    More of the WinCE port.
  
    except appears to be a bit too ambigous for the compiler.
  
  Submitted by:	Mladen Turk <mturk@mappingsoft.com>
  
  Revision  Changes    Path
  1.24      +10 -1     apr/include/arch/win32/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/networkio.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- networkio.h	1 Apr 2002 14:13:45 -0000	1.23
  +++ networkio.h	4 Jun 2002 04:50:44 -0000	1.24
  @@ -78,9 +78,18 @@
       int numread;
       fd_set *write;
       int numwrite;
  -    fd_set *except;
  +    fd_set *exception;
       int numexcept;    
   };
  +
  +#ifdef _WIN32_WCE
  +#ifndef WSABUF
  +typedef struct _WSABUF {
  +    u_long      len;     /* the length of the buffer */
  +    char FAR *  buf;     /* the pointer to the buffer */
  +} WSABUF, FAR * LPWSABUF;
  +#endif
  +#endif
   
   apr_status_t status_from_res_error(int);
   
  
  
  
  1.30      +15 -7     apr/network_io/win32/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/poll.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- poll.c	13 Mar 2002 20:39:25 -0000	1.29
  +++ poll.c	4 Jun 2002 04:50:44 -0000	1.30
  @@ -56,9 +56,12 @@
   #include "apr_network_io.h"
   #include "apr_general.h"
   #include "apr_lib.h"
  +#if APR_HAVE_ERRNO_H
   #include <errno.h>
  +#endif
  +#if APR_HAVE_TIME_H
   #include <time.h>
  -
  +#endif
   
   APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new, apr_int32_t num,
                                            apr_pool_t *cont)
  @@ -70,12 +73,12 @@
       (*new)->cntxt = cont;
       (*new)->read = (fd_set *)apr_palloc(cont, sizeof(fd_set));
       (*new)->write = (fd_set *)apr_palloc(cont, sizeof(fd_set));
  -    (*new)->except = (fd_set *)apr_palloc(cont, sizeof(fd_set));
  +    (*new)->exception = (fd_set *)apr_palloc(cont, sizeof(fd_set));
       FD_ZERO((*new)->read);
       (*new)->numread = 0;
       FD_ZERO((*new)->write);
       (*new)->numwrite = 0;
  -    FD_ZERO((*new)->except);
  +    FD_ZERO((*new)->exception);
       (*new)->numexcept = 0;
       return APR_SUCCESS;
   }
  @@ -115,7 +118,7 @@
           newwrite = aprset->write;
       }
       if (aprset->numexcept != 0) {
  -        newexcept = aprset->except;
  +        newexcept = aprset->exception;
       }
   
       if (newread == NULL && newwrite == NULL && newexcept == NULL) {
  @@ -164,8 +167,13 @@
   
       if (FD_ISSET(sock->sock, aprset->read)) {
           revents |= APR_POLLIN;
  +#ifdef _WIN32_WCE
  +        if (recv(sock->sock, data.buf, data.len, 0) == SOCKET_ERROR) 
  +#else
           if (WSARecv(sock->sock, &data, 1, &dummy, &flags, NULL, 
  -                    NULL) == SOCKET_ERROR) {
  +                    NULL) == SOCKET_ERROR) 
  +#endif
  +            {
               /* This is only legit since we don't return the error */
               dummy = WSAGetLastError();
               switch (dummy) {
  @@ -195,7 +203,7 @@
        * connection on a non-blocking socket.  Might be a bad assumption, but
        * it works for now. rbb.
        */
  -    if (FD_ISSET(sock->sock, aprset->except)) {
  +    if (FD_ISSET(sock->sock, aprset->exception)) {
           revents |= APR_POLLPRI;
       }
   
  @@ -225,7 +233,7 @@
           aprset->numread--;
       }
       if (events & APR_POLLPRI) {
  -        FD_CLR(sock->sock, aprset->except);
  +        FD_CLR(sock->sock, aprset->exception);
           aprset->numexcept--;
       }
       if (events & APR_POLLOUT) {
  
  
  
  1.54      +23 -2     apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- sendrecv.c	22 May 2002 20:06:32 -0000	1.53
  +++ sendrecv.c	4 Jun 2002 04:50:44 -0000	1.54
  @@ -58,7 +58,9 @@
   #include "apr_network_io.h"
   #include "apr_lib.h"
   #include "fileio.h"
  +#if APR_HAVE_TIME_H
   #include <time.h>
  +#endif
   
   /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client
    * in one call of TransmitFile. This number must be small enough to give the 
  @@ -82,7 +84,12 @@
       wsaData.len = *len;
       wsaData.buf = (char*) buf;
   
  +#ifndef _WIN32_WCE
       rv = WSASend(sock->sock, &wsaData, 1, &dwBytes, 0, NULL, NULL);
  +#else
  +    rv = send(sock->sock, wsaData.buf, wsaData.len, 0);
  +    dwBytes = rv;
  +#endif
       if (rv == SOCKET_ERROR) {
           lasterror = apr_get_netos_error();
           return lasterror;
  @@ -106,7 +113,12 @@
       wsaData.len = *len;
       wsaData.buf = (char*) buf;
   
  +#ifndef _WIN32_WCE
       rv = WSARecv(sock->sock, &wsaData, 1, &dwBytes, &flags, NULL, NULL);
  +#else
  +    rv = recv(sock->sock, wsaData.buf, wsaData.len, 0);
  +    dwBytes = rv;
  +#endif
       if (rv == SOCKET_ERROR) {
           lasterror = apr_get_netos_error();
           *len = 0;
  @@ -138,12 +150,21 @@
           pWsaBuf[i].buf = vec[i].iov_base;
           pWsaBuf[i].len = vec[i].iov_len;
       }
  -
  +#ifndef _WIN32_WCE
       rv = WSASend(sock->sock, pWsaBuf, nvec, &dwBytes, 0, NULL, NULL);
       if (rv == SOCKET_ERROR) {
           rc = apr_get_netos_error();
       }
  -
  +#else
  +    for (i = 0; i < nvec; i++) {
  +        rv = send(sock->sock, pWsaBuf[i].buf, pWsaBuf[i].len, 0);
  +        if (rv == SOCKET_ERROR) {
  +            rc = apr_get_netos_error();
  +            break;
  +        }
  +        dwBytes += rv;
  +    }
  +#endif
       if (nvec > WSABUF_ON_STACK) 
           free(pWsaBuf);
   
  
  
  
  1.28      +9 -0      apr/network_io/win32/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockaddr.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- sockaddr.c	5 Apr 2002 22:15:05 -0000	1.27
  +++ sockaddr.c	4 Jun 2002 04:50:44 -0000	1.28
  @@ -57,6 +57,7 @@
   #include "apr_general.h"
   #include "apr_strings.h"
   #include "apr_lib.h"
  +#include "apr_private.h"
   #include <string.h>
   
   static apr_status_t get_local_addr(apr_socket_t *sock)
  @@ -74,6 +75,14 @@
       }
   }
   
  +#ifdef _WIN32_WCE
  +/* WCE lacks getservbyname */
  +static void *getservbyname(const char *name, const char *proto)
  +{
  +    return NULL;
  +}
  +
  +#endif
   /* Include this here so we have get_local_addr defined... */
   #include "../unix/sa_common.c"
   
  
  
  
  1.76      +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.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- sockets.c	1 Apr 2002 17:52:05 -0000	1.75
  +++ sockets.c	4 Jun 2002 04:50:44 -0000	1.76
  @@ -142,8 +142,9 @@
   APR_DECLARE(apr_status_t) apr_shutdown(apr_socket_t *thesocket,
                                          apr_shutdown_how_e how)
   {
  -    int winhow;
  +    int winhow = 0;
   
  +#if SD_RECEIVE
       switch (how) {
           case APR_SHUTDOWN_READ: {
               winhow = SD_RECEIVE;
  @@ -160,6 +161,7 @@
           default:
               return APR_BADARG;
       }
  +#endif
       if (shutdown(thesocket->sock, winhow) == 0) {
           return APR_SUCCESS;
       }
  
  
  

Mime
View raw message