renaming mio to hio
This commit is contained in:
@ -1,60 +0,0 @@
|
||||
AUTOMAKE_OPTIONS = nostdinc
|
||||
|
||||
CPPFLAGS_COMMON = \
|
||||
-I$(abs_builddir) \
|
||||
-I$(abs_builddir)/../lib \
|
||||
-I$(abs_srcdir) \
|
||||
-I$(abs_srcdir)/../lib \
|
||||
-I$(includedir)
|
||||
CFLAGS_COMMON =
|
||||
LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir)
|
||||
LIBADD_COMMON = ../lib/libmio.la
|
||||
|
||||
bin_PROGRAMS = mio-execd
|
||||
mio_execd_SOURCES = execd.c
|
||||
mio_execd_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_execd_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_execd_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_execd_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t01
|
||||
mio_t01_SOURCES = t01.c
|
||||
mio_t01_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t01_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t01_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t01_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t02
|
||||
mio_t02_SOURCES = t02.c
|
||||
mio_t02_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t02_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t02_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t02_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t03
|
||||
mio_t03_SOURCES = t03.c
|
||||
mio_t03_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t03_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t03_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t03_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t04
|
||||
mio_t04_SOURCES = t04.c
|
||||
mio_t04_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t04_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t04_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t04_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t05
|
||||
mio_t05_SOURCES = t05.c
|
||||
mio_t05_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t05_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t05_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t05_LDADD = $(LIBADD_COMMON)
|
||||
|
||||
bin_PROGRAMS += mio-t06
|
||||
mio_t06_SOURCES = t06.c
|
||||
mio_t06_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t06_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t06_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t06_LDADD = $(LIBADD_COMMON)
|
@ -1,895 +0,0 @@
|
||||
# Makefile.in generated by automake 1.16.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2020 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 = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
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@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@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@
|
||||
bin_PROGRAMS = mio-execd$(EXEEXT) mio-t01$(EXEEXT) mio-t02$(EXEEXT) \
|
||||
mio-t03$(EXEEXT) mio-t04$(EXEEXT) mio-t05$(EXEEXT) \
|
||||
mio-t06$(EXEEXT)
|
||||
subdir = bin
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
|
||||
$(top_srcdir)/m4/ax_lib_mariadb.m4 \
|
||||
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.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)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/mio-cfg.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_mio_execd_OBJECTS = mio_execd-execd.$(OBJEXT)
|
||||
mio_execd_OBJECTS = $(am_mio_execd_OBJECTS)
|
||||
mio_execd_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
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 =
|
||||
mio_execd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_execd_CFLAGS) \
|
||||
$(CFLAGS) $(mio_execd_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t01_OBJECTS = mio_t01-t01.$(OBJEXT)
|
||||
mio_t01_OBJECTS = $(am_mio_t01_OBJECTS)
|
||||
mio_t01_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t01_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t01_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t01_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t02_OBJECTS = mio_t02-t02.$(OBJEXT)
|
||||
mio_t02_OBJECTS = $(am_mio_t02_OBJECTS)
|
||||
mio_t02_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t02_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t02_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t02_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t03_OBJECTS = mio_t03-t03.$(OBJEXT)
|
||||
mio_t03_OBJECTS = $(am_mio_t03_OBJECTS)
|
||||
mio_t03_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t03_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t03_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t03_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t04_OBJECTS = mio_t04-t04.$(OBJEXT)
|
||||
mio_t04_OBJECTS = $(am_mio_t04_OBJECTS)
|
||||
mio_t04_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t04_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t04_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t04_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t05_OBJECTS = mio_t05-t05.$(OBJEXT)
|
||||
mio_t05_OBJECTS = $(am_mio_t05_OBJECTS)
|
||||
mio_t05_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t05_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t05_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t05_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_mio_t06_OBJECTS = mio_t06-t06.$(OBJEXT)
|
||||
mio_t06_OBJECTS = $(am_mio_t06_OBJECTS)
|
||||
mio_t06_DEPENDENCIES = $(LIBADD_COMMON)
|
||||
mio_t06_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mio_t06_CFLAGS) \
|
||||
$(CFLAGS) $(mio_t06_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__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = ./$(DEPDIR)/mio_execd-execd.Po \
|
||||
./$(DEPDIR)/mio_t01-t01.Po ./$(DEPDIR)/mio_t02-t02.Po \
|
||||
./$(DEPDIR)/mio_t03-t03.Po ./$(DEPDIR)/mio_t04-t04.Po \
|
||||
./$(DEPDIR)/mio_t05-t05.Po ./$(DEPDIR)/mio_t06-t06.Po
|
||||
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 = $(mio_execd_SOURCES) $(mio_t01_SOURCES) $(mio_t02_SOURCES) \
|
||||
$(mio_t03_SOURCES) $(mio_t04_SOURCES) $(mio_t05_SOURCES) \
|
||||
$(mio_t06_SOURCES)
|
||||
DIST_SOURCES = $(mio_execd_SOURCES) $(mio_t01_SOURCES) \
|
||||
$(mio_t02_SOURCES) $(mio_t03_SOURCES) $(mio_t04_SOURCES) \
|
||||
$(mio_t05_SOURCES) $(mio_t06_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# 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
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
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@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
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@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MARIADB_CFLAGS = @MARIADB_CFLAGS@
|
||||
MARIADB_CONFIG = @MARIADB_CONFIG@
|
||||
MARIADB_LDFLAGS = @MARIADB_LDFLAGS@
|
||||
MARIADB_LIBS = @MARIADB_LIBS@
|
||||
MARIADB_VERSION = @MARIADB_VERSION@
|
||||
MIO_PROJECT_AUTHOR = @MIO_PROJECT_AUTHOR@
|
||||
MIO_PROJECT_URL = @MIO_PROJECT_URL@
|
||||
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@
|
||||
PTHREAD_CC = @PTHREAD_CC@
|
||||
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
|
||||
PTHREAD_LIBS = @PTHREAD_LIBS@
|
||||
QUADMATH_LIBS = @QUADMATH_LIBS@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SENDFILE_LIBS = @SENDFILE_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SOCKET_LIBS = @SOCKET_LIBS@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
UNICOWS_LIBS = @UNICOWS_LIBS@
|
||||
UNWIND_LIBS = @UNWIND_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_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@
|
||||
ax_pthread_config = @ax_pthread_config@
|
||||
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_COMMON = \
|
||||
-I$(abs_builddir) \
|
||||
-I$(abs_builddir)/../lib \
|
||||
-I$(abs_srcdir) \
|
||||
-I$(abs_srcdir)/../lib \
|
||||
-I$(includedir)
|
||||
|
||||
CFLAGS_COMMON =
|
||||
LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir)
|
||||
LIBADD_COMMON = ../lib/libmio.la
|
||||
mio_execd_SOURCES = execd.c
|
||||
mio_execd_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_execd_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_execd_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_execd_LDADD = $(LIBADD_COMMON)
|
||||
mio_t01_SOURCES = t01.c
|
||||
mio_t01_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t01_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t01_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t01_LDADD = $(LIBADD_COMMON)
|
||||
mio_t02_SOURCES = t02.c
|
||||
mio_t02_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t02_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t02_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t02_LDADD = $(LIBADD_COMMON)
|
||||
mio_t03_SOURCES = t03.c
|
||||
mio_t03_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t03_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t03_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t03_LDADD = $(LIBADD_COMMON)
|
||||
mio_t04_SOURCES = t04.c
|
||||
mio_t04_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t04_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t04_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t04_LDADD = $(LIBADD_COMMON)
|
||||
mio_t05_SOURCES = t05.c
|
||||
mio_t05_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t05_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t05_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t05_LDADD = $(LIBADD_COMMON)
|
||||
mio_t06_SOURCES = t06.c
|
||||
mio_t06_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
mio_t06_CFLAGS = $(CFLAGS_COMMON)
|
||||
mio_t06_LDFLAGS = $(LDFLAGS_COMMON)
|
||||
mio_t06_LDADD = $(LIBADD_COMMON)
|
||||
all: 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 bin/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign bin/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__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
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):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(bindir)" || 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)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || 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)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_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
|
||||
|
||||
mio-execd$(EXEEXT): $(mio_execd_OBJECTS) $(mio_execd_DEPENDENCIES) $(EXTRA_mio_execd_DEPENDENCIES)
|
||||
@rm -f mio-execd$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_execd_LINK) $(mio_execd_OBJECTS) $(mio_execd_LDADD) $(LIBS)
|
||||
|
||||
mio-t01$(EXEEXT): $(mio_t01_OBJECTS) $(mio_t01_DEPENDENCIES) $(EXTRA_mio_t01_DEPENDENCIES)
|
||||
@rm -f mio-t01$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t01_LINK) $(mio_t01_OBJECTS) $(mio_t01_LDADD) $(LIBS)
|
||||
|
||||
mio-t02$(EXEEXT): $(mio_t02_OBJECTS) $(mio_t02_DEPENDENCIES) $(EXTRA_mio_t02_DEPENDENCIES)
|
||||
@rm -f mio-t02$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t02_LINK) $(mio_t02_OBJECTS) $(mio_t02_LDADD) $(LIBS)
|
||||
|
||||
mio-t03$(EXEEXT): $(mio_t03_OBJECTS) $(mio_t03_DEPENDENCIES) $(EXTRA_mio_t03_DEPENDENCIES)
|
||||
@rm -f mio-t03$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t03_LINK) $(mio_t03_OBJECTS) $(mio_t03_LDADD) $(LIBS)
|
||||
|
||||
mio-t04$(EXEEXT): $(mio_t04_OBJECTS) $(mio_t04_DEPENDENCIES) $(EXTRA_mio_t04_DEPENDENCIES)
|
||||
@rm -f mio-t04$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t04_LINK) $(mio_t04_OBJECTS) $(mio_t04_LDADD) $(LIBS)
|
||||
|
||||
mio-t05$(EXEEXT): $(mio_t05_OBJECTS) $(mio_t05_DEPENDENCIES) $(EXTRA_mio_t05_DEPENDENCIES)
|
||||
@rm -f mio-t05$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t05_LINK) $(mio_t05_OBJECTS) $(mio_t05_LDADD) $(LIBS)
|
||||
|
||||
mio-t06$(EXEEXT): $(mio_t06_OBJECTS) $(mio_t06_DEPENDENCIES) $(EXTRA_mio_t06_DEPENDENCIES)
|
||||
@rm -f mio-t06$(EXEEXT)
|
||||
$(AM_V_CCLD)$(mio_t06_LINK) $(mio_t06_OBJECTS) $(mio_t06_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_execd-execd.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t01-t01.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t02-t02.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t03-t03.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t04-t04.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t05-t05.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mio_t06-t06.Po@am__quote@ # am--include-marker
|
||||
|
||||
$(am__depfiles_remade):
|
||||
@$(MKDIR_P) $(@D)
|
||||
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||
|
||||
am--depfiles: $(am__depfiles_remade)
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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 $@ $<
|
||||
|
||||
mio_execd-execd.o: execd.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_execd_CPPFLAGS) $(CPPFLAGS) $(mio_execd_CFLAGS) $(CFLAGS) -MT mio_execd-execd.o -MD -MP -MF $(DEPDIR)/mio_execd-execd.Tpo -c -o mio_execd-execd.o `test -f 'execd.c' || echo '$(srcdir)/'`execd.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_execd-execd.Tpo $(DEPDIR)/mio_execd-execd.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='execd.c' object='mio_execd-execd.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) $(mio_execd_CPPFLAGS) $(CPPFLAGS) $(mio_execd_CFLAGS) $(CFLAGS) -c -o mio_execd-execd.o `test -f 'execd.c' || echo '$(srcdir)/'`execd.c
|
||||
|
||||
mio_execd-execd.obj: execd.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_execd_CPPFLAGS) $(CPPFLAGS) $(mio_execd_CFLAGS) $(CFLAGS) -MT mio_execd-execd.obj -MD -MP -MF $(DEPDIR)/mio_execd-execd.Tpo -c -o mio_execd-execd.obj `if test -f 'execd.c'; then $(CYGPATH_W) 'execd.c'; else $(CYGPATH_W) '$(srcdir)/execd.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_execd-execd.Tpo $(DEPDIR)/mio_execd-execd.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='execd.c' object='mio_execd-execd.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) $(mio_execd_CPPFLAGS) $(CPPFLAGS) $(mio_execd_CFLAGS) $(CFLAGS) -c -o mio_execd-execd.obj `if test -f 'execd.c'; then $(CYGPATH_W) 'execd.c'; else $(CYGPATH_W) '$(srcdir)/execd.c'; fi`
|
||||
|
||||
mio_t01-t01.o: t01.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t01_CPPFLAGS) $(CPPFLAGS) $(mio_t01_CFLAGS) $(CFLAGS) -MT mio_t01-t01.o -MD -MP -MF $(DEPDIR)/mio_t01-t01.Tpo -c -o mio_t01-t01.o `test -f 't01.c' || echo '$(srcdir)/'`t01.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t01-t01.Tpo $(DEPDIR)/mio_t01-t01.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t01.c' object='mio_t01-t01.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) $(mio_t01_CPPFLAGS) $(CPPFLAGS) $(mio_t01_CFLAGS) $(CFLAGS) -c -o mio_t01-t01.o `test -f 't01.c' || echo '$(srcdir)/'`t01.c
|
||||
|
||||
mio_t01-t01.obj: t01.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t01_CPPFLAGS) $(CPPFLAGS) $(mio_t01_CFLAGS) $(CFLAGS) -MT mio_t01-t01.obj -MD -MP -MF $(DEPDIR)/mio_t01-t01.Tpo -c -o mio_t01-t01.obj `if test -f 't01.c'; then $(CYGPATH_W) 't01.c'; else $(CYGPATH_W) '$(srcdir)/t01.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t01-t01.Tpo $(DEPDIR)/mio_t01-t01.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t01.c' object='mio_t01-t01.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) $(mio_t01_CPPFLAGS) $(CPPFLAGS) $(mio_t01_CFLAGS) $(CFLAGS) -c -o mio_t01-t01.obj `if test -f 't01.c'; then $(CYGPATH_W) 't01.c'; else $(CYGPATH_W) '$(srcdir)/t01.c'; fi`
|
||||
|
||||
mio_t02-t02.o: t02.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t02_CPPFLAGS) $(CPPFLAGS) $(mio_t02_CFLAGS) $(CFLAGS) -MT mio_t02-t02.o -MD -MP -MF $(DEPDIR)/mio_t02-t02.Tpo -c -o mio_t02-t02.o `test -f 't02.c' || echo '$(srcdir)/'`t02.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t02-t02.Tpo $(DEPDIR)/mio_t02-t02.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t02.c' object='mio_t02-t02.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) $(mio_t02_CPPFLAGS) $(CPPFLAGS) $(mio_t02_CFLAGS) $(CFLAGS) -c -o mio_t02-t02.o `test -f 't02.c' || echo '$(srcdir)/'`t02.c
|
||||
|
||||
mio_t02-t02.obj: t02.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t02_CPPFLAGS) $(CPPFLAGS) $(mio_t02_CFLAGS) $(CFLAGS) -MT mio_t02-t02.obj -MD -MP -MF $(DEPDIR)/mio_t02-t02.Tpo -c -o mio_t02-t02.obj `if test -f 't02.c'; then $(CYGPATH_W) 't02.c'; else $(CYGPATH_W) '$(srcdir)/t02.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t02-t02.Tpo $(DEPDIR)/mio_t02-t02.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t02.c' object='mio_t02-t02.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) $(mio_t02_CPPFLAGS) $(CPPFLAGS) $(mio_t02_CFLAGS) $(CFLAGS) -c -o mio_t02-t02.obj `if test -f 't02.c'; then $(CYGPATH_W) 't02.c'; else $(CYGPATH_W) '$(srcdir)/t02.c'; fi`
|
||||
|
||||
mio_t03-t03.o: t03.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t03_CPPFLAGS) $(CPPFLAGS) $(mio_t03_CFLAGS) $(CFLAGS) -MT mio_t03-t03.o -MD -MP -MF $(DEPDIR)/mio_t03-t03.Tpo -c -o mio_t03-t03.o `test -f 't03.c' || echo '$(srcdir)/'`t03.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t03-t03.Tpo $(DEPDIR)/mio_t03-t03.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t03.c' object='mio_t03-t03.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) $(mio_t03_CPPFLAGS) $(CPPFLAGS) $(mio_t03_CFLAGS) $(CFLAGS) -c -o mio_t03-t03.o `test -f 't03.c' || echo '$(srcdir)/'`t03.c
|
||||
|
||||
mio_t03-t03.obj: t03.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t03_CPPFLAGS) $(CPPFLAGS) $(mio_t03_CFLAGS) $(CFLAGS) -MT mio_t03-t03.obj -MD -MP -MF $(DEPDIR)/mio_t03-t03.Tpo -c -o mio_t03-t03.obj `if test -f 't03.c'; then $(CYGPATH_W) 't03.c'; else $(CYGPATH_W) '$(srcdir)/t03.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t03-t03.Tpo $(DEPDIR)/mio_t03-t03.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t03.c' object='mio_t03-t03.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) $(mio_t03_CPPFLAGS) $(CPPFLAGS) $(mio_t03_CFLAGS) $(CFLAGS) -c -o mio_t03-t03.obj `if test -f 't03.c'; then $(CYGPATH_W) 't03.c'; else $(CYGPATH_W) '$(srcdir)/t03.c'; fi`
|
||||
|
||||
mio_t04-t04.o: t04.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t04_CPPFLAGS) $(CPPFLAGS) $(mio_t04_CFLAGS) $(CFLAGS) -MT mio_t04-t04.o -MD -MP -MF $(DEPDIR)/mio_t04-t04.Tpo -c -o mio_t04-t04.o `test -f 't04.c' || echo '$(srcdir)/'`t04.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t04-t04.Tpo $(DEPDIR)/mio_t04-t04.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t04.c' object='mio_t04-t04.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) $(mio_t04_CPPFLAGS) $(CPPFLAGS) $(mio_t04_CFLAGS) $(CFLAGS) -c -o mio_t04-t04.o `test -f 't04.c' || echo '$(srcdir)/'`t04.c
|
||||
|
||||
mio_t04-t04.obj: t04.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t04_CPPFLAGS) $(CPPFLAGS) $(mio_t04_CFLAGS) $(CFLAGS) -MT mio_t04-t04.obj -MD -MP -MF $(DEPDIR)/mio_t04-t04.Tpo -c -o mio_t04-t04.obj `if test -f 't04.c'; then $(CYGPATH_W) 't04.c'; else $(CYGPATH_W) '$(srcdir)/t04.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t04-t04.Tpo $(DEPDIR)/mio_t04-t04.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t04.c' object='mio_t04-t04.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) $(mio_t04_CPPFLAGS) $(CPPFLAGS) $(mio_t04_CFLAGS) $(CFLAGS) -c -o mio_t04-t04.obj `if test -f 't04.c'; then $(CYGPATH_W) 't04.c'; else $(CYGPATH_W) '$(srcdir)/t04.c'; fi`
|
||||
|
||||
mio_t05-t05.o: t05.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t05_CPPFLAGS) $(CPPFLAGS) $(mio_t05_CFLAGS) $(CFLAGS) -MT mio_t05-t05.o -MD -MP -MF $(DEPDIR)/mio_t05-t05.Tpo -c -o mio_t05-t05.o `test -f 't05.c' || echo '$(srcdir)/'`t05.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t05-t05.Tpo $(DEPDIR)/mio_t05-t05.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t05.c' object='mio_t05-t05.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) $(mio_t05_CPPFLAGS) $(CPPFLAGS) $(mio_t05_CFLAGS) $(CFLAGS) -c -o mio_t05-t05.o `test -f 't05.c' || echo '$(srcdir)/'`t05.c
|
||||
|
||||
mio_t05-t05.obj: t05.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t05_CPPFLAGS) $(CPPFLAGS) $(mio_t05_CFLAGS) $(CFLAGS) -MT mio_t05-t05.obj -MD -MP -MF $(DEPDIR)/mio_t05-t05.Tpo -c -o mio_t05-t05.obj `if test -f 't05.c'; then $(CYGPATH_W) 't05.c'; else $(CYGPATH_W) '$(srcdir)/t05.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t05-t05.Tpo $(DEPDIR)/mio_t05-t05.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t05.c' object='mio_t05-t05.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) $(mio_t05_CPPFLAGS) $(CPPFLAGS) $(mio_t05_CFLAGS) $(CFLAGS) -c -o mio_t05-t05.obj `if test -f 't05.c'; then $(CYGPATH_W) 't05.c'; else $(CYGPATH_W) '$(srcdir)/t05.c'; fi`
|
||||
|
||||
mio_t06-t06.o: t06.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t06_CPPFLAGS) $(CPPFLAGS) $(mio_t06_CFLAGS) $(CFLAGS) -MT mio_t06-t06.o -MD -MP -MF $(DEPDIR)/mio_t06-t06.Tpo -c -o mio_t06-t06.o `test -f 't06.c' || echo '$(srcdir)/'`t06.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t06-t06.Tpo $(DEPDIR)/mio_t06-t06.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t06.c' object='mio_t06-t06.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) $(mio_t06_CPPFLAGS) $(CPPFLAGS) $(mio_t06_CFLAGS) $(CFLAGS) -c -o mio_t06-t06.o `test -f 't06.c' || echo '$(srcdir)/'`t06.c
|
||||
|
||||
mio_t06-t06.obj: t06.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mio_t06_CPPFLAGS) $(CPPFLAGS) $(mio_t06_CFLAGS) $(CFLAGS) -MT mio_t06-t06.obj -MD -MP -MF $(DEPDIR)/mio_t06-t06.Tpo -c -o mio_t06-t06.obj `if test -f 't06.c'; then $(CYGPATH_W) 't06.c'; else $(CYGPATH_W) '$(srcdir)/t06.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mio_t06-t06.Tpo $(DEPDIR)/mio_t06-t06.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t06.c' object='mio_t06-t06.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) $(mio_t06_CPPFLAGS) $(CPPFLAGS) $(mio_t06_CFLAGS) $(CFLAGS) -c -o mio_t06-t06.obj `if test -f 't06.c'; then $(CYGPATH_W) 't06.c'; else $(CYGPATH_W) '$(srcdir)/t06.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
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: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(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 $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; 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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f ./$(DEPDIR)/mio_execd-execd.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t01-t01.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t02-t02.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t03-t03.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t04-t04.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t05-t05.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t06-t06.Po
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
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 -f ./$(DEPDIR)/mio_execd-execd.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t01-t01.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t02-t02.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t03-t03.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t04-t04.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t05-t05.Po
|
||||
-rm -f ./$(DEPDIR)/mio_t06-t06.Po
|
||||
-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-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am 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-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-binPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# 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:
|
386
mio/bin/execd.c
386
mio/bin/execd.c
@ -1,386 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright (c) 2016-2020 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 <mio.h>
|
||||
#include <mio-utl.h>
|
||||
#include <mio-sck.h>
|
||||
#include <mio-pro.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(HAVE_OPENSSL_SSL_H) && defined(HAVE_SSL)
|
||||
# include <openssl/ssl.h>
|
||||
# if defined(HAVE_OPENSSL_ERR_H)
|
||||
# include <openssl/err.h>
|
||||
# endif
|
||||
# if defined(HAVE_OPENSSL_ENGINE_H)
|
||||
# include <openssl/engine.h>
|
||||
# endif
|
||||
# define USE_SSL
|
||||
#endif
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
struct mmgr_stat_t
|
||||
{
|
||||
mio_oow_t total_count;
|
||||
};
|
||||
|
||||
typedef struct mmgr_stat_t mmgr_stat_t;
|
||||
|
||||
static mmgr_stat_t mmgr_stat;
|
||||
|
||||
static void* mmgr_alloc (mio_mmgr_t* mmgr, mio_oow_t size)
|
||||
{
|
||||
void* x;
|
||||
|
||||
#if 0
|
||||
if (((mmgr_stat_t*)mmgr->ctx)->total_count > 300)
|
||||
{
|
||||
printf ("CRITICAL ERROR ---> too many heap chunks...\n");
|
||||
return MIO_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
x = malloc (size);
|
||||
if (x) ((mmgr_stat_t*)mmgr->ctx)->total_count++;
|
||||
return x;
|
||||
}
|
||||
|
||||
static void* mmgr_realloc (mio_mmgr_t* mmgr, void* ptr, mio_oow_t size)
|
||||
{
|
||||
return realloc (ptr, size);
|
||||
}
|
||||
|
||||
static void mmgr_free (mio_mmgr_t* mmgr, void* ptr)
|
||||
{
|
||||
((mmgr_stat_t*)mmgr->ctx)->total_count--;
|
||||
return free (ptr);
|
||||
}
|
||||
|
||||
|
||||
static mio_mmgr_t mmgr =
|
||||
{
|
||||
mmgr_alloc,
|
||||
mmgr_realloc,
|
||||
mmgr_free,
|
||||
&mmgr_stat
|
||||
};
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
#if defined(USE_SSL)
|
||||
static void cleanup_openssl ()
|
||||
{
|
||||
/* ERR_remove_state() should be called for each thread if the application is thread */
|
||||
ERR_remove_state (0);
|
||||
#if defined(HAVE_ENGINE_CLEANUP)
|
||||
ENGINE_cleanup ();
|
||||
#endif
|
||||
ERR_free_strings ();
|
||||
EVP_cleanup ();
|
||||
#if defined(HAVE_CRYPTO_CLEANUP_ALL_EX_DATA)
|
||||
CRYPTO_cleanup_all_ex_data ();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
struct tcp_server_t
|
||||
{
|
||||
int tally;
|
||||
};
|
||||
typedef struct tcp_server_t tcp_server_t;
|
||||
|
||||
static void tcp_sck_on_disconnect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
switch (MIO_DEV_SCK_GET_PROGRESS(tcp))
|
||||
{
|
||||
case MIO_DEV_SCK_CONNECTING:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO SSL-CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_LISTENING:
|
||||
MIO_INFO1 (tcp->mio, "SHUTTING DOWN THE SERVER SOCKET(%d)...\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTED:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING CLIENT CONNECTION GOT TORN DOWN(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING SSL-ACCEPT GOT DISCONNECTED(%d) ....\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTED:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING CLIENT BEING SERVED GOT DISCONNECTED(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
MIO_INFO2 (tcp->mio, "SOCKET DEVICE DISCONNECTED (%d - %x)\n", (int)tcp->hnd, (unsigned int)tcp->state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tcp_sck_on_connect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
mio_bch_t buf1[128], buf2[128];
|
||||
|
||||
mio_skadtobcstr (tcp->mio, &tcp->localaddr, buf1, MIO_COUNTOF(buf1), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
mio_skadtobcstr (tcp->mio, &tcp->remoteaddr, buf2, MIO_COUNTOF(buf2), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
|
||||
if (tcp->state & MIO_DEV_SCK_CONNECTED)
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "DEVICE connected to a remote server... LOCAL %hs REMOTE %hs SCK: %d\n", buf1, buf2, tcp->hnd);
|
||||
}
|
||||
else if (tcp->state & MIO_DEV_SCK_ACCEPTED)
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "DEVICE accepted client device... .LOCAL %hs REMOTE %hs SCK: %d\n", buf1, buf2, tcp->hnd);
|
||||
}
|
||||
|
||||
if (mio_dev_sck_write(tcp, "hello", 5, MIO_NULL, MIO_NULL) <= -1)
|
||||
{
|
||||
mio_dev_sck_halt (tcp);
|
||||
}
|
||||
}
|
||||
|
||||
static int tcp_sck_on_write (mio_dev_sck_t* tcp, mio_iolen_t wrlen, void* wrctx, const mio_skad_t* dstaddr)
|
||||
{
|
||||
tcp_server_t* ts;
|
||||
mio_ntime_t tmout;
|
||||
|
||||
if (wrlen <= -1)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> SEDING TIMED OUT...........\n", (int)tcp->hnd);
|
||||
mio_dev_sck_halt (tcp);
|
||||
}
|
||||
else
|
||||
{
|
||||
ts = (tcp_server_t*)(tcp + 1);
|
||||
if (wrlen == 0)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> CLOSED WRITING END\n", (int)tcp->hnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> SENT MESSAGE %d of length %ld\n", (int)tcp->hnd, ts->tally, (long int)wrlen);
|
||||
}
|
||||
|
||||
ts->tally++;
|
||||
// if (ts->tally >= 2) mio_dev_sck_halt (tcp);
|
||||
|
||||
|
||||
MIO_INIT_NTIME (&tmout, 5, 0);
|
||||
//mio_dev_sck_read (tcp, 1);
|
||||
|
||||
MIO_INFO3 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> REQUESTING to READ with timeout of %ld.%08ld\n", (int)tcp->hnd, (long int)tmout.sec, (long int)tmout.nsec);
|
||||
mio_dev_sck_timedread (tcp, 1, &tmout);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tcp_sck_on_read (mio_dev_sck_t* tcp, const void* buf, mio_iolen_t len, const mio_skad_t* srcaddr)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (len <= -1)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) STREAM DEVICE: TIMED OUT...\n", (int)tcp->hnd);
|
||||
mio_dev_sck_halt (tcp);
|
||||
return 0;
|
||||
}
|
||||
else if (len <= 0)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) STREAM DEVICE: EOF RECEIVED...\n", (int)tcp->hnd);
|
||||
/* no outstanding request. but EOF */
|
||||
mio_dev_sck_halt (tcp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MIO_INFO2 (tcp->mio, "TCP_SCK_ON_READ(%d) - received %d bytes\n", (int)tcp->hnd, (int)len);
|
||||
|
||||
{
|
||||
mio_ntime_t tmout;
|
||||
|
||||
static char a ='A';
|
||||
static char xxx[1000000];
|
||||
memset (xxx, a++ , MIO_SIZEOF(xxx));
|
||||
|
||||
MIO_INFO2 (tcp->mio, "TCP_SCK_ON_READ(%d) >>> REQUESTING to write data of %d bytes\n", (int)tcp->hnd, MIO_SIZEOF(xxx));
|
||||
//return mio_dev_sck_write (tcp, "HELLO", 5, MIO_NULL);
|
||||
MIO_INIT_NTIME (&tmout, 5, 0);
|
||||
n = mio_dev_sck_timedwrite(tcp, xxx, MIO_SIZEOF(xxx), &tmout, MIO_NULL, MIO_NULL);
|
||||
|
||||
if (n <= -1) return -1;
|
||||
}
|
||||
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) - REQUESTING TO STOP READ\n", (int)tcp->hnd);
|
||||
mio_dev_sck_read (tcp, 0);
|
||||
|
||||
#if 0
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) - REQUESTING TO CLOSE WRITING END\n", (int)tcp->hnd);
|
||||
/* post the write finisher - close the writing end */
|
||||
n = mio_dev_sck_write(tcp, MIO_NULL, 0, MIO_NULL, MIO_NULL);
|
||||
if (n <= -1) return -1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
/* return 1; let the main loop to read more greedily without consulting the multiplexer */
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
static void pro_on_close (mio_dev_pro_t* pro, mio_dev_pro_sid_t sid)
|
||||
{
|
||||
mio_t* mio = pro->mio;
|
||||
if (sid == MIO_DEV_PRO_MASTER)
|
||||
MIO_INFO1 (mio, "PROCESS(%d) CLOSE MASTER\n", (int)pro->child_pid);
|
||||
else
|
||||
MIO_INFO2 (mio, "PROCESS(%d) CLOSE SLAVE[%d]\n", (int)pro->child_pid, sid);
|
||||
}
|
||||
|
||||
static int pro_on_read (mio_dev_pro_t* pro, mio_dev_pro_sid_t sid, const void* data, mio_iolen_t dlen)
|
||||
{
|
||||
mio_t* mio = pro->mio;
|
||||
|
||||
if (dlen <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "PROCESS(%d): READ TIMED OUT...\n", (int)pro->child_pid);
|
||||
mio_dev_pro_halt (pro);
|
||||
return 0;
|
||||
}
|
||||
else if (dlen <= 0)
|
||||
{
|
||||
MIO_INFO1 (mio, "PROCESS(%d): EOF RECEIVED...\n", (int)pro->child_pid);
|
||||
/* no outstanding request. but EOF */
|
||||
mio_dev_pro_halt (pro);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MIO_INFO5 (mio, "PROCESS(%d) READ DATA ON SLAVE[%d] len=%d [%.*hs]\n", (int)pro->child_pid, (int)sid, (int)dlen, dlen, (char*)data);
|
||||
if (sid == MIO_DEV_PRO_OUT)
|
||||
{
|
||||
mio_dev_pro_read (pro, sid, 0);
|
||||
mio_dev_pro_write (pro, "HELLO\n", 6, MIO_NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pro_on_write (mio_dev_pro_t* pro, mio_iolen_t wrlen, void* wrctx)
|
||||
{
|
||||
mio_t* mio = pro->mio;
|
||||
mio_ntime_t tmout;
|
||||
if (wrlen <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "PROCESS(%d): WRITE TIMED OUT...\n", (int)pro->child_pid);
|
||||
mio_dev_pro_halt (pro);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MIO_DEBUG2 (mio, "PROCESS(%d) wrote data of %d bytes\n", (int)pro->child_pid, (int)wrlen);
|
||||
/*mio_dev_pro_read (pro, MIO_DEV_PRO_OUT, 1);*/
|
||||
MIO_INIT_NTIME (&tmout, 5, 0);
|
||||
mio_dev_pro_timedread (pro, MIO_DEV_PRO_OUT, 1, &tmout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
static mio_t* g_mio;
|
||||
|
||||
static void handle_signal (int sig)
|
||||
{
|
||||
if (g_mio) mio_stop (g_mio, MIO_STOPREQ_TERMINATION);
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_dev_sck_t* tcpsvr;
|
||||
mio_dev_sck_make_t tcp_make;
|
||||
mio_dev_sck_connect_t tcp_conn;
|
||||
tcp_server_t* ts;
|
||||
|
||||
mio = mio_open(&mmgr, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
memset (&tcp_make, 0, MIO_SIZEOF(tcp_make));
|
||||
tcp_make.type = MIO_DEV_SCK_TCP4;
|
||||
tcp_make.on_write = tcp_sck_on_write;
|
||||
tcp_make.on_read = tcp_sck_on_read;
|
||||
tcp_make.on_connect = tcp_sck_on_connect;
|
||||
tcp_make.on_disconnect = tcp_sck_on_disconnect;
|
||||
tcpsvr = mio_dev_sck_make(mio, MIO_SIZEOF(tcp_server_t), &tcp_make);
|
||||
if (!tcpsvr)
|
||||
{
|
||||
printf ("Cannot make a tcp server\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
ts = (tcp_server_t*)(tcpsvr + 1);
|
||||
ts->tally = 0;
|
||||
|
||||
memset (&tcp_conn, 0, MIO_SIZEOF(tcp_conn));
|
||||
mio_bcstrtoskad(mio, "127.0.0.1:9999", &tcp_conn.remoteaddr);
|
||||
MIO_INIT_NTIME (&tcp_conn.connect_tmout, 5, 0);
|
||||
tcp_conn.options = 0;
|
||||
if (mio_dev_sck_connect(tcpsvr, &tcp_conn) <= -1)
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
while (1)
|
||||
{
|
||||
mio_exec (mio);
|
||||
}
|
||||
#endif
|
||||
mio_loop (mio);
|
||||
|
||||
oops:
|
||||
if (mio) mio_close (mio);
|
||||
return 0;
|
||||
}
|
1422
mio/bin/t01.c
1422
mio/bin/t01.c
File diff suppressed because it is too large
Load Diff
259
mio/bin/t02.c
259
mio/bin/t02.c
@ -1,259 +0,0 @@
|
||||
|
||||
|
||||
#include <mio.h>
|
||||
#include <mio-utl.h>
|
||||
#include <mio-sck.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct mmgr_stat_t
|
||||
{
|
||||
mio_oow_t total_count;
|
||||
};
|
||||
|
||||
typedef struct mmgr_stat_t mmgr_stat_t;
|
||||
|
||||
static mmgr_stat_t mmgr_stat;
|
||||
|
||||
static void* mmgr_alloc (mio_mmgr_t* mmgr, mio_oow_t size)
|
||||
{
|
||||
void* x;
|
||||
|
||||
if (((mmgr_stat_t*)mmgr->ctx)->total_count > 3000)
|
||||
{
|
||||
printf ("CRITICAL ERROR ---> too many heap chunks...\n");
|
||||
return MIO_NULL;
|
||||
}
|
||||
|
||||
x = malloc (size);
|
||||
if (x) ((mmgr_stat_t*)mmgr->ctx)->total_count++;
|
||||
return x;
|
||||
}
|
||||
|
||||
static void* mmgr_realloc (mio_mmgr_t* mmgr, void* ptr, mio_oow_t size)
|
||||
{
|
||||
return realloc (ptr, size);
|
||||
}
|
||||
|
||||
static void mmgr_free (mio_mmgr_t* mmgr, void* ptr)
|
||||
{
|
||||
((mmgr_stat_t*)mmgr->ctx)->total_count--;
|
||||
return free (ptr);
|
||||
}
|
||||
|
||||
|
||||
static mio_mmgr_t mmgr =
|
||||
{
|
||||
mmgr_alloc,
|
||||
mmgr_realloc,
|
||||
mmgr_free,
|
||||
&mmgr_stat
|
||||
};
|
||||
|
||||
|
||||
struct tcp_xtn_t
|
||||
{
|
||||
int tally;
|
||||
};
|
||||
typedef struct tcp_xtn_t tcp_xtn_t;
|
||||
|
||||
|
||||
static void tcp_sck_on_disconnect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
switch (MIO_DEV_SCK_GET_PROGRESS(tcp))
|
||||
{
|
||||
case MIO_DEV_SCK_CONNECTING:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO SSL-CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_LISTENING:
|
||||
MIO_INFO1 (tcp->mio, "SHUTTING DOWN THE SERVER SOCKET(%d)...\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTED:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING CLIENT CONNECTION GOT TORN DOWN(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING SSL-ACCEPT GOT DISCONNECTED(%d) ....\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTED:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING CLIENT BEING SERVED GOT DISCONNECTED(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
MIO_INFO2 (tcp->mio, "SOCKET DEVICE DISCONNECTED (%d - %x)\n", (int)tcp->hnd, (unsigned int)tcp->state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tcp_sck_on_connect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
mio_bch_t buf1[128], buf2[128];
|
||||
|
||||
mio_skadtobcstr (tcp->mio, &tcp->localaddr, buf1, MIO_COUNTOF(buf1), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
mio_skadtobcstr (tcp->mio, &tcp->remoteaddr, buf2, MIO_COUNTOF(buf2), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
|
||||
if (tcp->state & MIO_DEV_SCK_CONNECTED)
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "DEVICE connected to a remote server... LOCAL %hs REMOTE %hs SCK: %d\n", buf1, buf2, tcp->hnd);
|
||||
}
|
||||
else if (tcp->state & MIO_DEV_SCK_ACCEPTED)
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "DEVICE accepted client device... .LOCAL %hs REMOTE %hs SCK: %d\n", buf1, buf2, tcp->hnd);
|
||||
}
|
||||
|
||||
if (mio_dev_sck_write(tcp, "hello", 5, MIO_NULL, MIO_NULL) <= -1)
|
||||
{
|
||||
mio_dev_sck_halt (tcp);
|
||||
}
|
||||
}
|
||||
|
||||
static int tcp_sck_on_write (mio_dev_sck_t* tcp, mio_iolen_t wrlen, void* wrctx, const mio_skad_t* dstaddr)
|
||||
{
|
||||
tcp_xtn_t* ts;
|
||||
mio_ntime_t tmout;
|
||||
|
||||
if (wrlen <= -1)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> SEDING TIMED OUT...........\n", (int)tcp->hnd);
|
||||
mio_dev_sck_halt (tcp);
|
||||
}
|
||||
else
|
||||
{
|
||||
ts = (tcp_xtn_t*)(tcp + 1);
|
||||
if (wrlen == 0)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> CLOSED WRITING END\n", (int)tcp->hnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> SENT MESSAGE %d of length %ld\n", (int)tcp->hnd, ts->tally, (long int)wrlen);
|
||||
}
|
||||
|
||||
ts->tally++;
|
||||
// if (ts->tally >= 2) mio_dev_sck_halt (tcp);
|
||||
|
||||
|
||||
MIO_INIT_NTIME (&tmout, 5, 0);
|
||||
//mio_dev_sck_read (tcp, 1);
|
||||
|
||||
MIO_INFO3 (tcp->mio, "TCP_SCK_ON_WRITE(%d) >>> REQUESTING to READ with timeout of %ld.%08ld\n", (int)tcp->hnd, (long int)tmout.sec, (long int)tmout.nsec);
|
||||
mio_dev_sck_timedread (tcp, 1, &tmout);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tcp_sck_on_read (mio_dev_sck_t* tcp, const void* buf, mio_iolen_t len, const mio_skad_t* srcaddr)
|
||||
{
|
||||
int n;
|
||||
|
||||
if (len <= -1)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) STREAM DEVICE: TIMED OUT...\n", (int)tcp->hnd);
|
||||
mio_dev_sck_halt (tcp);
|
||||
return 0;
|
||||
}
|
||||
else if (len <= 0)
|
||||
{
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) STREAM DEVICE: EOF RECEIVED...\n", (int)tcp->hnd);
|
||||
/* no outstanding request. but EOF */
|
||||
mio_dev_sck_halt (tcp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MIO_INFO2 (tcp->mio, "TCP_SCK_ON_READ(%d) - received %d bytes\n", (int)tcp->hnd, (int)len);
|
||||
|
||||
{
|
||||
mio_ntime_t tmout;
|
||||
|
||||
static char a ='A';
|
||||
static char xxx[1000000];
|
||||
memset (xxx, a++ , MIO_SIZEOF(xxx));
|
||||
|
||||
MIO_INFO2 (tcp->mio, "TCP_SCK_ON_READ(%d) >>> REQUESTING to write data of %d bytes\n", (int)tcp->hnd, MIO_SIZEOF(xxx));
|
||||
//return mio_dev_sck_write (tcp, "HELLO", 5, MIO_NULL);
|
||||
MIO_INIT_NTIME (&tmout, 5, 0);
|
||||
n = mio_dev_sck_timedwrite(tcp, xxx, MIO_SIZEOF(xxx), &tmout, MIO_NULL, MIO_NULL);
|
||||
|
||||
if (n <= -1) return -1;
|
||||
}
|
||||
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) - REQUESTING TO STOP READ\n", (int)tcp->hnd);
|
||||
mio_dev_sck_read (tcp, 0);
|
||||
|
||||
#if 0
|
||||
MIO_INFO1 (tcp->mio, "TCP_SCK_ON_READ(%d) - REQUESTING TO CLOSE WRITING END\n", (int)tcp->hnd);
|
||||
/* post the write finisher - close the writing end */
|
||||
n = mio_dev_sck_write(tcp, MIO_NULL, 0, MIO_NULL, MIO_NULL);
|
||||
if (n <= -1) return -1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
/* return 1; let the main loop to read more greedily without consulting the multiplexer */
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_dev_sck_t* tcpsvr;
|
||||
mio_dev_sck_make_t tcp_make;
|
||||
mio_dev_sck_connect_t tcp_conn;
|
||||
tcp_xtn_t* ts;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s ipaddr:port\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
mio = mio_open(&mmgr, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
memset (&tcp_conn, 0, MIO_SIZEOF(tcp_conn));
|
||||
mio_bcstrtoskad(mio, argv[1], &tcp_conn.remoteaddr);
|
||||
MIO_INIT_NTIME (&tcp_conn.connect_tmout, 5, 0);
|
||||
tcp_conn.options = 0;
|
||||
|
||||
memset (&tcp_make, 0, MIO_SIZEOF(tcp_make));
|
||||
tcp_make.type = mio_skad_family(&tcp_conn.remoteaddr) == MIO_AF_INET? MIO_DEV_SCK_TCP4: MIO_DEV_SCK_TCP6;
|
||||
tcp_make.on_write = tcp_sck_on_write;
|
||||
tcp_make.on_read = tcp_sck_on_read;
|
||||
tcp_make.on_connect = tcp_sck_on_connect;
|
||||
tcp_make.on_disconnect = tcp_sck_on_disconnect;
|
||||
tcpsvr = mio_dev_sck_make(mio, MIO_SIZEOF(tcp_xtn_t), &tcp_make);
|
||||
if (!tcpsvr)
|
||||
{
|
||||
printf ("Cannot make a tcp server\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
ts = (tcp_xtn_t*)(tcpsvr + 1);
|
||||
ts->tally = 0;
|
||||
|
||||
|
||||
if (mio_dev_sck_connect(tcpsvr, &tcp_conn) <= -1)
|
||||
{
|
||||
}
|
||||
|
||||
mio_loop (mio);
|
||||
|
||||
oops:
|
||||
if (mio) mio_close (mio);
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
265
mio/bin/t03.c
265
mio/bin/t03.c
@ -1,265 +0,0 @@
|
||||
|
||||
#include <mio.h>
|
||||
#include <mio-json.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
static int on_json_inst (mio_json_t* json, mio_json_inst_t inst, mio_oow_t level, mio_oow_t index, mio_json_state_t container_state, const mio_oocs_t* str, void* ctx)
|
||||
{
|
||||
mio_t* mio = mio_json_getmio(json);
|
||||
mio_oow_t i;
|
||||
|
||||
switch (inst)
|
||||
{
|
||||
case MIO_JSON_INST_START_ARRAY:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>[\n", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "[\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_END_ARRAY:
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>]", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "]");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_START_OBJECT:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>{\n", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "{\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_END_OBJECT:
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>}", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "}");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_KEY:
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>%.*js: ", (unsigned long)index, str->len, str->ptr);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "%.*js: ", str->len, str->ptr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_NIL:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>null", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "null");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_TRUE:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>true", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "true");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_FALSE:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>false", (unsigned long)index);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "false");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_NUMBER:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>%.*js", (unsigned long)index, str->len, str->ptr);
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "%.*js", str->len, str->ptr);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MIO_JSON_INST_STRING:
|
||||
if (level > 0)
|
||||
{
|
||||
if (index > 0) mio_logbfmt (mio, MIO_LOG_STDOUT, ",\n");
|
||||
for (i = 0; i < level; i++) mio_logbfmt (mio, MIO_LOG_STDOUT, "\t");
|
||||
}
|
||||
#if defined(DEBUG)
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "<%lu>\"%.*js\"", (unsigned long)index, str->len, str->ptr); /* TODO: escaping */
|
||||
#else
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\"%.*js\"", str->len, str->ptr); /* TODO: escaping */
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "*****UNKNOWN*****\n", str->len, str->ptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_json_element (mio_jsonwr_t* jsonwr, const mio_bch_t* dptr, mio_oow_t dlen, void* ctx)
|
||||
{
|
||||
fwrite (dptr, 1, dlen, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_bitmask_t o = 0;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "--permit-word-key") == 0) o |= MIO_JSON_PERMIT_WORD_KEY;
|
||||
if (strcmp(argv[i], "--optional-comma") == 0) o |= MIO_JSON_OPTIONAL_COMMA;
|
||||
if (strcmp(argv[i], "--line-comment") == 0) o |= MIO_JSON_LINE_COMMENT;
|
||||
}
|
||||
|
||||
mio = mio_open(MIO_NULL, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
mio_json_t* json = MIO_NULL;
|
||||
char buf[128];
|
||||
mio_oow_t rem;
|
||||
size_t size;
|
||||
|
||||
json = mio_json_open(mio, 0);
|
||||
|
||||
mio_json_setoption (json, o);
|
||||
mio_json_setinstcb (json, on_json_inst, MIO_NULL);
|
||||
|
||||
rem = 0;
|
||||
while (!feof(stdin) || rem > 0)
|
||||
{
|
||||
int x;
|
||||
|
||||
if (!feof(stdin))
|
||||
{
|
||||
size = fread(&buf[rem], 1, sizeof(buf) - rem, stdin);
|
||||
if (size <= 0) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = rem;
|
||||
rem = 0;
|
||||
}
|
||||
|
||||
if ((x = mio_json_feed(json, buf, size + rem, &rem, 1)) <= -1)
|
||||
{
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "**** ERROR - %js ****\n", mio_geterrmsg(mio));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
/* document completed.
|
||||
* if only whitespaces are given, x is still greater 0. */
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\n-----------------------------------\n");
|
||||
}
|
||||
|
||||
/*printf ("--> x %d input %d left-over %d => [%.*s]\n", (int)x, (int)size, (int)rem, (int)rem, &buf[size - rem]);*/
|
||||
if (rem > 0) memcpy (buf, &buf[size - rem], rem);
|
||||
}
|
||||
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\n");
|
||||
if (json->state_stack != &json->state_top) mio_logbfmt (mio, MIO_LOG_STDOUT, "**** ERROR - incomplete ****\n");
|
||||
|
||||
done:
|
||||
mio_json_close (json);
|
||||
}
|
||||
|
||||
mio_logbfmt (mio, MIO_LOG_STDOUT, "\n===================================\n");
|
||||
|
||||
{
|
||||
mio_jsonwr_t* jsonwr = MIO_NULL;
|
||||
mio_uch_t ddd[4] = { 'D', '\0', 'R', 'Q' };
|
||||
mio_uch_t ddv[5] = { L'밝', L'혀', L'졌', L'는', L'데' };
|
||||
|
||||
jsonwr = mio_jsonwr_open (mio, 0, MIO_JSONWR_FLAG_PRETTY);
|
||||
|
||||
mio_jsonwr_setwritecb (jsonwr, write_json_element, MIO_NULL);
|
||||
|
||||
mio_jsonwr_startarray (jsonwr);
|
||||
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "hello", 5);
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "world", 5);
|
||||
|
||||
mio_jsonwr_startobject (jsonwr);
|
||||
mio_jsonwr_writekeywithbchars (jsonwr, "abc", 3);
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "computer", 8);
|
||||
mio_jsonwr_writekeywithbchars (jsonwr, "k", 1);
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "play nice", 9);
|
||||
mio_jsonwr_writekeywithuchars (jsonwr, ddd, 4);
|
||||
mio_jsonwr_writestringwithuchars (jsonwr, ddv, 5);
|
||||
mio_jsonwr_endobject (jsonwr);
|
||||
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "tyler", 5);
|
||||
|
||||
mio_jsonwr_startarray (jsonwr);
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "airplain", 8);
|
||||
mio_jsonwr_writestringwithbchars (jsonwr, "gro\0wn\nup", 9);
|
||||
mio_jsonwr_writetrue (jsonwr);
|
||||
mio_jsonwr_endarray (jsonwr);
|
||||
|
||||
mio_jsonwr_endarray (jsonwr);
|
||||
|
||||
mio_jsonwr_close (jsonwr);
|
||||
}
|
||||
|
||||
mio_close (mio);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
302
mio/bin/t04.c
302
mio/bin/t04.c
@ -1,302 +0,0 @@
|
||||
#if defined(MIO_ENABLE_MARIADB)
|
||||
|
||||
#include <mio.h>
|
||||
#include <mio-mar.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <mariadb/mysql.h>
|
||||
|
||||
#if 0
|
||||
static void mar_on_disconnect (mio_dev_mar_t* dev)
|
||||
{
|
||||
}
|
||||
|
||||
static void mar_on_connect (mio_dev_mar_t* dev)
|
||||
{
|
||||
printf ("CONNECTED...\n");
|
||||
if (mio_dev_mar_querywithbchars(dev, "SHOW STATUS", 11) <= -1)
|
||||
{
|
||||
mio_dev_mar_halt (dev);
|
||||
}
|
||||
}
|
||||
|
||||
static void mar_on_query_started (mio_dev_mar_t* dev, int mar_ret, const mio_bch_t* mar_errmsg)
|
||||
{
|
||||
if (mar_ret != 0)
|
||||
{
|
||||
printf ("QUERY NOT SENT PROPERLY..%s\n", mysql_error(dev->hnd));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("QUERY SENT..\n");
|
||||
if (mio_dev_mar_fetchrows(dev) <= -1)
|
||||
{
|
||||
printf ("FETCH ROW FAILURE - %s\n", errmsg);
|
||||
mio_dev_mar_halt (dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void mar_on_row_fetched (mio_dev_mar_t* dev, void* data)
|
||||
{
|
||||
MYSQL_ROW row = (MYSQL_ROW)data;
|
||||
static int x = 0;
|
||||
if (!row)
|
||||
{
|
||||
printf ("NO MORE ROW..\n");
|
||||
if (x == 0 && mio_dev_mar_querywithbchars(dev, "SELECT * FROM pdns.records", 26) <= -1) mio_dev_mar_halt (dev);
|
||||
x++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x == 0)
|
||||
printf ("%s %s\n", row[0], row[1]);
|
||||
else if (x == 1)
|
||||
printf ("%s %s %s %s %s\n", row[0], row[1], row[2], row[3], row[4]);
|
||||
//printf ("GOT ROW\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_dev_mar_t* mar;
|
||||
mio_dev_mar_make_t mi;
|
||||
mio_dev_mar_connect_t ci;
|
||||
|
||||
if (argc != 6)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s ipaddr port username password dbname\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mio = mio_open(MIO_NULL, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
memset (&ci, 0, MIO_SIZEOF(ci));
|
||||
ci.host = argv[1];
|
||||
ci.port = 3306; /* TODO: argv[2]; */
|
||||
ci.username = argv[3];
|
||||
ci.password = argv[4];
|
||||
ci.dbname = argv[5];
|
||||
|
||||
memset (&mi, 0, MIO_SIZEOF(mi));
|
||||
/*mi.on_write = mar_on_write;
|
||||
mi.on_read = mar_on_read;*/
|
||||
mi.on_connect = mar_on_connect;
|
||||
mi.on_disconnect = mar_on_disconnect;
|
||||
mi.on_query_started = mar_on_query_started;
|
||||
mi.on_row_fetched = mar_on_row_fetched;
|
||||
|
||||
mar = mio_dev_mar_make(mio, 0, &mi);
|
||||
if (!mar)
|
||||
{
|
||||
printf ("Cannot make a mar db client device\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
if (mio_dev_mar_connect(mar, &ci) <= -1)
|
||||
{
|
||||
printf ("Cannot connect to mar db server\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
mio_loop (mio);
|
||||
|
||||
oops:
|
||||
if (mio) mio_close (mio);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void on_result (mio_svc_marc_t* svc, mio_oow_t sid, mio_svc_marc_rcode_t rcode, void* data, void* qctx)
|
||||
{
|
||||
static int x = 0;
|
||||
switch (rcode)
|
||||
{
|
||||
case MIO_SVC_MARC_RCODE_ROW:
|
||||
{
|
||||
MYSQL_ROW row = (MYSQL_ROW)data;
|
||||
// if (x == 0)
|
||||
printf ("[%lu] %s %s\n", sid, row[0], row[1]);
|
||||
// else if (x == 1)
|
||||
// printf ("%s %s %s %s %s\n", row[0], row[1], row[2], row[3], row[4]);
|
||||
//printf ("GOT ROW\n");
|
||||
#if 0
|
||||
x++;
|
||||
if (x == 1)
|
||||
{
|
||||
printf ("BLOCKING PACKET...........................\n");
|
||||
system ("/sbin/iptables -I OUTPUT -p tcp --dport 3306 -j REJECT");
|
||||
system ("/sbin/iptables -I INPUT -p tcp --sport 3306 -j REJECT");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case MIO_SVC_MARC_RCODE_DONE:
|
||||
printf ("[%lu] NO DATA..\n", sid);
|
||||
break;
|
||||
|
||||
case MIO_SVC_MARC_RCODE_ERROR:
|
||||
{
|
||||
mio_svc_marc_dev_error_t* err = (mio_svc_marc_dev_error_t*)data;
|
||||
printf ("QUERY ERROR - [%d] %s\n", err->mar_errcode, err->mar_errmsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static mio_t* g_mio = MIO_NULL;
|
||||
|
||||
static void handle_signal (int sig)
|
||||
{
|
||||
mio_stop (g_mio, MIO_STOPREQ_TERMINATION);
|
||||
}
|
||||
|
||||
static void send_test_query (mio_t* mio, const mio_ntime_t* now, mio_tmrjob_t* job)
|
||||
{
|
||||
mio_svc_marc_t* marc = (mio_svc_marc_t*)job->ctx;
|
||||
mio_bch_t buf[256];
|
||||
mio_bch_t tmp[256];
|
||||
int len;
|
||||
|
||||
if (mio_svc_marc_querywithbchars(marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL) <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio));
|
||||
}
|
||||
|
||||
mio_svc_marc_escapebchars (marc, "wild", 4, tmp);
|
||||
len = snprintf(buf, MIO_COUNTOF(buf), "SELECT name, content FROM records WHERE name like '%%%s%%'", tmp);
|
||||
if (mio_svc_marc_querywithbchars(marc, 1, MIO_SVC_MARC_QTYPE_SELECT, buf, len, on_result, MIO_NULL) <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "FAILED TO SEND QUERY - %js\n", mio_geterrmsg(mio));
|
||||
}
|
||||
}
|
||||
|
||||
static int schedule_timer_job_after (mio_t* mio, const mio_ntime_t* fire_after, mio_tmrjob_handler_t handler, void* ctx)
|
||||
{
|
||||
mio_tmrjob_t tmrjob;
|
||||
|
||||
memset (&tmrjob, 0, MIO_SIZEOF(tmrjob));
|
||||
tmrjob.ctx = ctx;
|
||||
|
||||
mio_gettime (mio, &tmrjob.when);
|
||||
MIO_ADD_NTIME (&tmrjob.when, &tmrjob.when, fire_after);
|
||||
|
||||
tmrjob.handler = handler;
|
||||
tmrjob.idxptr = MIO_NULL;
|
||||
|
||||
return mio_instmrjob(mio, &tmrjob);
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_svc_marc_t* marc;
|
||||
mio_svc_marc_connect_t ci;
|
||||
/* mio_svc_marc_tmout_t tmout;*/
|
||||
|
||||
if (argc != 6)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s ipaddr port username password dbname\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mio = mio_open(MIO_NULL, 0, MIO_NULL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
memset (&ci, 0, MIO_SIZEOF(ci));
|
||||
ci.host = argv[1];
|
||||
ci.port = 3306; /* TODO: argv[2]; */
|
||||
ci.username = argv[3];
|
||||
ci.password = argv[4];
|
||||
ci.dbname = argv[5];
|
||||
|
||||
/* timeout not implemented yet in the mardiab device and services
|
||||
MIO_INIT_NTIME (&tmout.c, 2, 0);
|
||||
MIO_INIT_NTIME (&tmout.r, -1, 0);
|
||||
MIO_INIT_NTIME (&tmout.w, -1, 0);
|
||||
*/
|
||||
|
||||
marc = mio_svc_marc_start(mio, &ci, MIO_NULL);
|
||||
if (!marc)
|
||||
{
|
||||
printf ("Cannot start a mariadb client service\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL);
|
||||
mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM", 11, on_result, MIO_NULL);
|
||||
// mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_SELECT, "SHOW STATUS", 11, on_result, MIO_NULL);
|
||||
mio_svc_marc_querywithbchars (marc, 0, MIO_SVC_MARC_QTYPE_ACTION, "DELETE FROM XXX", 14, on_result, MIO_NULL);
|
||||
|
||||
#if 0
|
||||
memset (&mi, 0, MIO_SIZEOF(mi));
|
||||
/*mi.on_write = mar_on_write;
|
||||
mi.on_read = mar_on_read;*/
|
||||
mi.on_connect = mar_on_connect;
|
||||
mi.on_disconnect = mar_on_disconnect;
|
||||
mi.on_query_started = mar_on_query_started;
|
||||
mi.on_row_fetched = mar_on_row_fetched;
|
||||
|
||||
mar = mio_dev_mar_make(mio, 0, &mi);
|
||||
if (!mar)
|
||||
{
|
||||
printf ("Cannot make a mar db client device\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
if (mio_dev_mar_connect(mar, &ci) <= -1)
|
||||
{
|
||||
printf ("Cannot connect to mar db server\n");
|
||||
goto oops;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_mio = mio;
|
||||
signal (SIGINT, handle_signal);
|
||||
|
||||
/* ---------------------------------------- */
|
||||
{
|
||||
mio_ntime_t x;
|
||||
MIO_INIT_NTIME (&x, 32, 0);
|
||||
schedule_timer_job_after (mio, &x, send_test_query, marc);
|
||||
mio_loop (mio);
|
||||
}
|
||||
/* ---------------------------------------- */
|
||||
|
||||
signal (SIGINT, SIG_IGN);
|
||||
g_mio = MIO_NULL;
|
||||
|
||||
oops:
|
||||
printf ("about to close mio...\n");
|
||||
if (mio) mio_close (mio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
printf ("mariadb not enabled\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
287
mio/bin/t05.c
287
mio/bin/t05.c
@ -1,287 +0,0 @@
|
||||
#include <mio-utl.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* https://131002.net/siphash/siphash24.c */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
SipHash reference C implementation
|
||||
|
||||
Copyright (c) 2012-2016 Jean-Philippe Aumasson
|
||||
<jeanphilippe.aumasson@gmail.com>
|
||||
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
|
||||
|
||||
To the extent possible under law, the author(s) have dedicated all copyright
|
||||
and related and neighboring rights to this software to the public domain
|
||||
worldwide. This software is distributed without any warranty.
|
||||
|
||||
You should have received a copy of the CC0 Public Domain Dedication along
|
||||
with
|
||||
this software. If not, see
|
||||
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* default: SipHash-2-4 */
|
||||
#ifndef cROUNDS
|
||||
#define cROUNDS 2
|
||||
#endif
|
||||
#ifndef dROUNDS
|
||||
#define dROUNDS 4
|
||||
#endif
|
||||
|
||||
#define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
|
||||
|
||||
#define U32TO8_LE(p, v) \
|
||||
(p)[0] = (uint8_t)((v)); \
|
||||
(p)[1] = (uint8_t)((v) >> 8); \
|
||||
(p)[2] = (uint8_t)((v) >> 16); \
|
||||
(p)[3] = (uint8_t)((v) >> 24);
|
||||
|
||||
#define U64TO8_LE(p, v) \
|
||||
U32TO8_LE((p), (uint32_t)((v))); \
|
||||
U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
|
||||
|
||||
#define U8TO64_LE(p) \
|
||||
(((uint64_t)((p)[0])) | ((uint64_t)((p)[1]) << 8) | \
|
||||
((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) | \
|
||||
((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) | \
|
||||
((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
|
||||
|
||||
#define SIPROUND \
|
||||
do { \
|
||||
v0 += v1; \
|
||||
v1 = ROTL(v1, 13); \
|
||||
v1 ^= v0; \
|
||||
v0 = ROTL(v0, 32); \
|
||||
v2 += v3; \
|
||||
v3 = ROTL(v3, 16); \
|
||||
v3 ^= v2; \
|
||||
v0 += v3; \
|
||||
v3 = ROTL(v3, 21); \
|
||||
v3 ^= v0; \
|
||||
v2 += v1; \
|
||||
v1 = ROTL(v1, 17); \
|
||||
v1 ^= v2; \
|
||||
v2 = ROTL(v2, 32); \
|
||||
} while (0)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define TRACE \
|
||||
do { \
|
||||
printf("(%3zu) v0 %016"PRIx64"\n", inlen, v0); \
|
||||
printf("(%3zu) v1 %016"PRIx64"\n", inlen, v1); \
|
||||
printf("(%3zu) v2 %016"PRIx64"\n", inlen, v2); \
|
||||
printf("(%3zu) v3 %016"PRIx64"\n", inlen, v3); \
|
||||
} while (0)
|
||||
#else
|
||||
#define TRACE
|
||||
#endif
|
||||
|
||||
int siphash(const uint8_t *in, const size_t inlen, const uint8_t *k,
|
||||
uint8_t *out, const size_t outlen) {
|
||||
|
||||
assert((outlen == 8) || (outlen == 16));
|
||||
uint64_t v0 = UINT64_C(0x736f6d6570736575);
|
||||
uint64_t v1 = UINT64_C(0x646f72616e646f6d);
|
||||
uint64_t v2 = UINT64_C(0x6c7967656e657261);
|
||||
uint64_t v3 = UINT64_C(0x7465646279746573);
|
||||
uint64_t k0 = U8TO64_LE(k);
|
||||
uint64_t k1 = U8TO64_LE(k + 8);
|
||||
uint64_t m;
|
||||
int i;
|
||||
const uint8_t *end = in + inlen - (inlen % sizeof(uint64_t));
|
||||
const int left = inlen & 7;
|
||||
uint64_t b = ((uint64_t)inlen) << 56;
|
||||
v3 ^= k1;
|
||||
v2 ^= k0;
|
||||
v1 ^= k1;
|
||||
v0 ^= k0;
|
||||
|
||||
if (outlen == 16)
|
||||
v1 ^= 0xee;
|
||||
|
||||
for (; in != end; in += 8) {
|
||||
m = U8TO64_LE(in);
|
||||
v3 ^= m;
|
||||
|
||||
TRACE;
|
||||
for (i = 0; i < cROUNDS; ++i)
|
||||
SIPROUND;
|
||||
|
||||
v0 ^= m;
|
||||
}
|
||||
|
||||
switch (left) {
|
||||
case 7:
|
||||
b |= ((uint64_t)in[6]) << 48;
|
||||
case 6:
|
||||
b |= ((uint64_t)in[5]) << 40;
|
||||
case 5:
|
||||
b |= ((uint64_t)in[4]) << 32;
|
||||
case 4:
|
||||
b |= ((uint64_t)in[3]) << 24;
|
||||
case 3:
|
||||
b |= ((uint64_t)in[2]) << 16;
|
||||
case 2:
|
||||
b |= ((uint64_t)in[1]) << 8;
|
||||
case 1:
|
||||
b |= ((uint64_t)in[0]);
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
v3 ^= b;
|
||||
|
||||
TRACE;
|
||||
for (i = 0; i < cROUNDS; ++i)
|
||||
SIPROUND;
|
||||
|
||||
v0 ^= b;
|
||||
|
||||
if (outlen == 16)
|
||||
v2 ^= 0xee;
|
||||
else
|
||||
v2 ^= 0xff;
|
||||
|
||||
TRACE;
|
||||
for (i = 0; i < dROUNDS; ++i)
|
||||
SIPROUND;
|
||||
|
||||
b = v0 ^ v1 ^ v2 ^ v3;
|
||||
U64TO8_LE(out, b);
|
||||
|
||||
if (outlen == 8)
|
||||
return 0;
|
||||
|
||||
v1 ^= 0xdd;
|
||||
|
||||
TRACE;
|
||||
for (i = 0; i < dROUNDS; ++i)
|
||||
SIPROUND;
|
||||
|
||||
b = v0 ^ v1 ^ v2 ^ v3;
|
||||
U64TO8_LE(out + 8, b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
SipHash-2-4 output with
|
||||
k = 00 01 02 ...
|
||||
and
|
||||
in = (empty string)
|
||||
in = 00 (1 byte)
|
||||
in = 00 01 (2 bytes)
|
||||
in = 00 01 02 (3 bytes)
|
||||
...
|
||||
in = 00 01 02 ... 3e (63 bytes)
|
||||
*/
|
||||
mio_uint8_t vectors[64][8] =
|
||||
{
|
||||
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },
|
||||
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },
|
||||
{ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, },
|
||||
{ 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, },
|
||||
{ 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, },
|
||||
{ 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, },
|
||||
{ 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, },
|
||||
{ 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, },
|
||||
{ 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, },
|
||||
{ 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, },
|
||||
{ 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, },
|
||||
{ 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, },
|
||||
{ 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, },
|
||||
{ 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, },
|
||||
{ 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, },
|
||||
{ 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, },
|
||||
{ 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, },
|
||||
{ 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, },
|
||||
{ 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, },
|
||||
{ 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, },
|
||||
{ 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, },
|
||||
{ 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, },
|
||||
{ 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, },
|
||||
{ 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, },
|
||||
{ 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, },
|
||||
{ 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, },
|
||||
{ 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, },
|
||||
{ 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, },
|
||||
{ 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, },
|
||||
{ 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, },
|
||||
{ 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, },
|
||||
{ 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, },
|
||||
{ 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, },
|
||||
{ 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, },
|
||||
{ 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, },
|
||||
{ 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, },
|
||||
{ 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, },
|
||||
{ 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, },
|
||||
{ 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, },
|
||||
{ 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, },
|
||||
{ 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, },
|
||||
{ 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, },
|
||||
{ 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, },
|
||||
{ 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, },
|
||||
{ 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, },
|
||||
{ 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, },
|
||||
{ 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, },
|
||||
{ 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, },
|
||||
{ 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, },
|
||||
{ 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, },
|
||||
{ 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, },
|
||||
{ 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, },
|
||||
{ 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, },
|
||||
{ 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, },
|
||||
{ 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, },
|
||||
{ 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, },
|
||||
{ 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, },
|
||||
{ 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, },
|
||||
{ 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, },
|
||||
{ 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, },
|
||||
{ 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, },
|
||||
{ 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, },
|
||||
{ 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },
|
||||
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
|
||||
};
|
||||
|
||||
|
||||
int test_vectors()
|
||||
{
|
||||
#define MAXLEN 64
|
||||
|
||||
mio_uint8_t in[MAXLEN], out[8], k[16];
|
||||
int i;
|
||||
int ok = 1;
|
||||
|
||||
for( i = 0; i < 16; ++i ) k[i] = i;
|
||||
|
||||
for( i = 0; i < MAXLEN; ++i )
|
||||
{
|
||||
in[i] = i;
|
||||
mio_sip_hash_24(k, in, i, out);
|
||||
// siphash(in, i, k, out, 8);
|
||||
|
||||
if ( memcmp( out, vectors[i], 8 ) )
|
||||
{
|
||||
printf( "test vector failed for %d bytes\n", i );
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (test_vectors()) printf( "test vectors ok\n" );
|
||||
return 0;
|
||||
}
|
633
mio/bin/t06.c
633
mio/bin/t06.c
@ -1,633 +0,0 @@
|
||||
#include <mio-sck.h>
|
||||
#include <mio-http.h>
|
||||
#include <mio-utl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_NUM_THRS 256
|
||||
static int g_reuse_port = 0;
|
||||
static int g_num_thrs = 2;
|
||||
static mio_svc_htts_t* g_htts[MAX_NUM_THRS];
|
||||
static int g_htts_no = 0;
|
||||
static pthread_mutex_t g_htts_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static int print_qparam (mio_bcs_t* key, mio_bcs_t* val, void* ctx)
|
||||
{
|
||||
key->len = mio_perdec_http_bcs(key, key->ptr, MIO_NULL);
|
||||
val->len = mio_perdec_http_bcs(val, val->ptr, MIO_NULL);
|
||||
fprintf ((FILE*)ctx, "\t[%.*s] = [%.*s]\n", (int)key->len, key->ptr, (int)val->len, val->ptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void on_htts_thr_request (mio_t* mio, mio_dev_thr_iopair_t* iop, mio_svc_htts_thr_func_info_t* tfi, void* ctx)
|
||||
{
|
||||
FILE* fp;
|
||||
int i;
|
||||
|
||||
if (tfi->req_method != MIO_HTTP_GET)
|
||||
{
|
||||
write (iop->wfd, "Status: 405\r\n\r\n", 15); /* method not allowed */
|
||||
return;
|
||||
}
|
||||
|
||||
fp = fdopen(iop->wfd, "w");
|
||||
if (!fp)
|
||||
{
|
||||
write (iop->wfd, "Status: 500\r\n\r\n", 15); /* internal server error */
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf (fp, "Status: 200\r\n");
|
||||
fprintf (fp, "Content-Type: text/html\r\n\r\n");
|
||||
|
||||
fprintf (fp, "request path = %s\n", tfi->req_path);
|
||||
if (tfi->req_param)
|
||||
{
|
||||
fprintf (fp, "request params:\n");
|
||||
mio_scan_http_qparam (tfi->req_param, print_qparam, fp);
|
||||
}
|
||||
for (i = 0; i < 100; i++) fprintf (fp, "%d * %d => %d\n", i, i, i * i);
|
||||
|
||||
/* invalid iop->wfd to mark that this function closed this file descriptor.
|
||||
* no invalidation will lead to double closes on the same file descriptor. */
|
||||
iop->wfd = MIO_SYSHND_INVALID;
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
static void on_htts_thr2_request (mio_t* mio, mio_dev_thr_iopair_t* iop, mio_svc_htts_thr_func_info_t* tfi, void* ctx)
|
||||
{
|
||||
FILE* fp, * sf;
|
||||
|
||||
if (tfi->req_method != MIO_HTTP_GET)
|
||||
{
|
||||
write (iop->wfd, "Status: 405\r\n\r\n", 15); /* method not allowed */
|
||||
return;
|
||||
}
|
||||
|
||||
fp = fdopen(iop->wfd, "w");
|
||||
if (!fp)
|
||||
{
|
||||
write (iop->wfd, "Status: 500\r\n\r\n", 15); /* internal server error */
|
||||
return;
|
||||
}
|
||||
|
||||
sf = fopen(&tfi->req_path[5], "r");
|
||||
if (!sf)
|
||||
{
|
||||
fprintf (fp, "Status: 404\r\n\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
fprintf (fp, "Status: 200\r\n");
|
||||
fprintf (fp, "Content-Type: text/html\r\n\r\n");
|
||||
|
||||
while (!feof(sf))
|
||||
{
|
||||
size_t n;
|
||||
n = fread(buf, 1, sizeof(buf), sf);
|
||||
if (n > 0) fwrite (buf, 1, n, fp);
|
||||
}
|
||||
|
||||
fclose (sf);
|
||||
}
|
||||
|
||||
/* invalid iop->wfd to mark that this function closed this file descriptor.
|
||||
* no invalidation will lead to double closes on the same file descriptor. */
|
||||
iop->wfd = MIO_SYSHND_INVALID;
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int process_http_request (mio_svc_htts_t* htts, mio_dev_sck_t* csck, mio_htre_t* req)
|
||||
{
|
||||
mio_t* mio = mio_svc_htts_getmio(htts);
|
||||
// mio_svc_htts_cli_t* cli = mio_dev_sck_getxtn(csck);
|
||||
mio_http_method_t mth;
|
||||
|
||||
/* percent-decode the query path to the original buffer
|
||||
* since i'm not going to need it in the original form
|
||||
* any more. once it's decoded in the peek mode,
|
||||
* the decoded query path is made available in the
|
||||
* non-peek mode as well */
|
||||
|
||||
MIO_DEBUG2 (mio, "[RAW-REQ] %s %s\n", mio_htre_getqmethodname(req), mio_htre_getqpath(req));
|
||||
|
||||
mio_htre_perdecqpath(req);
|
||||
/* TODO: proper request logging */
|
||||
|
||||
MIO_DEBUG2 (mio, "[REQ] %s %s\n", mio_htre_getqmethodname(req), mio_htre_getqpath(req));
|
||||
|
||||
#if 0
|
||||
mio_printf (MIO_T("================================\n"));
|
||||
mio_printf (MIO_T("[%lu] %hs REQUEST ==> [%hs] version[%d.%d %hs] method[%hs]\n"),
|
||||
(unsigned long)time(NULL),
|
||||
(peek? MIO_MT("PEEK"): MIO_MT("HANDLE")),
|
||||
mio_htre_getqpath(req),
|
||||
mio_htre_getmajorversion(req),
|
||||
mio_htre_getminorversion(req),
|
||||
mio_htre_getverstr(req),
|
||||
mio_htre_getqmethodname(req)
|
||||
);
|
||||
if (mio_htre_getqparam(req))
|
||||
mio_printf (MIO_T("PARAMS ==> [%hs]\n"), mio_htre_getqparam(req));
|
||||
|
||||
mio_htb_walk (&req->hdrtab, walk, MIO_NULL);
|
||||
if (mio_htre_getcontentlen(req) > 0)
|
||||
{
|
||||
mio_printf (MIO_T("CONTENT [%.*S]\n"), (int)mio_htre_getcontentlen(req), mio_htre_getcontentptr(req));
|
||||
}
|
||||
#endif
|
||||
|
||||
mth = mio_htre_getqmethodtype(req);
|
||||
/* determine what to do once the header fields are all received.
|
||||
* i don't want to delay this until the contents are received.
|
||||
* if you don't like this behavior, you must implement your own
|
||||
* callback function for request handling. */
|
||||
#if 0
|
||||
/* TODO support X-HTTP-Method-Override */
|
||||
if (data.method == MIO_HTTP_POST)
|
||||
{
|
||||
tmp = mio_htre_getheaderval(req, MIO_MT("X-HTTP-Method-Override"));
|
||||
if (tmp)
|
||||
{
|
||||
/*while (tmp->next) tmp = tmp->next;*/ /* get the last value */
|
||||
data.method = mio_mbstohttpmethod (tmp->ptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (mth == MIO_HTTP_CONNECT)
|
||||
{
|
||||
/* CONNECT method must not have content set.
|
||||
* however, arrange to discard it if so.
|
||||
*
|
||||
* NOTE: CONNECT is implemented to ignore many headers like
|
||||
* 'Expect: 100-continue' and 'Connection: keep-alive'. */
|
||||
mio_htre_discardcontent (req);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this part can be checked in actual mio_svc_htts_doXXX() functions.
|
||||
* some doXXX handlers may not require length for POST.
|
||||
* it may be able to simply accept till EOF? or treat as if CONTENT_LENGTH is 0*/
|
||||
if (mth == MIO_HTTP_POST && !(req->flags & (MIO_HTRE_ATTR_LENGTH | MIO_HTRE_ATTR_CHUNKED)))
|
||||
{
|
||||
/* POST without Content-Length nor not chunked */
|
||||
mio_htre_discardcontent (req);
|
||||
/* 411 Length Required - can't keep alive. Force disconnect */
|
||||
req->flags &= ~MIO_HTRE_ATTR_KEEPALIVE; /* to cause sendstatus() to close */
|
||||
if (mio_svc_htts_sendstatus(htts, csck, req, 411, MIO_NULL) <= -1) goto oops;
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
#endif
|
||||
const mio_bch_t* qpath = mio_htre_getqpath(req);
|
||||
int x;
|
||||
if (mio_comp_bcstr_limited(qpath, "/thr/", 5, 1) == 0)
|
||||
x = mio_svc_htts_dothr(htts, csck, req, on_htts_thr_request, MIO_NULL);
|
||||
else if (mio_comp_bcstr_limited(qpath, "/thr2/", 6, 1) == 0)
|
||||
x = mio_svc_htts_dothr(htts, csck, req, on_htts_thr2_request, MIO_NULL);
|
||||
else if (mio_comp_bcstr_limited(qpath, "/txt/", 5, 1) == 0)
|
||||
x = mio_svc_htts_dotxt(htts, csck, req, 200, "text/plain", qpath);
|
||||
else if (mio_comp_bcstr_limited(qpath, "/cgi/", 5, 1) == 0)
|
||||
x = mio_svc_htts_docgi(htts, csck, req, "", mio_htre_getqpath(req));
|
||||
else
|
||||
x = mio_svc_htts_dofile(htts, csck, req, "", mio_htre_getqpath(req), "text/plain");
|
||||
if (x <= -1) goto oops;
|
||||
|
||||
return 0;
|
||||
|
||||
oops:
|
||||
mio_dev_sck_halt (csck);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void* thr_func (void* arg)
|
||||
{
|
||||
mio_t* mio = MIO_NULL;
|
||||
mio_svc_htts_t* htts = MIO_NULL;
|
||||
mio_dev_sck_bind_t htts_bind_info;
|
||||
int htts_no = -1;
|
||||
|
||||
mio = mio_open(MIO_NULL, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
mio_setoption (mio, MIO_LOG_TARGET_BCSTR, "/dev/stderr");
|
||||
|
||||
memset (&htts_bind_info, 0, MIO_SIZEOF(htts_bind_info));
|
||||
if (g_reuse_port)
|
||||
{
|
||||
mio_bcstrtoskad (mio, "0.0.0.0:9987", &htts_bind_info.localaddr);
|
||||
htts_bind_info.options = MIO_DEV_SCK_BIND_REUSEADDR | MIO_DEV_SCK_BIND_REUSEPORT | MIO_DEV_SCK_BIND_IGNERR;
|
||||
//htts_bind_info.options |= MIO_DEV_SCK_BIND_SSL;
|
||||
htts_bind_info.ssl_certfile = "localhost.crt";
|
||||
htts_bind_info.ssl_keyfile = "localhost.key";
|
||||
}
|
||||
|
||||
htts = mio_svc_htts_start(mio, &htts_bind_info, process_http_request);
|
||||
if (!htts)
|
||||
{
|
||||
printf ("Unable to start htts\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
pthread_mutex_lock (&g_htts_mutex);
|
||||
htts_no = g_htts_no;
|
||||
g_htts[htts_no] = htts;
|
||||
g_htts_no = (g_htts_no + 1) % g_num_thrs;
|
||||
pthread_mutex_unlock (&g_htts_mutex);
|
||||
|
||||
printf ("entering the loop for %d\n", htts_no);
|
||||
mio_loop (mio);
|
||||
printf ("exiting the loop for %d\n", htts_no);
|
||||
|
||||
oops:
|
||||
pthread_mutex_lock (&g_htts_mutex);
|
||||
if (htts)
|
||||
{
|
||||
mio_svc_htts_stop (htts);
|
||||
g_htts[htts_no] = MIO_NULL;
|
||||
}
|
||||
pthread_mutex_unlock (&g_htts_mutex);
|
||||
if (mio) mio_close (mio);
|
||||
|
||||
pthread_exit (MIO_NULL);
|
||||
return MIO_NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
static void tcp_sck_on_disconnect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
switch (MIO_DEV_SCK_GET_PROGRESS(tcp))
|
||||
{
|
||||
case MIO_DEV_SCK_CONNECTING:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING SESSION DISCONNECTED - FAILED TO SSL-CONNECT (%d) TO REMOTE SERVER\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_LISTENING:
|
||||
MIO_INFO1 (tcp->mio, "SHUTTING DOWN THE SERVER SOCKET(%d)...\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_CONNECTED:
|
||||
MIO_INFO1 (tcp->mio, "OUTGOING CLIENT CONNECTION GOT TORN DOWN(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTING_SSL:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING SSL-ACCEPT GOT DISCONNECTED(%d) ....\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
case MIO_DEV_SCK_ACCEPTED:
|
||||
MIO_INFO1 (tcp->mio, "INCOMING CLIENT BEING SERVED GOT DISCONNECTED(%d).......\n", (int)tcp->hnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
MIO_INFO2 (tcp->mio, "SOCKET DEVICE DISCONNECTED (%d - %x)\n", (int)tcp->hnd, (unsigned int)tcp->state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void tcp_sck_on_connect (mio_dev_sck_t* tcp)
|
||||
{
|
||||
mio_bch_t buf1[128], buf2[128];
|
||||
|
||||
mio_skadtobcstr (tcp->mio, &tcp->localaddr, buf1, MIO_COUNTOF(buf1), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
mio_skadtobcstr (tcp->mio, &tcp->remoteaddr, buf2, MIO_COUNTOF(buf2), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
|
||||
if (tcp->state & MIO_DEV_SCK_CONNECTED)
|
||||
{
|
||||
MIO_INFO3 (tcp->mio, "DEVICE connected to a remote server... LOCAL %hs REMOTE %hs SCK: %d\n", buf1, buf2, tcp->hnd);
|
||||
}
|
||||
else if (tcp->state & MIO_DEV_SCK_ACCEPTED)
|
||||
{
|
||||
/* TODO: pass it to distributor??? */
|
||||
/* THIS PART WON"T BE CALLED FOR tcp_sck_on_raw_accept.. */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static mio_tmridx_t xx_tmridx;
|
||||
static int try_to_accept (mio_dev_sck_t* sck, mio_dev_sck_qxmsg_t* qxmsg, int in_mq);
|
||||
|
||||
typedef struct xx_mq_t xx_mq_t;
|
||||
|
||||
struct xx_mq_t
|
||||
{
|
||||
xx_mq_t* q_next;
|
||||
xx_mq_t* q_prev;
|
||||
|
||||
mio_dev_sck_qxmsg_t msg;
|
||||
};
|
||||
|
||||
#define XX_MQ_INIT(mq) ((mq)->q_next = (mq)->q_prev = (mq))
|
||||
#define XX_MQ_TAIL(mq) ((mq)->q_prev)
|
||||
#define XX_MQ_HEAD(mq) ((mq)->q_next)
|
||||
#define XX_MQ_IS_EMPTY(mq) (XX_MQ_HEAD(mq) == (mq))
|
||||
#define XX_MQ_IS_NODE(mq,x) ((mq) != (x))
|
||||
#define XX_MQ_IS_HEAD(mq,x) (XX_MQ_HEAD(mq) == (x))
|
||||
#define XX_MQ_IS_TAIL(mq,x) (XX_MQ_TAIL(mq) == (x))
|
||||
#define XX_MQ_NEXT(x) ((x)->q_next)
|
||||
#define XX_MQ_PREV(x) ((x)->q_prev)
|
||||
#define XX_MQ_LINK(p,x,n) MIO_Q_LINK((mio_q_t*)p,(mio_q_t*)x,(mio_q_t*)n)
|
||||
#define XX_MQ_UNLINK(x) MIO_Q_UNLINK((mio_q_t*)x)
|
||||
#define XX_MQ_REPL(o,n) MIO_Q_REPL(o,n);
|
||||
#define XX_MQ_ENQ(mq,x) XX_MQ_LINK(XX_MQ_TAIL(mq), (mio_q_t*)x, mq)
|
||||
#define XX_MQ_DEQ(mq) XX_MQ_UNLINK(XX_MQ_HEAD(mq))
|
||||
|
||||
static xx_mq_t xx_mq;
|
||||
|
||||
static void enable_accept (mio_t* mio, const mio_ntime_t* now, mio_tmrjob_t* job)
|
||||
{
|
||||
mio_dev_sck_t* rdev = (mio_dev_sck_t*)job->ctx;
|
||||
|
||||
while (!XX_MQ_IS_EMPTY(&xx_mq))
|
||||
{
|
||||
xx_mq_t* mq;
|
||||
|
||||
mq = XX_MQ_HEAD(&xx_mq);
|
||||
if (try_to_accept(rdev, &mq->msg, 1) == 0) return; /* EAGAIN situation */
|
||||
|
||||
XX_MQ_UNLINK (mq);
|
||||
mio_freemem (mio, mq);
|
||||
}
|
||||
|
||||
assert (XX_MQ_IS_EMPTY(&xx_mq));
|
||||
if (mio_dev_sck_read(rdev, 1) <= -1) // it's a disaster if this fails. the acceptor will get stalled if it happens
|
||||
{
|
||||
printf ("DISASTER.... UNABLE TO ENABLE READ ON ACCEPTOR\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int try_to_accept (mio_dev_sck_t* sck, mio_dev_sck_qxmsg_t* qxmsg, int in_mq)
|
||||
{
|
||||
mio_t* mio = sck->mio;
|
||||
mio_svc_htts_t* htts;
|
||||
|
||||
pthread_mutex_lock (&g_htts_mutex);
|
||||
htts = g_htts[g_htts_no];
|
||||
g_htts_no = (g_htts_no + 1) % g_num_thrs;
|
||||
pthread_mutex_unlock (&g_htts_mutex);
|
||||
|
||||
if (mio_svc_htts_writetosidechan(htts, qxmsg, MIO_SIZEOF(*qxmsg)) <= -1)
|
||||
{
|
||||
mio_bch_t buf[128];
|
||||
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
//printf ("sidechannel retrying %s\n", strerror(errno));
|
||||
|
||||
if (mio_dev_sck_read(sck, 0) <= -1) goto sidechan_write_error;
|
||||
|
||||
if (!in_mq)
|
||||
{
|
||||
xx_mq_t* mq;
|
||||
mq = mio_allocmem(mio, MIO_SIZEOF(*mq));
|
||||
if (MIO_UNLIKELY(!mq)) goto sidechan_write_error;
|
||||
mq->msg = *qxmsg;
|
||||
XX_MQ_ENQ (&xx_mq, mq);
|
||||
}
|
||||
|
||||
if (xx_tmridx == MIO_TMRIDX_INVALID)
|
||||
mio_schedtmrjobat (mio, MIO_NULL, enable_accept, &xx_tmridx, sck);
|
||||
|
||||
return 0; /* enqueued for later writing */
|
||||
}
|
||||
else
|
||||
{
|
||||
sidechan_write_error:
|
||||
printf ("sidechannel write error %s\n", strerror(errno));
|
||||
mio_skadtobcstr (mio, &qxmsg->remoteaddr, buf, MIO_COUNTOF(buf), MIO_SKAD_TO_BCSTR_ADDR | MIO_SKAD_TO_BCSTR_PORT);
|
||||
MIO_INFO2 (mio, "unable to handle the accepted connection %ld from %hs\n", (long int)qxmsg->syshnd, buf);
|
||||
|
||||
const char* msg = "HTTP/1.0 503 Service unavailable\r\nConnection: close\r\nContent-Length: 0\r\n\r\n";
|
||||
write (qxmsg->syshnd, msg, strlen(msg));
|
||||
printf ("close %d\n", qxmsg->syshnd);
|
||||
close (qxmsg->syshnd);
|
||||
|
||||
return -1; /* failed to accept */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************
|
||||
{
|
||||
static int sc = 0;
|
||||
printf ("sc => %d\n", sc++);
|
||||
}
|
||||
************************************/
|
||||
|
||||
return 1; /* full success */
|
||||
}
|
||||
|
||||
static void tcp_sck_on_raw_accept (mio_dev_sck_t* sck, mio_syshnd_t syshnd, mio_skad_t* remoteaddr)
|
||||
{
|
||||
/*mio_t* mio = sck->mio;*/
|
||||
|
||||
/* inform the worker of this accepted syshnd */
|
||||
mio_dev_sck_qxmsg_t qxmsg;
|
||||
memset (&qxmsg, 0, MIO_SIZEOF(qxmsg));
|
||||
qxmsg.cmd = MIO_DEV_SCK_QXMSG_NEWCONN;
|
||||
qxmsg.scktype = sck->type;
|
||||
qxmsg.syshnd = syshnd;
|
||||
qxmsg.remoteaddr = *remoteaddr;
|
||||
|
||||
try_to_accept (sck, &qxmsg, 0);
|
||||
}
|
||||
|
||||
static int tcp_sck_on_write (mio_dev_sck_t* tcp, mio_iolen_t wrlen, void* wrctx, const mio_skad_t* dstaddr)
|
||||
{
|
||||
/* won't be invoked */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tcp_sck_on_read (mio_dev_sck_t* tcp, const void* buf, mio_iolen_t len, const mio_skad_t* srcaddr)
|
||||
{
|
||||
/* won't be invoked */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_listener (mio_t* mio, mio_bch_t* addrstr)
|
||||
{
|
||||
mio_dev_sck_make_t mi;
|
||||
mio_dev_sck_t* tcp;
|
||||
mio_dev_sck_bind_t bi;
|
||||
mio_dev_sck_listen_t li;
|
||||
|
||||
memset (&bi, 0, MIO_SIZEOF(bi));
|
||||
if (mio_bcstrtoskad(mio, addrstr, &bi.localaddr) <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "invalid listening address - %hs\n", addrstr);
|
||||
return -1;
|
||||
}
|
||||
bi.options = MIO_DEV_SCK_BIND_REUSEADDR /*| MIO_DEV_SCK_BIND_REUSEPORT |*/;
|
||||
#if defined(USE_SSL)
|
||||
bi.options |= MIO_DEV_SCK_BIND_SSL;
|
||||
bi.ssl_certfile = "localhost.crt";
|
||||
bi.ssl_keyfile = "localhost.key";
|
||||
#endif
|
||||
|
||||
memset (&mi, 0, MIO_SIZEOF(mi));
|
||||
mi.type = (mio_skad_family(&bi.localaddr) == MIO_AF_INET? MIO_DEV_SCK_TCP4: MIO_DEV_SCK_TCP6);
|
||||
mi.options = MIO_DEV_SCK_MAKE_LENIENT;
|
||||
mi.on_write = tcp_sck_on_write;
|
||||
mi.on_read = tcp_sck_on_read;
|
||||
mi.on_connect = tcp_sck_on_connect; /* this is invoked on a client accept as well */
|
||||
mi.on_disconnect = tcp_sck_on_disconnect;
|
||||
mi.on_raw_accept = tcp_sck_on_raw_accept;
|
||||
|
||||
tcp = mio_dev_sck_make(mio, 0, &mi);
|
||||
if (!tcp)
|
||||
{
|
||||
MIO_INFO1 (mio, "Cannot make tcp - %js\n", mio_geterrmsg(mio));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!g_reuse_port)
|
||||
{
|
||||
if (mio_dev_sck_bind(tcp, &bi) <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "tcp mio_dev_sck_bind() failed - %js\n", mio_geterrmsg(mio));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memset (&li, 0, MIO_SIZEOF(li));
|
||||
li.backlogs = 4096;
|
||||
MIO_INIT_NTIME (&li.accept_tmout, 5, 1);
|
||||
if (mio_dev_sck_listen(tcp, &li) <= -1)
|
||||
{
|
||||
MIO_INFO1 (mio, "tcp[2] mio_dev_sck_listen() failed - %js\n", mio_geterrmsg(mio));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static mio_t* g_mio = MIO_NULL;
|
||||
|
||||
static void handle_sigint (int sig)
|
||||
{
|
||||
if (g_mio) mio_stop (g_mio, MIO_STOPREQ_TERMINATION);
|
||||
}
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
mio_t* mio = MIO_NULL;
|
||||
pthread_t t[MAX_NUM_THRS];
|
||||
mio_oow_t i;
|
||||
struct sigaction sigact;
|
||||
int xret = -1;
|
||||
|
||||
// TODO: use getopt() or something similar
|
||||
for (i = 1; i < argc; )
|
||||
{
|
||||
if (strcmp(argv[i], "-r") == 0)
|
||||
{
|
||||
g_reuse_port = 1;
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-t") == 0)
|
||||
{
|
||||
i++;
|
||||
if (i < argc)
|
||||
{
|
||||
g_num_thrs = atoi(argv[i]);
|
||||
if (g_num_thrs < 1 || g_num_thrs > MAX_NUM_THRS)
|
||||
{
|
||||
printf ("Error: %s not allowed for -t\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_num_thrs = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("Error: invalid argument %s\n", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memset (&sigact, 0, MIO_SIZEOF(sigact));
|
||||
sigact.sa_handler = SIG_IGN;
|
||||
sigaction (SIGPIPE, &sigact, MIO_NULL);
|
||||
|
||||
memset (&sigact, 0, MIO_SIZEOF(sigact));
|
||||
sigact.sa_handler = handle_sigint;
|
||||
sigaction (SIGINT, &sigact, MIO_NULL);
|
||||
|
||||
|
||||
XX_MQ_INIT (&xx_mq);
|
||||
xx_tmridx = MIO_TMRIDX_INVALID;
|
||||
|
||||
mio = mio_open(MIO_NULL, 0, MIO_NULL, MIO_FEATURE_ALL, 512, MIO_NULL);
|
||||
if (!mio)
|
||||
{
|
||||
printf ("Cannot open mio\n");
|
||||
goto oops;
|
||||
}
|
||||
|
||||
mio_setoption (mio, MIO_LOG_TARGET_BCSTR, "/dev/stderr");
|
||||
|
||||
g_mio = mio;
|
||||
|
||||
for (i = 0; i < g_num_thrs; i++)
|
||||
pthread_create (&t[i], MIO_NULL, thr_func, mio);
|
||||
|
||||
sleep (1); /* TODO: use pthread_cond_wait()/pthread_cond_signal() or a varialble to see if all threads are up */
|
||||
/* TODO: wait until all threads are ready to serve... */
|
||||
|
||||
if (add_listener(mio, "[::]:9987") <= -1 ||
|
||||
add_listener(mio, "0.0.0.0:9987") <= -1) goto oops;
|
||||
|
||||
printf ("entering the main loop\n");
|
||||
mio_loop (mio);
|
||||
printf ("exiting the main loop\n");
|
||||
|
||||
xret = 0;
|
||||
|
||||
oops:
|
||||
|
||||
memset (&sigact, 0, MIO_SIZEOF(sigact));
|
||||
sigact.sa_handler = SIG_IGN;
|
||||
sigaction (SIGINT, &sigact, MIO_NULL);
|
||||
|
||||
pthread_mutex_lock (&g_htts_mutex);
|
||||
for (i = 0; i < g_num_thrs; i++)
|
||||
{
|
||||
if (g_htts[i]) mio_stop (mio_svc_htts_getmio(g_htts[i]), MIO_STOPREQ_TERMINATION);
|
||||
}
|
||||
pthread_mutex_unlock (&g_htts_mutex);
|
||||
|
||||
for (i = 0; i < g_num_thrs; i++)
|
||||
{
|
||||
pthread_join (t[i], MIO_NULL);
|
||||
}
|
||||
|
||||
|
||||
if (mio) mio_close (mio);
|
||||
return xret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user