forked from osmocom/wireshark
This should get cmake to ignore echld...
svn path=/trunk/; revision=50141
This commit is contained in:
parent
ce088c334d
commit
e200f6cbf9
34
Makefile.am
34
Makefile.am
|
@ -45,10 +45,14 @@ bin_PROGRAMS = \
|
|||
@dftest_bin@ \
|
||||
@dumpcap_bin@ \
|
||||
@reordercap_bin@ \
|
||||
@rawshark_bin@
|
||||
@rawshark_bin@ \
|
||||
@echld_test_bin@
|
||||
|
||||
|
||||
EXTRA_PROGRAMS = wireshark tshark capinfos editcap mergecap dftest \
|
||||
randpkt text2pcap dumpcap reordercap rawshark wireshark_cxx
|
||||
randpkt text2pcap dumpcap reordercap rawshark wireshark_cxx echld_test
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Wireshark configuration files are put in $(pkgdatadir).
|
||||
|
@ -526,6 +530,20 @@ dftest_LDADD = \
|
|||
@LIBSMI_LDFLAGS@
|
||||
dftest_CFLAGS = $(AM_CLEAN_CFLAGS) $(py_dissectors_dir)
|
||||
|
||||
echld_test_LDADD = \
|
||||
epan/libwireshark.la \
|
||||
echld/libechld.la \
|
||||
wsutil/libwsutil.la \
|
||||
@GLIB_LIBS@ -lm \
|
||||
@PCAP_LIBS@ \
|
||||
@SOCKET_LIBS@ \
|
||||
@NSL_LIBS@ \
|
||||
@C_ARES_LIBS@ \
|
||||
@ADNS_LIBS@
|
||||
|
||||
echld_test_CFLAGS = $(AM_CLEAN_CFLAGS)
|
||||
|
||||
|
||||
# Libraries with which to link dumpcap.
|
||||
dumpcap_LDADD = \
|
||||
wsutil/libwsutil.la \
|
||||
|
@ -997,12 +1015,18 @@ endif
|
|||
endif
|
||||
|
||||
|
||||
DIST_SUBDIRS = asn1 codecs doc epan ui ui/cli ui/gtk ui/qt help packaging plugins tools wiretap wsutil docbook
|
||||
DIST_SUBDIRS = asn1 codecs doc epan echld ui ui/cli ui/gtk ui/qt help packaging plugins tools wiretap wsutil docbook
|
||||
|
||||
if HAVE_PLUGINS
|
||||
SUBDIRS = tools wsutil wiretap epan plugins packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
|
||||
SDIRS = tools wsutil wiretap epan plugins packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
|
||||
else
|
||||
SUBDIRS = tools wsutil wiretap epan packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
|
||||
SDIRS = tools wsutil wiretap epan packaging help ui @wireshark_SUBDIRS@ ui/cli . doc
|
||||
endif
|
||||
|
||||
if HAVE_ECHLD
|
||||
SUBDIRS = echld $(SDIRS)
|
||||
else
|
||||
SUBDIRS = $(SDIRS)
|
||||
endif
|
||||
|
||||
help/faq.txt: $(srcdir)/help/faq.py
|
||||
|
|
28
configure.ac
28
configure.ac
|
@ -1451,6 +1451,32 @@ fi
|
|||
AC_SUBST(editcap_bin)
|
||||
AC_SUBST(editcap_man)
|
||||
|
||||
|
||||
|
||||
# Enable/disable echld
|
||||
|
||||
AC_ARG_WITH(echld,
|
||||
AC_HELP_STRING( [--with-echld],
|
||||
[support echld]),
|
||||
[
|
||||
if test "x$withval" = "xno"; then
|
||||
have_echld="no"
|
||||
else
|
||||
have_echld="$withval"
|
||||
fi
|
||||
])
|
||||
AM_CONDITIONAL(HAVE_ECHLD, test "x$have_echld" = "xyes")
|
||||
if test "x$have_echld" = xyes
|
||||
then
|
||||
AC_DEFINE(HAVE_ECHLD, 1, [Define if echld is enabled])
|
||||
echld_test_bin="echld_test\$(EXEEXT)"
|
||||
else
|
||||
have_echld="no"
|
||||
echld_test_bin=""
|
||||
fi
|
||||
AC_SUBST(echld_test_bin)
|
||||
|
||||
|
||||
# Enabling/disabling of dumpcap is done later (after we know if we have PCAP
|
||||
# or not)
|
||||
|
||||
|
@ -2498,6 +2524,7 @@ AC_OUTPUT(
|
|||
tools/lemon/Makefile
|
||||
wiretap/Makefile
|
||||
wsutil/Makefile
|
||||
echld/Makefile
|
||||
_CUSTOM_AC_OUTPUT_
|
||||
,)
|
||||
dnl AC_CONFIG_FILES([tools/setuid-root.pl], [chmod +x tools/setuid-root.pl])
|
||||
|
@ -2617,6 +2644,7 @@ echo " Build text2pcap : $enable_text2pcap"
|
|||
echo " Build randpkt : $enable_randpkt"
|
||||
echo " Build dftest : $enable_dftest"
|
||||
echo " Build rawshark : $enable_rawshark"
|
||||
echo " Build echld : $have_echld"
|
||||
echo ""
|
||||
echo " Save files as pcap-ng by default : $enable_pcap_ng_default"
|
||||
echo " Install dumpcap with capabilities : $setcap_message"
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
# CMakeLists.txt
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
set(ECHLD_FILES
|
||||
echld_common.c
|
||||
echld_child.c
|
||||
echld_dispatcher.c
|
||||
echld_parent.c
|
||||
echld_util.c
|
||||
)
|
||||
|
||||
set(wsutil_LIBS
|
||||
${GLIB2_LIBRARIES}
|
||||
)
|
||||
|
||||
add_library(echld ${LINK_MODE_LIB}
|
||||
${ECHLD_FILES}
|
||||
)
|
||||
|
||||
set(FULL_SO_VERSION "0.0.0")
|
||||
|
||||
set_target_properties(wsutil PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL")
|
||||
set_target_properties(wsutil PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
|
||||
set_target_properties(wsutil PROPERTIES VERSION ${FULL_SO_VERSION} SOVERSION 0)
|
||||
|
||||
# discover and substitute list of include directories for ABI compatibility
|
||||
# checks
|
||||
#get_directory_property(INCLUDE_DIRS INCLUDE_DIRECTORIES)
|
||||
#list(REMOVE_DUPLICATES INCLUDE_DIRS)
|
||||
#string(REGEX REPLACE ";" "\n" INCLUDE_DIRS "${INCLUDE_DIRS}")
|
||||
#configure_file(../abi-descriptor.template abi-descriptor.xml)
|
||||
|
||||
# ABI compliance checker can be obtained from
|
||||
# http://ispras.linux-foundation.org/index.php/ABI_compliance_checker
|
||||
# Checked using version 1.21.12
|
||||
#file(GLOB HEADERS *.h)
|
||||
#file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/abi-check-headers)
|
||||
#
|
||||
#file(COPY ${HEADERS} ../ws_symbol_export.h DESTINATION abi-check-headers)
|
||||
|
||||
#add_custom_command(OUTPUT libwsutil.abi.tar.gz
|
||||
# COMMAND cp ../config.h abi-check-headers/
|
||||
# COMMAND abi-compliance-checker -l libwsutil -v1 ${FULL_SO_VERSION}
|
||||
# -relpath ${CMAKE_CURRENT_BINARY_DIR} -dump-abi abi-descriptor.xml
|
||||
# || cat logs/libwsutil/[0-9]*/log.txt
|
||||
# COMMAND cp abi_dumps/libwsutil/libwsutil_* libwsutil.abi.tar.gz
|
||||
# COMMAND rm -rf abi-check-headers/* abi_dumps
|
||||
# DEPENDS ${HEADERS} wsutil)
|
||||
#add_custom_target(dumpabi-libwsutil DEPENDS libwsutil.abi.tar.gz)
|
||||
|
||||
target_link_libraries(echld ${echld_LIBS})
|
||||
|
||||
if(NOT ${ENABLE_STATIC})
|
||||
install(TARGETS echld
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
endif()
|
||||
|
|
@ -69,9 +69,6 @@ struct _echld_parent {
|
|||
|
||||
#define PARENT_SEND(BYTEARR,CHILDNUM,TYPE) echld_write_frame(parent.dispatcher_fd, BYTEARR, CHILDNUM, TYPE, parent.reqh_id++, NULL)
|
||||
|
||||
|
||||
#define PARENT_FATAL(attrs) parent_fatal attrs
|
||||
|
||||
#ifdef DEBUG_PARENT
|
||||
|
||||
static int dbg_level = 0;
|
||||
|
@ -83,10 +80,11 @@ static void parent_dbg(int level, const char* fmt, ...) {
|
|||
if (level > dbg_level) return;
|
||||
|
||||
va_start(ap,fmt);
|
||||
g_snprintf(str,1024,fmt,ap);
|
||||
g_vsnprintf(str,1024,fmt,ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr,"ParentDebug: level=%d msg='%s'\n",level,str);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
#define PARENT_DBG(attrs) parent_dbg attrs
|
||||
|
@ -96,21 +94,25 @@ static void parent_dbg(int level, const char* fmt, ...) {
|
|||
#endif
|
||||
|
||||
extern void echld_set_parent_dbg_level(int lvl) {
|
||||
PARENT_DBG((0,"Debug Level Set: %d",(dbg_level = lvl)));
|
||||
(dbg_level = lvl);
|
||||
PARENT_DBG((0,"Debug Level Set: %d",lvl));
|
||||
}
|
||||
|
||||
|
||||
#define PARENT_FATAL(attrs) parent_fatal attrs
|
||||
|
||||
static void parent_fatal(int exit_code, const char* fmt, ...) {
|
||||
va_list ap;
|
||||
char str[1024];
|
||||
|
||||
va_start(ap,fmt);
|
||||
g_snprintf(str,1024,fmt,ap);
|
||||
g_vsnprintf(str,1024,fmt,ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef DEBUG_PARENT
|
||||
PARENT_DBG((0,"Fatal error: %s",str));
|
||||
PARENT_DBG((0,"Fatal error: exit_code=%d str=%s",exit_code,str));
|
||||
#else
|
||||
fprintf(stderr,"Fatal error: %s",str);
|
||||
fprintf(stderr,"Fatal error: exit_code=%d str=%s",exit_code,str);
|
||||
#endif
|
||||
|
||||
exit(exit_code);
|
||||
|
@ -184,6 +186,8 @@ void echld_initialize(echld_encoding_t enc) {
|
|||
int from_disp[2];
|
||||
int to_disp[2];
|
||||
|
||||
PARENT_DBG((1,"Echld Starting"));
|
||||
|
||||
if (enc != ECHLD_ENCODING_JSON) {
|
||||
PARENT_FATAL((1111,"Only JSON implemented"));
|
||||
}
|
||||
|
@ -195,45 +199,56 @@ void echld_initialize(echld_encoding_t enc) {
|
|||
} else {
|
||||
int pid;
|
||||
int i;
|
||||
if (( pid = fork() < 0)) {
|
||||
|
||||
pid = fork();
|
||||
|
||||
if ( pid < 0 ) {
|
||||
PARENT_FATAL((1114,"Failed to fork() reason='%s'",strerror(errno)));
|
||||
} else if ( pid == 0) {
|
||||
#ifdef PARENT_THREADS
|
||||
reader_realloc_buf = child_realloc_buff;
|
||||
#endif
|
||||
|
||||
PARENT_DBG((1,"Dispatcher starting"));
|
||||
/* child code */
|
||||
echld_cleanup();
|
||||
//echld_cleanup();
|
||||
|
||||
PARENT_DBG((2,"Dispatcher starting.."));
|
||||
|
||||
echld_dispatcher_start(to_disp,from_disp);
|
||||
//echld_dispatcher_start(to_disp,from_disp);
|
||||
PARENT_FATAL((1115,"This shoudln't happen"));
|
||||
} else {
|
||||
/* parent code */
|
||||
#ifdef PARENT_THREADS
|
||||
reader_realloc_buf = parent_realloc_buff;
|
||||
#endif
|
||||
|
||||
PARENT_DBG((3,"Dispatcher forked"));
|
||||
|
||||
echld_get_all_codecs(NULL, NULL, &parent.enc, &parent.dec);
|
||||
parent.children = g_new0(echld_t,ECHLD_MAX_CHILDREN);
|
||||
parent.snd = g_byte_array_new();
|
||||
parent.dispatcher_fd = to_disp[0];
|
||||
|
||||
echld_init_reader(&(parent.reader),from_disp[1],4096);
|
||||
|
||||
parent.children[0].chld_id = 0;
|
||||
parent.children[0].data = NULL;
|
||||
parent.children[0].state = IDLE;
|
||||
parent.children[0].handlers = g_array_new(TRUE,TRUE,sizeof(hdlr_t));
|
||||
|
||||
for (i=1;i<ECHLD_MAX_CHILDREN;i++) {
|
||||
parent.children[i].chld_id = -1;
|
||||
parent.children[i].data = NULL;
|
||||
parent.children[i].state = FREE;
|
||||
parent.children[i].handlers = g_array_new(TRUE,TRUE,sizeof(hdlr_t));
|
||||
}
|
||||
|
||||
signal(SIGCHLD,parent_reaper);
|
||||
close(to_disp[1]);
|
||||
close(from_disp[0]);
|
||||
PARENT_DBG((3,"Ready"));
|
||||
}
|
||||
|
||||
/* parent code */
|
||||
#ifdef PARENT_THREADS
|
||||
reader_realloc_buf = parent_realloc_buff;
|
||||
#endif
|
||||
|
||||
PARENT_DBG((3,"Dispatcher forked"));
|
||||
|
||||
echld_get_all_codecs(NULL, NULL, &parent.enc, &parent.dec);
|
||||
parent.children = g_new0(echld_t,ECHLD_MAX_CHILDREN);
|
||||
parent.snd = g_byte_array_new();
|
||||
parent.dispatcher_fd = to_disp[0];
|
||||
|
||||
echld_init_reader(&(parent.reader),from_disp[1],4096);
|
||||
|
||||
for (i=0;i<ECHLD_MAX_CHILDREN;i++) {
|
||||
parent.children[i].chld_id = -1;
|
||||
parent.children[i].data = NULL;
|
||||
parent.children[i].state = FREE;
|
||||
parent.children[i].handlers = g_array_new(TRUE,TRUE,sizeof(hdlr_t));
|
||||
}
|
||||
|
||||
signal(SIGCHLD,parent_reaper);
|
||||
close(to_disp[1]);
|
||||
close(from_disp[0]);
|
||||
PARENT_DBG((3,"Ready"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ int main(int argc, char** argv) {
|
|||
do {
|
||||
if (tot_cycles < npings) echld_ping(0,ping_cb,NULL);
|
||||
tot_cycles++;
|
||||
} while( pings < 10 && tot_cycles < 25 && echld_wait(&tv));
|
||||
echld_wait(&tv);
|
||||
} while( (pings < 10) && (tot_cycles < 25));
|
||||
|
||||
fprintf(stderr, "Done: pings=%d errors=%d tot_cycles=%d\n", pings, errors ,tot_cycles );
|
||||
|
||||
|
|
Loading…
Reference in New Issue