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 sendrecv.c
Date Sat, 31 Mar 2001 07:57:00 GMT
wrowe       01/03/30 23:57:00

  Modified:    network_io/win32 sendrecv.c
  Log:
    Hmmm... can't stand unimplemented features - needs review by the
    FirstBill though!
  
  Revision  Changes    Path
  1.34      +61 -0     apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- sendrecv.c	2001/02/16 04:16:04	1.33
  +++ sendrecv.c	2001/03/31 07:57:00	1.34
  @@ -69,6 +69,8 @@
    * bytes.
    */
   #define MAX_SEGMENT_SIZE 65536
  +
  +
   APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf,
                                      apr_size_t *len)
   {
  @@ -91,6 +93,7 @@
       return APR_SUCCESS;
   }
   
  +
   APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock, char *buf,
                                      apr_size_t *len) 
   {
  @@ -115,6 +118,7 @@
   
   }
   
  +
   APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock,
                                       const struct iovec *vec,
                                       apr_int32_t nvec, apr_int32_t *nbytes)
  @@ -147,6 +151,61 @@
       *nbytes = dwBytes;
       return APR_SUCCESS;
   }
  +
  +
  +APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where,
  +                                     apr_int32_t flags, const char *buf, 
  +                                     apr_size_t *len)
  +{
  +    apr_ssize_t rv;
  +
  +    rv = sendto(sock->sock, buf, (*len), flags, 
  +                (const struct sockaddr*)&where->sa, 
  +                where->salen);
  +    if (rv == SOCKET_ERROR) {
  +        *len = 0;
  +        return apr_get_netos_error();
  +    }
  +
  +    *len = rv;
  +    return APR_SUCCESS;
  +}
  +
  +
  +APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, 
  +                                       apr_socket_t *sock,
  +                                       apr_int32_t flags, 
  +                                       char *buf, apr_size_t *len)
  +{
  +    apr_ssize_t rv;
  +    apr_status_t err;
  +
  +    if (from == NULL){
  +        return APR_ENOMEM;
  +        /* Not sure if this is correct.  Maybe we should just allocate
  +           the memory??
  +         */
  +    }
  +
  +    rv = recvfrom(sock->sock, buf, (*len), flags, 
  +                  (struct sockaddr*)&from->sa, &from->salen);
  +    if (rv == SOCKET_ERROR) {
  +        (*len) = 0;
  +        return apr_get_netos_error();
  +    }
  +
  +    if (err) {
  +        return errno;
  +    }
  +
  +    (*len) = rv;
  +    if (rv == 0)
  +        return APR_EOF;
  +
  +    return APR_SUCCESS;
  +}
  +
  +
   static void collapse_iovec(char **buf, int *len, struct iovec *iovec, int numvec, apr_pool_t
*p)
   {
       int ptr = 0;
  @@ -169,6 +228,8 @@
           }
       }
   }
  +
  +
   #if APR_HAS_SENDFILE
   /*
    *#define WAIT_FOR_EVENT
  
  
  

Mime
View raw message