dreid 00/11/10 08:16:06
Modified: src/lib/apr/include apr_network_io.h Log: Add the apr_sockaddr_t type. I've added a single pointer that should be used to point at the address structure. The port and family are in the same place in either a v4 or v6 sockaddr so we don't need to worry about those, but in a v6 sockaddr they start at different points. I'll wait a while before starting to move this into the code as it's going to break a good few things :) Revision Changes Path 1.67 +29 -0 apache-2.0/src/lib/apr/include/apr_network_io.h Index: apr_network_io.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_network_io.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- apr_network_io.h 2000/11/10 16:11:13 1.66 +++ apr_network_io.h 2000/11/10 16:16:06 1.67 @@ -137,6 +137,35 @@ /* use apr_uint16_t just in case some system has a short that isn't 16 bits... */ typedef apr_uint16_t apr_port_t; +/* we're going to roll our own sockaddr type as we want to make sure + * we have protocol independance for APR... + * + * It's defined here as I think it should all be platform safe... + */ +typedef struct { + apr_pool_t *pool; /* The pool to use... */ + char *hostname; /* The hostname */ + char *servname; /* This is either a string of the port number or + * the service name for the port + */ + apr_port_t port; /* The numeric port */ + union { + struct sockaddr_in sin; /* IPv4 sockaddr structure */ +#if APR_HAVE_IPV6 + struct sockaddr_in6 sin6; /* IPv6 sockaddr structure */ +#endif + } sa; + apr_socklen_t sa_len; /* How big is the sockaddr we're using? */ + int addr_str_len; /* How big should the address buffer be? + * 16 for v4 or 46 for v6 + * used in inet_ntop... + */ + void *addr_ptr; /* This should be set to point to the + * sockaddr structure address we're using... + * i.e. sa.sin.sin_addr or sa.sin6.sin6_addr + */ +} apr_sockaddr_t; + #if APR_HAS_SENDFILE /* Define flags passed in on apr_sendfile() */ #define APR_SENDFILE_DISCONNECT_SOCKET 1