Dear all:
I attach the option 1 patch... aka add the call apr_socket_create_protocol() to the apr. This causes the smallest amount of change to the apr.
I will follow up .. possibly tommorrow if I get the cycles...sigh.. with option 2 .. change to the arguments of apr_socket_create() itself to include the protocol and then changing all the places that apr_socket_create is called...
I would appreciate feedback on style.. I think I got everything correct.. but it never hurts to find out :>
I found the setting for emacs so no more ugly tabs :> now if I could teach it to add a space for me between ){ and arguments I would be set :-0
R -- Randall R. Stewart [EMAIL PROTECTED] 815-342-5222 (cell phone)
Index: configure.in =================================================================== RCS file: /home/cvspublic/apr/configure.in,v retrieving revision 1.488 diff -u -r1.488 configure.in --- configure.in 16 Oct 2002 12:49:18 -0000 1.488 +++ configure.in 17 Oct 2002 12:59:18 -0000 @@ -940,6 +940,8 @@ kernel/OS.h \ net/errno.h \ netinet/in.h \ + netinet/sctp.h \ + netinet/sctp_uio.h \ sys/file.h \ sys/mman.h \ sys/poll.h \ @@ -974,7 +976,6 @@ else AC_MSG_RESULT(no) fi - AC_SUBST(arpa_ineth) AC_SUBST(conioh) AC_SUBST(ctypeh) @@ -987,6 +988,8 @@ AC_SUBST(netdbh) AC_SUBST(sys_syslimitsh) AC_SUBST(netinet_inh) +AC_SUBST(netinet_sctph) +AC_SUBST(netinet_sctp_uioh) AC_SUBST(netinet_tcph) AC_SUBST(stdargh) AC_SUBST(stdioh) Index: include/apr.h.in =================================================================== RCS file: /home/cvspublic/apr/include/apr.h.in,v retrieving revision 1.115 diff -u -r1.115 apr.h.in --- include/apr.h.in 3 Aug 2002 20:29:54 -0000 1.115 +++ include/apr.h.in 17 Oct 2002 12:59:19 -0000 @@ -32,38 +32,40 @@ #define APR_HAS_INLINE 1 #endif -#define APR_HAVE_ARPA_INET_H @arpa_ineth@ -#define APR_HAVE_CONIO_H @conioh@ -#define APR_HAVE_CRYPT_H @crypth@ -#define APR_HAVE_CTYPE_H @ctypeh@ -#define APR_HAVE_DIRENT_H @direnth@ -#define APR_HAVE_ERRNO_H @errnoh@ -#define APR_HAVE_FCNTL_H @fcntlh@ -#define APR_HAVE_IO_H @ioh@ -#define APR_HAVE_LIMITS_H @limitsh@ -#define APR_HAVE_NETDB_H @netdbh@ -#define APR_HAVE_NETINET_IN_H @netinet_inh@ -#define APR_HAVE_NETINET_TCP_H @netinet_tcph@ -#define APR_HAVE_PTHREAD_H @pthreadh@ -#define APR_HAVE_SEMAPHORE_H @semaphoreh@ -#define APR_HAVE_SIGNAL_H @signalh@ -#define APR_HAVE_STDARG_H @stdargh@ -#define APR_HAVE_STDINT_H @stdint@ -#define APR_HAVE_STDIO_H @stdioh@ -#define APR_HAVE_STDLIB_H @stdlibh@ -#define APR_HAVE_STRING_H @stringh@ -#define APR_HAVE_STRINGS_H @stringsh@ -#define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@ -#define APR_HAVE_SYS_SIGNAL_H @sys_signalh@ -#define APR_HAVE_SYS_SOCKET_H @sys_socketh@ -#define APR_HAVE_SYS_SYSLIMITS_H @sys_syslimitsh@ -#define APR_HAVE_SYS_TIME_H @sys_timeh@ -#define APR_HAVE_SYS_TYPES_H @sys_typesh@ -#define APR_HAVE_SYS_UIO_H @sys_uioh@ -#define APR_HAVE_SYS_UN_H @sys_unh@ -#define APR_HAVE_SYS_WAIT_H @sys_waith@ -#define APR_HAVE_TIME_H @timeh@ -#define APR_HAVE_UNISTD_H @unistdh@ +#define APR_HAVE_ARPA_INET_H @arpa_ineth@ +#define APR_HAVE_CONIO_H @conioh@ +#define APR_HAVE_CRYPT_H @crypth@ +#define APR_HAVE_CTYPE_H @ctypeh@ +#define APR_HAVE_DIRENT_H @direnth@ +#define APR_HAVE_ERRNO_H @errnoh@ +#define APR_HAVE_FCNTL_H @fcntlh@ +#define APR_HAVE_IO_H @ioh@ +#define APR_HAVE_LIMITS_H @limitsh@ +#define APR_HAVE_NETDB_H @netdbh@ +#define APR_HAVE_NETINET_IN_H @netinet_inh@ +#define APR_HAVE_NETINET_TCP_H @netinet_tcph@ +#define APR_HAVE_NETINET_SCTP_H @netinet_sctph@ +#define APR_HAVE_NETINET_SCTP_UIO_H @netinet_sctp_uioh@ +#define APR_HAVE_PTHREAD_H @pthreadh@ +#define APR_HAVE_SEMAPHORE_H @semaphoreh@ +#define APR_HAVE_SIGNAL_H @signalh@ +#define APR_HAVE_STDARG_H @stdargh@ +#define APR_HAVE_STDINT_H @stdint@ +#define APR_HAVE_STDIO_H @stdioh@ +#define APR_HAVE_STDLIB_H @stdlibh@ +#define APR_HAVE_STRING_H @stringh@ +#define APR_HAVE_STRINGS_H @stringsh@ +#define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@ +#define APR_HAVE_SYS_SIGNAL_H @sys_signalh@ +#define APR_HAVE_SYS_SOCKET_H @sys_socketh@ +#define APR_HAVE_SYS_SYSLIMITS_H @sys_syslimitsh@ +#define APR_HAVE_SYS_TIME_H @sys_timeh@ +#define APR_HAVE_SYS_TYPES_H @sys_typesh@ +#define APR_HAVE_SYS_UIO_H @sys_uioh@ +#define APR_HAVE_SYS_UN_H @sys_unh@ +#define APR_HAVE_SYS_WAIT_H @sys_waith@ +#define APR_HAVE_TIME_H @timeh@ +#define APR_HAVE_UNISTD_H @unistdh@ #define APR_HAVE_SHMEM_MMAP_TMP @havemmaptmp@ #define APR_HAVE_SHMEM_MMAP_SHM @havemmapshm@ @@ -128,6 +130,12 @@ #if APR_HAVE_STDINT_H #include <stdint.h> +#endif + +#if APR_HAVE_NETINET_SCTP_H +#define APR_HAVE_SCTP 1 +#else +#define APR_HAVE_SCTP 0 #endif /* APR Feature Macros */ Index: include/apr_network_io.h =================================================================== RCS file: /home/cvspublic/apr/include/apr_network_io.h,v retrieving revision 1.129 diff -u -r1.129 apr_network_io.h --- include/apr_network_io.h 11 Oct 2002 20:41:23 -0000 1.129 +++ include/apr_network_io.h 17 Oct 2002 12:59:20 -0000 @@ -168,6 +168,26 @@ #endif /** + * Some defines for the various IP protocols + */ +#ifdef IPPROTO_TCP +#define APR_PROTO_TCP IPPROTO_TCP +#else +#define APR_PROTO_TCP 6 +#endif +#ifdef IPPROTO_UDP +#define APR_PROTO_UDP IPPROTO_UDP +#else +#define APR_PROTO_UDP 17 +#endif +#ifdef IPPROTO_SCTP +#define APR_PROTO_SCTP IPPROTO_SCTP +#else +#define APR_PROTO_SCTP 132 +#endif + + +/** * Enum to tell us if we're interested in remote or local socket */ typedef enum { @@ -262,9 +282,12 @@ }; /* function definitions */ - /** - * Create a socket. + * Create a socket. Note that this version attempts to + * guess the protocol type and then calls + * apr_socket_create_protocol() users should really use + * the apr_socket_create_protocol() function below to assure + * proper assignement of protocol. * @param new_sock The new socket that has been set up. * @param family The address family of the socket (e.g., APR_INET). * @param type The type of the socket (e.g., SOCK_STREAM). @@ -275,6 +298,19 @@ apr_pool_t *cont); /** + * Create a socket. + * @param new_sock The new socket that has been set up. + * @param family The address family of the socket (e.g., APR_INET). + * @param type The type of the socket (e.g., SOCK_STREAM). + * @param protocl The protocol to use (e.g., APR_TCP, APR_UDP, APR_SCTP) + * @param cont The pool to use + */ +APR_DECLARE(apr_status_t) apr_socket_create_protocol(apr_socket_t **new_sock, + int family, int type, + int protocol, + apr_pool_t *cont); + +/** * Shutdown either reading, writing, or both sides of a socket. * @param thesocket The socket to close * @param how How to shutdown the socket. One of: @@ -728,6 +764,12 @@ apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, char *args); #endif + +/** + * Return the protocol in the APR socket structure + */ +APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock, + int *protocol); /** * Set a socket to be inherited by child processes. Index: include/apr_portable.h =================================================================== RCS file: /home/cvspublic/apr/include/apr_portable.h,v retrieving revision 1.81 diff -u -r1.81 apr_portable.h --- include/apr_portable.h 3 Oct 2002 17:55:42 -0000 1.81 +++ include/apr_portable.h 17 Oct 2002 12:59:20 -0000 @@ -214,6 +214,7 @@ struct sockaddr *remote; /**< NULL if not connected */ int family; /**< always required (APR_INET, APR_INET6, etc. */ int type; /**< always required (SOCK_STREAM, SOCK_DGRAM, etc. */ + int protocol; /**< APR_PROTO_SCTP/APR_PROTO_TCP/APR_PROTO_UDP **/ }; typedef struct apr_os_sock_info_t apr_os_sock_info_t; Index: include/arch/os2/networkio.h =================================================================== RCS file: /home/cvspublic/apr/include/arch/os2/networkio.h,v retrieving revision 1.26 diff -u -r1.26 networkio.h --- include/arch/os2/networkio.h 11 Jul 2002 06:28:40 -0000 1.26 +++ include/arch/os2/networkio.h 17 Oct 2002 12:59:20 -0000 @@ -67,6 +67,7 @@ apr_pool_t *cntxt; int socketdes; int type; + int protocol; apr_sockaddr_t *local_addr; apr_sockaddr_t *remote_addr; apr_interval_time_t timeout; Index: include/arch/unix/networkio.h =================================================================== RCS file: /home/cvspublic/apr/include/arch/unix/networkio.h,v retrieving revision 1.54 diff -u -r1.54 networkio.h --- include/arch/unix/networkio.h 11 Jul 2002 05:19:44 -0000 1.54 +++ include/arch/unix/networkio.h 17 Oct 2002 12:59:21 -0000 @@ -87,6 +87,12 @@ #if APR_HAVE_NETINET_TCP_H #include <netinet/tcp.h> #endif +#if APR_HAVE_NETINET_SCTP_UIO_H +#include <netinet/sctp_uio.h> +#endif +#if APR_HAVE_NETINET_SCTP_H +#include <netinet/sctp.h> +#endif #if APR_HAVE_NETINET_IN_H #include <netinet/in.h> #endif @@ -120,6 +126,7 @@ apr_pool_t *cntxt; int socketdes; int type; + int protocol; apr_sockaddr_t *local_addr; apr_sockaddr_t *remote_addr; apr_interval_time_t timeout; Index: include/arch/win32/networkio.h =================================================================== RCS file: /home/cvspublic/apr/include/arch/win32/networkio.h,v retrieving revision 1.28 diff -u -r1.28 networkio.h --- include/arch/win32/networkio.h 15 Jul 2002 07:26:12 -0000 1.28 +++ include/arch/win32/networkio.h 17 Oct 2002 12:59:21 -0000 @@ -62,6 +62,7 @@ apr_pool_t *cntxt; SOCKET socketdes; int type; /* SOCK_STREAM, SOCK_DGRAM */ + int protocol; apr_sockaddr_t *local_addr; apr_sockaddr_t *remote_addr; int timeout_ms; /* MUST MATCH if timeout > 0 */ Index: network_io/os2/sockets.c =================================================================== RCS file: /home/cvspublic/apr/network_io/os2/sockets.c,v retrieving revision 1.56 diff -u -r1.56 sockets.c --- network_io/os2/sockets.c 30 Jul 2002 13:56:14 -0000 1.56 +++ network_io/os2/sockets.c 17 Oct 2002 12:59:21 -0000 @@ -103,9 +103,48 @@ (*new)->remote_addr->pool = p; } -APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int type, + +APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock, + int *protocol) +{ + *protocol = sock->protocol; + return APR_SUCCESS; +} + +APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, + int family, + int type, apr_pool_t *cont) { + /* Here we guess the protocol type based on the + * family and type. + */ + int protocol; + if ((family == APR_INET) || (family == APR_INET6)) { + if (type == SOCK_DGRAM) { + protocol = APR_PROTO_UDP; + } else if (type == SOCK_STREAM) { + protocol = APR_PROTO_TCP; + } else if (type == SOCK_SEQPACKET) { + protocol = APR_PROTO_SCTP; + } else { + /* Punt? */ + protocol = 0; + } + } else { + /* Punt? */ + protocol = 0; + } + return apr_socket_create_protocol(new,family,type,protocol,cont); +} + + +APR_DECLARE(apr_status_t) apr_socket_create_protocol(apr_socket_t **new, + int family, + int type, + int protocol, + apr_pool_t *cont) +{ int downgrade = (family == AF_UNSPEC); if (family == AF_UNSPEC) { @@ -118,11 +157,11 @@ alloc_socket(new, cont); - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); #if APR_HAVE_IPV6 if ((*new)->socketdes < 0 && downgrade) { family = AF_INET; - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); } #endif @@ -130,7 +169,7 @@ return APR_OS2_STATUS(sock_errno()); } set_socket_vars(*new, family, type); - + (*new)->protocol = protocol; (*new)->timeout = -1; (*new)->nonblock = FALSE; apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), @@ -249,6 +288,7 @@ set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type); (*apr_sock)->timeout = -1; (*apr_sock)->socketdes = *os_sock_info->os_sock; + (*apr_sock)->protocol = os_sock_info->protocol; if (os_sock_info->local) { memcpy(&(*apr_sock)->local_addr->sa.sin, os_sock_info->local, Index: network_io/unix/sockets.c =================================================================== RCS file: /home/cvspublic/apr/network_io/unix/sockets.c,v retrieving revision 1.101 diff -u -r1.101 sockets.c --- network_io/unix/sockets.c 30 Jul 2002 13:56:14 -0000 1.101 +++ network_io/unix/sockets.c 17 Oct 2002 12:59:22 -0000 @@ -103,9 +103,42 @@ (*new)->remote_addr->pool = p; } -apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, +apr_status_t apr_socket_get_protocol(apr_socket_t *sock, + int *protocol) +{ + *protocol = sock->protocol; + return APR_SUCCESS; +} + +apr_status_t apr_socket_create(apr_socket_t **new, int family, int type, apr_pool_t *cont) { + /* Here we guess the protocol type based on the + * family and type. + */ + int protocol; + if ((family == APR_INET) || (family == APR_INET6)) { + if (type == SOCK_DGRAM) { + protocol = APR_PROTO_UDP; + } else if (type == SOCK_STREAM) { + protocol = APR_PROTO_TCP; + } else if (type == SOCK_SEQPACKET) { + protocol = APR_PROTO_SCTP; + } else { + /* Punt? */ + protocol = 0; + } + } else { + /* Punt? */ + protocol = 0; + } + return apr_socket_create_protocol(new,family,type,protocol,cont); +} + +apr_status_t apr_socket_create_protocol(apr_socket_t **new, int ofamily, + int type, + int protocol, apr_pool_t *cont) +{ int family = ofamily; if (family == APR_UNSPEC) { @@ -118,12 +151,12 @@ alloc_socket(new, cont); - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); #if APR_HAVE_IPV6 if ((*new)->socketdes < 0 && ofamily == APR_UNSPEC) { family = APR_INET; - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); } #endif @@ -131,7 +164,7 @@ return errno; } set_socket_vars(*new, family, type); - + (*new)->protocol = protocol; (*new)->timeout = -1; (*new)->inherit = 0; apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup, @@ -325,6 +358,7 @@ set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type); (*apr_sock)->timeout = -1; (*apr_sock)->socketdes = *os_sock_info->os_sock; + (*apr_sock)->protocol = os_sock_info->protocol; if (os_sock_info->local) { memcpy(&(*apr_sock)->local_addr->sa.sin, os_sock_info->local, Index: network_io/unix/sockopt.c =================================================================== RCS file: /home/cvspublic/apr/network_io/unix/sockopt.c,v retrieving revision 1.59 diff -u -r1.59 sockopt.c --- network_io/unix/sockopt.c 15 Jul 2002 20:29:38 -0000 1.59 +++ network_io/unix/sockopt.c 17 Oct 2002 12:59:22 -0000 @@ -231,12 +231,28 @@ } if (opt & APR_TCP_NODELAY) { #if defined(TCP_NODELAY) - if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){ +#if APR_HAVE_SCTP + if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) { + if(sock->protocol == APR_PROTO_SCTP){ + if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY, (void *)&on, sizeof(int)) == -1) { + return errno; + } + } else { + if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, (void *)&on, sizeof(int)) == -1) { + return errno; + } + } + apr_set_option(&sock->netmask, APR_TCP_NODELAY, on); + } +#else + + if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) { if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, (void *)&on, sizeof(int)) == -1) { return errno; } apr_set_option(&sock->netmask, APR_TCP_NODELAY, on); } +#endif #else /* BeOS pre-BONE has TCP_NODELAY set by default. * As it can't be turned off we might as well check if they're asking @@ -252,18 +268,32 @@ } if (opt & APR_TCP_NOPUSH){ #if APR_TCP_NOPUSH_FLAG - if (apr_is_option_set(sock->netmask, APR_TCP_NOPUSH) != on){ + if (apr_is_option_set(sock->netmask, APR_TCP_NOPUSH) != on) { /* OK we're going to change some settings here... */ /* TCP_NODELAY is mutually exclusive, so do we have it set? */ - if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) == 1 && on){ + if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) == 1 && on) { /* If we want to set NOPUSH then if we have the TCP_NODELAY * flag set we need to switch it off... */ int tmpflag = 0; +#if APR_HAVE_SCTP + if(sock->protocol == APR_PROTO_SCTP){ + if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY, + (void*)&tmpflag, sizeof(int)) == -1) { + return errno; + } + }else{ + if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, + (void*)&tmpflag, sizeof(int)) == -1) { + return errno; + } + } +#else if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, - (void*)&tmpflag, sizeof(int)) == -1){ + (void*)&tmpflag, sizeof(int)) == -1) { return errno; } +#endif apr_set_option(&sock->netmask, APR_RESET_NODELAY, 1); apr_set_option(&sock->netmask, APR_TCP_NODELAY, 0); } else if (on){ @@ -271,16 +301,31 @@ } /* OK, now we can just set the TCP_NOPUSH flag accordingly...*/ if (setsockopt(sock->socketdes, IPPROTO_TCP, APR_TCP_NOPUSH_FLAG, - (void*)&on, sizeof(int)) == -1){ + (void*)&on, sizeof(int)) == -1) { return errno; } apr_set_option(&sock->netmask, APR_TCP_NOPUSH, on); - if (!on && apr_is_option_set(sock->netmask, APR_RESET_NODELAY)){ + if (!on && apr_is_option_set(sock->netmask, APR_RESET_NODELAY)) { int tmpflag = 1; +#if APR_HAVE_SCTP + if(sock->protocol == APR_PROTO_SCTP){ + if (setsockopt(sock->socketdes, IPPROTO_SCTP, SCTP_NODELAY, + (void*)&tmpflag, sizeof(int)) == -1) { + return errno; + } + }else{ + if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, + (void*)&tmpflag, sizeof(int)) == -1) { + return errno; + } + } + +#else if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, - (void*)&tmpflag, sizeof(int)) == -1){ + (void*)&tmpflag, sizeof(int)) == -1) { return errno; } +#endif apr_set_option(&sock->netmask, APR_RESET_NODELAY,0); apr_set_option(&sock->netmask, APR_TCP_NODELAY, 1); } Index: network_io/win32/sockets.c =================================================================== RCS file: /home/cvspublic/apr/network_io/win32/sockets.c,v retrieving revision 1.85 diff -u -r1.85 sockets.c --- network_io/win32/sockets.c 30 Jul 2002 13:56:17 -0000 1.85 +++ network_io/win32/sockets.c 17 Oct 2002 12:59:23 -0000 @@ -94,8 +94,41 @@ (*new)->remote_addr->pool = p; } -APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, - int type, apr_pool_t *cont) +APR_DECLARE(apr_status_t) apr_socket_get_protocol(apr_socket_t *sock, + int *protocol) +{ + *protocol = sock->protocol; + return APR_SUCCESS; +} + +apr_status_t apr_socket_create(apr_socket_t **new, int family, int type, + apr_pool_t *cont) +{ + /* Here we guess the protocol type based on the + * family and type. + */ + int protocol; + if ((family == APR_INET) || (family == APR_INET6)) { + if (type == SOCK_DGRAM) { + protocol = APR_PROTO_UDP; + } else if (type == SOCK_STREAM) { + protocol = APR_PROTO_TCP; + } else if (type == SOCK_SEQPACKET) { + protocol = APR_PROTO_SCTP; + } else { + /* Punt? */ + protocol = 0; + } + } else { + /* Punt? */ + protocol = 0; + } + return apr_socket_create_protocol(new,family,type,protocol,cont); +} + + +APR_DECLARE(apr_status_t) apr_socket_create_protocol(apr_socket_t **new, int family, + int type, int protocol, apr_pool_t *cont) { int downgrade = (family == AF_UNSPEC); @@ -112,11 +145,11 @@ /* For right now, we are not using socket groups. We may later. * No flags to use when creating a socket, so use 0 for that parameter as well. */ - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); #if APR_HAVE_IPV6 if ((*new)->socketdes == INVALID_SOCKET && downgrade) { family = AF_INET; - (*new)->socketdes = socket(family, type, 0); + (*new)->socketdes = socket(family, type, protocol); } #endif @@ -161,6 +194,7 @@ set_socket_vars(*new, family, type); + (*new)->protocol = protocol; (*new)->timeout = -1; (*new)->disconnected = 0; @@ -412,6 +446,7 @@ (*apr_sock)->timeout = -1; (*apr_sock)->disconnected = 0; (*apr_sock)->socketdes = *os_sock_info->os_sock; + (*apr_sock)->protocol = os_sock_info->protocol; if (os_sock_info->local) { memcpy(&(*apr_sock)->local_addr->sa.sin, os_sock_info->local, Index: network_io/win32/sockopt.c =================================================================== RCS file: /home/cvspublic/apr/network_io/win32/sockopt.c,v retrieving revision 1.45 diff -u -r1.45 sockopt.c --- network_io/win32/sockopt.c 15 Jul 2002 20:29:38 -0000 1.45 +++ network_io/win32/sockopt.c 17 Oct 2002 12:59:23 -0000 @@ -193,13 +193,32 @@ break; } case APR_TCP_NODELAY: - if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on){ +#if APR_HAVE_SCTP + if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) { + if(sock->protocol == APR_PROTO_SCTP) { + if (setsockopt(sock->socketdes, IPPROTO_SCTP, + SCTP_NODELAY, + (void *)&on, sizeof(int)) == -1 ) { + return apr_get_netos_error(); + } + + } else { + if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, + (void *)&on, sizeof(int)) == -1) { + return apr_get_netos_error(); + } + } + apr_set_option(&sock->netmask, APR_TCP_NODELAY, on); + } +#else + if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) { if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, (void *)&on, sizeof(int)) == -1) { return apr_get_netos_error(); } apr_set_option(&sock->netmask, APR_TCP_NODELAY, on); } +#endif break; default: return APR_EINVAL;