Branch: Tag:

2003-04-23

2003-04-23 15:32:15 by Marcus Comstedt <marcus@mc.pp.se>

Allow room for IPv6 addresses in sockaddr values.

Rev: src/acconfig.h:1.124
Rev: src/configure.in:1.716
Rev: src/modules/HTTPLoop/accept_and_parse.c:1.32
Rev: src/modules/HTTPLoop/accept_and_parse.h:1.13
Rev: src/modules/HTTPLoop/cache.c:1.21
Rev: src/modules/HTTPLoop/log.c:1.16
Rev: src/modules/HTTPLoop/requestobject.c:1.27
Rev: src/modules/HTTPLoop/timeout.c:1.14
Rev: src/modules/HTTPLoop/util.c:1.11
Rev: src/modules/files/file.c:1.271
Rev: src/modules/files/file.h:1.27
Rev: src/modules/files/socket.c:1.70
Rev: src/modules/files/udp.c:1.46
Rev: src/modules/system/system.c:1.146
Rev: src/pike_netlib.h:1.1

1: + /* + || This file is part of Pike. For copyright information see COPYRIGHT. + || Pike is distributed under GPL, LGPL and MPL. See the file COPYING + || for more information. + || $Id: pike_netlib.h,v 1.1 2003/04/23 15:32:15 marcus Exp $ + */    -  + #ifndef PIKE_NETLIB_H + #define PIKE_NETLIB_H +  + #ifdef HAVE_SYS_TYPES_H + #include <sys/types.h> + #endif /* HAVE_SYS_TYPES_H */ + #ifdef HAVE_UNISTD_H + #include <unistd.h> + #endif /* HAVE_UNISTD_H */ + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> + #endif /* HAVE_SYS_SOCKET_H */ + #ifdef HAVE_NETINET_IN_H + #include <netinet/in.h> + #endif /* HAVE_NETINET_IN_H */ +  + typedef union { +  struct sockaddr sa; +  struct sockaddr_in ipv4; + #ifdef HAVE_STRUCT_SOCKADDR_IN6 +  struct sockaddr_in6 ipv6; + #endif + } SOCKADDR; +  + #define SOCKADDR_FAMILY(X) ((X).sa.sa_family) +  + #ifdef HAVE_STRUCT_SOCKADDR_IN6 + #define SOCKADDR_IN_ADDR(X) (SOCKADDR_FAMILY(X)==AF_INET? \ +  &(X).ipv4.sin_addr : (struct in_addr *)&(X).ipv6.sin6_addr) + #else + #define SOCKADDR_IN_ADDR(X) (&(X).ipv4) + #endif +  + #endif /* PIKE_NETLIB_H */   Newline at end of file added.