added some urs code

This commit is contained in:
hyung-hwan 2014-08-25 16:18:17 +00:00
parent eb1511b817
commit 78f8b4a994
54 changed files with 779 additions and 259 deletions

View File

@ -57,6 +57,7 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
ac/depcomp ac/install-sh ac/ltmain.sh ac/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

1
qse/aclocal.m4 vendored
View File

@ -1027,6 +1027,7 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/argz.m4])
m4_include([m4/ax_check_sign.m4])
m4_include([m4/ax_cxx_namespace.m4])
m4_include([m4/ax_numval.m4])
m4_include([m4/ax_pthread.m4])

View File

@ -54,6 +54,7 @@ subdir = cmd
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -64,6 +64,7 @@ subdir = cmd/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -8,7 +8,7 @@ AM_CPPFLAGS = \
qsecfgdir = $(sysconfdir)/qse
qsecfg_DATA = httpd.conf httpd-mime.conf
bin_PROGRAMS = qsehttpd
bin_PROGRAMS = qsehttpd qseursd
qsehttpd_SOURCES = httpd.c
qsehttpd_LDFLAGS = -L../../lib/xli -L../../lib/http -L../../lib/cmn
@ -20,4 +20,8 @@ qsehttpd_LDADD += $(UNICOWS_LIBS)
endif
endif
qseursd_SOURCES = ursd.c
qseursd_LDFLAGS = -L../../lib/cmn
qseursd_LDADD = -lqsecmn
EXTRA_DIST = $(qsecfg_DATA)

View File

@ -52,12 +52,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = qsehttpd$(EXEEXT)
bin_PROGRAMS = qsehttpd$(EXEEXT) qseursd$(EXEEXT)
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
subdir = cmd/http
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
@ -83,6 +84,12 @@ am__v_lt_0 = --silent
qsehttpd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(qsehttpd_LDFLAGS) $(LDFLAGS) -o $@
am_qseursd_OBJECTS = ursd.$(OBJEXT)
qseursd_OBJECTS = $(am_qseursd_OBJECTS)
qseursd_DEPENDENCIES =
qseursd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(qseursd_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
@ -109,8 +116,8 @@ am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(qsehttpd_SOURCES)
DIST_SOURCES = $(qsehttpd_SOURCES)
SOURCES = $(qsehttpd_SOURCES) $(qseursd_SOURCES)
DIST_SOURCES = $(qsehttpd_SOURCES) $(qseursd_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@ -332,6 +339,9 @@ qsecfg_DATA = httpd.conf httpd-mime.conf
qsehttpd_SOURCES = httpd.c
qsehttpd_LDFLAGS = -L../../lib/xli -L../../lib/http -L../../lib/cmn
qsehttpd_LDADD = -lqsexli -lqsehttp -lqsecmn $(am__append_1)
qseursd_SOURCES = ursd.c
qseursd_LDFLAGS = -L../../lib/cmn
qseursd_LDADD = -lqsecmn
EXTRA_DIST = $(qsecfg_DATA)
all: all-am
@ -416,6 +426,9 @@ clean-binPROGRAMS:
qsehttpd$(EXEEXT): $(qsehttpd_OBJECTS) $(qsehttpd_DEPENDENCIES) $(EXTRA_qsehttpd_DEPENDENCIES)
@rm -f qsehttpd$(EXEEXT)
$(AM_V_CCLD)$(qsehttpd_LINK) $(qsehttpd_OBJECTS) $(qsehttpd_LDADD) $(LIBS)
qseursd$(EXEEXT): $(qseursd_OBJECTS) $(qseursd_DEPENDENCIES) $(EXTRA_qseursd_DEPENDENCIES)
@rm -f qseursd$(EXEEXT)
$(AM_V_CCLD)$(qseursd_LINK) $(qseursd_OBJECTS) $(qseursd_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -424,6 +437,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ursd.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<

View File

@ -188,7 +188,7 @@ struct loccfg_t
unsigned int allow_http: 1;
unsigned int allow_connect: 1;
unsigned int dns_enabled: 1;
unsigned int urs_enabled: 1;
unsigned int urs_enabled: 2;
qse_nwad_t dns_nwad; /* TODO: multiple dns */
qse_nwad_t urs_nwad; /* TODO: multiple urs */
int dns_timeout;
@ -1467,8 +1467,6 @@ static int load_loccfg_proxy (qse_httpd_t* httpd, qse_xli_t* xli, qse_xli_list_t
if (pair) cfg->proxy.dns_retries = get_integer ((qse_xli_str_t*)pair->val);
else cfg->proxy.dns_retries = -1;
pair = QSE_NULL;
if (proxy) pair = qse_xli_findpair (xli, proxy, QSE_T("urs-enabled"));
if (!pair && default_proxy) pair = qse_xli_findpair (xli, default_proxy, QSE_T("urs-enabled"));

View File

@ -138,7 +138,7 @@ server-default {
#dns-timeout = 3
#dns-retries = 2
#urs-enabled = yes;
#urs-enabled = yes; # no, yes,
#urs-server = "127.0.0.1:97";
#urs-timeout = 1;
#urs-retries = 4;

View File

@ -57,6 +57,7 @@ subdir = cmd/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -57,6 +57,7 @@ subdir = cmd/xli
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

219
qse/configure vendored
View File

@ -17451,7 +17451,7 @@ fi
done
for ac_header in sys/sysctl.h sys/socket.h sys/sockio.h ifaddrs.h linux/netfilter_ipv4.h
for ac_header in sys/sysctl.h sys/socket.h sys/sockio.h ifaddrs.h linux/netfilter_ipv4.h netinet/sctp.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -19829,7 +19829,7 @@ _ACEOF
if test "${platform_win32}" == "yes"
then
# The cast to long int works around a bug in the HP C Compiler
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
@ -19839,8 +19839,8 @@ if ${ac_cv_sizeof_struct_sockaddr_in+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in))" "ac_cv_sizeof_struct_sockaddr_in" "
#include <winsock2.h>
#include <ws2tcpip.h>
#include <winsock2.h>
#include <ws2tcpip.h>
"; then :
else
@ -19865,7 +19865,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
@ -19875,8 +19875,8 @@ if ${ac_cv_sizeof_struct_sockaddr_in6+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in6))" "ac_cv_sizeof_struct_sockaddr_in6" "
#include <winsock2.h>
#include <ws2tcpip.h>
#include <winsock2.h>
#include <ws2tcpip.h>
"; then :
else
@ -19901,8 +19901,87 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of socklen_t" >&5
$as_echo_n "checking size of socklen_t... " >&6; }
if ${ac_cv_sizeof_socklen_t+:} false; then :
$as_echo_n "(cached) " >&6
else
# The cast to long int works around a bug in the HP C Compiler
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" "
#include <winsock2.h>
#include <ws2tcpip.h>
"; then :
else
if test "$ac_cv_type_socklen_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (socklen_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_socklen_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_socklen_t" >&5
$as_echo "$ac_cv_sizeof_socklen_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SOCKLEN_T $ac_cv_sizeof_socklen_t
_ACEOF
if test ${ac_cv_sizeof_socklen_t} -gt 0
then
typename=`echo socklen_t | sed "s/[^a-zA-Z0-9_]/_/g"`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether socklen_t is signed" >&5
$as_echo_n "checking whether socklen_t is signed... " >&6; }
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <winsock2.h>
#include <ws2tcpip.h>
int
main ()
{
int foo [ 1 - 2 * !(((socklen_t) -1) < 0) ]
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "ax_cv_decl_${typename}_signed=\"yes\""
else
eval "ax_cv_decl_${typename}_signed=\"no\""
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$ax_cv_decl_${typename}_signed
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
symbolname=`echo socklen_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
$as_echo "#define QSE_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
$as_echo_n ""
fi
fi
else
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
@ -19912,8 +19991,8 @@ if ${ac_cv_sizeof_struct_sockaddr_in+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in))" "ac_cv_sizeof_struct_sockaddr_in" "
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
"; then :
else
@ -19938,7 +20017,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
@ -19948,8 +20027,8 @@ if ${ac_cv_sizeof_struct_sockaddr_in6+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in6))" "ac_cv_sizeof_struct_sockaddr_in6" "
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
"; then :
else
@ -19974,8 +20053,87 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of socklen_t" >&5
$as_echo_n "checking size of socklen_t... " >&6; }
if ${ac_cv_sizeof_socklen_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" "
#include <sys/socket.h>
#include <netinet/in.h>
"; then :
else
if test "$ac_cv_type_socklen_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (socklen_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_socklen_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_socklen_t" >&5
$as_echo "$ac_cv_sizeof_socklen_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SOCKLEN_T $ac_cv_sizeof_socklen_t
_ACEOF
if test ${ac_cv_sizeof_socklen_t} -gt 0
then
typename=`echo socklen_t | sed "s/[^a-zA-Z0-9_]/_/g"`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether socklen_t is signed" >&5
$as_echo_n "checking whether socklen_t is signed... " >&6; }
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/socket.h>
int
main ()
{
int foo [ 1 - 2 * !(((socklen_t) -1) < 0) ]
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "ax_cv_decl_${typename}_signed=\"yes\""
else
eval "ax_cv_decl_${typename}_signed=\"no\""
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$ax_cv_decl_${typename}_signed
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
symbolname=`echo socklen_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
$as_echo "#define QSE_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
$as_echo_n ""
fi
fi
fi
if test ${ac_cv_sizeof___int128_t} -gt 0
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __int128_t with %" >&5
@ -20170,6 +20328,7 @@ fi
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_CHAR ${ac_cv_sizeof_char}
_ACEOF
@ -20288,6 +20447,12 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define QSE_SIZEOF_SOCKLEN_T ${ac_cv_sizeof_socklen_t}
_ACEOF
qse_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`"
qse_package_version_minor="`echo ${PACKAGE_VERSION} | cut -d. -f2`"
qse_package_version_patch="`echo ${PACKAGE_VERSION} | cut -d. -f3`"
@ -21152,34 +21317,6 @@ $as_echo "#define QSE_ENABLE_SED_TRACER /**/" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t in sys/socket.h" >&5
$as_echo_n "checking for socklen_t in sys/socket.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _POSIX_PII_SOCKET
#include <sys/types.h>
#include <sys/socket.h>
int
main ()
{
socklen_t x = 5;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "${enable_shared}" = "no" -a "${enable_static}" = "yes"
then

View File

@ -123,7 +123,7 @@ AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h])
AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h])
AC_CHECK_HEADERS([sys/resource.h sys/wait.h sys/syscall.h sys/ioctl.h])
AC_CHECK_HEADERS([sys/sendfile.h sys/epoll.h sys/event.h])
AC_CHECK_HEADERS([sys/sysctl.h sys/socket.h sys/sockio.h ifaddrs.h linux/netfilter_ipv4.h])
AC_CHECK_HEADERS([sys/sysctl.h sys/socket.h sys/sockio.h ifaddrs.h linux/netfilter_ipv4.h netinet/sctp.h])
AC_CHECK_HEADERS([net/if.h net/if_dl.h], [], [], [
#include <sys/types.h>
#include <sys/socket.h>])
@ -132,8 +132,8 @@ AC_CHECK_HEADERS([quadmath.h crt_externs.h sys/prctl.h uci.h])
dnl check data types
AC_CHECK_TYPE([wchar_t],
[AC_DEFINE([HAVE_WCHAR_T_IN_STDDEF_H],
[],[wchar_t is available in stddef.h])],
[ AC_DEFINE([HAVE_WCHAR_T_IN_STDDEF_H],
[],[wchar_t is available in stddef.h]) ],
[],
[#include <stddef.h>])
@ -368,21 +368,45 @@ AX_CHECK_NUMVALOF(MB_LEN_MAX,[32],[#include <limits.h>])
if test "${platform_win32}" == "yes"
then
AC_CHECK_SIZEOF(struct sockaddr_in,,[
#include <winsock2.h>
#include <ws2tcpip.h>])
AC_CHECK_SIZEOF(struct sockaddr_in6,, [
#include <winsock2.h>
#include <ws2tcpip.h>])
AC_CHECK_SIZEOF(struct sockaddr_in,,[
#include <winsock2.h>
#include <ws2tcpip.h>])
AC_CHECK_SIZEOF(struct sockaddr_in6,,[
#include <winsock2.h>
#include <ws2tcpip.h>])
AC_CHECK_SIZEOF(socklen_t,, [
#include <winsock2.h>
#include <ws2tcpip.h>])
if test ${ac_cv_sizeof_socklen_t} -gt 0
then
AX_CHECK_SIGN([socklen_t],
[ AC_DEFINE(QSE_SOCKLEN_T_IS_SIGNED, 1, [Define if socklen_t is signed]) ],
[ AS_ECHO_N("") ],
[#include <winsock2.h>
#include <ws2tcpip.h>])
fi
else
AC_CHECK_SIZEOF(struct sockaddr_in,,[
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_SIZEOF(struct sockaddr_in6,, [
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_SIZEOF(struct sockaddr_in,,[
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_SIZEOF(struct sockaddr_in6,,[
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_SIZEOF(socklen_t,, [
#include <sys/socket.h>
#include <netinet/in.h>])
if test ${ac_cv_sizeof_socklen_t} -gt 0
then
AX_CHECK_SIGN([socklen_t],
[ AC_DEFINE(QSE_SOCKLEN_T_IS_SIGNED, 1, [Define if socklen_t is signed]) ],
[ AS_ECHO_N("") ],
[#include <sys/socket.h>])
fi
fi
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
dnl something similar.
dnl SSE vector argument without SSE enabled changes the ABI
@ -483,6 +507,7 @@ then
fi
AC_SUBST(QUADMATH_LIBS)
AC_DEFINE_UNQUOTED(QSE_SIZEOF_CHAR, ${ac_cv_sizeof_char}, [sizeof(char)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SHORT, ${ac_cv_sizeof_short}, [sizeof(short)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_INT, ${ac_cv_sizeof_int}, [sizeof(int)])
@ -509,6 +534,8 @@ AC_DEFINE_UNQUOTED(QSE_MBLEN_MAX, ${ax_cv_numvalof_MB_LEN_MAX}, [MB_LEN_MAX])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_SOCKADDR_IN, ${ac_cv_sizeof_struct_sockaddr_in}, [sizeof(struct sockaddr_in)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_SOCKADDR_IN6, ${ac_cv_sizeof_struct_sockaddr_in6}, [sizeof(struct sockaddr_in6)])
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SOCKLEN_T, ${ac_cv_sizeof_socklen_t}, [sizeof(socklen_t)])
qse_package_version_major="`echo ${PACKAGE_VERSION} | cut -d. -f1`"
qse_package_version_minor="`echo ${PACKAGE_VERSION} | cut -d. -f2`"
@ -641,15 +668,6 @@ then
AC_DEFINE([QSE_ENABLE_SED_TRACER],[],[enable qse_sed_setexectracer()])
fi
AC_MSG_CHECKING([for socklen_t in sys/socket.h])
AC_TRY_COMPILE([#define _POSIX_PII_SOCKET
#include <sys/types.h>
#include <sys/socket.h>], [socklen_t x = 5;],
[AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
)
if test "${enable_shared}" = "no" -a "${enable_static}" = "yes"
then
AC_DEFINE([QSE_ENABLE_STATIC_MODULE],[],[link modules statically into the main library])

View File

@ -55,6 +55,7 @@ DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -54,6 +54,7 @@ subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -56,6 +56,7 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -56,6 +56,7 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -34,6 +34,7 @@ pkginclude_HEADERS = \
pma.h \
rbt.h \
rex.h \
sck.h \
sio.h \
sll.h \
slmb.h \

View File

@ -56,6 +56,7 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
@ -84,8 +85,8 @@ am__can_run_installinfo = \
am__pkginclude_HEADERS_DIST = alg.h chr.h cp949.h cp950.h dir.h dll.h \
env.h fio.h fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h \
lda.h main.h map.h mb8.h mbwc.h mem.h mux.h nwad.h nwif.h \
nwio.h oht.h opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h \
slmb.h str.h task.h time.h tio.h tmr.h tre.h uni.h uri.h \
nwio.h oht.h opt.h path.h pio.h pma.h rbt.h rex.h sck.h sio.h \
sll.h slmb.h str.h task.h time.h tio.h tmr.h tre.h uni.h uri.h \
utf8.h xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@ -298,9 +299,9 @@ top_srcdir = @top_srcdir@
pkginclude_HEADERS = alg.h chr.h cp949.h cp950.h dir.h dll.h env.h \
fio.h fma.h fmt.h fs.h gdl.h glob.h htb.h hton.h ipad.h lda.h \
main.h map.h mb8.h mbwc.h mem.h mux.h nwad.h nwif.h nwio.h \
oht.h opt.h path.h pio.h pma.h rbt.h rex.h sio.h sll.h slmb.h \
str.h task.h time.h tio.h tmr.h tre.h uni.h uri.h utf8.h xma.h \
$(am__append_1)
oht.h opt.h path.h pio.h pma.h rbt.h rex.h sck.h sio.h sll.h \
slmb.h str.h task.h time.h tio.h tmr.h tre.h uni.h uri.h \
utf8.h xma.h $(am__append_1)
all: all-am
.SUFFIXES:

View File

@ -30,6 +30,7 @@
#include <qse/cmn/tio.h>
#include <qse/cmn/nwad.h>
#include <qse/cmn/time.h>
#include <qse/cmn/sck.h>
enum qse_nwio_flag_t
{
@ -82,16 +83,7 @@ struct qse_nwio_tmout_t
typedef struct qse_nwio_tmout_t qse_nwio_tmout_t;
#if defined(_WIN32)
typedef qse_uintptr_t qse_nwio_hnd_t;
#elif defined(__OS2__)
typedef int qse_nwio_hnd_t;
#elif defined(__DOS__)
typedef int qse_nwio_hnd_t;
#else
typedef int qse_nwio_hnd_t;
#endif
typedef qse_sck_hnd_t qse_nwio_hnd_t;
typedef struct qse_nwio_t qse_nwio_t;
/**
@ -102,7 +94,7 @@ struct qse_nwio_t
qse_mmgr_t* mmgr;
int flags;
qse_nwio_errnum_t errnum;
qse_nwio_tmout_t tmout;
qse_nwio_tmout_t tmout;
qse_nwio_hnd_t handle;
qse_tio_t* tio;
int status;

76
qse/include/qse/cmn/sck.h Normal file
View File

@ -0,0 +1,76 @@
/*
* $Id$
*
Copyright 2006-2014 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _QSE_CMN_SCK_H_
#define _QSE_CMN_SCK_H_
#include <qse/types.h>
#include <qse/macros.h>
#if defined(_WIN32)
typedef qse_uintptr_t qse_sck_hnd_t;
# define QSE_INVALID_SCKHND (~(qse_sck_hnd_t)0)
#elif defined(__OS2__)
typedef int qse_sck_hnd_t;
# define QSE_INVALID_SCKHND -1
#elif defined(__DOS__)
typedef int qse_sck_hnd_t;
# define QSE_INVALID_SCKHND -1
#else
typedef int qse_sck_hnd_t;
# define QSE_INVALID_SCKHND -1
#endif
#if (QSE_SIZEOF_SOCKLEN_T == QSE_SIZEOF_INT)
#if defined(QSE_SOCKLEN_T_IS_SIGNED)
typedef int qse_sck_len_t;
#else
typedef unsigned int qse_sck_len_t;
#endif
#elif (QSE_SIZEOF_SOCKLEN_T == QSE_SIZEOF_LONG)
#if defined(QSE_SOCKLEN_T_IS_SIGNED)
typedef long qse_sck_len_t;
#else
typedef unsigned long qse_sck_len_t;
#endif
#else
typedef int qse_sck_len_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
QSE_EXPORT int qse_isvalidsckhnd (
qse_sck_hnd_t handle
);
QSE_EXPORT void qse_closesckhnd (
qse_sck_hnd_t handle
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -61,6 +61,7 @@
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1
@ -100,6 +101,7 @@
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1

View File

@ -57,6 +57,7 @@
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1

View File

@ -80,6 +80,7 @@ _M_X64 x64 platform
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1
@ -164,6 +165,7 @@ _M_X64 x64 platform
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1
@ -202,6 +204,7 @@ _M_X64 x64 platform
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1

View File

@ -64,6 +64,7 @@
/* these two have only to be large enough */
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1
@ -101,6 +102,7 @@
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define QSE_SIZEOF_SOCKLEN_T 4
# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1

View File

@ -118,6 +118,7 @@
/* these two have only to be large enough */
#define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32
#define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64
#define QSE_SIZEOF_SOCKLEN_T 4
#if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR)
# define QSE_CHAR_IS_WCHAR 1

View File

@ -350,6 +350,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <netinet/sctp.h> header file. */
#undef HAVE_NETINET_SCTP_H
/* Define to 1 if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H
@ -461,9 +464,6 @@
/* Define to 1 if you have the `sinq' function. */
#undef HAVE_SINQ
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
/* Define to 1 if you have the <spawn.h> header file. */
#undef HAVE_SPAWN_H
@ -853,6 +853,9 @@
/* sizeof(short) */
#undef QSE_SIZEOF_SHORT
/* sizeof(socklen_t) */
#undef QSE_SIZEOF_SOCKLEN_T
/* sizeof(struct sockaddr_in) */
#undef QSE_SIZEOF_STRUCT_SOCKADDR_IN
@ -886,6 +889,9 @@
/* sizeof(__int8) */
#undef QSE_SIZEOF___INT8
/* Define if socklen_t is signed */
#undef QSE_SOCKLEN_T_IS_SIGNED
/* use qse_fltmax_t for floating-point numbers in AWK */
#undef QSE_USE_AWK_FLTMAX
@ -928,6 +934,9 @@
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `socklen_t', as computed by sizeof. */
#undef SIZEOF_SOCKLEN_T
/* The size of `struct sockaddr_in', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN

View File

@ -55,6 +55,7 @@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -83,7 +83,7 @@ enum qse_httpd_trait_t
QSE_HTTPD_PROXYNOVIA = (1 << 4),
QSE_HTTPD_LOGACT = (1 << 5),
QSE_HTTPD_DNSNOA = (1 << 6),
QSE_HTTPD_DNSNOAAAA = (1 << 7),
QSE_HTTPD_DNSNOAAAA = (1 << 7)
};
typedef enum qse_httpd_trait_t qse_httpd_trait_t;
@ -131,9 +131,9 @@ typedef struct qse_httpd_natr_t qse_httpd_natr_t;
struct qse_httpd_natr_t
{
qse_nwad_t nwad;
qse_nwad_t nwad;
qse_ntime_t tmout;
int retries;
int retries;
};
typedef void (*qse_httpd_resol_t) (
@ -584,13 +584,13 @@ struct qse_httpd_rsrc_cgi_t
enum qse_httpd_rsrc_proxy_flag_t
{
QSE_HTTPD_RSRC_PROXY_RAW = (1 << 0), /* raw proxying. set this for CONNECT */
QSE_HTTPD_RSRC_PROXY_TRANSPARENT = (1 << 1),
QSE_HTTPD_RSRC_PROXY_DST_STR = (1 << 2), /* destination is an unresovled string pointed to by dst.str */
QSE_HTTPD_RSRC_PROXY_ENABLE_DNS = (1 << 3), /* dns service enabled */
QSE_HTTPD_RSRC_PROXY_ENABLE_URS = (1 << 4), /* url rewriting enabled */
QSE_HTTPD_RSRC_PROXY_DNS_SERVER = (1 << 5), /* dns address specified */
QSE_HTTPD_RSRC_PROXY_URS_SERVER = (1 << 6) /* urs address specified */
QSE_HTTPD_RSRC_PROXY_RAW = (1 << 0), /* raw proxying. set this for CONNECT */
QSE_HTTPD_RSRC_PROXY_TRANSPARENT = (1 << 1),
QSE_HTTPD_RSRC_PROXY_DST_STR = (1 << 2), /* destination is an unresovled string pointed to by dst.str */
QSE_HTTPD_RSRC_PROXY_ENABLE_DNS = (1 << 3), /* dns service enabled (udp) */
QSE_HTTPD_RSRC_PROXY_ENABLE_URS = (1 << 4), /* url rewriting enabled (udp) */
QSE_HTTPD_RSRC_PROXY_DNS_SERVER = (1 << 5), /* dns address specified */
QSE_HTTPD_RSRC_PROXY_URS_SERVER = (1 << 6), /* urs address specified */
};
typedef struct qse_httpd_rsrc_proxy_t qse_httpd_rsrc_proxy_t;

View File

@ -56,6 +56,7 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -55,6 +55,7 @@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -54,6 +54,7 @@ subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -80,6 +80,7 @@ subdir = lib/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -70,6 +70,7 @@ libqsecmn_la_SOURCES = \
pma.c \
rbt.c \
rex.c \
sck.c \
sio.c \
sll.c \
slmb.c \

View File

@ -60,6 +60,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
@ -109,16 +110,16 @@ am__libqsecmn_la_SOURCES_DIST = alg-base64.c alg-rand.c alg-search.c \
fma.c fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c \
hton.c ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c \
nwad.c nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c \
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sio.c \
sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c \
str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c str-excl.c \
str-fcpy.c str-fmt.c str-fnmat.c str-incl.c str-join.c \
str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c \
str-set.c str-spl.c str-spn.c str-str.c str-subst.c str-tok.c \
str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
tre-compile.c tre-match-backtrack.c tre-match-parallel.c \
tre-parse.c tre-stack.c uri.c utf8.c xma.c uni.c cp949.c \
cp950.c
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sck.c \
sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c \
str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c \
str-excl.c str-fcpy.c str-fmt.c str-fnmat.c str-incl.c \
str-join.c str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c \
str-rot.c str-set.c str-spl.c str-spn.c str-str.c str-subst.c \
str-tok.c str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c \
tre-ast.c tre-compile.c tre-match-backtrack.c \
tre-match-parallel.c tre-parse.c tre-stack.c uri.c utf8.c \
xma.c uni.c cp949.c cp950.c
@ENABLE_BUNDLED_UNICODE_TRUE@am__objects_1 = uni.lo
@ENABLE_XCMGRS_TRUE@am__objects_2 = cp949.lo cp950.lo
am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
@ -127,7 +128,7 @@ am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
fs-move.lo glob.lo hton.lo ipad.lo lda.lo main.lo mb8.lo \
mbwc.lo mbwc-str.lo mem.lo mux.lo nwad.lo nwad-skad.lo nwif.lo \
nwif-cfg.lo nwio.lo oht.lo opt.lo path-basename.lo \
path-canon.lo pio.lo pma.lo rbt.lo rex.lo sio.lo sll.lo \
path-canon.lo pio.lo pma.lo rbt.lo rex.lo sck.lo sio.lo sll.lo \
slmb.lo str-beg.lo str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo \
str-cpy.lo str-del.lo str-dup.lo str-dyn.lo str-end.lo \
str-excl.lo str-fcpy.lo str-fmt.lo str-fnmat.lo str-incl.lo \
@ -416,16 +417,16 @@ libqsecmn_la_SOURCES = alg-base64.c alg-rand.c alg-search.c alg-sort.c \
fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c hton.c \
ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c nwad.c \
nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c \
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sio.c \
sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c \
str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c str-excl.c \
str-fcpy.c str-fmt.c str-fnmat.c str-incl.c str-join.c \
str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c \
str-set.c str-spl.c str-spn.c str-str.c str-subst.c str-tok.c \
str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
tre-compile.c tre-match-backtrack.c tre-match-parallel.c \
tre-parse.c tre-stack.c uri.c utf8.c xma.c $(am__append_1) \
$(am__append_2)
path-basename.c path-canon.c pio.c pma.c rbt.c rex.c sck.c \
sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c \
str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c \
str-excl.c str-fcpy.c str-fmt.c str-fnmat.c str-incl.c \
str-join.c str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c \
str-rot.c str-set.c str-spl.c str-spn.c str-str.c str-subst.c \
str-tok.c str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c \
tre-ast.c tre-compile.c tre-match-backtrack.c \
tre-match-parallel.c tre-parse.c tre-stack.c uri.c utf8.c \
xma.c $(am__append_1) $(am__append_2)
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
libqsecmn_la_LIBADD = $(SOCKET_LIBS) $(QUADMATH_LIBS)
@ENABLE_CXX_TRUE@libqsecmnxx_la_SOURCES = \
@ -555,6 +556,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sck.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slmb.Plo@am__quote@

View File

@ -377,11 +377,7 @@ int qse_nwio_init (
int flags, const qse_nwio_tmout_t* tmout)
{
qse_skad_t addr;
#if defined(HAVE_SOCKLEN_T)
socklen_t addrlen;
#else
int addrlen;
#endif
qse_sck_len_t addrlen;
int family, type, tmp;
QSE_MEMSET (nwio, 0, QSE_SIZEOF(*nwio));
@ -744,11 +740,7 @@ int qse_nwio_init (
if (wait_for_data (nwio, &nwio->tmout.c, 1) <= -1) goto oops;
else
{
#if defined(HAVE_SOCKLEN_T)
socklen_t xlen;
#else
int xlen;
#endif
qse_sck_len_t xlen;
xlen = QSE_SIZEOF(xret);
if (getsockopt (nwio->handle, SOL_SOCKET, SO_ERROR, (char*)&xret, &xlen) <= -1)
{
@ -766,7 +758,7 @@ int qse_nwio_init (
{
xret = connect (nwio->handle, (struct sockaddr*)&addr, addrlen);
if (xret <= -1)
{
{
nwio->errnum = skerr_to_errnum (errno);
goto oops;
}
@ -810,18 +802,7 @@ oops:
nwio->tio = QSE_NULL;
}
#if defined(_WIN32)
if (nwio->handle != INVALID_SOCKET) closesocket (nwio->handle);
#elif defined(__OS2__)
if (nwio->handle >= 0) soclose (nwio->handle);
#elif defined(__DOS__)
/* TODO: */
#else
if (nwio->handle >= 0) QSE_CLOSE (nwio->handle);
#endif
if (qse_isvalidsckhnd(nwio->handle)) qse_closesckhnd (nwio->handle);
return -1;
}
@ -835,15 +816,7 @@ void qse_nwio_fini (qse_nwio_t* nwio)
nwio->tio = QSE_NULL;
}
#if defined(_WIN32)
closesocket (nwio->handle);
#elif defined(__OS2__)
/* TODO: */
#elif defined(__DOS__)
/* TODO: */
#else
QSE_CLOSE (nwio->handle);
#endif
qse_closesckhnd (nwio->handle);
}
qse_mmgr_t* qse_nwio_getmmgr (qse_nwio_t* nwio)
@ -1031,11 +1004,7 @@ reread:
if (nwio->status & STATUS_UDP_CONNECT)
{
qse_skad_t addr;
#if defined(HAVE_SOCKLEN_T)
socklen_t addrlen;
#else
int addrlen;
#endif
qse_sck_len_t addrlen;
addrlen = QSE_SIZEOF(addr);

202
qse/lib/cmn/sck.c Normal file
View File

@ -0,0 +1,202 @@
/*
* $Id$
*
Copyright 2006-2014 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/sck.h>
#if defined(_WIN32)
# include <winsock2.h>
# include <ws2tcpip.h> /* sockaddr_in6 */
# include <windows.h>
#elif defined(__OS2__)
# if defined(TCPV40HDRS)
# define BSD_SELECT
# endif
# include <types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <sys/ioctl.h>
# include <nerrno.h>
# if defined(TCPV40HDRS)
# define USE_SELECT
# include <sys/select.h>
# else
# include <unistd.h>
# endif
#elif defined(__DOS__)
/* TODO: consider watt-32 */
#else
# include "syscall.h"
# include <sys/socket.h>
# include <netinet/in.h>
# if defined(HAVE_NETINET_SCTP_H)
# include <netinet/sctp.h>
# endif
#endif
QSE_INLINE int qse_isvalidsckhnd (qse_sck_hnd_t handle)
{
#if defined(_WIN32)
return handle != QSE_INVALID_SCKHND;
#elif defined(__OS2__)
return handle >= 0;
#elif defined(__DOS__)
/* TODO: */
return 0;
#else
return handle >= 0;
#endif
}
QSE_INLINE void qse_closesckhnd (qse_sck_hnd_t handle)
{
#if defined(_WIN32)
closesocket (handle);
#elif defined(__OS2__)
soclose (handle);
#elif defined(__DOS__)
/* TODO: */
#else
QSE_CLOSE (handle);
#endif
}
#if 0
qse_sck_hnd_t
int qse_sck_open (qse_mmgr_t* mmgr, qse_sck_type_t type)
{
}
void qse_sck_close (qse_sck_t* sck)
{
}
int qse_sck_init (qse_sck_t* sck, qse_mmgr_t* mmgr, qse_sck_type_t type)
{
int domain, type, proto = 0;
switch (type)
{
case QSE_SCK_TCP4:
domain = AF_INET;
type = SOCK_STREAM;
break;
case QSE_SCK_TCP6:
domain = AF_INET6;
type = SOCK_STREAM;
break;
case QSE_SCK_UDP4:
domain = AF_INET;
type = SOCK_DGRAM;
break;
case QSE_SCK_UDP6:
domain = AF_INET6;
type = SOCK_DGRAM;
break;
case QSE_SCK_SCTP4:
domain = AF_INET;
type = SCOK_SEQPACKET;
proto = IPPROTO_SCTP;
break;
case QSE_SCK_SCTP6:
domain = AF_INET6;
type = SCOK_SEQPACKET;
proto = IPPROTO_SCTP;
break;
case QSE_SCK_SCTP4:
domain = AF_INET;
type = SCOK_STREAM;
proto = IPPROTO_SCTP;
break;
case QSE_SCK_SCTP6:
domain = AF_INET6;
type = SCOK_STREAM;
proto = IPPROTO_SCTP;
break;
#if 0
case QSE_SCK_RAW4:
domain = AF_INET;
type = SOCK_RAW;
break;
case QSE_SCK_RAW6:
domain = AF_INET6;
type = SOCK_RAW;
break;
case QSE_SCK_PACKET:
domain = AF_PACKET;
type = SOCK_RAW;
proto = qse_hton16(ETH_P_ALL);
break;
case QSE_SCK_PACKET:
domain = AF_PACKET;
type = SOCK_DGRAM; /* cooked packet with the link level header removed */
proto = qse_hton16(ETH_P_ALL);
break;
case QSE_SCK_ARP:
domain = AF_PACKET;
type = SOCK_RAW;
proto = qse_hton16(ETH_P_ARP);
proto =
#endif
}
sck->handle = socket (domain, type, proto);
}
void qse_sck_fini (qse_sck_t* sck)
{
#if defined(_WIN32)
closesocket (sck->handle);
#elif defined(__OS2__)
soclose (sck->handle);
#elif defined(__DOS__)
/* TODO: */
#else
QSE_CLOSE (sck->handle);
#endif
}
qse_ssize_t qse_recvsocket ()
qse_ssize_t recvfromsocket ()
qse_ssize_t sendsocket ()
qse_ssize_t sendtosocket ()
#endif

View File

@ -24,5 +24,5 @@ libqsehttp_la_SOURCES = \
upxd.c
libqsehttp_la_LDFLAGS = -L../cmn -version-info 1:0:0 -no-undefined
libqsehttp_la_LIBADD = -lqsecmn $(SOCKET_LIBS) $(SENDFILE_LIBS) $(SSL_LIBS)
libqsehttp_la_LIBADD = -lqsecmn $(SOCKET_LIBS) $(SENDFILE_LIBS) $(SSL_LIBS)

View File

@ -55,6 +55,7 @@ subdir = lib/http
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
@ -345,7 +346,7 @@ libqsehttp_la_SOURCES = \
upxd.c
libqsehttp_la_LDFLAGS = -L../cmn -version-info 1:0:0 -no-undefined
libqsehttp_la_LIBADD = -lqsecmn $(SOCKET_LIBS) $(SENDFILE_LIBS) $(SSL_LIBS)
libqsehttp_la_LIBADD = -lqsecmn $(SOCKET_LIBS) $(SENDFILE_LIBS) $(SSL_LIBS)
all: all-am
.SUFFIXES:

View File

@ -545,7 +545,7 @@ static QSE_INLINE int task_main_getdir (
qse_httpd_reqsum_t reqsum;
acc.remote = remote;
acc.qpath = qpath;
acc.qpath = qpath;
acc.status = 200;
acc.version = ...;
acc.method = ...;

View File

@ -357,12 +357,11 @@ static int dns_open (qse_httpd_t* httpd, qse_httpd_dns_t* dns)
httpd->opt.rcb.logact (httpd, &msg);
}
dns->handle[0].i = open_udp_socket (httpd, AF_INET);
dns->handle[0].i = open_udp_socket (httpd, AF_INET, SOCK_DGRAM, IPPROTO_UDP);
#if defined(AF_INET6)
dns->handle[1].i = open_udp_socket (httpd, AF_INET6);
dns->handle[1].i = open_udp_socket (httpd, AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
#endif
if (!is_valid_socket(dns->handle[0].i) &&
!is_valid_socket(dns->handle[1].i))
if (!qse_isvalidsckhnd(dns->handle[0].i) && !qse_isvalidsckhnd(dns->handle[1].i))
{
goto oops;
}
@ -380,7 +379,7 @@ static int dns_open (qse_httpd_t* httpd, qse_httpd_dns_t* dns)
}
else
{
dc->dns_socket = SOCK_INVALID;
dc->dns_socket = QSE_INVALID_SCKHND;
}
dns->handle_count = 2;
@ -389,8 +388,8 @@ static int dns_open (qse_httpd_t* httpd, qse_httpd_dns_t* dns)
return 0;
oops:
if (is_valid_socket(dns->handle[0].i)) close_socket (dns->handle[0].i);
if (is_valid_socket(dns->handle[1].i)) close_socket (dns->handle[1].i);
if (qse_isvalidsckhnd(dns->handle[0].i)) qse_closesckhnd (dns->handle[0].i);
if (qse_isvalidsckhnd(dns->handle[1].i)) qse_closesckhnd (dns->handle[1].i);
if (dc) qse_httpd_freemem (httpd, dc);
return -1;
@ -441,8 +440,8 @@ static void dns_close (qse_httpd_t* httpd, qse_httpd_dns_t* dns)
for (i = 0; i < dns->handle_count; i++)
{
if (is_valid_socket(dns->handle[i].i))
close_socket (dns->handle[i].i);
if (qse_isvalidsckhnd(dns->handle[i].i))
qse_closesckhnd (dns->handle[i].i);
}
qse_httpd_freemem (httpd, dns->ctx);
}

View File

@ -33,10 +33,10 @@ typedef struct urs_req_t urs_req_t;
#include <qse/pack1.h>
struct urs_hdr_t
{
qse_uint16_t seq; /* in network-byte order */
qse_uint16_t rcode; /* response code */
qse_uint32_t qusum;/* checksum of url in the request */
qse_uint16_t len; /* url length in network-byte order */
qse_uint16_t seq; /* in network-byte order */
qse_uint16_t rcode; /* response code */
qse_uint32_t urlsum; /* checksum of url in the request */
qse_uint16_t urllen; /* url length in network-byte order */
};
struct urs_pkt_t
@ -95,6 +95,7 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
qse_nwad_t nwad;
urs_ctx_t* dc;
httpd_xtn_t* httpd_xtn;
int type, proto = IPPROTO_SCTP;
httpd_xtn = qse_httpd_getxtn (httpd);
@ -118,12 +119,14 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
httpd->opt.rcb.logact (httpd, &msg);
}
urs->handle[0].i = open_udp_socket (httpd, AF_INET);
type = (proto == IPPROTO_SCTP)? SOCK_SEQPACKET: SOCK_DGRAM;
urs->handle[0].i = open_udp_socket (httpd, AF_INET, type, proto);
#if defined(AF_INET6)
urs->handle[1].i = open_udp_socket (httpd, AF_INET6);
urs->handle[1].i = open_udp_socket (httpd, AF_INET6, type, proto);
#endif
if (!is_valid_socket(urs->handle[0].i) &&
!is_valid_socket(urs->handle[1].i))
if (!qse_isvalidsckhnd(urs->handle[0].i) && !qse_isvalidsckhnd(urs->handle[1].i))
{
goto oops;
}
@ -141,17 +144,23 @@ static int urs_open (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
}
else
{
dc->urs_socket = SOCK_INVALID;
dc->urs_socket = QSE_INVALID_SCKHND;
}
if (proto == IPPROTO_SCTP)
{
/* TODO: error ahndleing */
if (qse_isvalidsckhnd(urs->handle[0].i)) listen (urs->handle[0].i, 99);
if (qse_isvalidsckhnd(urs->handle[1].i)) listen (urs->handle[1].i, 99);
}
urs->handle_count = 2;
urs->ctx = dc;
return 0;
oops:
if (is_valid_socket(urs->handle[0].i)) close_socket (urs->handle[0].i);
if (is_valid_socket(urs->handle[1].i)) close_socket (urs->handle[1].i);
if (qse_isvalidsckhnd(urs->handle[0].i)) qse_closesckhnd (urs->handle[0].i);
if (qse_isvalidsckhnd(urs->handle[1].i)) qse_closesckhnd (urs->handle[1].i);
if (dc) qse_httpd_freemem (httpd, dc);
return -1;
@ -189,8 +198,8 @@ static void urs_close (qse_httpd_t* httpd, qse_httpd_urs_t* urs)
for (i = 0; i < urs->handle_count; i++)
{
if (is_valid_socket(urs->handle[i].i))
close_socket (urs->handle[i].i);
if (qse_isvalidsckhnd(urs->handle[i].i))
qse_closesckhnd (urs->handle[i].i);
}
qse_httpd_freemem (httpd, urs->ctx);
@ -220,15 +229,16 @@ printf ("URS_RECV....\n");
/* TODO: check if fromaddr matches the dc->skad... */
pkt = (urs_pkt_t*)dc->rcvbuf;
if (len >= QSE_SIZEOF(pkt->hdr) && len >= QSE_SIZEOF(pkt->hdr) + qse_ntoh16(pkt->hdr.len))
if (len >= QSE_SIZEOF(pkt->hdr) && len >= QSE_SIZEOF(pkt->hdr) + qse_ntoh16(pkt->hdr.urllen))
{
xid = qse_ntoh16(pkt->hdr.seq) % QSE_COUNTOF(dc->reqs);
for (req = dc->reqs[xid]; req; req = req->next)
{
if (req->pkt->hdr.seq == pkt->hdr.seq && req->pkt->hdr.qusum == pkt->hdr.qusum)
if (req->pkt->hdr.seq == pkt->hdr.seq && req->pkt->hdr.urlsum == pkt->hdr.urlsum)
{
pkt->url[qse_ntoh16(pkt->hdr.len)] = QSE_MT('\0');
/* null-terminate the url for easier processing */
pkt->url[qse_ntoh16(pkt->hdr.urllen)] = QSE_MT('\0');
urs_remove_tmr_tmout (httpd, req);
req->rewrite (httpd, req->pkt->url, pkt->url, req->ctx);
@ -329,11 +339,10 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t
urs_req_t* req = QSE_NULL;
qse_size_t url_len;
qse_tmr_event_t tmout_event;
httpd_xtn = qse_httpd_getxtn (httpd);
printf ("URS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
if (dc->req_count >= QSE_COUNTOF(dc->reqs))
{
/* too many pending requests */
@ -361,8 +370,8 @@ printf ("URS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
req->pkt = (urs_pkt_t*)(req + 1);
req->pkt->hdr.seq = qse_hton16(seq);
req->pkt->hdr.len = qse_hton16(url_len);
req->pkt->hdr.qusum = hash_string (url);
req->pkt->hdr.urllen = qse_hton16(url_len);
req->pkt->hdr.urlsum = hash_string (url);
qse_mbscpy (req->pkt->url, url);
/* -1 to exclude the terminating '\0' as urs_pkt_t has url[1]. */
@ -412,6 +421,21 @@ printf ("URS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
tmout_event.updater = tmr_urs_tmout_update;
if (qse_httpd_inserttimerevent (httpd, &tmout_event, &req->tmr_tmout) <= -1) goto oops;
/*
{
struct msghdr msg;
struct iovec iov;
QSE_MEMSET (&msg, 0, QSE_SIZEOF(msg));
msg.msg_name = &req->urs_skad;
msg.msg_namelen = req->urs_skadlen;
iov.iov_base = req->pkt;
iov.iov_len = req->pktlen;
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
if (sendmsg (req->urs_socket, &msg, 0) != req->pktlen)
}
*/
if (sendto (req->urs_socket, req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen)
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());

View File

@ -33,6 +33,7 @@
#include <qse/cmn/dir.h>
#include <qse/cmn/fio.h>
#include <qse/cmn/sio.h>
#include <qse/cmn/sck.h>
#define STAT_REG 1
#define STAT_DIR 2
@ -87,6 +88,9 @@
# define IP_TRANSPARENT 19
# endif
# endif
# if defined(HAVE_NETINET_SCTP_H)
# include <netinet/sctp.h>
# endif
#endif
#if defined(HAVE_SSL)
@ -651,41 +655,7 @@ void* qse_httpd_getxtnstd (qse_httpd_t* httpd)
/* ------------------------------------------------------------------- */
#if defined(_WIN32)
typedef SOCKET sock_t;
# define SOCK_INVALID INVALID_SOCKET
#else
typedef int sock_t;
# define SOCK_INVALID -1
#endif
#if !defined(HAVE_SOCKLEN_T)
typedef int socklen_t;
#endif
static QSE_INLINE int is_valid_socket (sock_t fd)
{
#if defined(_WIN32)
return fd != INVALID_SOCKET;
#else
return fd >= 0;
#endif
}
static QSE_INLINE void close_socket (sock_t fd)
{
#if defined(_WIN32)
closesocket (fd);
#elif defined(__OS2__)
soclose (fd);
#elif defined(__DOS__)
/* TODO: */
#else
QSE_CLOSE (fd);
#endif
}
static int set_socket_nonblock (qse_httpd_t* httpd, sock_t fd, int enabled)
static int set_socket_nonblock (qse_httpd_t* httpd, qse_sck_hnd_t fd, int enabled)
{
#if defined(_WIN32)
if (ioctlsocket (fd, FIONBIO, &enabled) == SOCKET_ERROR)
@ -723,13 +693,13 @@ static int set_socket_nonblock (qse_httpd_t* httpd, sock_t fd, int enabled)
}
static sock_t open_udp_socket (qse_httpd_t* httpd, int domain)
static qse_sck_hnd_t open_udp_socket (qse_httpd_t* httpd, int domain, int type, int proto)
{
sock_t fd;
qse_sck_hnd_t fd;
int flag;
fd = socket (domain, SOCK_DGRAM, IPPROTO_UDP);
if (!is_valid_socket(fd))
fd = socket (domain, type, proto);
if (!qse_isvalidsckhnd(fd))
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
@ -750,13 +720,34 @@ static sock_t open_udp_socket (qse_httpd_t* httpd, int domain)
setsockopt (fd, SOL_SOCKET, SO_REUSEPORT, (void*)&flag, QSE_SIZEOF(flag));
#endif
#if defined(IPV6_V6ONLY)
if (domain == AF_INET6)
{
flag = 1;
setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&flag, QSE_SIZEOF(flag));
}
#endif
if (set_socket_nonblock (httpd, fd, 1) <= -1) goto oops;
if (proto == IPPROTO_SCTP)
{
struct sctp_initmsg im;
QSE_MEMSET (&im, 0, QSE_SIZEOF(im));
im.sinit_num_ostreams = 1;
im.sinit_max_instreams = 1;
im.sinit_max_attempts = 1;
if (setsockopt (fd, SOL_SCTP, SCTP_INITMSG, &im, QSE_SIZEOF(im)) <= -1) goto oops;
}
return fd;
oops:
if (is_valid_socket(fd)) close_socket (fd);
return SOCK_INVALID;
if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd);
return QSE_INVALID_SCKHND;
}
/* ------------------------------------------------------------------- */
@ -767,7 +758,7 @@ static int server_open (qse_httpd_t* httpd, qse_httpd_server_t* server)
qse_httpd_seterrnum (httpd, QSE_HTTPD_ENOIMPL);
return -1;
#else
sock_t fd = SOCK_INVALID, flag;
qse_sck_hnd_t fd = QSE_INVALID_SCKHND, flag;
qse_skad_t addr;
int addrsize;
@ -779,7 +770,7 @@ static int server_open (qse_httpd_t* httpd, qse_httpd_server_t* server)
}
fd = socket (qse_skadfamily(&addr), SOCK_STREAM, IPPROTO_TCP);
if (!is_valid_socket(fd))
if (!qse_isvalidsckhnd(fd))
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
@ -861,24 +852,15 @@ static int server_open (qse_httpd_t* httpd, qse_httpd_server_t* server)
{
int on = 1;
setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on));
if (bind (fd, (struct sockaddr*)&addr, addrsize) <= -1)
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
}
if (bind (fd, (struct sockaddr*)&addr, addrsize) == 0) goto bind_ok;
}
else
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
}
#else
#endif
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
#endif
}
bind_ok:
if (listen (fd, 10) <= -1)
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
@ -891,14 +873,14 @@ static int server_open (qse_httpd_t* httpd, qse_httpd_server_t* server)
return 0;
oops:
if (is_valid_socket(fd)) close_socket (fd);
if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd);
return -1;
#endif
}
static void server_close (qse_httpd_t* httpd, qse_httpd_server_t* server)
{
close_socket (server->handle.i);
qse_closesckhnd (server->handle.i);
}
static int server_accept (
@ -910,13 +892,13 @@ static int server_accept (
#else
qse_skad_t addr;
socklen_t addrlen;
sock_t fd = SOCK_INVALID;
qse_sck_len_t addrlen;
qse_sck_hnd_t fd = QSE_INVALID_SCKHND;
int flag;
addrlen = QSE_SIZEOF(addr);
fd = accept (server->handle.i, (struct sockaddr*)&addr, &addrlen);
if (!is_valid_socket(fd))
if (!qse_isvalidsckhnd(fd))
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
@ -985,7 +967,7 @@ qse_fprintf (QSE_STDERR, QSE_T("Error: too many client?\n"));
return 0;
oops:
if (is_valid_socket(fd)) close_socket (fd);
if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd);
return -1;
#endif
}
@ -1005,7 +987,8 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
qse_skad_t connaddr, bindaddr;
int connaddrsize, bindaddrsize;
int connected = 1;
sock_t fd = SOCK_INVALID;
qse_sck_hnd_t fd = QSE_INVALID_SCKHND;
#if defined(_WIN32)
unsigned long cmd;
#elif defined(__OS2__)
@ -1026,7 +1009,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
bindaddrsize = qse_nwadtoskad (&peer->local, &bindaddr);
fd = socket (qse_skadfamily(&connaddr), SOCK_STREAM, IPPROTO_TCP);
if (!is_valid_socket(fd))
if (!qse_isvalidsckhnd(fd))
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
@ -1038,6 +1021,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
setsockopt (fd, SOL_IP, IP_TRANSPARENT, &flag, QSE_SIZEOF(flag));
#endif
/* don't use invalid binding address */
if (bindaddrsize >= 0 &&
bind (fd, (struct sockaddr*)&bindaddr, bindaddrsize) <= -1)
{
@ -1096,7 +1080,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
oops:
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
if (is_valid_socket(fd)) close_socket (fd);
if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd);
return -1;
/* -------------------------------------------------------------------- */
@ -1105,7 +1089,7 @@ oops:
static void peer_close (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
{
close_socket (peer->handle.i);
qse_closesckhnd (peer->handle.i);
}
static int peer_connected (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
@ -1159,7 +1143,7 @@ static int peer_connected (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
#else
socklen_t len;
qse_sck_len_t len;
int ret;
len = QSE_SIZEOF(ret);
@ -1857,7 +1841,7 @@ static void client_close (qse_httpd_t* httpd, qse_httpd_client_t* client)
#else
shutdown (client->handle.i, SHUT_RDWR);
#endif
close_socket (client->handle.i);
qse_closesckhnd (client->handle.i);
}
static void client_shutdown (qse_httpd_t* httpd, qse_httpd_client_t* client)

View File

@ -56,6 +56,7 @@ subdir = lib/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -55,6 +55,7 @@ subdir = lib/xli
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

53
qse/m4/ax_check_sign.m4 Normal file
View File

@ -0,0 +1,53 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_sign.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_SIGN (TYPE, [ACTION-IF-SIGNED], [ACTION-IF-UNSIGNED], [INCLUDES])
#
# DESCRIPTION
#
# Checks whether TYPE is signed or not. If no INCLUDES are specified, the
# default includes are used. If ACTION-IF-SIGNED is given, it is
# additional shell code to execute when the type is signed. If
# ACTION-IF-UNSIGNED is given, it is executed when the type is unsigned.
#
# This macro assumes that the type exists. Therefore the existence of the
# type should be checked before calling this macro. For example:
#
# AC_CHECK_HEADERS([wchar.h])
# AC_CHECK_TYPE([wchar_t],,[ AC_MSG_ERROR([Type wchar_t not found.]) ])
# AX_CHECK_SIGN([wchar_t],
# [ AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ],
# [ AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned]) ], [
# #ifdef HAVE_WCHAR_H
# #include <wchar.h>
# #endif
# ])
#
# LICENSE
#
# Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_SIGN], [
typename=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g"`
AC_CACHE_CHECK([whether $1 is signed], ax_cv_decl_${typename}_signed, [
AC_TRY_COMPILE([$4],
[ int foo @<:@ 1 - 2 * !((($1) -1) < 0) @:>@ ],
[ eval "ax_cv_decl_${typename}_signed=\"yes\"" ],
[ eval "ax_cv_decl_${typename}_signed=\"no\"" ])])
symbolname=`echo $1 | sed "s/@<:@^a-zA-Z0-9_@:>@/_/g" | tr "a-z" "A-Z"`
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
$2
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
$3
fi
])dnl

View File

@ -54,6 +54,7 @@ subdir = regress
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -55,6 +55,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -56,6 +56,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -54,6 +54,7 @@ subdir = samples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -61,6 +61,7 @@ subdir = samples/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -66,6 +66,7 @@ subdir = samples/cmn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -57,6 +57,7 @@ subdir = samples/http
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -59,6 +59,7 @@ subdir = samples/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \

View File

@ -54,6 +54,7 @@ subdir = tools
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \