From a9dc900515a28dcf55b2901a8609072430087693 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 16 Jul 2008 19:16:41 +0000 Subject: Configure process now checks availability of recvfrom() socket function and finds out its return type and the types of its arguments. Added definitions for non-configure systems config files, and introduced macro sreadfrom which will be used on udp sockets as a recvfrom() wrapper. --- CHANGES | 6 ++ acinclude.m4 | 146 ++++++++++++++++++++++++++++++++++++++++++++++ ares/CHANGES | 5 ++ ares/Makefile.dj | 6 +- ares/Makefile.netware | 15 +++++ ares/acinclude.m4 | 146 ++++++++++++++++++++++++++++++++++++++++++++++ ares/config-win32.h | 24 ++++++++ ares/configure.ac | 3 +- ares/setup_once.h | 33 ++++++++++- configure.ac | 3 +- lib/Makefile.netware | 15 +++++ lib/config-amigaos.h | 11 +++- lib/config-mac.h | 9 +++ lib/config-os400.h | 24 ++++++++ lib/config-riscos.h | 24 ++++++++ lib/config-symbian.h | 11 ++++ lib/config-tpf.h | 24 ++++++++ lib/config-win32.h | 24 ++++++++ lib/config-win32ce.h | 24 ++++++++ lib/config.dos | 12 +++- lib/setup_once.h | 33 ++++++++++- packages/vms/config-vms.h | 24 ++++++++ src/Makefile.netware | 15 +++++ src/config-win32.h | 24 ++++++++ 24 files changed, 651 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index b757a0df4..29ba012a7 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,12 @@ Changelog +Yang Tse (16 Jul 2008) +- Configure process now checks availability of recvfrom() socket function and + finds out its return type and the types of its arguments. Added definitions + for non-configure systems config files, and introduced macro sreadfrom which + will be used on udp sockets as a recvfrom() wrapper. + Yang Tse (15 Jul 2008) - Added description/comment to include paths used in several Makefile.am files. Added automake option nostdinc to test servers makefile and modified libcurl diff --git a/acinclude.m4 b/acinclude.m4 index f120559d5..21399c7f6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1582,6 +1582,152 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ ]) # AC_DEFUN +dnl CURL_CHECK_FUNC_RECVFROM +dnl ------------------------------------------------- +dnl Test if the socket recvfrom() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_RECVFROM +dnl will be defined, defining the types of the arguments +dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on +dnl to RECVFROM_TYPE_ARG6, defining also the type of the +dnl function return value in RECVFROM_TYPE_RETV. + +AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + # + AC_MSG_CHECKING([for recvfrom]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + recvfrom(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_recvfrom="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_recvfrom="no" + ]) + # + if test "$curl_cv_recvfrom" = "yes"; then + AC_CACHE_CHECK([types of args and return type for recvfrom], + [curl_cv_func_recvfrom_args], [ + curl_cv_func_recvfrom_args="unknown" + for recvfrom_retv in 'int' 'ssize_t'; do + for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recvfrom_arg2 in 'char *' 'void *'; do + for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recvfrom_arg4 in 'int' 'unsigned int'; do + for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do + for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *'; do + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVFROMCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVFROMCALLCONV +#endif + extern $recvfrom_retv RECVFROMCALLCONV + recvfrom($recvfrom_arg1, $recvfrom_arg2, + $recvfrom_arg3, $recvfrom_arg4, + $recvfrom_arg5, $recvfrom_arg6); + ]],[[ + $recvfrom_arg1 s=0; + $recvfrom_arg2 buf=0; + $recvfrom_arg3 len=0; + $recvfrom_arg4 flags=0; + $recvfrom_arg5 addr=0; + $recvfrom_arg6 addrlen=0; + $recvfrom_retv res=0; + res = recvfrom(s, buf, len, flags, addr, addrlen); + ]]) + ],[ + curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" + ]) + fi + done + done + done + done + done + done + done + ]) # AC_CACHE_CHECK + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_MSG_ERROR([Cannot find proper types to use for recvfrom args]) + else + recvfrom_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` + IFS=$recvfrom_prev_IFS + shift + # + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1], + [Define to the type of arg 1 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $[2], + [Define to the type of arg 2 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3], + [Define to the type of arg 3 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4], + [Define to the type of arg 4 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $[5], + [Define to the type of arg 5 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $[6], + [Define to the type of arg 6 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7], + [Define to the function return type for recvfrom.]) + # + AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, + [Define to 1 if you have the recvfrom function.]) + ac_cv_func_recvfrom="yes" + fi + else + AC_MSG_ERROR([Unable to link function recvfrom]) + fi +]) # AC_DEFUN + + dnl CURL_CHECK_MSG_NOSIGNAL dnl ------------------------------------------------- dnl Check for MSG_NOSIGNAL diff --git a/ares/CHANGES b/ares/CHANGES index 91430acae..00673574f 100644 --- a/ares/CHANGES +++ b/ares/CHANGES @@ -4,6 +4,11 @@ - Improved configure detection of number of arguments for getservbyport_r. Detection is now based on compilation checks instead of linker ones. +- Configure process now checks availability of recvfrom() socket function and + finds out its return type and the types of its arguments. Added definitions + for non-configure systems config files, and introduced macro sreadfrom which + will be used on udp sockets as a recvfrom() wrapper. + * Jul 15 2008 (Yang Tse) - Introduce definition of _REENTRANT symbol in setup.h to improve library usability. Previously the configure process only used the AC_SYS_LARGEFILE diff --git a/ares/Makefile.dj b/ares/Makefile.dj index 804b0a7a5..0539e4b6e 100644 --- a/ares/Makefile.dj +++ b/ares/Makefile.dj @@ -23,7 +23,11 @@ CFLAGS += -DWATT32 -DHAVE_AF_INET6 -DHAVE_PF_INET6 -DHAVE_IOCTLSOCKET \ -DRECV_TYPE_ARG1='int' -DRECV_TYPE_ARG2='void*' \ -DRECV_TYPE_ARG3='int' -DRECV_TYPE_ARG4='int' \ -DRECV_TYPE_RETV='int' -DHAVE_STRUCT_TIMEVAL \ - -Dselect=select_s -Dsocklen_t=int -UHAVE_CONFIG_H + -Dselect=select_s -Dsocklen_t=int -UHAVE_CONFIG_H \ + -DRECVFROM_TYPE_ARG1='int' -DRECVFROM_TYPE_ARG2='void*' \ + -DRECVFROM_TYPE_ARG3='int' -DRECVFROM_TYPE_ARG4='int' \ + -DRECVFROM_TYPE_ARG6='int*' -DRECVFROM_TYPE_RETV='int' \ + -DRECVFROM_TYPE_ARG5='struct sockaddr*' -DHAVE_RECVFROM LDFLAGS = -s diff --git a/ares/Makefile.netware b/ares/Makefile.netware index 2f2b8ec4b..874e59d1c 100644 --- a/ares/Makefile.netware +++ b/ares/Makefile.netware @@ -288,6 +288,13 @@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ @@ -324,6 +331,13 @@ else @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ @@ -349,6 +363,7 @@ endif @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index bd3998563..95ab7a3d8 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -1049,6 +1049,152 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [ ]) # AC_DEFUN +dnl CURL_CHECK_FUNC_RECVFROM +dnl ------------------------------------------------- +dnl Test if the socket recvfrom() function is available, +dnl and check its return type and the types of its +dnl arguments. If the function succeeds HAVE_RECVFROM +dnl will be defined, defining the types of the arguments +dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on +dnl to RECVFROM_TYPE_ARG6, defining also the type of the +dnl function return value in RECVFROM_TYPE_RETV. + +AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [ + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl + AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl + AC_CHECK_HEADERS(sys/types.h sys/socket.h) + # + AC_MSG_CHECKING([for recvfrom]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#endif + ]],[[ + recvfrom(0, 0, 0, 0, 0, 0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + curl_cv_recvfrom="yes" + ],[ + AC_MSG_RESULT([no]) + curl_cv_recvfrom="no" + ]) + # + if test "$curl_cv_recvfrom" = "yes"; then + AC_CACHE_CHECK([types of args and return type for recvfrom], + [curl_cv_func_recvfrom_args], [ + curl_cv_func_recvfrom_args="unknown" + for recvfrom_retv in 'int' 'ssize_t'; do + for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do + for recvfrom_arg2 in 'char *' 'void *'; do + for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do + for recvfrom_arg4 in 'int' 'unsigned int'; do + for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do + for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *'; do + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#undef inline +#ifdef HAVE_WINDOWS_H +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#ifdef HAVE_WINSOCK2_H +#include +#else +#ifdef HAVE_WINSOCK_H +#include +#endif +#endif +#define RECVFROMCALLCONV PASCAL +#else +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#define RECVFROMCALLCONV +#endif + extern $recvfrom_retv RECVFROMCALLCONV + recvfrom($recvfrom_arg1, $recvfrom_arg2, + $recvfrom_arg3, $recvfrom_arg4, + $recvfrom_arg5, $recvfrom_arg6); + ]],[[ + $recvfrom_arg1 s=0; + $recvfrom_arg2 buf=0; + $recvfrom_arg3 len=0; + $recvfrom_arg4 flags=0; + $recvfrom_arg5 addr=0; + $recvfrom_arg6 addrlen=0; + $recvfrom_retv res=0; + res = recvfrom(s, buf, len, flags, addr, addrlen); + ]]) + ],[ + curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" + ]) + fi + done + done + done + done + done + done + done + ]) # AC_CACHE_CHECK + if test "$curl_cv_func_recvfrom_args" = "unknown"; then + AC_MSG_ERROR([Cannot find proper types to use for recvfrom args]) + else + recvfrom_prev_IFS=$IFS; IFS=',' + set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` + IFS=$recvfrom_prev_IFS + shift + # + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1], + [Define to the type of arg 1 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $[2], + [Define to the type of arg 2 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3], + [Define to the type of arg 3 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4], + [Define to the type of arg 4 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $[5], + [Define to the type of arg 5 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $[6], + [Define to the type of arg 6 for recvfrom.]) + AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7], + [Define to the function return type for recvfrom.]) + # + AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, + [Define to 1 if you have the recvfrom function.]) + ac_cv_func_recvfrom="yes" + fi + else + AC_MSG_ERROR([Unable to link function recvfrom]) + fi +]) # AC_DEFUN + + dnl CURL_CHECK_MSG_NOSIGNAL dnl ------------------------------------------------- dnl Check for MSG_NOSIGNAL diff --git a/ares/config-win32.h b/ares/config-win32.h index 854143d55..8e621a474 100644 --- a/ares/config-win32.h +++ b/ares/config-win32.h @@ -97,6 +97,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND 1 diff --git a/ares/configure.ac b/ares/configure.ac index 57f16c3cb..2f7f6c96c 100644 --- a/ares/configure.ac +++ b/ares/configure.ac @@ -623,9 +623,8 @@ TYPE_SIG_ATOMIC_T AC_TYPE_SIGNAL CURL_CHECK_FUNC_RECV - +CURL_CHECK_FUNC_RECVFROM CURL_CHECK_FUNC_SEND - CURL_CHECK_MSG_NOSIGNAL dnl check for AF_INET6 diff --git a/ares/setup_once.h b/ares/setup_once.h index 59ed25cb2..85a291a81 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -3,7 +3,7 @@ /* $Id$ */ -/* Copyright (C) 2004 - 2007 by Daniel Stenberg et al +/* Copyright (C) 2004 - 2008 by Daniel Stenberg et al * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided @@ -191,6 +191,37 @@ struct timeval { #endif /* HAVE_SEND */ +#if defined(HAVE_RECVFROM) +/* + * Currently recvfrom is only used on udp sockets. + */ +#if !defined(RECVFROM_TYPE_ARG1) || \ + !defined(RECVFROM_TYPE_ARG2) || \ + !defined(RECVFROM_TYPE_ARG3) || \ + !defined(RECVFROM_TYPE_ARG4) || \ + !defined(RECVFROM_TYPE_ARG5) || \ + !defined(RECVFROM_TYPE_ARG6) || \ + !defined(RECVFROM_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recvfrom + /* */ +#else +#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1)(s), \ + (RECVFROM_TYPE_ARG2)(b), \ + (RECVFROM_TYPE_ARG3)(bl), \ + (RECVFROM_TYPE_ARG4)(0), \ + (RECVFROM_TYPE_ARG5)(f), \ + (RECVFROM_TYPE_ARG6)(fl)) +#endif +#else /* HAVE_RECVFROM */ +#ifndef sreadfrom + /* */ + Error Missing_definition_of_macro_sreadfrom + /* */ +#endif +#endif /* HAVE_RECVFROM */ + + /* * Uppercase macro versions of ANSI/ISO is*() functions/macros which * avoid negative number inputs with argument byte codes > 127. diff --git a/configure.ac b/configure.ac index 631939439..278f75fa4 100644 --- a/configure.ac +++ b/configure.ac @@ -2068,9 +2068,8 @@ AC_TYPE_SIGNAL CURL_CHECK_FUNC_SELECT CURL_CHECK_FUNC_RECV - +CURL_CHECK_FUNC_RECVFROM CURL_CHECK_FUNC_SEND - CURL_CHECK_MSG_NOSIGNAL dnl Checks for library functions. diff --git a/lib/Makefile.netware b/lib/Makefile.netware index 16f294a85..9d71b6d8e 100644 --- a/lib/Makefile.netware +++ b/lib/Makefile.netware @@ -382,6 +382,13 @@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ @@ -414,6 +421,13 @@ else @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ @@ -441,6 +455,7 @@ endif @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h index 1859b2f6b..553a910aa 100644 --- a/lib/config-amigaos.h +++ b/lib/config-amigaos.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -131,6 +131,15 @@ #define RECV_TYPE_ARG4 long #define RECV_TYPE_RETV long +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 long +#define RECVFROM_TYPE_ARG2 char * +#define RECVFROM_TYPE_ARG3 long +#define RECVFROM_TYPE_ARG4 long +#define RECVFROM_TYPE_ARG5 struct sockaddr * +#define RECVFROM_TYPE_ARG6 long * +#define RECVFROM_TYPE_RETV long + #define HAVE_SEND 1 #define SEND_TYPE_ARG1 int #define SEND_QUAL_ARG2 const diff --git a/lib/config-mac.h b/lib/config-mac.h index 0af258620..9769f9dfe 100644 --- a/lib/config-mac.h +++ b/lib/config-mac.h @@ -63,6 +63,15 @@ #define RECV_TYPE_ARG4 int #define RECV_TYPE_RETV ssize_t +#define HAVE_RECVFROM 1 +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void * +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr * +#define RECVFROM_TYPE_ARG6 int * +#define RECVFROM_TYPE_RETV ssize_t + #define HAVE_SEND 1 #define SEND_TYPE_ARG1 int #define SEND_QUAL_ARG2 const diff --git a/lib/config-os400.h b/lib/config-os400.h index edc01e679..20785665c 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -456,6 +456,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND diff --git a/lib/config-riscos.h b/lib/config-riscos.h index e1160e625..722e8734f 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -430,6 +430,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV ssize_t +/* Define 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV ssize_t + /* Define if you have the send function. */ #define HAVE_SEND 1 diff --git a/lib/config-symbian.h b/lib/config-symbian.h index e656ade91..2297b9f73 100644 --- a/lib/config-symbian.h +++ b/lib/config-symbian.h @@ -415,6 +415,9 @@ /* Define to 1 if you have the recv function. */ #define HAVE_RECV 1 +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_RSA_H */ @@ -680,6 +683,14 @@ #define RECV_TYPE_ARG4 int #define RECV_TYPE_RETV ssize_t +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void* +#define RECVFROM_TYPE_ARG3 size_t +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr * +#define RECVFROM_TYPE_ARG6 size_t * +#define RECVFROM_TYPE_RETV ssize_t + #define SEND_TYPE_ARG1 int #define SEND_QUAL_ARG2 const #define SEND_TYPE_ARG2 void* diff --git a/lib/config-tpf.h b/lib/config-tpf.h index ee86bab41..1d114b9ce 100644 --- a/lib/config-tpf.h +++ b/lib/config-tpf.h @@ -702,6 +702,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define to 1 if you have the send function. */ #define HAVE_SEND 1 diff --git a/lib/config-win32.h b/lib/config-win32.h index 031eda54a..d51047526 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -248,6 +248,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND 1 diff --git a/lib/config-win32ce.h b/lib/config-win32ce.h index 0126cca78..c9b9bea38 100644 --- a/lib/config-win32ce.h +++ b/lib/config-win32ce.h @@ -234,6 +234,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND 1 diff --git a/lib/config.dos b/lib/config.dos index 0e4998336..46b4a385d 100644 --- a/lib/config.dos +++ b/lib/config.dos @@ -35,6 +35,7 @@ #define HAVE_NET_IF_H 1 #define HAVE_PROCESS_H 1 #define HAVE_RECV 1 +#define HAVE_RECVFROM 1 #define HAVE_SELECT 1 #define HAVE_SEND 1 #define HAVE_SETJMP_H 1 @@ -63,8 +64,8 @@ #define STDC_HEADERS 1 #define TIME_WITH_SYS_TIME 1 -/* Qualifiers for send() and recv(). - */ +/* Qualifiers for send(), recv() and recv(). */ + #define SEND_TYPE_ARG1 int #define SEND_QUAL_ARG2 const #define SEND_TYPE_ARG2 void * @@ -78,6 +79,13 @@ #define RECV_TYPE_ARG4 int #define RECV_TYPE_RETV int +#define RECVFROM_TYPE_ARG1 int +#define RECVFROM_TYPE_ARG2 void * +#define RECVFROM_TYPE_ARG3 int +#define RECVFROM_TYPE_ARG4 int +#define RECVFROM_TYPE_ARG5 struct sockaddr * +#define RECVFROM_TYPE_ARG6 int * +#define RECVFROM_TYPE_RETV int #define BSD diff --git a/lib/setup_once.h b/lib/setup_once.h index b0355e289..77b253588 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -198,6 +198,37 @@ struct timeval { #endif /* HAVE_SEND */ +#if defined(HAVE_RECVFROM) +/* + * Currently recvfrom is only used on udp sockets. + */ +#if !defined(RECVFROM_TYPE_ARG1) || \ + !defined(RECVFROM_TYPE_ARG2) || \ + !defined(RECVFROM_TYPE_ARG3) || \ + !defined(RECVFROM_TYPE_ARG4) || \ + !defined(RECVFROM_TYPE_ARG5) || \ + !defined(RECVFROM_TYPE_ARG6) || \ + !defined(RECVFROM_TYPE_RETV) + /* */ + Error Missing_definition_of_return_and_arguments_types_of_recvfrom + /* */ +#else +#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1)(s), \ + (RECVFROM_TYPE_ARG2)(b), \ + (RECVFROM_TYPE_ARG3)(bl), \ + (RECVFROM_TYPE_ARG4)(0), \ + (RECVFROM_TYPE_ARG5)(f), \ + (RECVFROM_TYPE_ARG6)(fl)) +#endif +#else /* HAVE_RECVFROM */ +#ifndef sreadfrom + /* */ + Error Missing_definition_of_macro_sreadfrom + /* */ +#endif +#endif /* HAVE_RECVFROM */ + + /* * Uppercase macro versions of ANSI/ISO is*() functions/macros which * avoid negative number inputs with argument byte codes > 127. diff --git a/packages/vms/config-vms.h b/packages/vms/config-vms.h index 1fbb9fd62..19c72ac64 100644 --- a/packages/vms/config-vms.h +++ b/packages/vms/config-vms.h @@ -315,6 +315,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND 1 diff --git a/src/Makefile.netware b/src/Makefile.netware index 86e593653..11e596ef1 100644 --- a/src/Makefile.netware +++ b/src/Makefile.netware @@ -369,6 +369,13 @@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 char *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@ @@ -397,6 +404,13 @@ else @echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG2 void *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_ARG6 int *$(DL) >> $@ + @echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@ @echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@ @@ -421,6 +435,7 @@ endif @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ @echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_RECV 1$(DL) >> $@ + @echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@ @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@ @echo $(DL)#define HAVE_SEND 1$(DL) >> $@ @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@ diff --git a/src/config-win32.h b/src/config-win32.h index 6aaac0032..33f0d9cbf 100644 --- a/src/config-win32.h +++ b/src/config-win32.h @@ -110,6 +110,30 @@ /* Define to the function return type for recv. */ #define RECV_TYPE_RETV int +/* Define if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 SOCKET + +/* Define to the type of arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 char * + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 int + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type of arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr * + +/* Define to the type of arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int * + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + /* Define if you have the send function. */ #define HAVE_SEND 1 -- cgit v1.2.3