First attempt to modularity, through plugins

Initial
Stephane Bortzmeyer 20 years ago
parent 225dfc2d82
commit b46a6cb296

@ -7,6 +7,10 @@ man_MANS = echoping.1
echoping_SOURCES = echoping.c error.c readline.c writen.c util.c http.c icp.c HTParse.c echoping.h icp.h HTParse.h smtp.c
echoping_LDADD =
DOCS=DETAILS
SUBDIRS=plugins
# Export global symbols to plugins
AM_CFLAGS=-rdynamic
TESTS=test-echoping-local test-echoping-remote
MORE_TESTS=test-echoping-proxy test-echoping-icp test-echoping-crypto test-echoping-tos test-echoping-ipv6 test-echoping-idn
@ -61,7 +65,7 @@ upload-force: dist
ncftpput -d upload.log upload.sourceforge.net /incoming $(distdir).tar.gz
realclean: clean
rm -f *~
rm -rf *~ autom4te.cache
EXTRA_DIST = $(man_MANS) $(TESTS) $(DOCS) $(MORE_TESTS)

@ -74,6 +74,10 @@ man_MANS = echoping.1
echoping_SOURCES = echoping.c error.c readline.c writen.c util.c http.c icp.c HTParse.c echoping.h icp.h HTParse.h smtp.c
echoping_LDADD =
DOCS = DETAILS
SUBDIRS = plugins
# Export global symbols to plugins
AM_CFLAGS = -rdynamic
TESTS = test-echoping-local test-echoping-remote
MORE_TESTS = test-echoping-proxy test-echoping-icp test-echoping-crypto test-echoping-tos test-echoping-ipv6 test-echoping-idn
@ -104,8 +108,8 @@ MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS TODO acinclude.m4 aclocal.m4 config.guess \
config.h.in config.sub configure configure.ac install-sh missing \
mkinstalldirs
config.h.in config.sub configure configure.ac install-sh ltmain.sh \
missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@ -247,6 +251,61 @@ uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man1
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
test "$$subdir" = "." && dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
@ -257,9 +316,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
@ -329,6 +393,16 @@ distdir: $(DISTFILES)
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
for subdir in $(SUBDIRS); do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
@ -387,33 +461,34 @@ check-TESTS: $(TESTS)
echo "$$dashes"; \
test "$$failed" -eq 0
info-am:
info: info-am
info: info-recursive
dvi-am:
dvi: dvi-am
dvi: dvi-recursive
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
check: check-recursive
installcheck-am:
installcheck: installcheck-am
installcheck: installcheck-recursive
all-recursive-am: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-exec: install-exec-recursive
install-data-am: install-man
install-data: install-data-am
install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
install: install-recursive
uninstall-am: uninstall-binPROGRAMS uninstall-man
uninstall: uninstall-am
uninstall: uninstall-recursive
all-am: Makefile $(PROGRAMS) $(MANS) config.h
all-redirect: all-am
all-redirect: all-recursive-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
@ -430,18 +505,18 @@ mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
mostlyclean-generic
mostlyclean: mostlyclean-am
mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
clean-depend clean-generic mostlyclean-am
clean: clean-am
clean: clean-recursive
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
distclean-tags distclean-depend distclean-generic \
clean-am
distclean: distclean-am
distclean: distclean-recursive
-rm -f config.status
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
@ -451,7 +526,7 @@ maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
@ -459,13 +534,19 @@ mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile install-man1 uninstall-man1 install-man \
uninstall-man tags mostlyclean-tags distclean-tags clean-tags \
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
clean-depend maintainer-clean-depend check-TESTS info-am info dvi-am \
dvi check check-am installcheck-am installcheck all-recursive-am \
install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
uninstall-man install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend check-TESTS info-am info dvi-am dvi check \
check-am installcheck-am installcheck all-recursive-am install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
@ -519,7 +600,7 @@ upload-force: dist
ncftpput -d upload.log upload.sourceforge.net /incoming $(distdir).tar.gz
realclean: clean
rm -f *~
rm -rf *~ autom4te.cache
# 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.

@ -0,0 +1,24 @@
If you want to write your own plugins, they will have to provide three
functions:
char * init (const int argc, const char **argv)
Accepts remaining arguments (you have to use popt to parse them, or
do it by hand, getopt does not allow you to resume the parsing) and
returns a string identifying the port name. If it makes no sens, you
can safely return NULL.
void start (struct addrinfo *res)
Typically just stores the res structure for later use.
void execute ()
Connects and do whatever the protocol requires.
Start your plugin source code with:
#define IN_PLUGIN
#include "../echoping.h"
You can look at random.c, the simplest plugin, and whois.c, the
simplest which still does something useful.
$Id$

@ -26,6 +26,7 @@ Current features:
- can repeat the test and display various measures about it,
- supports IPv6 as well as IPv4,
- supports IDN (Unicode domain names),
- supports plugins written by you, to test even more protocols (see PLUGINS),
- can use T/TCP on systems which support it.
Examples of output:

@ -126,7 +126,6 @@ AC_TRY_LINK([#include <math.h>
])
])
dnl Check the port name for HTTP. Everyone should declare "http" but
dnl not everyone does. This test is BUGgy, we should use a program
dnl which calls getservbyname() otherwise we miss NIS tables, for

1
SRC/aclocal.m4 vendored

@ -138,7 +138,6 @@ AC_TRY_LINK([#include <math.h>
])
])
dnl Check the port name for HTTP. Everyone should declare "http" but
dnl not everyone does. This test is BUGgy, we should use a program
dnl which calls getservbyname() otherwise we miss NIS tables, for

@ -3,6 +3,9 @@
/* Crypto (TLS) support */
#undef GNUTLS
/* Define to 1 if you have the `dlopen' function. */
#undef HAVE_DLOPEN
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
@ -21,6 +24,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

364
SRC/configure vendored

@ -309,7 +309,8 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CPP EGREP LIBOBJS LTLIBOBJS'
ac_subdirs_all="$ac_subdirs_all plugins"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CPP EGREP subdirs LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -5152,6 +5153,185 @@ fi
done
for ac_func in dlopen
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
char (*f) () = $ac_func;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
else
echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_dl_dlopen=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDL 1
_ACEOF
LIBS="-ldl $LIBS"
else
{ { echo "$as_me:$LINENO: error: echoping requires dlopen (dynamic loading of libraries) for plugins" >&5
echo "$as_me: error: echoping requires dlopen (dynamic loading of libraries) for plugins" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
done
if test "$LIBIDN" = "1"; then
echo "$as_me:$LINENO: checking for idna_to_ascii_8z in -lidn" >&5
@ -5630,6 +5810,10 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall"
fi
subdirs="$subdirs plugins"
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -6282,6 +6466,7 @@ s,@MAKEINFO@,$MAKEINFO,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@subdirs@,$subdirs,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
@ -6894,6 +7079,183 @@ if test "$no_create" != yes; then
$ac_cs_success || { (exit 1); exit 1; }
fi
#
# CONFIG_SUBDIRS section.
#
if test "$no_recursion" != yes; then
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
ac_prev=
for ac_arg in $ac_configure_args; do
if test -n "$ac_prev"; then
ac_prev=
continue
fi
case $ac_arg in
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
| --c=*)
;;
--config-cache | -C)
;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
;;
*) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
esac
done
# Always prepend --prefix to ensure using the same prefix
# in subdir configurations.
ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args"
ac_popdir=`pwd`
for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
# Do not complain, so a configure script can configure whichever
# parts of a large source tree are present.
test -d $srcdir/$ac_dir || continue
{ echo "$as_me:$LINENO: configuring in $ac_dir" >&5
echo "$as_me: configuring in $ac_dir" >&6;}
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A "../" for each directory in $ac_dir_suffix.
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
ac_dir_suffix= ac_top_builddir=
fi
case $srcdir in
.) # No --srcdir option. We are building in place.
ac_srcdir=.
if test -z "$ac_top_builddir"; then
ac_top_srcdir=.
else
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
fi ;;
[\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir ;;
*) # Relative path.
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
if test -f $ac_srcdir/configure.gnu; then
ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
elif test -f $ac_srcdir/configure; then
ac_sub_configure="$SHELL '$ac_srcdir/configure'"
elif test -f $ac_srcdir/configure.in; then
ac_sub_configure=$ac_configure
else
{ echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
ac_sub_configure=
fi
# The recursion is here.
if test -n "$ac_sub_configure"; then
# Make the cache file name correct relative to the subdirectory.
case $cache_file in
[\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
*) # Relative path.
ac_sub_cache_file=$ac_top_builddir$cache_file ;;
esac
{ echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
# The eval makes quoting arguments work.
eval $ac_sub_configure $ac_sub_configure_args \
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
{ { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
{ (exit 1); exit 1; }; }
fi
cd "$ac_popdir"
done
fi
echo ""
echo "Configuration of echoping:"

@ -151,6 +151,9 @@ AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_ntop, ,
AC_CHECK_FUNCS(gettimeofday socket sigaction strerror, , AC_MSG_ERROR(Missing mandatory function))
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(dlopen, ,
[AC_CHECK_LIB(dl,dlopen, ,
[AC_MSG_ERROR([echoping requires dlopen (dynamic loading of libraries) for plugins])])])
if test "$LIBIDN" = "1"; then
CF_LIB_LIBIDN
@ -251,6 +254,7 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall"
fi
AC_CONFIG_SUBDIRS(plugins)
AC_OUTPUT(Makefile)
AC_DEFUN([DISPLAY_SETTING],

@ -25,6 +25,7 @@ echoping \- tests a remote host with TCP or UDP
.RI [-S]
.RI [-A]
.RI [-a]
.RI [-m plugin]
.B hostname
[:port]
@ -124,6 +125,8 @@ or
.BR ip(4)
(depending on your Unix). /usr/include/netinet/ip.h may contain
interesting constants for setting Type Of Service.
.IP -m\ plugin
Load the given plugin. Quite experimental.
.SH EXAMPLES
.IP echoping\ \-v\ foobar.example.com
Tests the remote machine with TCP echo (one test).

File diff suppressed because it is too large Load Diff

@ -33,6 +33,7 @@
#include <string.h>
#include <signal.h>
#include <math.h>
#include <dlfcn.h>
#ifdef OPENSSL
#include <openssl/crypto.h>
@ -113,6 +114,20 @@ struct result
unsigned short valid;
struct timeval timevalue;
};
unsigned short timeout_flag;
#ifndef IN_PLUGIN
/* The functions we will find in the plugin */
/* Initializes the plugin with its arguments. Returns the port name or number. */
typedef char * (*init_f) (const int argc, const char **argv);
init_f plugin_init;
typedef void (*start_f) (struct addrinfo *);
start_f plugin_start;
typedef void (*execute_f) ();
execute_f plugin_execute;
#endif
#endif
struct timeval null_timeval;

@ -0,0 +1,26 @@
CCFLAGS=-DHAVE_CONFIG_H -Wall -O0 -g
CCDYNAMICFLAGS=${CCFLAGS} -fPIC
LDFLAGS=
LDDYNAMICFLAGS=${LDFLAGS} -shared
PLUGINS=random.so whois.so
all: $(PLUGINS)
%.o: %.c
${CC} ${CCDYNAMICFLAGS} -c -o $@ $<
%.so: %.o
${CC} ${LDDYNAMICFLAGS} -o $@ $<
clean:
-rm -f *.o *.so program
distclean: clean
-rm -f *~
.SECONDARY: ${OBJECTS}
# $Id$

3294
SRC/plugins/configure vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,11 @@
dnl $Id$
AC_INIT(random.c)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_CHECK_FUNCS(usleep)
AC_OUTPUT(Makefile)

@ -0,0 +1,22 @@
/*
* Pseudo-random plugin. Just an example. $Id$
*/
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
void
init (const int argc, const char *argv[])
{
struct timeval tv;
(void) gettimeofday (&tv, (struct timezone *) NULL);
srand (tv.tv_usec);
}
void
execute ()
{
usleep (rand () % 1000000);
}

@ -0,0 +1,51 @@
/*
* Whois (RFC 954) plugin.
*
* $Id$
*/
#define IN_PLUGIN
#include "../echoping.h"
#define MAX_REQUEST 256
struct addrinfo whois_server;
const char *request = "nic.fr";
int n;
int sockfd;
FILE *files = NULL;
char *
init (const int argc, const char **argv)
{
return "nicname";
}
void
start (struct addrinfo *res)
{
whois_server = *res;
}
void
execute ()
{
int nr = 0;
char recvline[MAX_LINE + 1];
char complete_request[MAX_REQUEST];
if ((sockfd =
socket (whois_server.ai_family, whois_server.ai_socktype,
whois_server.ai_protocol)) < 0)
err_sys ("Can't open socket");
if (connect (sockfd, whois_server.ai_addr, whois_server.ai_addrlen) < 0)
err_sys ("Can't connect to server");
if ((files = fdopen (sockfd, "r")) == NULL)
err_sys ("Cannot fdopen");
sprintf (complete_request, "%s\r\n", request);
n = strlen (complete_request);
if (writen (sockfd, complete_request, n) != n)
err_sys ("writen error on socket");
/* Read from the server */
nr = readline (files, recvline, n, 0);
close (sockfd);
}
Loading…
Cancel
Save