added timer job functions

This commit is contained in:
2016-01-30 05:24:23 +00:00
parent 596304d446
commit 82712da618
33 changed files with 52714 additions and 175 deletions

60
stio/lib/Makefile.am Normal file
View File

@ -0,0 +1,60 @@
AUTOMAKE_OPTIONS = nostdinc
CPPFLAGS_ALL_COMMON = \
-I$(abs_builddir) \
-I$(abs_srcdir) \
-I$(includedir)
LDFLAGS_ALL_COMMON = -L$(abs_builddir) -L$(libdir)
##################################################
# MAIN LIBRARY
##################################################
CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) $(LTDLINCL)
LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined
LIBADD_LIB_COMMON = $(LIBM) $(LIBLTDL)
pkgincludedir = $(includedir)
pkglibdir = $(libdir)
pkgbindir = $(bindir)
pkginclude_HEADERS = \
stio-cfg.h \
stio-cmn.h \
stio-tcp.h \
stio-udp.h \
stio.h
pkglib_LTLIBRARIES = libstio.la
libstio_la_SOURCES = \
stio-prv.h \
stio-tim.h \
stio-tmr.h \
stio.c \
stio-sck.c \
stio-tcp.c \
stio-tim.c \
stio-tmr.c \
stio-udp.c
libstio_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
libstio_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libstio_la_LIBADD = $(LIBADD_LIB_COMMON)
pkgbin_PROGRAMS = stio
stio_SOURCES = main.c
stio_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
stio_LDFLAGS = $(LDFLAGS_LIB_COMMON)
stio_LDADD = $(LIBADD_LIB_COMMON) -lstio
install-data-hook:
@echo "#ifndef _STIO_CFG_H_" > "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@echo "#define _STIO_CFG_H_" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@$(EGREP) "#define[ ]+STIO_" "$(abs_builddir)/stio-cfg.h" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@echo "#endif" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@$(RM) "$(DESTDIR)$(pkgincludedir)/stio-cfg.h.in"
@$(SED) 's|/\*#define STIO_HAVE_CFG_H\*/|#define STIO_HAVE_CFG_H|' "$(srcdir)/stio-cmn.h" > "$(DESTDIR)$(pkgincludedir)/stio-cmn.h"
uninstall-hook:
@$(RM) "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"

892
stio/lib/Makefile.in Normal file
View File

@ -0,0 +1,892 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
pkgbin_PROGRAMS = stio$(EXEEXT)
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/stio-cfg.h.in $(top_srcdir)/ac/depcomp \
$(pkginclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = stio-cfg.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgbindir)" \
"$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(pkglib_LTLIBRARIES)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
libstio_la_DEPENDENCIES = $(am__DEPENDENCIES_2)
am_libstio_la_OBJECTS = libstio_la-stio.lo libstio_la-stio-sck.lo \
libstio_la-stio-tcp.lo libstio_la-stio-tim.lo \
libstio_la-stio-tmr.lo libstio_la-stio-udp.lo
libstio_la_OBJECTS = $(am_libstio_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libstio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libstio_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(pkgbin_PROGRAMS)
am_stio_OBJECTS = stio-main.$(OBJEXT)
stio_OBJECTS = $(am_stio_OBJECTS)
stio_DEPENDENCIES = $(am__DEPENDENCIES_2)
stio_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(stio_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libstio_la_SOURCES) $(stio_SOURCES)
DIST_SOURCES = $(libstio_la_SOURCES) $(stio_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)stio-cfg.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = $(includedir)
pkglibdir = $(libdir)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STIO_PROJECT_AUTHOR = @STIO_PROJECT_AUTHOR@
STIO_PROJECT_URL = @STIO_PROJECT_URL@
STIO_SIZEOF_CHAR = @STIO_SIZEOF_CHAR@
STIO_SIZEOF_DOUBLE = @STIO_SIZEOF_DOUBLE@
STIO_SIZEOF_FLOAT = @STIO_SIZEOF_FLOAT@
STIO_SIZEOF_INT = @STIO_SIZEOF_INT@
STIO_SIZEOF_LONG = @STIO_SIZEOF_LONG@
STIO_SIZEOF_LONG_DOUBLE = @STIO_SIZEOF_LONG_DOUBLE@
STIO_SIZEOF_LONG_LONG = @STIO_SIZEOF_LONG_LONG@
STIO_SIZEOF_OFF64_T = @STIO_SIZEOF_OFF64_T@
STIO_SIZEOF_OFF_T = @STIO_SIZEOF_OFF_T@
STIO_SIZEOF_SHORT = @STIO_SIZEOF_SHORT@
STIO_SIZEOF_VOID_P = @STIO_SIZEOF_VOID_P@
STIO_SIZEOF_WCHAR_T = @STIO_SIZEOF_WCHAR_T@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
CPPFLAGS_ALL_COMMON = \
-I$(abs_builddir) \
-I$(abs_srcdir) \
-I$(includedir)
LDFLAGS_ALL_COMMON = -L$(abs_builddir) -L$(libdir)
##################################################
# MAIN LIBRARY
##################################################
CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) $(LTDLINCL)
LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined
LIBADD_LIB_COMMON = $(LIBM) $(LIBLTDL)
pkgbindir = $(bindir)
pkginclude_HEADERS = \
stio-cfg.h \
stio-cmn.h \
stio-tcp.h \
stio-udp.h \
stio.h
pkglib_LTLIBRARIES = libstio.la
libstio_la_SOURCES = \
stio-prv.h \
stio-tim.h \
stio-tmr.h \
stio.c \
stio-sck.c \
stio-tcp.c \
stio-tim.c \
stio-tmr.c \
stio-udp.c
libstio_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
libstio_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libstio_la_LIBADD = $(LIBADD_LIB_COMMON)
stio_SOURCES = main.c
stio_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
stio_LDFLAGS = $(LDFLAGS_LIB_COMMON)
stio_LDADD = $(LIBADD_LIB_COMMON) -lstio
all: stio-cfg.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
stio-cfg.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/stio-cfg.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status lib/stio-cfg.h
$(srcdir)/stio-cfg.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f stio-cfg.h stamp-h1
install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
}
uninstall-pkglibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
done
clean-pkglibLTLIBRARIES:
-test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
@list='$(pkglib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libstio.la: $(libstio_la_OBJECTS) $(libstio_la_DEPENDENCIES) $(EXTRA_libstio_la_DEPENDENCIES)
$(AM_V_CCLD)$(libstio_la_LINK) -rpath $(pkglibdir) $(libstio_la_OBJECTS) $(libstio_la_LIBADD) $(LIBS)
install-pkgbinPROGRAMS: $(pkgbin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(pkgbin_PROGRAMS)'; test -n "$(pkgbindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgbindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p \
|| test -f $$p1 \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkgbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkgbindir)$$dir" || exit $$?; \
} \
; done
uninstall-pkgbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(pkgbin_PROGRAMS)'; test -n "$(pkgbindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgbindir)" && rm -f $$files
clean-pkgbinPROGRAMS:
@list='$(pkgbin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
stio$(EXEEXT): $(stio_OBJECTS) $(stio_DEPENDENCIES) $(EXTRA_stio_DEPENDENCIES)
@rm -f stio$(EXEEXT)
$(AM_V_CCLD)$(stio_LINK) $(stio_OBJECTS) $(stio_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio-sck.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio-tcp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio-tim.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio-tmr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio-udp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstio_la-stio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stio-main.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
libstio_la-stio.lo: stio.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio.Tpo -c -o libstio_la-stio.lo `test -f 'stio.c' || echo '$(srcdir)/'`stio.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio.Tpo $(DEPDIR)/libstio_la-stio.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio.c' object='libstio_la-stio.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio.lo `test -f 'stio.c' || echo '$(srcdir)/'`stio.c
libstio_la-stio-sck.lo: stio-sck.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio-sck.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio-sck.Tpo -c -o libstio_la-stio-sck.lo `test -f 'stio-sck.c' || echo '$(srcdir)/'`stio-sck.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio-sck.Tpo $(DEPDIR)/libstio_la-stio-sck.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio-sck.c' object='libstio_la-stio-sck.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio-sck.lo `test -f 'stio-sck.c' || echo '$(srcdir)/'`stio-sck.c
libstio_la-stio-tcp.lo: stio-tcp.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio-tcp.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio-tcp.Tpo -c -o libstio_la-stio-tcp.lo `test -f 'stio-tcp.c' || echo '$(srcdir)/'`stio-tcp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio-tcp.Tpo $(DEPDIR)/libstio_la-stio-tcp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio-tcp.c' object='libstio_la-stio-tcp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio-tcp.lo `test -f 'stio-tcp.c' || echo '$(srcdir)/'`stio-tcp.c
libstio_la-stio-tim.lo: stio-tim.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio-tim.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio-tim.Tpo -c -o libstio_la-stio-tim.lo `test -f 'stio-tim.c' || echo '$(srcdir)/'`stio-tim.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio-tim.Tpo $(DEPDIR)/libstio_la-stio-tim.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio-tim.c' object='libstio_la-stio-tim.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio-tim.lo `test -f 'stio-tim.c' || echo '$(srcdir)/'`stio-tim.c
libstio_la-stio-tmr.lo: stio-tmr.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio-tmr.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio-tmr.Tpo -c -o libstio_la-stio-tmr.lo `test -f 'stio-tmr.c' || echo '$(srcdir)/'`stio-tmr.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio-tmr.Tpo $(DEPDIR)/libstio_la-stio-tmr.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio-tmr.c' object='libstio_la-stio-tmr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio-tmr.lo `test -f 'stio-tmr.c' || echo '$(srcdir)/'`stio-tmr.c
libstio_la-stio-udp.lo: stio-udp.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstio_la-stio-udp.lo -MD -MP -MF $(DEPDIR)/libstio_la-stio-udp.Tpo -c -o libstio_la-stio-udp.lo `test -f 'stio-udp.c' || echo '$(srcdir)/'`stio-udp.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstio_la-stio-udp.Tpo $(DEPDIR)/libstio_la-stio-udp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stio-udp.c' object='libstio_la-stio-udp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstio_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstio_la-stio-udp.lo `test -f 'stio-udp.c' || echo '$(srcdir)/'`stio-udp.c
stio-main.o: main.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stio-main.o -MD -MP -MF $(DEPDIR)/stio-main.Tpo -c -o stio-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stio-main.Tpo $(DEPDIR)/stio-main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='stio-main.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stio-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
stio-main.obj: main.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stio-main.obj -MD -MP -MF $(DEPDIR)/stio-main.Tpo -c -o stio-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stio-main.Tpo $(DEPDIR)/stio-main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='stio-main.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stio-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) stio-cfg.h
installdirs:
for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgbindir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-pkgbinPROGRAMS \
clean-pkglibLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgbinPROGRAMS install-pkgincludeHEADERS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-pkglibLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgbinPROGRAMS uninstall-pkgincludeHEADERS \
uninstall-pkglibLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
.MAKE: all install-am install-data-am install-strip uninstall-am
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-pkgbinPROGRAMS clean-pkglibLTLIBRARIES \
cscopelist-am ctags ctags-am distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgbinPROGRAMS install-pkgincludeHEADERS \
install-pkglibLTLIBRARIES install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-hook uninstall-pkgbinPROGRAMS \
uninstall-pkgincludeHEADERS uninstall-pkglibLTLIBRARIES
install-data-hook:
@echo "#ifndef _STIO_CFG_H_" > "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@echo "#define _STIO_CFG_H_" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@$(EGREP) "#define[ ]+STIO_" "$(abs_builddir)/stio-cfg.h" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@echo "#endif" >> "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
@$(RM) "$(DESTDIR)$(pkgincludedir)/stio-cfg.h.in"
@$(SED) 's|/\*#define STIO_HAVE_CFG_H\*/|#define STIO_HAVE_CFG_H|' "$(srcdir)/stio-cmn.h" > "$(DESTDIR)$(pkgincludedir)/stio-cmn.h"
uninstall-hook:
@$(RM) "$(DESTDIR)$(pkgincludedir)/stio-cfg.h"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -30,6 +30,7 @@
#include <stio-udp.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
@ -41,6 +42,11 @@ static void* mmgr_alloc (stio_mmgr_t* mmgr, stio_size_t size)
return malloc (size);
}
static void* mmgr_realloc (stio_mmgr_t* mmgr, void* ptr, stio_size_t size)
{
return realloc (ptr, size);
}
static void mmgr_free (stio_mmgr_t* mmgr, void* ptr)
{
return free (ptr);
@ -49,13 +55,18 @@ static void mmgr_free (stio_mmgr_t* mmgr, void* ptr)
static stio_mmgr_t mmgr =
{
mmgr_alloc,
mmgr_realloc,
mmgr_free,
STIO_NULL
};
static void tcp_on_disconnected (stio_dev_tcp_t* tcp)
{
if (tcp->state & STIO_DEV_TCP_LISTENING)
if (tcp->state & STIO_DEV_TCP_CONNECTING)
{
printf ("TCP DISCONNECTED - FAILED TO CONNECT (%d) TO REMOTE SERVER\n", tcp->sck);
}
else if (tcp->state & STIO_DEV_TCP_LISTENING)
{
printf ("SHUTTING DOWN THE SERVER SOCKET(%d)...\n", tcp->sck);
}
@ -111,15 +122,14 @@ int main ()
stio_t* stio;
stio_dev_udp_t* udp;
stio_dev_tcp_t* tcp;
stio_dev_tcp_t* tcp[2];
struct sockaddr_in sin;
struct sigaction sigact;
stio_dev_tcp_connect_t tcp_conn;
stio_dev_tcp_listen_t tcp_lstn;
stio_dev_tcp_make_t tcp_make;
stio = stio_open (&mmgr, 0, STIO_NULL);
stio = stio_open (&mmgr, 0, 512, STIO_NULL);
if (!stio)
{
printf ("Cannot open stio\n");
@ -128,7 +138,7 @@ int main ()
g_stio = stio;
STIO_MEMSET (&sigact, 0, STIO_SIZEOF(sigact));
memset (&sigact, 0, STIO_SIZEOF(sigact));
sigact.sa_flags = SA_RESTART;
sigact.sa_handler = handle_signal;
sigaction (SIGINT, &sigact, STIO_NULL);
@ -137,21 +147,7 @@ int main ()
//sigact.sa_handler = SIG_IGN;
//sigaction (SIGPIPE, &sigact, STIO_NULL);
/*
pkt = stio_pkt_open (packet type, protocol type); // packet socket
arp = stio_arp_open (binding_addr); // raw socket - arp filter
tcpd = stio_tcp_open (binding_addr); // crude tcp
udpd= stio_udp_open (binding_addr); // crude udp
httpd = stio_httpd_open (binding_addr);
httpsd = stio_httpsd_open (binding_addr);
radiusd = stio_radiusd_open (binding_addr); // udp - radius
stio_register (stio, httpd);
stio_register (stio, httpsd);
stio_register (stio, radiusd);
*/
STIO_MEMSET (&sin, 0, STIO_SIZEOF(sin));
memset (&sin, 0, STIO_SIZEOF(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(1234);
/*
@ -163,12 +159,14 @@ int main ()
}
*/
STIO_MEMSET (&sin, 0, STIO_SIZEOF(sin));
memset (&sin, 0, STIO_SIZEOF(sin));
sin.sin_family = AF_INET;
#if 0
tcp = (stio_dev_tcp_t*)stio_makedev (stio, STIO_SIZEOF(*tcp), &tcp_mth, &tcp_evcb, &sin);
if (!tcp)
memcpy (&tcp_make.addr, &sin, STIO_SIZEOF(sin));
tcp_make.on_sent = tcp_on_sent;
tcp_make.on_recv = tcp_on_recv;
tcp[0] = stio_dev_tcp_make (stio, 0, &tcp_make);
if (!tcp[0])
{
printf ("Cannot make tcp\n");
goto oops;
@ -184,21 +182,19 @@ int main ()
tcp_conn.on_disconnected = tcp_on_disconnected;
//tcp_conn.on_failure = .... (error code? etc???) or on_connect to access success or failure??? what is better??
}
if (stio_dev_tcp_connect (tcp, &tcp_conn) <= -1)
if (stio_dev_tcp_connect (tcp[0], &tcp_conn) <= -1)
{
printf ("stio_dev_tcp_connect() failed....\n");
goto oops;
}
#else
sin.sin_port = htons(1234);
memcpy (&tcp_make.addr, &sin, STIO_SIZEOF(sin));
tcp_make.on_sent = tcp_on_sent;
tcp_make.on_recv = tcp_on_recv;
STIO_MEMCPY (&tcp_make.addr, &sin, STIO_SIZEOF(sin));
tcp_make.on_sent = tcp_on_sent; /* inherit this handler */
tcp_make.on_recv = tcp_on_recv; /* inherit this handler */
tcp = stio_dev_tcp_make (stio, 0, &tcp_make);
if (!tcp)
tcp[1] = stio_dev_tcp_make (stio, 0, &tcp_make);
if (!tcp[1])
{
printf ("Cannot make tcp\n");
goto oops;
@ -207,21 +203,18 @@ int main ()
tcp_lstn.backlogs = 100;
tcp_lstn.on_connected = tcp_on_connected;
tcp_lstn.on_disconnected = tcp_on_disconnected;
if (stio_dev_tcp_listen (tcp, &tcp_lstn) <= -1)
if (stio_dev_tcp_listen (tcp[1], &tcp_lstn) <= -1)
{
printf ("stio_dev_tcp_listen() failed....\n");
goto oops;
}
#endif
////////////////////////////
stio_loop (stio);
////////////////////////////
g_stio = STIO_NULL;
stio_close (stio);
return 0;
oops:

938
stio/lib/stio-cfg.h.in Normal file
View File

@ -0,0 +1,938 @@
/* lib/stio-cfg.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to 1 if you have the `acos' function. */
#undef HAVE_ACOS
/* Define to 1 if you have the `acosf' function. */
#undef HAVE_ACOSF
/* Define to 1 if you have the `acosl' function. */
#undef HAVE_ACOSL
/* Define to 1 if you have the `acosq' function. */
#undef HAVE_ACOSQ
/* Define to 1 if you have the `asin' function. */
#undef HAVE_ASIN
/* Define to 1 if you have the `asinf' function. */
#undef HAVE_ASINF
/* Define to 1 if you have the `asinl' function. */
#undef HAVE_ASINL
/* Define to 1 if you have the `asinq' function. */
#undef HAVE_ASINQ
/* Define to 1 if you have the `atan' function. */
#undef HAVE_ATAN
/* Define to 1 if you have the `atan2' function. */
#undef HAVE_ATAN2
/* Define to 1 if you have the `atan2f' function. */
#undef HAVE_ATAN2F
/* Define to 1 if you have the `atan2l' function. */
#undef HAVE_ATAN2L
/* Define to 1 if you have the `atan2q' function. */
#undef HAVE_ATAN2Q
/* Define to 1 if you have the `atanf' function. */
#undef HAVE_ATANF
/* Define to 1 if you have the `atanl' function. */
#undef HAVE_ATANL
/* Define to 1 if you have the `atanq' function. */
#undef HAVE_ATANQ
/* Define to 1 if you have the `backtrace' function. */
#undef HAVE_BACKTRACE
/* Define to 1 if you have the `backtrace_symbols' function. */
#undef HAVE_BACKTRACE_SYMBOLS
/* Define to 1 if you have the `ceil' function. */
#undef HAVE_CEIL
/* Define to 1 if you have the `ceilf' function. */
#undef HAVE_CEILF
/* Define to 1 if you have the `ceill' function. */
#undef HAVE_CEILL
/* Define to 1 if you have the `ceilq' function. */
#undef HAVE_CEILQ
/* Define to 1 if you have the `connect' function. */
#undef HAVE_CONNECT
/* Define to 1 if you have the `cos' function. */
#undef HAVE_COS
/* Define to 1 if you have the `cosf' function. */
#undef HAVE_COSF
/* Define to 1 if you have the `cosh' function. */
#undef HAVE_COSH
/* Define to 1 if you have the `coshf' function. */
#undef HAVE_COSHF
/* Define to 1 if you have the `coshl' function. */
#undef HAVE_COSHL
/* Define to 1 if you have the `coshq' function. */
#undef HAVE_COSHQ
/* Define to 1 if you have the `cosl' function. */
#undef HAVE_COSL
/* Define to 1 if you have the `cosq' function. */
#undef HAVE_COSQ
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
/* Define if c++ supports namespace std. */
#undef HAVE_CXX_NAMESPACE_STD
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the `dirfd' function. */
#undef HAVE_DIRFD
/* Define to 1 if `dd_fd' is a member of `DIR'. */
#undef HAVE_DIR_DD_FD
/* Define to 1 if `d_fd' is a member of `DIR'. */
#undef HAVE_DIR_D_FD
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `ENGINE_cleanup' function. */
#undef HAVE_ENGINE_CLEANUP
/* epoll support */
#undef HAVE_EPOLL
/* Define to 1 if you have the `epoll_create' function. */
#undef HAVE_EPOLL_CREATE
/* Define to 1 if you have the `epoll_create1' function. */
#undef HAVE_EPOLL_CREATE1
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the `exp' function. */
#undef HAVE_EXP
/* Define to 1 if you have the `expf' function. */
#undef HAVE_EXPF
/* Define to 1 if you have the `expl' function. */
#undef HAVE_EXPL
/* Define to 1 if you have the `expq' function. */
#undef HAVE_EXPQ
/* Define to 1 if you have the `fchmod' function. */
#undef HAVE_FCHMOD
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fdopendir' function. */
#undef HAVE_FDOPENDIR
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define to 1 if you have the `floorf' function. */
#undef HAVE_FLOORF
/* Define to 1 if you have the `floorl' function. */
#undef HAVE_FLOORL
/* Define to 1 if you have the `floorq' function. */
#undef HAVE_FLOORQ
/* Define to 1 if you have the `fmod' function. */
#undef HAVE_FMOD
/* Define to 1 if you have the `fmodf' function. */
#undef HAVE_FMODF
/* Define to 1 if you have the `fmodl' function. */
#undef HAVE_FMODL
/* Define to 1 if you have the `fmodq' function. */
#undef HAVE_FMODQ
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `fstat64' function. */
#undef HAVE_FSTAT64
/* Define to 1 if you have the `fsync' function. */
#undef HAVE_FSYNC
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* Define to 1 if you have the `ftruncate64' function. */
#undef HAVE_FTRUNCATE64
/* Define to 1 if you have the `futimens' function. */
#undef HAVE_FUTIMENS
/* Define to 1 if you have the `futimes' function. */
#undef HAVE_FUTIMES
/* Define to 1 if you have the `getcontext' function. */
#undef HAVE_GETCONTEXT
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `getifaddrs' function. */
#undef HAVE_GETIFADDRS
/* Define to 1 if you have the `getpgid' function. */
#undef HAVE_GETPGID
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define to 1 if you have the `gettid' function. */
#undef HAVE_GETTID
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <ifaddrs.h> header file. */
#undef HAVE_IFADDRS_H
/* Define to 1 if you have the `if_indextoname' function. */
#undef HAVE_IF_INDEXTONAME
/* Define to 1 if you have the `if_nametoindex' function. */
#undef HAVE_IF_NAMETOINDEX
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `isblank' function. */
#undef HAVE_ISBLANK
/* Define to 1 if you have the `iswblank' function. */
#undef HAVE_ISWBLANK
/* Define to 1 if you have the `iswctype' function. */
#undef HAVE_ISWCTYPE
/* Define to 1 if you have the `kevent' function. */
#undef HAVE_KEVENT
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
/* Define to 1 if you have the `kqueue1' function. */
#undef HAVE_KQUEUE1
/* Define to 1 if you have the <linux/ethtool.h> header file. */
#undef HAVE_LINUX_ETHTOOL_H
/* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */
#undef HAVE_LINUX_NETFILTER_IPV4_H
/* Define to 1 if you have the <linux/sockios.h> header file. */
#undef HAVE_LINUX_SOCKIOS_H
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define to 1 if you have the `log' function. */
#undef HAVE_LOG
/* Define to 1 if you have the `log10' function. */
#undef HAVE_LOG10
/* Define to 1 if you have the `log10f' function. */
#undef HAVE_LOG10F
/* Define to 1 if you have the `log10l' function. */
#undef HAVE_LOG10L
/* Define to 1 if you have the `log10q' function. */
#undef HAVE_LOG10Q
/* Define to 1 if you have the `logf' function. */
#undef HAVE_LOGF
/* Define to 1 if you have the `logl' function. */
#undef HAVE_LOGL
/* Define to 1 if you have the `logq' function. */
#undef HAVE_LOGQ
/* Define to 1 if you have the `lseek64' function. */
#undef HAVE_LSEEK64
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the `lstat64' function. */
#undef HAVE_LSTAT64
/* Define to 1 if you have the `lutimes' function. */
#undef HAVE_LUTIMES
/* Define to 1 if you have the `makecontext' function. */
#undef HAVE_MAKECONTEXT
/* Define to 1 if you have the `mbrlen' function. */
#undef HAVE_MBRLEN
/* Define to 1 if you have the `mbrtowc' function. */
#undef HAVE_MBRTOWC
/* Define to 1 if you have the `mbsnrtowcs' function. */
#undef HAVE_MBSNRTOWCS
/* Define to 1 if you have the `mbsrtowcs' function. */
#undef HAVE_MBSRTOWCS
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* 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
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define to 1 if you have the <openssl/engine.h> header file. */
#undef HAVE_OPENSSL_ENGINE_H
/* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define to 1 if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define to 1 if you have the `posix_spawn' function. */
#undef HAVE_POSIX_SPAWN
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the `powf' function. */
#undef HAVE_POWF
/* Define to 1 if you have the `powl' function. */
#undef HAVE_POWL
/* Define to 1 if you have the `powq' function. */
#undef HAVE_POWQ
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
/* Define to 1 if you have the <quadmath.h> header file. */
#undef HAVE_QUADMATH_H
/* Define to 1 if you have the `quadmath_snprintf' function. */
#undef HAVE_QUADMATH_SNPRINTF
/* Define to 1 if you have the `readdir64' function. */
#undef HAVE_READDIR64
/* Define to 1 if you have the `round' function. */
#undef HAVE_ROUND
/* Define to 1 if you have the `roundf' function. */
#undef HAVE_ROUNDF
/* Define to 1 if you have the `roundl' function. */
#undef HAVE_ROUNDL
/* Define to 1 if you have the `roundq' function. */
#undef HAVE_ROUNDQ
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `sendfile' function. */
#undef HAVE_SENDFILE
/* Define to 1 if you have the `sendfile64' function. */
#undef HAVE_SENDFILE64
/* Define to 1 if you have the `sendfilev' function. */
#undef HAVE_SENDFILEV
/* Define to 1 if you have the `sendfilev64' function. */
#undef HAVE_SENDFILEV64
/* Define to 1 if you have the `setcontext' function. */
#undef HAVE_SETCONTEXT
/* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define to 1 if you have the `settimeofday' function. */
#undef HAVE_SETTIMEOFDAY
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the `sin' function. */
#undef HAVE_SIN
/* Define to 1 if you have the `sinf' function. */
#undef HAVE_SINF
/* Define to 1 if you have the `sinh' function. */
#undef HAVE_SINH
/* Define to 1 if you have the `sinhf' function. */
#undef HAVE_SINHF
/* Define to 1 if you have the `sinhl' function. */
#undef HAVE_SINHL
/* Define to 1 if you have the `sinhq' function. */
#undef HAVE_SINHQ
/* Define to 1 if you have the `sinl' function. */
#undef HAVE_SINL
/* Define to 1 if you have the `sinq' function. */
#undef HAVE_SINQ
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <spawn.h> header file. */
#undef HAVE_SPAWN_H
/* Define to 1 if you have the `sqrt' function. */
#undef HAVE_SQRT
/* Define to 1 if you have the `sqrtf' function. */
#undef HAVE_SQRTF
/* Define to 1 if you have the `sqrtl' function. */
#undef HAVE_SQRTL
/* Define to 1 if you have the `sqrtq' function. */
#undef HAVE_SQRTQ
/* ssl support */
#undef HAVE_SSL
/* Define to 1 if you have the `SSL_library_init' function. */
#undef HAVE_SSL_LIBRARY_INIT
/* Define to 1 if you have the `stat64' function. */
#undef HAVE_STAT64
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtoflt128' function. */
#undef HAVE_STRTOFLT128
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#undef HAVE_STRUCT_DIRENT_D_TYPE
/* Define to 1 if `ifr_ifindex' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
/* Define to 1 if `ifr_mtu' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_MTU
/* Define to 1 if the system has the type `struct if_laddrreq'. */
#undef HAVE_STRUCT_IF_LADDRREQ
/* Define to 1 if the system has the type `struct lifconf'. */
#undef HAVE_STRUCT_LIFCONF
/* Define to 1 if the system has the type `struct lifreq'. */
#undef HAVE_STRUCT_LIFREQ
/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
/* Define to 1 if the system has the type `struct timespec'. */
#undef HAVE_STRUCT_TIMESPEC
/* Define to 1 if you have the `swapcontext' function. */
#undef HAVE_SWAPCONTEXT
/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
/* Define to 1 if you have the <sys/event.h> header file. */
#undef HAVE_SYS_EVENT_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/macstat.h> header file. */
#undef HAVE_SYS_MACSTAT_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/prctl.h> header file. */
#undef HAVE_SYS_PRCTL_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#undef HAVE_SYS_SENDFILE_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/stropts.h> header file. */
#undef HAVE_SYS_STROPTS_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the `tan' function. */
#undef HAVE_TAN
/* Define to 1 if you have the `tanf' function. */
#undef HAVE_TANF
/* Define to 1 if you have the `tanh' function. */
#undef HAVE_TANH
/* Define to 1 if you have the `tanhf' function. */
#undef HAVE_TANHF
/* Define to 1 if you have the `tanhl' function. */
#undef HAVE_TANHL
/* Define to 1 if you have the `tanhq' function. */
#undef HAVE_TANHQ
/* Define to 1 if you have the `tanl' function. */
#undef HAVE_TANL
/* Define to 1 if you have the `tanq' function. */
#undef HAVE_TANQ
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM
/* Define to 1 if you have the `timelocal' function. */
#undef HAVE_TIMELOCAL
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <tiuser.h> header file. */
#undef HAVE_TIUSER_H
/* Define to 1 if you have the `towctrans' function. */
#undef HAVE_TOWCTRANS
/* Define to 1 if you have the `t_connect' function. */
#undef HAVE_T_CONNECT
/* Define to 1 if you have the <uci.h> header file. */
#undef HAVE_UCI_H
/* Define to 1 if you have the <ucontext.h> header file. */
#undef HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* va_copy is available */
#undef HAVE_VA_COPY
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the `wcrtomb' function. */
#undef HAVE_WCRTOMB
/* Define to 1 if you have the `wcsnrtombs' function. */
#undef HAVE_WCSNRTOMBS
/* Define to 1 if you have the `wcsrtombs' function. */
#undef HAVE_WCSRTOMBS
/* Define to 1 if you have the `wctrans' function. */
#undef HAVE_WCTRANS
/* Define to 1 if you have the `wctype' function. */
#undef HAVE_WCTYPE
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if you have the `_vsnprintf' function. */
#undef HAVE__VSNPRINTF
/* Define to 1 if you have the `_vsnwprintf' function. */
#undef HAVE__VSNWPRINTF
/* __builtin_memcmp */
#undef HAVE___BUILTIN_MEMCMP
/* __builtin_memcpy */
#undef HAVE___BUILTIN_MEMCPY
/* __builtin_memmove */
#undef HAVE___BUILTIN_MEMMOVE
/* __builtin_memset */
#undef HAVE___BUILTIN_MEMSET
/* __va_copy is available */
#undef HAVE___VA_COPY
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* The size of `MB_LEN_MAX', as computed by valueof. */
#undef NUMVALOF_MB_LEN_MAX
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of `double', as computed by sizeof. */
#undef SIZEOF_DOUBLE
/* The size of `float', as computed by sizeof. */
#undef SIZEOF_FLOAT
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `mbstate_t', as computed by sizeof. */
#undef SIZEOF_MBSTATE_T
/* The size of `off64_t', as computed by sizeof. */
#undef SIZEOF_OFF64_T
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* 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
/* The size of `struct sockaddr_in6', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN6
/* The size of `struct sockaddr_un', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_UN
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* The size of `__float128', as computed by sizeof. */
#undef SIZEOF___FLOAT128
/* The size of `__int128', as computed by sizeof. */
#undef SIZEOF___INT128
/* The size of `__int128_t', as computed by sizeof. */
#undef SIZEOF___INT128_T
/* The size of `__int16', as computed by sizeof. */
#undef SIZEOF___INT16
/* The size of `__int16_t', as computed by sizeof. */
#undef SIZEOF___INT16_T
/* The size of `__int32', as computed by sizeof. */
#undef SIZEOF___INT32
/* The size of `__int32_t', as computed by sizeof. */
#undef SIZEOF___INT32_T
/* The size of `__int64', as computed by sizeof. */
#undef SIZEOF___INT64
/* The size of `__int64_t', as computed by sizeof. */
#undef SIZEOF___INT64_T
/* The size of `__int8', as computed by sizeof. */
#undef SIZEOF___INT8
/* The size of `__int8_t', as computed by sizeof. */
#undef SIZEOF___INT8_T
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Big Endian */
#undef STIO_ENDIAN_BIG
/* Little Endian */
#undef STIO_ENDIAN_LITTLE
/* Unknown Endian */
#undef STIO_ENDIAN_UNKNOWN
/* MB_LEN_MAX */
#undef STIO_MBLEN_MAX
/* Author */
#undef STIO_PACKAGE_AUTHOR
/* package name */
#undef STIO_PACKAGE_NAME
/* Project URL */
#undef STIO_PACKAGE_URL
/* Package version */
#undef STIO_PACKAGE_VERSION
/* Major version number */
#undef STIO_PACKAGE_VERSION_MAJOR
/* Minor version number */
#undef STIO_PACKAGE_VERSION_MINOR
/* Patch level */
#undef STIO_PACKAGE_VERSION_PATCH
/* sizeof(char) */
#undef STIO_SIZEOF_CHAR
/* sizeof(double) */
#undef STIO_SIZEOF_DOUBLE
/* sizeof(float) */
#undef STIO_SIZEOF_FLOAT
/* sizeof(int) */
#undef STIO_SIZEOF_INT
/* sizeof(long) */
#undef STIO_SIZEOF_LONG
/* sizeof(long double) */
#undef STIO_SIZEOF_LONG_DOUBLE
/* sizeof(long long) */
#undef STIO_SIZEOF_LONG_LONG
/* sizeof(mbstate_t) */
#undef STIO_SIZEOF_MBSTATE_T
/* sizeof(off64_t) */
#undef STIO_SIZEOF_OFF64_T
/* sizeof(off_t) */
#undef STIO_SIZEOF_OFF_T
/* sizeof(short) */
#undef STIO_SIZEOF_SHORT
/* sizeof(socklen_t) */
#undef STIO_SIZEOF_SOCKLEN_T
/* sizeof(struct sockaddr_in) */
#undef STIO_SIZEOF_STRUCT_SOCKADDR_IN
/* sizeof(struct sockaddr_in6) */
#undef STIO_SIZEOF_STRUCT_SOCKADDR_IN6
/* sizeof(struct sockaddr_un) */
#undef STIO_SIZEOF_STRUCT_SOCKADDR_UN
/* sizeof(void*) */
#undef STIO_SIZEOF_VOID_P
/* sizeof(wchar_t) */
#undef STIO_SIZEOF_WCHAR_T
/* sizeof(__float128) */
#undef STIO_SIZEOF___FLOAT128
/* sizeof(__int128) */
#undef STIO_SIZEOF___INT128
/* sizeof(__int128_t) */
#undef STIO_SIZEOF___INT128_T
/* sizeof(__int16) */
#undef STIO_SIZEOF___INT16
/* sizeof(__int32) */
#undef STIO_SIZEOF___INT32
/* sizeof(__int64) */
#undef STIO_SIZEOF___INT64
/* sizeof(__int8) */
#undef STIO_SIZEOF___INT8
/* Define if socklen_t is signed */
#undef STIO_SOCKLEN_T_IS_SIGNED
/* Version number of package */
#undef VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif

549
stio/lib/stio-cmn.h Normal file
View File

@ -0,0 +1,549 @@
/*
* $Id$
*
Copyright (c) 2015-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _STIO_CMN_H_
#define _STIO_CMN_H_
/* WARNING: NEVER CHANGE/DELETE THE FOLLOWING STIO_HAVE_CFG_H DEFINITION.
* IT IS USED FOR DEPLOYMENT BY MAKEFILE.AM */
/*#define STIO_HAVE_CFG_H*/
#if defined(STIO_HAVE_CFG_H)
# include "stio-cfg.h"
#elif defined(_WIN32)
# include "stio-msw.h"
#elif defined(__OS2__)
# include "stio-os2.h"
#elif defined(__MSDOS__)
# include "stio-dos.h"
#elif defined(macintosh)
# include "stio-mac.h" /* class mac os */
#else
# error UNSUPPORTED SYSTEM
#endif
#if defined(EMSCRIPTEN)
# if defined(STIO_SIZEOF___INT128)
# undef STIO_SIZEOF___INT128
# define STIO_SIZEOF___INT128 0
# endif
# if defined(STIO_SIZEOF_LONG) && defined(STIO_SIZEOF_INT) && (STIO_SIZEOF_LONG > STIO_SIZEOF_INT)
/* autoconf doesn't seem to match actual emscripten */
# undef STIO_SIZEOF_LONG
# define STIO_SIZEOF_LONG STIO_SIZEOF_INT
# endif
#endif
/* =========================================================================
* PRIMITIVE TYPE DEFINTIONS
* ========================================================================= */
/* stio_int8_t */
#if defined(STIO_SIZEOF_CHAR) && (STIO_SIZEOF_CHAR == 1)
# define STIO_HAVE_UINT8_T
# define STIO_HAVE_INT8_T
typedef unsigned char stio_uint8_t;
typedef signed char stio_int8_t;
#elif defined(STIO_SIZEOF___INT8) && (STIO_SIZEOF___INT8 == 1)
# define STIO_HAVE_UINT8_T
# define STIO_HAVE_INT8_T
typedef unsigned __int8 stio_uint8_t;
typedef signed __int8 stio_int8_t;
#elif defined(STIO_SIZEOF___INT8_T) && (STIO_SIZEOF___INT8_T == 1)
# define STIO_HAVE_UINT8_T
# define STIO_HAVE_INT8_T
typedef unsigned __int8_t stio_uint8_t;
typedef signed __int8_t stio_int8_t;
#else
# define STIO_HAVE_UINT8_T
# define STIO_HAVE_INT8_T
typedef unsigned char stio_uint8_t;
typedef signed char stio_int8_t;
#endif
/* stio_int16_t */
#if defined(STIO_SIZEOF_SHORT) && (STIO_SIZEOF_SHORT == 2)
# define STIO_HAVE_UINT16_T
# define STIO_HAVE_INT16_T
typedef unsigned short int stio_uint16_t;
typedef signed short int stio_int16_t;
#elif defined(STIO_SIZEOF___INT16) && (STIO_SIZEOF___INT16 == 2)
# define STIO_HAVE_UINT16_T
# define STIO_HAVE_INT16_T
typedef unsigned __int16 stio_uint16_t;
typedef signed __int16 stio_int16_t;
#elif defined(STIO_SIZEOF___INT16_T) && (STIO_SIZEOF___INT16_T == 2)
# define STIO_HAVE_UINT16_T
# define STIO_HAVE_INT16_T
typedef unsigned __int16_t stio_uint16_t;
typedef signed __int16_t stio_int16_t;
#else
# define STIO_HAVE_UINT16_T
# define STIO_HAVE_INT16_T
typedef unsigned short int stio_uint16_t;
typedef signed short int stio_int16_t;
#endif
/* stio_int32_t */
#if defined(STIO_SIZEOF_INT) && (STIO_SIZEOF_INT == 4)
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned int stio_uint32_t;
typedef signed int stio_int32_t;
#elif defined(STIO_SIZEOF_LONG) && (STIO_SIZEOF_LONG == 4)
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned long stio_uint32_t;
typedef signed long stio_int32_t;
#elif defined(STIO_SIZEOF___INT32) && (STIO_SIZEOF___INT32 == 4)
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned __int32 stio_uint32_t;
typedef signed __int32 stio_int32_t;
#elif defined(STIO_SIZEOF___INT32_T) && (STIO_SIZEOF___INT32_T == 4)
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned __int32_t stio_uint32_t;
typedef signed __int32_t stio_int32_t;
#elif defined(__MSDOS__)
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned long int stio_uint32_t;
typedef signed long int stio_int32_t;
#else
# define STIO_HAVE_UINT32_T
# define STIO_HAVE_INT32_T
typedef unsigned int stio_uint32_t;
typedef signed int stio_int32_t;
#endif
/* stio_int64_t */
#if defined(STIO_SIZEOF_INT) && (STIO_SIZEOF_INT == 8)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned int stio_uint64_t;
typedef signed int stio_int64_t;
#elif defined(STIO_SIZEOF_LONG) && (STIO_SIZEOF_LONG == 8)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned long stio_uint64_t;
typedef signed long stio_int64_t;
#elif defined(STIO_SIZEOF_LONG_LONG) && (STIO_SIZEOF_LONG_LONG == 8)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned long long stio_uint64_t;
typedef signed long long stio_int64_t;
#elif defined(STIO_SIZEOF___INT64) && (STIO_SIZEOF___INT64 == 8)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned __int64 stio_uint64_t;
typedef signed __int64 stio_int64_t;
#elif defined(STIO_SIZEOF___INT64_T) && (STIO_SIZEOF___INT64_T == 8)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned __int64_t stio_uint64_t;
typedef signed __int64_t stio_int64_t;
#elif defined(_WIN64) || defined(_WIN32)
# define STIO_HAVE_UINT64_T
# define STIO_HAVE_INT64_T
typedef unsigned __int64 stio_uint64_t;
typedef signed __int64 stio_int64_t;
#else
/* no 64-bit integer */
#endif
/* stio_int128_t */
#if defined(STIO_SIZEOF_INT) && (STIO_SIZEOF_INT == 16)
# define STIO_HAVE_UINT128_T
# define STIO_HAVE_INT128_T
typedef unsigned int stio_uint128_t;
typedef signed int stio_int128_t;
#elif defined(STIO_SIZEOF_LONG) && (STIO_SIZEOF_LONG == 16)
# define STIO_HAVE_UINT128_T
# define STIO_HAVE_INT128_T
typedef unsigned long stio_uint128_t;
typedef signed long stio_int128_t;
#elif defined(STIO_SIZEOF_LONG_LONG) && (STIO_SIZEOF_LONG_LONG == 16)
# define STIO_HAVE_UINT128_T
# define STIO_HAVE_INT128_T
typedef unsigned long long stio_uint128_t;
typedef signed long long stio_int128_t;
#elif defined(STIO_SIZEOF___INT128) && (STIO_SIZEOF___INT128 == 16)
# define STIO_HAVE_UINT128_T
# define STIO_HAVE_INT128_T
typedef unsigned __int128 stio_uint128_t;
typedef signed __int128 stio_int128_t;
#elif defined(STIO_SIZEOF___INT128_T) && (STIO_SIZEOF___INT128_T == 16)
# define STIO_HAVE_UINT128_T
# define STIO_HAVE_INT128_T
#if defined(__clang__)
typedef __uint128_t stio_uint128_t;
typedef __int128_t stio_int128_t;
#else
typedef unsigned __int128_t stio_uint128_t;
typedef signed __int128_t stio_int128_t;
#endif
#else
/* no 128-bit integer */
#endif
#if defined(STIO_HAVE_UINT8_T) && (STIO_SIZEOF_VOID_P == 1)
# error UNSUPPORTED POINTER SIZE
#elif defined(STIO_HAVE_UINT16_T) && (STIO_SIZEOF_VOID_P == 2)
typedef stio_uint16_t stio_uintptr_t;
typedef stio_int16_t stio_intptr_t;
typedef stio_uint8_t stio_ushortptr_t;
typedef stio_int8_t stio_shortptr_t;
#elif defined(STIO_HAVE_UINT32_T) && (STIO_SIZEOF_VOID_P == 4)
typedef stio_uint32_t stio_uintptr_t;
typedef stio_int32_t stio_intptr_t;
typedef stio_uint16_t stio_ushortptr_t;
typedef stio_int16_t stio_shortptr_t;
#elif defined(STIO_HAVE_UINT64_T) && (STIO_SIZEOF_VOID_P == 8)
typedef stio_uint64_t stio_uintptr_t;
typedef stio_int64_t stio_intptr_t;
typedef stio_uint32_t stio_ushortptr_t;
typedef stio_int32_t stio_shortptr_t;
#elif defined(STIO_HAVE_UINT128_T) && (STIO_SIZEOF_VOID_P == 16)
typedef stio_uint128_t stio_uintptr_t;
typedef stio_int128_t stio_intptr_t;
typedef stio_uint64_t stio_ushortptr_t;
typedef stio_int64_t stio_shortptr_t;
#else
# error UNKNOWN POINTER SIZE
#endif
#define STIO_SIZEOF_INTPTR_T STIO_SIZEOF_VOID_P
#define STIO_SIZEOF_UINTPTR_T STIO_SIZEOF_VOID_P
#define STIO_SIZEOF_SHORTPTR_T (STIO_SIZEOF_VOID_P / 2)
#define STIO_SIZEOF_USHORTPTR_T (STIO_SIZEOF_VOID_P / 2)
#if defined(STIO_HAVE_INT128_T)
# define STIO_SIZEOF_INTMAX_T 16
# define STIO_SIZEOF_UINTMAX_T 16
typedef stio_int128_t stio_intmax_t;
typedef stio_uint128_t stio_uintmax_t;
#elif defined(STIO_HAVE_INT64_T)
# define STIO_SIZEOF_INTMAX_T 8
# define STIO_SIZEOF_UINTMAX_T 8
typedef stio_int64_t stio_intmax_t;
typedef stio_uint64_t stio_uintmax_t;
#elif defined(STIO_HAVE_INT32_T)
# define STIO_SIZEOF_INTMAX_T 4
# define STIO_SIZEOF_UINTMAX_T 4
typedef stio_int32_t stio_intmax_t;
typedef stio_uint32_t stio_uintmax_t;
#elif defined(STIO_HAVE_INT16_T)
# define STIO_SIZEOF_INTMAX_T 2
# define STIO_SIZEOF_UINTMAX_T 2
typedef stio_int16_t stio_intmax_t;
typedef stio_uint16_t stio_uintmax_t;
#elif defined(STIO_HAVE_INT8_T)
# define STIO_SIZEOF_INTMAX_T 1
# define STIO_SIZEOF_UINTMAX_T 1
typedef stio_int8_t stio_intmax_t;
typedef stio_uint8_t stio_uintmax_t;
#else
# error UNKNOWN INTMAX SIZE
#endif
/* =========================================================================
* BASIC STIO TYPES
* =========================================================================*/
typedef stio_uint8_t stio_byte_t;
typedef stio_uintptr_t stio_size_t;
/* =========================================================================
* PRIMITIVE MACROS
* ========================================================================= */
#define STIO_SIZEOF(x) (sizeof(x))
#define STIO_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
/**
* The STIO_OFFSETOF() macro returns the offset of a field from the beginning
* of a structure.
*/
#define STIO_OFFSETOF(type,member) ((stio_uintptr_t)&((type*)0)->member)
/**
* The STIO_ALIGNOF() macro returns the alignment size of a structure.
* Note that this macro may not work reliably depending on the type given.
*/
#define STIO_ALIGNOF(type) STIO_OFFSETOF(struct { stio_uint8_t d1; type d2; }, d2)
/*(sizeof(struct { stio_uint8_t d1; type d2; }) - sizeof(type))*/
#if defined(__cplusplus)
# if (__cplusplus >= 201103L) /* C++11 */
# define STIO_NULL nullptr
# else
# define STIO_NULL (0)
# endif
#else
# define STIO_NULL ((void*)0)
#endif
/* make a bit mask that can mask off low n bits */
#define STIO_LBMASK(type,n) (~(~((type)0) << (n)))
#define STIO_LBMASK_SAFE(type,n) (((n) < STIO_SIZEOF(type) * 8)? STIO_LBMASK(type,n): ~(type)0)
/* make a bit mask that can mask off hig n bits */
#define STIO_HBMASK(type,n) (~(~((type)0) >> (n)))
#define STIO_HBMASK_SAFE(type,n) (((n) < STIO_SIZEOF(type) * 8)? STIO_HBMASK(type,n): ~(type)0)
/* get 'length' bits starting from the bit at the 'offset' */
#define STIO_GETBITS(type,value,offset,length) \
((((type)(value)) >> (offset)) & STIO_LBMASK(type,length))
#define STIO_SETBITS(type,value,offset,length,bits) \
(value = (((type)(value)) | (((bits) & STIO_LBMASK(type,length)) << (offset))))
/**
* The STIO_BITS_MAX() macros calculates the maximum value that the 'nbits'
* bits of an unsigned integer of the given 'type' can hold.
* \code
* printf ("%u", STIO_BITS_MAX(unsigned int, 5));
* \endcode
*/
/*#define STIO_BITS_MAX(type,nbits) ((((type)1) << (nbits)) - 1)*/
#define STIO_BITS_MAX(type,nbits) ((~(type)0) >> (STIO_SIZEOF(type) * 8 - (nbits)))
/* =========================================================================
* MMGR
* ========================================================================= */
typedef struct stio_mmgr_t stio_mmgr_t;
/**
* allocate a memory chunk of the size \a n.
* \return pointer to a memory chunk on success, #STIO_NULL on failure.
*/
typedef void* (*stio_mmgr_alloc_t) (stio_mmgr_t* mmgr, stio_size_t n);
/**
* resize a memory chunk pointed to by \a ptr to the size \a n.
* \return pointer to a memory chunk on success, #STIO_NULL on failure.
*/
typedef void* (*stio_mmgr_realloc_t) (stio_mmgr_t* mmgr, void* ptr, stio_size_t n);
/**
* free a memory chunk pointed to by \a ptr.
*/
typedef void (*stio_mmgr_free_t) (stio_mmgr_t* mmgr, void* ptr);
/**
* The stio_mmgr_t type defines the memory management interface.
* As the type is merely a structure, it is just used as a single container
* for memory management functions with a pointer to user-defined data.
* The user-defined data pointer \a ctx is passed to each memory management
* function whenever it is called. You can allocate, reallocate, and free
* a memory chunk.
*
* For example, a stio_xxx_open() function accepts a pointer of the stio_mmgr_t
* type and the xxx object uses it to manage dynamic data within the object.
*/
struct stio_mmgr_t
{
stio_mmgr_alloc_t alloc; /**< allocation function */
stio_mmgr_realloc_t realloc; /**< resizing function */
stio_mmgr_free_t free; /**< disposal function */
void* ctx; /**< user-defined data pointer */
};
/**
* The STIO_MMGR_ALLOC() macro allocates a memory block of the \a size bytes
* using the \a mmgr memory manager.
*/
#define STIO_MMGR_ALLOC(mmgr,size) ((mmgr)->alloc(mmgr,size))
/**
* The STIO_MMGR_REALLOC() macro resizes a memory block pointed to by \a ptr
* to the \a size bytes using the \a mmgr memory manager.
*/
#define STIO_MMGR_REALLOC(mmgr,ptr,size) ((mmgr)->realloc(mmgr,ptr,size))
/**
* The STIO_MMGR_FREE() macro deallocates the memory block pointed to by \a ptr.
*/
#define STIO_MMGR_FREE(mmgr,ptr) ((mmgr)->free(mmgr,ptr))
/* =========================================================================
* MACROS THAT CHANGES THE BEHAVIORS OF THE C COMPILER/LINKER
* =========================================================================*/
#if defined(_WIN32) || (defined(__WATCOMC__) && !defined(__WINDOWS_386__))
# define STIO_IMPORT __declspec(dllimport)
# define STIO_EXPORT __declspec(dllexport)
# define STIO_PRIVATE
#elif defined(__GNUC__) && (__GNUC__>=4)
# define STIO_IMPORT __attribute__((visibility("default")))
# define STIO_EXPORT __attribute__((visibility("default")))
# define STIO_PRIVATE __attribute__((visibility("hidden")))
/*# define STIO_PRIVATE __attribute__((visibility("internal")))*/
#else
# define STIO_IMPORT
# define STIO_EXPORT
# define STIO_PRIVATE
#endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__>=199901L)
# define STIO_INLINE inline
# define STIO_HAVE_INLINE
#elif defined(__GNUC__) && defined(__GNUC_GNU_INLINE__)
/* gcc disables inline when -std=c89 or -ansi is used.
* so use __inline__ supported by gcc regardless of the options */
# define STIO_INLINE /*extern*/ __inline__
# define STIO_HAVE_INLINE
#else
# define STIO_INLINE
# undef STIO_HAVE_INLINE
#endif
/**
* The STIO_TYPE_IS_SIGNED() macro determines if a type is signed.
* \code
* printf ("%d\n", (int)STIO_TYPE_IS_SIGNED(int));
* printf ("%d\n", (int)STIO_TYPE_IS_SIGNED(unsigned int));
* \endcode
*/
#define STIO_TYPE_IS_SIGNED(type) (((type)0) > ((type)-1))
/**
* The STIO_TYPE_IS_SIGNED() macro determines if a type is unsigned.
* \code
* printf ("%d\n", STIO_TYPE_IS_UNSIGNED(int));
* printf ("%d\n", STIO_TYPE_IS_UNSIGNED(unsigned int));
* \endcode
*/
#define STIO_TYPE_IS_UNSIGNED(type) (((type)0) < ((type)-1))
#define STIO_TYPE_SIGNED_MAX(type) \
((type)~((type)1 << ((type)STIO_SIZEOF(type) * 8 - 1)))
#define STIO_TYPE_UNSIGNED_MAX(type) ((type)(~(type)0))
#define STIO_TYPE_SIGNED_MIN(type) \
((type)((type)1 << ((type)STIO_SIZEOF(type) * 8 - 1)))
#define STIO_TYPE_UNSIGNED_MIN(type) ((type)0)
#define STIO_TYPE_MAX(type) \
((STIO_TYPE_IS_SIGNED(type)? STIO_TYPE_SIGNED_MAX(type): STIO_TYPE_UNSIGNED_MAX(type)))
#define STIO_TYPE_MIN(type) \
((STIO_TYPE_IS_SIGNED(type)? STIO_TYPE_SIGNED_MIN(type): STIO_TYPE_UNSIGNED_MIN(type)))
/* =========================================================================
* COMPILER FEATURE TEST MACROS
* =========================================================================*/
#if defined(__has_builtin)
#if __has_builtin(__builtin_ctz)
#define STIO_HAVE_BUILTIN_CTZ
#endif
#if __has_builtin(__builtin_uadd_overflow)
#define STIO_HAVE_BUILTIN_UADD_OVERFLOW
#endif
#if __has_builtin(__builtin_uaddl_overflow)
#define STIO_HAVE_BUILTIN_UADDL_OVERFLOW
#endif
#if __has_builtin(__builtin_uaddll_overflow)
#define STIO_HAVE_BUILTIN_UADDLL_OVERFLOW
#endif
#if __has_builtin(__builtin_umul_overflow)
#define STIO_HAVE_BUILTIN_UMUL_OVERFLOW
#endif
#if __has_builtin(__builtin_umull_overflow)
#define STIO_HAVE_BUILTIN_UMULL_OVERFLOW
#endif
#if __has_builtin(__builtin_umulll_overflow)
#define STIO_HAVE_BUILTIN_UMULLL_OVERFLOW
#endif
#if __has_builtin(__builtin_sadd_overflow)
#define STIO_HAVE_BUILTIN_SADD_OVERFLOW
#endif
#if __has_builtin(__builtin_saddl_overflow)
#define STIO_HAVE_BUILTIN_SADDL_OVERFLOW
#endif
#if __has_builtin(__builtin_saddll_overflow)
#define STIO_HAVE_BUILTIN_SADDLL_OVERFLOW
#endif
#if __has_builtin(__builtin_smul_overflow)
#define STIO_HAVE_BUILTIN_SMUL_OVERFLOW
#endif
#if __has_builtin(__builtin_smull_overflow)
#define STIO_HAVE_BUILTIN_SMULL_OVERFLOW
#endif
#if __has_builtin(__builtin_smulll_overflow)
#define STIO_HAVE_BUILTIN_SMULLL_OVERFLOW
#endif
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define STIO_HAVE_BUILTIN_CTZ
#endif
#if (__GNUC__ >= 5)
#define STIO_HAVE_BUILTIN_UADD_OVERFLOW
#define STIO_HAVE_BUILTIN_UADDL_OVERFLOW
#define STIO_HAVE_BUILTIN_UADDLL_OVERFLOW
#define STIO_HAVE_BUILTIN_UMUL_OVERFLOW
#define STIO_HAVE_BUILTIN_UMULL_OVERFLOW
#define STIO_HAVE_BUILTIN_UMULLL_OVERFLOW
#define STIO_HAVE_BUILTIN_SADD_OVERFLOW
#define STIO_HAVE_BUILTIN_SADDL_OVERFLOW
#define STIO_HAVE_BUILTIN_SADDLL_OVERFLOW
#define STIO_HAVE_BUILTIN_SMUL_OVERFLOW
#define STIO_HAVE_BUILTIN_SMULL_OVERFLOW
#define STIO_HAVE_BUILTIN_SMULLL_OVERFLOW
#endif
#endif
/*
#if !defined(__has_builtin)
#define __has_builtin(x) 0
#endif
#if !defined(__is_identifier)
#define __is_identifier(x) 0
#endif
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif
*/
#endif

View File

@ -28,8 +28,47 @@
#define _STIO_PRV_H_
#include "stio.h"
#include "stio-tim.h"
#include <sys/epoll.h>
/*TODO: redefine and remove these */
#include <assert.h>
#include <string.h>
#include <stdio.h>
/*TODO: redefine these */
#define STIO_MEMSET(dst,byte,count) memset(dst,byte,count)
#define STIO_MEMCPY(dst,src,count) memcpy(dst,src,count)
#define STIO_MEMMOVE(dst,src,count) memmove(dst,src,count)
#define STIO_ASSERT assert
typedef struct stio_tmrjob_t stio_tmrjob_t;
typedef stio_size_t stio_tmridx_t;
typedef void (*stio_tmr_handler_t) (
stio_t* stio,
const stio_ntime_t* now,
stio_tmrjob_t* evt
);
typedef void (*stio_updtmrjobr_t) (
stio_t* stio,
stio_tmridx_t old_index,
stio_tmridx_t new_index,
stio_tmrjob_t* evt
);
struct stio_tmrjob_t
{
void* ctx;
stio_ntime_t when;
stio_tmr_handler_t handler;
stio_updtmrjobr_t updater;
};
#define STIO_TMRIDX_INVALID ((stio_tmridx_t)-1)
struct stio_t
{
stio_mmgr_t* mmgr;
@ -42,9 +81,16 @@ struct stio_t
stio_dev_t* tail;
} dev;
stio_uint8_t bigbuf[65535]; /* make this dynamic depending on devices added. device may indicate a buffer size required??? */
stio_uint8_t bigbuf[65535]; /* TODO: make this dynamic depending on devices added. device may indicate a buffer size required??? */
struct
{
stio_size_t capa;
stio_size_t size;
stio_tmrjob_t* jobs;
} tmr;
/* platform specific fields below */
#if defined(_WIN32)
HANDLE iocp;
#else
@ -64,6 +110,52 @@ int stio_makesckasync (stio_sckhnd_t sck);
int stio_getsckadrinfo (stio_t* stio, const stio_sckadr_t* addr, stio_scklen_t* len, stio_sckfam_t* family);
/**
* The stio_instmrjob() function schedules a new event.
*
* \return #STIO_TMRIDX_INVALID on failure, valid index on success.
*/
stio_tmridx_t stio_instmrjob (
stio_t* stio,
const stio_tmrjob_t* job
);
stio_tmridx_t stio_updtmrjob (
stio_t* stio,
stio_tmridx_t index,
const stio_tmrjob_t* job
);
void stio_deltmrjob (
stio_t* stio,
stio_tmridx_t index
);
void stio_cleartmrjobs (
stio_t* stio
);
stio_size_t stio_firetmrjobs (
stio_t* stio,
const stio_ntime_t* tm
);
int stio_gettmrtmout (
stio_t* stio,
const stio_ntime_t* tm,
stio_ntime_t* tmout
);
/**
* The stio_gettmrjob() function returns the
* pointer to the registered event at the given index.
*/
stio_tmrjob_t* stio_gettmrjob (
stio_t* stio,
stio_tmridx_t index
);
#ifdef __cplusplus
}
#endif

View File

@ -34,7 +34,6 @@
#include <arpa/inet.h>
#include <errno.h>
static int tcp_make (stio_dev_t* dev, void* ctx)
{
/* NOTE: this can be extended to use ctx to tell between INET and INET6 or other types of sockets without creating a new dev method set. */
@ -131,7 +130,7 @@ static int tcp_send (stio_dev_t* dev, const void* data, stio_len_t* len)
ssize_t x;
int flags = 0;
/* flags MSG_DONTROUTE, MSG_DONTWAIT, MSG_MORE, MSG_OOB, MSG_NOSIGNAL */
/* TODO: flags MSG_DONTROUTE, MSG_DONTWAIT, MSG_MORE, MSG_OOB, MSG_NOSIGNAL */
#if defined(MSG_NOSIGNAL)
flags |= MSG_NOSIGNAL;
#endif
@ -143,17 +142,29 @@ static int tcp_send (stio_dev_t* dev, const void* data, stio_len_t* len)
return -1;
}
/***************/
{
static int x = 0;
if (x <= 2) { x++; return 0; }
}
/***************/
*len = x;
return 1;
}
static void tmr_connect_handle (stio_t* stio, const stio_ntime_t* now, stio_tmrjob_t* job)
{
stio_dev_tcp_t* tcp = (stio_dev_tcp_t*)job->ctx;
if (tcp->state & STIO_DEV_TCP_CONNECTING)
{
/* the state check is actually redundant as it must not be fired
* after it gets connected. the timer job doesn't need to be deleted
* when it gets connected for this check here */
if (tcp->on_disconnected) tcp->on_disconnected (tcp);
}
}
static void tmr_connect_update (stio_t* stio, stio_tmridx_t old_index, stio_tmridx_t new_index, stio_tmrjob_t* job)
{
stio_dev_tcp_t* tcp = (stio_dev_tcp_t*)job->ctx;
}
static int tcp_ioctl (stio_dev_t* dev, int cmd, void* arg)
{
stio_dev_tcp_t* tcp = (stio_dev_tcp_t*)dev;
@ -212,8 +223,23 @@ static int tcp_ioctl (stio_dev_t* dev, int cmd, void* arg)
{
if (errno == EINPROGRESS || errno == EWOULDBLOCK)
{
if (stio_dev_event ((stio_dev_t*)tcp, STIO_DEV_EVENT_MOD, STIO_DEV_EVENT_IN | STIO_DEV_EVENT_OUT) >= 0)
if (stio_dev_event ((stio_dev_t*)tcp, STIO_DEV_EVENT_UPD, STIO_DEV_EVENT_IN | STIO_DEV_EVENT_OUT) >= 0)
{
stio_tmrjob_t tmrjob;
if (!stio_iszerotime(&conn->timeout))
{
STIO_MEMSET (&tmrjob, 0, STIO_SIZEOF(tmrjob));
tmrjob.ctx = tcp;
tmrjob.when = conn->timeout;
tmrjob.handler = tmr_connect_handle;
tmrjob.updater = tmr_connect_update;
if (stio_instmrjob (tcp->stio, &tmrjob) == STIO_TMRIDX_INVALID)
{
return -1;
}
}
tcp->state |= STIO_DEV_TCP_CONNECTING;
tcp->peer = conn->addr;
tcp->on_connected = conn->on_connected;
@ -324,7 +350,8 @@ printf ("TCP READY...%p\n", dev);
tcp->state &= ~STIO_DEV_TCP_CONNECTING;
tcp->state |= STIO_DEV_TCP_CONNECTED;
if (stio_dev_event ((stio_dev_t*)tcp, STIO_DEV_EVENT_MOD, STIO_DEV_EVENT_IN) <= -1)
if (stio_dev_event ((stio_dev_t*)tcp, STIO_DEV_EVENT_UPD, STIO_DEV_EVENT_IN) <= -1)
if (stio_dev_event ((stio_dev_t*)tcp, STIO_DEV_EVENT_UPD, STIO_DEV_EVENT_IN) <= -1)
{
printf ("CAANOT MANIPULTE EVENT ...\n");
return -1;

View File

@ -28,6 +28,7 @@
#define _STIO_TCP_H_
#include <stio.h>
#include <stio-tim.h>
enum stio_dev_tcp_ioctl_cmd_t
{
@ -94,7 +95,7 @@ struct stio_dev_tcp_make_t
typedef struct stio_dev_tcp_bind_t stio_dev_tcp_bind_t;
struct stio_dev_tcp_bind_t
{
int options; /* TODO: REUSEADDR , TRANSPARENT, etc or someting?? */
int opts; /* TODO: REUSEADDR , TRANSPARENT, etc or someting?? */
stio_sckadr_t addr;
/* TODO: add device name for BIND_TO_DEVICE */
};
@ -103,10 +104,9 @@ typedef struct stio_dev_tcp_connect_t stio_dev_tcp_connect_t;
struct stio_dev_tcp_connect_t
{
stio_sckadr_t addr;
/* TODO: add timeout */
stio_ntime_t timeout; /* connect timeout */
stio_dev_tcp_on_connected_t on_connected;
stio_dev_tcp_on_disconnected_t on_disconnected;
/* stio_dev_tcp_on_timeout_t on_timeout; should the timeout handler be here? what about write timeout? or accept timeout? */
};
typedef struct stio_dev_tcp_listen_t stio_dev_tcp_listen_t;
@ -130,31 +130,31 @@ struct stio_dev_tcp_accept_t
extern "C" {
#endif
stio_dev_tcp_t* stio_dev_tcp_make (
STIO_EXPORT stio_dev_tcp_t* stio_dev_tcp_make (
stio_t* stio,
stio_size_t xtnsize,
const stio_dev_tcp_make_t* data
);
void stio_dev_tcp_kill (
STIO_EXPORT void stio_dev_tcp_kill (
stio_dev_tcp_t* tcp
);
int stio_dev_tcp_bind (
STIO_EXPORT int stio_dev_tcp_bind (
stio_dev_tcp_t* tcp,
stio_dev_tcp_bind_t* bind
);
int stio_dev_tcp_connect (
STIO_EXPORT int stio_dev_tcp_connect (
stio_dev_tcp_t* tcp,
stio_dev_tcp_connect_t* conn);
int stio_dev_tcp_listen (
STIO_EXPORT int stio_dev_tcp_listen (
stio_dev_tcp_t* tcp,
stio_dev_tcp_listen_t* lstn
);
int stio_dev_tcp_send (
STIO_EXPORT int stio_dev_tcp_send (
stio_dev_tcp_t* tcp,
const void* data,
stio_len_t len,

223
stio/lib/stio-tmr.c Normal file
View File

@ -0,0 +1,223 @@
/*
* $Id$
*
Copyright (c) 2015-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAfRRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "stio-prv.h"
#define HEAP_PARENT(x) (((x) - 1) / 2)
#define HEAP_LEFT(x) ((x) * 2 + 1)
#define HEAP_RIGHT(x) ((x) * 2 + 2)
#define YOUNGER_THAN(x,y) (stio_cmptime(&(x)->when, &(y)->when) < 0)
void stio_cleartmrjobs (stio_t* stio)
{
while (stio->tmr.size > 0) stio_deltmrjob (stio, 0);
}
static stio_tmridx_t sift_up (stio_t* stio, stio_tmridx_t index, int notify)
{
stio_size_t parent;
parent = HEAP_PARENT(index);
if (index > 0 && YOUNGER_THAN(&stio->tmr.jobs[index], &stio->tmr.jobs[parent]))
{
stio_tmrjob_t item;
stio_size_t old_index;
item = stio->tmr.jobs[index];
old_index = index;
do
{
/* move down the parent to my current position */
stio->tmr.jobs[index] = stio->tmr.jobs[parent];
stio->tmr.jobs[index].updater (stio, parent, index, &stio->tmr.jobs[index]);
/* traverse up */
index = parent;
parent = HEAP_PARENT(parent);
}
while (index > 0 && YOUNGER_THAN(&item, &stio->tmr.jobs[parent]));
/* we send no notification if the item is added with stio_instmrjob()
* or updated with stio_updtmrjob(). the caller of these functions
* must rely on the return value. */
stio->tmr.jobs[index] = item;
if (notify && index != old_index)
stio->tmr.jobs[index].updater (stio, old_index, index, &stio->tmr.jobs[index]);
}
return index;
}
static stio_tmridx_t sift_down (stio_t* stio, stio_tmridx_t index, int notify)
{
stio_size_t base = stio->tmr.size / 2;
if (index < base) /* at least 1 child is under the 'index' positmrn */
{
stio_tmrjob_t item;
stio_size_t old_index;
item = stio->tmr.jobs[index];
old_index = index;
do
{
stio_size_t left, right, younger;
left= HEAP_LEFT(index);
right = HEAP_RIGHT(index);
if (right < stio->tmr.size && YOUNGER_THAN(&stio->tmr.jobs[right], &stio->tmr.jobs[left]))
{
younger = right;
}
else
{
younger = left;
}
if (YOUNGER_THAN(&item, &stio->tmr.jobs[younger])) break;
stio->tmr.jobs[index] = stio->tmr.jobs[younger];
stio->tmr.jobs[index].updater (stio, younger, index, &stio->tmr.jobs[index]);
index = younger;
}
while (index < base);
stio->tmr.jobs[index] = item;
if (notify && index != old_index)
stio->tmr.jobs[index].updater (stio, old_index, index, &stio->tmr.jobs[index]);
}
return index;
}
void stio_deltmrjob (stio_t* stio, stio_tmridx_t index)
{
stio_tmrjob_t item;
STIO_ASSERT (index < stio->tmr.size);
item = stio->tmr.jobs[index];
stio->tmr.jobs[index].updater (stio, index, STIO_TMRIDX_INVALID, &stio->tmr.jobs[index]);
stio->tmr.size = stio->tmr.size - 1;
if (stio->tmr.size > 0 && index != stio->tmr.size)
{
stio->tmr.jobs[index] = stio->tmr.jobs[stio->tmr.size];
stio->tmr.jobs[index].updater (stio, stio->tmr.size, index, &stio->tmr.jobs[index]);
YOUNGER_THAN(&stio->tmr.jobs[index], &item)? sift_up(stio, index, 1): sift_down(stio, index, 1);
}
}
stio_tmridx_t stio_instmrjob (stio_t* stio, const stio_tmrjob_t* job)
{
stio_tmridx_t index = stio->tmr.size;
if (index >= stio->tmr.capa)
{
stio_tmrjob_t* tmp;
stio_size_t new_capa;
STIO_ASSERT (stio->tmr.capa >= 1);
new_capa = stio->tmr.capa * 2;
tmp = (stio_tmrjob_t*)STIO_MMGR_REALLOC (stio->mmgr, stio->tmr.jobs, new_capa * STIO_SIZEOF(*tmp));
if (tmp == STIO_NULL)
{
stio->errnum = STIO_ENOMEM;
return STIO_TMRIDX_INVALID;
}
stio->tmr.jobs = tmp;
stio->tmr.capa = new_capa;
}
stio->tmr.size = stio->tmr.size + 1;
stio->tmr.jobs[index] = *job;
return sift_up (stio, index, 0);
}
stio_tmridx_t stio_updtmrjob (stio_t* stio, stio_size_t index, const stio_tmrjob_t* job)
{
stio_tmrjob_t item;
item = stio->tmr.jobs[index];
stio->tmr.jobs[index] = *job;
return YOUNGER_THAN(job, &item)? sift_up (stio, index, 0): sift_down (stio, index, 0);
}
stio_size_t stio_firetmrjobs (stio_t* stio, const stio_ntime_t* tm)
{
stio_ntime_t now;
stio_tmrjob_t event;
stio_size_t fire_count = 0;
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
else if (stio_gettime (&now) <= -1) return -1;
while (stio->tmr.size > 0)
{
if (stio_cmptime(&stio->tmr.jobs[0].when, &now) > 0) break;
event = stio->tmr.jobs[0];
stio_deltmrjob (stio, 0); /* remove the registered event structure */
fire_count++;
event.handler (stio, &now, &event); /* then fire the event */
}
return fire_count;
}
int stio_gettmrtmout (stio_t* stio, const stio_ntime_t* tm, stio_ntime_t* tmout)
{
stio_ntime_t now;
/* time-out can't be calculated when there's no event scheduled */
if (stio->tmr.size <= 0)
{
stio->errnum = STIO_ENOENT;
return -1;
}
/* if the current time is not specified, get it from the system */
if (tm) now = *tm;
else if (stio_gettime (&now) <= -1) return -1;
stio_subtime (&stio->tmr.jobs[0].when, &now, tmout);
if (tmout->sec < 0) stio_cleartime (tmout);
return 0;
}
stio_tmrjob_t* stio_gettmrjob (stio_t* stio, stio_tmridx_t index)
{
return (index < 0 || index >= stio->tmr.size)? STIO_NULL: &stio->tmr.jobs[index];
}

View File

@ -45,13 +45,13 @@ extern "C" {
#endif
stio_dev_udp_t* stio_dev_udp_make (
STIO_EXPORT stio_dev_udp_t* stio_dev_udp_make (
stio_t* stio,
stio_size_t xtnsize,
stio_sckadr_t* addr
);
void stio_dev_udp_kill (
STIO_EXPORT void stio_dev_udp_kill (
stio_dev_udp_t* udp
);

View File

@ -32,26 +32,27 @@
#include <unistd.h>
#include <errno.h>
stio_t* stio_open (stio_mmgr_t* mmgr, stio_size_t xtnsize, stio_errnum_t* errnum)
stio_t* stio_open (stio_mmgr_t* mmgr, stio_size_t xtnsize, stio_size_t tmrcapa, stio_errnum_t* errnum)
{
stio_t* stio;
stio = STIO_MMGR_ALLOC (mmgr, STIO_SIZEOF(*stio));
if (!stio)
stio = STIO_MMGR_ALLOC (mmgr, STIO_SIZEOF(stio_t) + xtnsize);
if (stio)
{
if (stio_init (stio, mmgr, tmrcapa) <= -1)
{
if (errnum) *errnum = stio->errnum;
STIO_MMGR_FREE (mmgr, stio);
stio = STIO_NULL;
}
else STIO_MEMSET (stio + 1, 0, xtnsize);
}
else
{
if (errnum) *errnum = STIO_ENOMEM;
return STIO_NULL;
}
STIO_MEMSET (stio, 0, STIO_SIZEOF(*stio));
stio->mmgr = mmgr;
stio->mux = epoll_create (1000);
if (stio->mux == -1)
{
//if (errnum) *errnum = XXXXX
STIO_MMGR_FREE (stio->mmgr, stio);
return STIO_NULL;
}
return stio;
@ -59,13 +60,52 @@ stio_t* stio_open (stio_mmgr_t* mmgr, stio_size_t xtnsize, stio_errnum_t* errnum
void stio_close (stio_t* stio)
{
stio_fini (stio);
STIO_MMGR_FREE (stio->mmgr, stio);
}
int stio_init (stio_t* stio, stio_mmgr_t* mmgr, stio_size_t tmrcapa)
{
STIO_MEMSET (stio, 0, STIO_SIZEOF(*stio));
stio->mmgr = mmgr;
/* intialize the multiplexer object */
stio->mux = epoll_create (1000);
if (stio->mux == -1)
{
/* TODO: set error number */
//if (stio->errnum) *errnum = XXXXX
return -1;
}
/* initialize the timer object */
if (tmrcapa <= 0) tmrcapa = 1;
stio->tmr.jobs = STIO_MMGR_ALLOC (stio->mmgr, tmrcapa * STIO_SIZEOF(stio_tmrjob_t));
if (!stio->tmr.jobs)
{
stio->errnum = STIO_ENOMEM;
close (stio->mux);
return -1;
}
stio->tmr.capa = tmrcapa;
return 0;
}
void stio_fini (stio_t* stio)
{
/* kill all registered devices */
while (stio->dev.tail)
{
stio_killdev (stio, stio->dev.tail);
}
/* purge scheduled timer jobs and kill the timer */
stio_cleartmrjobs (stio);
STIO_MMGR_FREE (stio->mmgr, stio->tmr.jobs);
/* close the multiplexer */
close (stio->mux);
STIO_MMGR_FREE (stio->mmgr, stio);
}
stio_dev_t* stio_makedev (stio_t* stio, stio_size_t dev_size, stio_dev_mth_t* dev_mth, stio_dev_evcb_t* dev_evcb, void* make_ctx)
@ -156,18 +196,7 @@ printf ("DELETING UNSENT REQUETS...%p\n", wq);
else
stio->dev.tail = dev->prev;
/* ------------------------------------ */
{
#if defined(_WIN32)
/* nothing - can't deassociate it. closing the socket
* will do. kill should close it */
#else
struct epoll_event ev; /* dummy */
epoll_ctl (stio->mux, EPOLL_CTL_DEL, dev->mth->getsyshnd(dev), &ev);
/* don't care about failure */
#endif
}
/* ------------------------------------ */
stio_dev_event (dev, STIO_DEV_EVENT_DEL, 0);
/* and call the callback function */
dev->mth->kill (dev);
@ -188,7 +217,7 @@ void stio_epilogue (stio_t* stio)
int stio_exec (stio_t* stio)
{
int timeout;
stio_ntime_t tmout;
#if defined(_WIN32)
ULONG nentries, i;
@ -198,7 +227,14 @@ int stio_exec (stio_t* stio)
/*if (!stio->dev.head) return 0;*/
timeout = 1000; //TODO: get_timeout (stio); // use the task heap to get the timeout.
if (stio_gettmrtmout (stio, STIO_NULL, &tmout) <= -1)
{
/* defaults to 1 second if timeout can't be acquired */
tmout.sec = 1;
tmout.nsec = 0;
}
#if defined(_WIN32)
/*
@ -214,14 +250,17 @@ int stio_exec (stio_t* stio)
*/
#else
nentries = epoll_wait (stio->mux, stio->revs, STIO_COUNTOF(stio->revs), timeout);
nentries = epoll_wait (stio->mux, stio->revs, STIO_COUNTOF(stio->revs), STIO_SECNSEC_TO_MSEC(tmout.sec, tmout.nsec));
if (nentries <= -1)
{
if (errno == EINTR) return 0; /* it's actually ok */
/* other errors are critical - EBADF, EFAULT, EINVAL */
/* TODO: set errnum */
return -1;
}
/* TODO: merge events??? for the same descriptor */
for (i = 0; i < nentries; i++)
{
stio_dev_t* dev = stio->revs[i].data.ptr;
@ -257,7 +296,11 @@ int stio_exec (stio_t* stio)
}
else
{
int dev_eof;
invoke_evcb:
dev_eof = 0;
if (dev && stio->revs[i].events & EPOLLPRI)
{
/* urgent data */
@ -269,29 +312,44 @@ int stio_exec (stio_t* stio)
stio_len_t len;
int x;
len = STIO_COUNTOF(stio->bigbuf);
x = dev->mth->recv (dev, stio->bigbuf, &len);
/* the devices are all non-blocking. so read as much as possible */
/* TODO: limit the number of iterations? */
while (1)
{
len = STIO_COUNTOF(stio->bigbuf);
x = dev->mth->recv (dev, stio->bigbuf, &len);
printf ("DATA...recv %d length %d\n", (int)x, len);
if (x <= -1)
{
/*TODO: waht to do? killdev? how to indicate an error? call on_recv? with erro rindicator?? */
stio_killdev (stio, dev);
dev = STIO_NULL;
}
else if (x == 0)
{
/* EOF received. kill the device. */
stio_killdev (stio, dev);
dev = STIO_NULL;
}
else if (x >= 1)
{
/* data available??? */
if (dev->evcb->on_recv (dev, stio->bigbuf, len) <= -1)
printf ("DATA...recv %d length %d\n", (int)x, len);
if (x <= -1)
{
/*TODO: what to do? killdev? how to indicate an error? call on_recv? with error indicator?? */
stio_killdev (stio, dev);
dev = STIO_NULL;
break;
}
else if (x == 0)
{
/* no data is available */
break;
}
else if (x >= 1)
{
if (len <= 0)
{
/* EOF received. delay killing until output has been handled */
dev_eof = 1;
break;
}
else
{
/* data available */
if (dev->evcb->on_recv (dev, stio->bigbuf, len) <= -1)
{
stio_killdev (stio, dev);
dev = STIO_NULL;
break;
}
}
}
}
}
@ -355,7 +413,7 @@ printf ("DATA...recv %d length %d\n", (int)x, len);
{
/* no pending request to write.
* watch input only. disable output watching */
if (stio_dev_event (dev, STIO_DEV_EVENT_MOD, STIO_DEV_EVENT_IN) <= -1)
if (stio_dev_event (dev, STIO_DEV_EVENT_UPD, STIO_DEV_EVENT_IN) <= -1)
{
/* TODO: call an error handler??? */
stio_killdev (stio, dev);
@ -363,6 +421,13 @@ printf ("DATA...recv %d length %d\n", (int)x, len);
}
}
}
if (dev && dev_eof)
{
/* handled delayed device killing */
stio_killdev (stio, dev);
dev = STIO_NULL;
}
}
}
@ -426,12 +491,12 @@ int stio_dev_event (stio_dev_t* dev, stio_dev_event_cmd_t cmd, int flags)
epoll_op = EPOLL_CTL_ADD;
break;
case STIO_DEV_EVENT_MOD:
case STIO_DEV_EVENT_UPD:
epoll_op = EPOLL_CTL_MOD;
break;
case STIO_DEV_EVENT_DEL:
epoll_op = EPOLL_CTL_ADD;
epoll_op = EPOLL_CTL_DEL;
break;
default:
@ -489,7 +554,7 @@ int stio_dev_send (stio_dev_t* dev, const void* data, stio_len_t len, void* send
STIO_WQ_ENQ (&dev->wq, q);
if (wq_empty)
{
if (stio_dev_event (dev, STIO_DEV_EVENT_MOD, STIO_DEV_EVENT_IN | STIO_DEV_EVENT_OUT) <= -1)
if (stio_dev_event (dev, STIO_DEV_EVENT_UPD, STIO_DEV_EVENT_IN | STIO_DEV_EVENT_OUT) <= -1)
{
STIO_WQ_UNLINK (q); /* unlink the ENQed item */
STIO_MMGR_FREE (dev->stio->mmgr, q);

View File

@ -27,68 +27,53 @@
#ifndef _STIO_H_
#define _STIO_H_
/* TODO: remove these headers */
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <sys/socket.h>
typedef signed char stio_int8_t;
typedef unsigned char stio_uint8_t;
typedef unsigned long stio_size_t;
#define STIO_MEMSET(dst,byte,count) memset(dst,byte,count)
#define STIO_MEMCPY(dst,src,count) memcpy(dst,src,count)
#define STIO_MEMMOVE(dst,src,count) memmove(dst,src,count)
#define STIO_ASSERT assert
#define STIO_SIZEOF(x) sizeof(x)
#define STIO_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
#define STIO_NULL ((void*)0)
typedef struct stio_mmgr_t stio_mmgr_t;
typedef void* (*stio_mmgr_alloc_t) (stio_mmgr_t* mmgr, stio_size_t size);
typedef void (*stio_mmgr_free_t) (stio_mmgr_t* mmgr, void* ptr);
struct stio_mmgr_t
{
stio_mmgr_alloc_t alloc;
stio_mmgr_free_t free;
void* ctx;
};
#define STIO_MMGR_ALLOC(mmgr,size) (mmgr)->alloc(mmgr,size)
#define STIO_MMGR_FREE(mmgr,ptr) (mmgr)->free(mmgr,ptr)
#include <stio-cmn.h>
struct stio_sckadr_t
{
int family;
stio_uint8_t data[64]; /* TODO: use the actual sockaddr size */
stio_uint8_t data[128]; /* TODO: use the actual sockaddr size */
};
typedef struct stio_sckadr_t stio_sckadr_t;
#if (STIO_SIZEOF_SOCKLEN_T == STIO_SIZEOF_INT)
#if defined(STIO_SOCKLEN_T_IS_SIGNED)
typedef int stio_scklen_t;
#else
typedef unsigned int stio_scklen_t;
#endif
#elif (STIO_SIZEOF_SOCKLEN_T == STIO_SIZEOF_LONG)
#if defined(STIO_SOCKLEN_T_IS_SIGNED)
typedef long stio_scklen_t;
#else
typedef unsigned long stio_scklen_t;
#endif
#else
typedef int stio_scklen_t;
#endif
#if defined(_WIN32)
# define STIO_IOCP_KEY 1
typedef int stio_scklen_t;
/*
typedef HANDLE stio_syshnd_t;
typedef SOCKET stio_sckhnd_t;
# define STIO_SCKHND_INVALID (INVALID_SOCKET)
*/
typedef stio_uintptr_t qse_syshnd_t;
typedef stio_uintptr_t qse_sckhnd_t;
# define STIO_SCKHND_INVALID (~(qse_sck_hnd_t)0)
typedef HANDLE stio_syshnd_t;
#else
typedef socklen_t stio_scklen_t;
typedef int stio_syshnd_t;
typedef int stio_sckhnd_t;
# define STIO_SCKHND_INVALID (-1)
typedef int stio_syshnd_t;
#endif
typedef int stio_sckfam_t;
/* ------------------------------------------------------------------------- */
typedef struct stio_t stio_t;
typedef struct stio_dev_t stio_dev_t;
@ -104,6 +89,7 @@ enum stio_errnum_t
STIO_ENOERR,
STIO_ENOMEM,
STIO_EINVAL,
STIO_ENOENT,
STIO_ENOSUP, /* not supported */
STIO_EDEVMAKE
@ -115,10 +101,10 @@ typedef enum stio_errnum_t stio_errnum_t;
struct stio_dev_mth_t
{
/* ------------------------------------------------------------------ */
int (*make) (stio_dev_t* dev, void* ctx); /* mandatory. called in stix_makedev() */
int (*make) (stio_dev_t* dev, void* ctx); /* mandatory. called in stio_makedev() */
/* ------------------------------------------------------------------ */
void (*kill) (stio_dev_t* dev); /* mandatory. called in stix_killdev(). called in stix_makedev() upon failure after make() success */
void (*kill) (stio_dev_t* dev); /* mandatory. called in stio_killdev(). called in stio_makedev() upon failure after make() success */
/* ------------------------------------------------------------------ */
#if 0
@ -127,12 +113,16 @@ struct stio_dev_mth_t
*/
int (*countsyshnds) (stio_dev_t* dev); /* optional */
#endif
stio_syshnd_t (*getsyshnd) (stio_dev_t* dev); /* mandatory. called in stix_makedev() after successful make() */
stio_syshnd_t (*getsyshnd) (stio_dev_t* dev); /* mandatory. called in stio_makedev() after successful make() */
/* ------------------------------------------------------------------ */
int (*ioctl) (stio_dev_t* dev, int cmd, void* arg);
/* ------------------------------------------------------------------ */
/* return -1 on failure, 0 if no data is availble, 1 otherwise.
* when returning 1, *len must be sent to the length of data read.
* if *len is set to 0, it's treated as EOF.
* it must not kill the device */
int (*recv) (stio_dev_t* dev, void* data, stio_len_t* len);
/* ------------------------------------------------------------------ */
@ -221,7 +211,7 @@ struct stio_dev_t
enum stio_dev_event_cmd_t
{
STIO_DEV_EVENT_ADD,
STIO_DEV_EVENT_MOD,
STIO_DEV_EVENT_UPD,
STIO_DEV_EVENT_DEL
};
typedef enum stio_dev_event_cmd_t stio_dev_event_cmd_t;
@ -241,29 +231,40 @@ typedef enum stio_dev_event_flag_t stio_dev_event_flag_t;
extern "C" {
#endif
stio_t* stio_open (
stio_mmgr_t* mmgr,
stio_size_t xtnsize,
STIO_EXPORT stio_t* stio_open (
stio_mmgr_t* mmgr,
stio_size_t xtnsize,
stio_size_t tmrcapa, /**< initial timer capacity */
stio_errnum_t* errnum
);
void stio_close (
STIO_EXPORT void stio_close (
stio_t* stio
);
int stio_exec (
STIO_EXPORT int stio_init (
stio_t* stio,
stio_mmgr_t* mmgr,
stio_size_t tmrcapa
);
STIO_EXPORT void stio_fini (
stio_t* stio
);
STIO_EXPORT int stio_exec (
stio_t* stio
);
int stio_loop (
STIO_EXPORT int stio_loop (
stio_t* stio
);
void stio_stop (
STIO_EXPORT void stio_stop (
stio_t* stio
);
stio_dev_t* stio_makedev (
STIO_EXPORT stio_dev_t* stio_makedev (
stio_t* stio,
stio_size_t dev_size,
stio_dev_mth_t* dev_mth,
@ -271,24 +272,24 @@ stio_dev_t* stio_makedev (
void* make_ctx
);
void stio_killdev (
STIO_EXPORT void stio_killdev (
stio_t* stio,
stio_dev_t* dev
);
int stio_dev_ioctl (
STIO_EXPORT int stio_dev_ioctl (
stio_dev_t* dev,
int cmd,
void* arg
);
int stio_dev_event (
STIO_EXPORT int stio_dev_event (
stio_dev_t* dev,
stio_dev_event_cmd_t cmd,
int flags
);
int stio_dev_send (
STIO_EXPORT int stio_dev_send (
stio_dev_t* dev,
const void* data,
stio_len_t len,