From 2c7c381cdaded61cded1d8c6479c1fab9537b764 Mon Sep 17 00:00:00 2001 From: Kaian Date: Sat, 22 Jun 2013 17:32:51 +0200 Subject: [PATCH] More ui rework and refactoring * Improved pcpa file parsing * Improved ui memory management * Added wrappers for ui functions * Adedd destructor for uis * Fixed scroll arrows in Call List * Moar moar moar --- Makefile.in | 113 +++++++++++----- aclocal.m4 | 106 +++++++++++---- configure | 301 +++++++++++++++++++++++++---------------- configure.ac | 28 ++-- src/Makefile.in | 79 ++++++++--- src/pcap.c | 10 +- src/sip.c | 76 ++++++----- src/sip.h | 7 +- src/ui_call_flow.c | 147 +++++++++++--------- src/ui_call_flow.h | 5 +- src/ui_call_flow_ex.c | 4 +- src/ui_call_list.c | 68 +++++++--- src/ui_call_list.h | 3 +- src/ui_call_raw.c | 97 +++++++++++--- src/ui_call_raw.h | 17 ++- src/ui_manager.c | 303 ++++++++++++++++++++++++------------------ src/ui_manager.h | 34 +++-- 17 files changed, 903 insertions(+), 495 deletions(-) diff --git a/Makefile.in b/Makefile.in index fd7abcc..4667e47 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @@ -15,6 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -44,11 +61,11 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +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_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ SOURCES = DIST_SOURCES = @@ -59,6 +76,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -71,9 +93,11 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -102,6 +126,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -201,7 +227,7 @@ SUBDIRS = src all: all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ @@ -405,13 +431,10 @@ distdir: $(DISTFILES) done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -443,7 +466,11 @@ dist-gzip: distdir $(am__remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir @@ -451,7 +478,7 @@ dist-lzma: distdir $(am__remove_distdir) dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir @@ -482,6 +509,8 @@ distcheck: dist bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ @@ -501,6 +530,7 @@ distcheck: dist && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -529,8 +559,16 @@ distcheck: dist list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -561,10 +599,15 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + 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: @@ -651,15 +694,15 @@ uninstall-am: .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ - distclean distclean-generic distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am 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 installdirs-am maintainer-clean \ + dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am diff --git a/aclocal.m4 b/aclocal.m4 index 9a13098..ab044ee 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,8 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. # This file 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. @@ -13,18 +14,21 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, -[m4_warning([this file was generated for autoconf 2.67. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. # # This file 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. +# serial 1 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been @@ -34,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], +m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,19 +54,21 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl +[AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file 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. +# serial 1 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. @@ -144,14 +150,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. # # This file 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. -# serial 10 +# serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -191,6 +197,7 @@ AC_CACHE_CHECK([dependency style of $depcc], # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -255,7 +262,7 @@ AC_CACHE_CHECK([dependency style of $depcc], break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -320,10 +327,13 @@ AC_DEFUN([AM_DEP_TRACK], if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- @@ -545,12 +555,15 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. # # This file 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. +# serial 1 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -682,12 +695,15 @@ else fi ]) -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. # # This file 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. +# serial 1 + # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. @@ -710,13 +726,14 @@ esac # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. # # This file 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. -# serial 4 +# serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -724,13 +741,13 @@ AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) -# ------------------------------ +# -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- +# ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) @@ -806,13 +823,13 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2011 Free Software Foundation, Inc. # # This file 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. -# serial 1 +# serial 2 # AM_SILENT_RULES([DEFAULT]) # -------------------------- @@ -827,18 +844,50 @@ yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac +dnl +dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using `$V' instead of `$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file 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. +# serial 1 + # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't @@ -861,13 +910,13 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file 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. -# serial 2 +# serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- @@ -876,13 +925,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- +# -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -904,10 +953,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) diff --git a/configure b/configure index 72f33d4..331050c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for sngrep 0.0-alpha. +# Generated by GNU Autoconf 2.68 for sngrep 0.0-alpha. # # Report bugs to . # @@ -93,6 +93,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -218,11 +219,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -614,6 +622,7 @@ CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -629,6 +638,8 @@ CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V am__untar am__tar AMTAR @@ -695,6 +706,7 @@ ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking +enable_debug ' ac_precious_vars='build_alias host_alias @@ -1112,7 +1124,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1328,6 +1340,7 @@ Optional Features: --disable-silent-rules verbose build output (undo: `make V=0') --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-debug Debug compilation (Default = no) Some influential environment variables: CC C compiler command @@ -1409,7 +1422,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF sngrep configure 0.0-alpha -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1457,7 +1470,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1494,7 +1507,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1507,10 +1520,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1577,7 +1590,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1586,7 +1599,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1627,7 +1640,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1641,7 +1654,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1659,7 +1672,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1696,7 +1709,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1742,7 +1755,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1751,7 +1764,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by sngrep $as_me 0.0-alpha, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2009,7 +2022,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2146,7 +2159,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2233,11 +2246,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's @@ -2323,7 +2336,7 @@ if test "$cross_compiling" != no; then set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2363,7 +2376,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2416,7 +2429,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2467,7 +2480,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2507,7 +2520,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2595,11 +2608,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -2615,6 +2628,33 @@ yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi AM_BACKSLASH='\' @@ -2673,6 +2713,7 @@ fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -2693,7 +2734,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2733,7 +2774,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2786,7 +2827,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2826,7 +2867,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2885,7 +2926,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2929,7 +2970,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2984,7 +3025,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3099,7 +3140,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3142,7 +3183,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3201,7 +3242,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3212,7 +3253,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3253,7 +3294,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3263,7 +3304,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3300,7 +3341,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3378,7 +3419,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3477,7 +3518,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3486,6 +3527,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -3545,7 +3587,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -3613,7 +3655,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -3729,7 +3771,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3741,7 +3783,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -3804,7 +3846,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3871,7 +3913,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4000,7 +4042,7 @@ done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : +if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= @@ -4022,7 +4064,7 @@ $as_echo "#define _MINIX 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : +if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4060,6 +4102,20 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } +# debug compilation +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; enable_debug=$enableval +else + enable_debug=no +fi + + +if test "$enable_debug" = "yes" ; then + CFLAGS="$CFLAGS -g -O0 -Wall -Werror -Wno-uninitialized" + CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Werror -Wno-uninitialized" +fi + # Minimum checks for a C program :) ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4071,7 +4127,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4111,7 +4167,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4164,7 +4220,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4204,7 +4260,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4263,7 +4319,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4307,7 +4363,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4362,7 +4418,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -4391,7 +4447,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4428,7 +4484,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -4506,7 +4562,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4605,7 +4661,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4614,6 +4670,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -4673,7 +4730,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -4744,7 +4801,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4788,7 +4845,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -4866,7 +4923,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4903,7 +4960,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -4989,7 +5046,7 @@ depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4998,6 +5055,7 @@ else # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -5057,7 +5115,7 @@ else break fi ;; - msvisualcpp | msvcmsys) + msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. @@ -5126,7 +5184,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -5202,7 +5260,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check for other REQUIRED libraries ac_fn_c_check_header_mongrel "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" -if test "x$ac_cv_header_ncurses_h" = x""yes; then : +if test "x$ac_cv_header_ncurses_h" = xyes; then : else @@ -5213,11 +5271,11 @@ fi ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" -if test "x$ac_cv_header_pcap_h" = x""yes; then : +if test "x$ac_cv_header_pcap_h" = xyes; then : else - as_fn_error $? " You need to have libpcap development files installed to compile sngrep." "$LINENO" 5 + as_fn_error $? " You need to have libpcap development files installed to compile sngrep." "$LINENO" 5 fi @@ -5225,7 +5283,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 $as_echo_n "checking for initscr in -lncurses... " >&6; } -if test "${ac_cv_lib_ncurses_initscr+set}" = set; then : +if ${ac_cv_lib_ncurses_initscr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5259,7 +5317,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 $as_echo "$ac_cv_lib_ncurses_initscr" >&6; } -if test "x$ac_cv_lib_ncurses_initscr" = x""yes; then : +if test "x$ac_cv_lib_ncurses_initscr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNCURSES 1 _ACEOF @@ -5268,14 +5326,14 @@ _ACEOF else - as_fn_error $? " You need to have libncurses installed to compile sngrep." "$LINENO" 5 + as_fn_error $? " You need to have libncurses installed to compile sngrep." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new_panel in -lpanel" >&5 $as_echo_n "checking for new_panel in -lpanel... " >&6; } -if test "${ac_cv_lib_panel_new_panel+set}" = set; then : +if ${ac_cv_lib_panel_new_panel+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5309,7 +5367,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panel_new_panel" >&5 $as_echo "$ac_cv_lib_panel_new_panel" >&6; } -if test "x$ac_cv_lib_panel_new_panel" = x""yes; then : +if test "x$ac_cv_lib_panel_new_panel" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPANEL 1 _ACEOF @@ -5318,14 +5376,14 @@ _ACEOF else - as_fn_error $? " You need to have libpanel installed to compile sngrep." "$LINENO" 5 + as_fn_error $? " You need to have libpanel installed to compile sngrep." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5359,7 +5417,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -5368,14 +5426,14 @@ _ACEOF else - as_fn_error $? " You need to have libpthread installed to compile sngrep." "$LINENO" 5 + as_fn_error $? " You need to have libpthread installed to compile sngrep." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_open_offline in -lpcap" >&5 $as_echo_n "checking for pcap_open_offline in -lpcap... " >&6; } -if test "${ac_cv_lib_pcap_pcap_open_offline+set}" = set; then : +if ${ac_cv_lib_pcap_pcap_open_offline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5409,7 +5467,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_offline" >&5 $as_echo "$ac_cv_lib_pcap_pcap_open_offline" >&6; } -if test "x$ac_cv_lib_pcap_pcap_open_offline" = x""yes; then : +if test "x$ac_cv_lib_pcap_pcap_open_offline" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPCAP 1 _ACEOF @@ -5418,7 +5476,7 @@ _ACEOF else - as_fn_error $? " You need to have libpcap installed to compile sngrep." "$LINENO" 5 + as_fn_error $? " You need to have libpcap installed to compile sngrep." "$LINENO" 5 fi @@ -5429,7 +5487,7 @@ fi set dummy stdbuf; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_STDBUF+set}" = set; then : +if ${ac_cv_path_STDBUF+:} false; then : $as_echo_n "(cached) " >&6 else case $STDBUF in @@ -5480,7 +5538,7 @@ fi set dummy ngrep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_NGREP+set}" = set; then : +if ${ac_cv_path_NGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $NGREP in @@ -5638,10 +5696,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -5733,7 +5802,7 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -5834,6 +5903,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -6141,7 +6211,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by sngrep $as_me 0.0-alpha, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6199,7 +6269,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ sngrep config.status 0.0-alpha -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -6320,7 +6390,7 @@ do "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -6342,9 +6412,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -6352,12 +6423,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6379,7 +6451,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -6407,7 +6479,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -6455,7 +6527,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -6487,7 +6559,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -6527,7 +6599,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6546,7 +6618,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -6555,7 +6627,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -6581,8 +6653,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -6718,21 +6790,22 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; diff --git a/configure.ac b/configure.ac index 161885b..416255f 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,16 @@ AC_COPYRIGHT("Irontec S.L.") # Define _GNU_SOURCE etc. AC_USE_SYSTEM_EXTENSIONS +# debug compilation +AC_ARG_ENABLE(debug, + AC_HELP_STRING(--enable-debug, [Debug compilation (Default = no)]), + enable_debug=$enableval, enable_debug=no) + +if test "$enable_debug" = "yes" ; then + CFLAGS="$CFLAGS -g -O0 -Wall -Werror -Wno-uninitialized" + CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Werror -Wno-uninitialized" +fi + # Minimum checks for a C program :) AC_PROG_CC AC_PROG_CXX @@ -24,37 +34,37 @@ AC_CHECK_HEADER([ncurses.h], [], [ ]) AC_CHECK_HEADER([pcap.h], [], [ - AC_MSG_ERROR([ You need to have libpcap development files installed to compile sngrep.]) + AC_MSG_ERROR([ You need to have libpcap development files installed to compile sngrep.]) ]) AC_CHECK_LIB([ncurses], [initscr], [], [ - AC_MSG_ERROR([ You need to have libncurses installed to compile sngrep.]) + AC_MSG_ERROR([ You need to have libncurses installed to compile sngrep.]) ]) AC_CHECK_LIB([panel], [new_panel], [], [ - AC_MSG_ERROR([ You need to have libpanel installed to compile sngrep.]) + AC_MSG_ERROR([ You need to have libpanel installed to compile sngrep.]) ]) AC_CHECK_LIB([pthread], [pthread_create], [], [ - AC_MSG_ERROR([ You need to have libpthread installed to compile sngrep.]) + AC_MSG_ERROR([ You need to have libpthread installed to compile sngrep.]) ]) AC_CHECK_LIB([pcap], [pcap_open_offline], [], [ - AC_MSG_ERROR([ You need to have libpcap installed to compile sngrep.]) + AC_MSG_ERROR([ You need to have libpcap installed to compile sngrep.]) ]) ####################################################################### # Check for REQUIRED binaries AC_PATH_PROG(STDBUF, stdbuf, [:], $PATH) AS_IF([test "x$STDBUF" != "x:"], - [AC_DEFINE_UNQUOTED([STDBUF_BIN], ["$STDBUF"])], - [AC_MSG_ERROR([stdbuf (coreutils) is needed to run sngrep])] + [AC_DEFINE_UNQUOTED([STDBUF_BIN], ["$STDBUF"])], + [AC_MSG_ERROR([stdbuf (coreutils) is needed to run sngrep])] ) AC_PATH_PROG(NGREP, ngrep, [:], $PATH) AS_IF([test "x$NGREP" != "x:"], - [AC_DEFINE_UNQUOTED([NGREP_BIN], ["$NGREP"])], - [AC_MSG_ERROR([ngrep is needed to run sngrep])] + [AC_DEFINE_UNQUOTED([NGREP_BIN], ["$NGREP"])], + [AC_MSG_ERROR([ngrep is needed to run sngrep])] ) ###################################################################### diff --git a/src/Makefile.in b/src/Makefile.in index 51fcffa..ae672f2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -56,15 +73,33 @@ am__depfiles_maybe = depfiles am__mv = mv -f 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_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ CCLD = $(CC) 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_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(sngrep_SOURCES) DIST_SOURCES = $(sngrep_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -193,8 +228,11 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @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; \ @@ -228,9 +266,9 @@ uninstall-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES) +sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES) $(EXTRA_sngrep_DEPENDENCIES) @rm -f sngrep$(EXEEXT) - $(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -249,18 +287,18 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_manager.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -361,10 +399,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + 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: diff --git a/src/pcap.c b/src/pcap.c index bbd74c0..58d9926 100644 --- a/src/pcap.c +++ b/src/pcap.c @@ -53,6 +53,9 @@ int load_pcap_file(const char* file) { u_char *msg_payload; // Packet payload data int size_payload; // Packet payload size + struct timeval tvBegin, tvEnd; + int packagecnt = 0; + gettimeofday(&tvBegin, NULL); // Grab starting time // Open PCAP file if ((handle = pcap_open_offline(file, errbuf)) == NULL) { fprintf(stderr,"Couldn't open pcap file %s: %s\n", file, errbuf); @@ -64,7 +67,7 @@ int load_pcap_file(const char* file) { // Loop through packages while ((packet = pcap_next(handle,&header))) { - + packagecnt++; // Get link header size from datalink type if (linktype == DLT_EN10MB ) { eptr = (struct ether_header *) packet; @@ -100,7 +103,6 @@ int load_pcap_file(const char* file) { // XXX Get current time char timestr[200]; - //time_t t = time(NULL); struct tm *time = localtime(&t); strftime(timestr, sizeof(timestr), "%Y/%m/%d %T", time); @@ -115,7 +117,9 @@ int load_pcap_file(const char* file) { // Close PCAP file pcap_close(handle); - + gettimeofday(&tvEnd, NULL); // Grab ending time + long int diff = ((tvEnd.tv_usec + 1000000 * tvEnd.tv_sec) - (tvBegin.tv_usec + 1000000 * tvBegin.tv_sec)) / 1000; + printf("%d packages readed in %ld ms.\n", packagecnt, diff); return 0; } diff --git a/src/sip.c b/src/sip.c index 5ad46eb..3e41954 100644 --- a/src/sip.c +++ b/src/sip.c @@ -118,14 +118,10 @@ char *get_callid(const char* payload) */ struct sip_call *call_new(const char *callid) { - struct sip_call *call = malloc(sizeof(struct sip_call)); // XXX LOCKING + struct sip_call *call = malloc(sizeof(struct sip_call)); + memset(call, 0, sizeof(sip_call_t)); call->callid = strdup(callid); - call->messages = NULL; - call->finished = 0; - call->next = NULL; - call->prev = NULL; - memset(&call->xcallid, 0, sizeof(call->xcallid)); // XXX Put this call at the end of the call list // Order is important (FIXME)!!! @@ -133,8 +129,7 @@ struct sip_call *call_new(const char *callid) if (!calls) { calls = call; } else { - for (cur = calls; cur; prev = cur, cur = cur->next) - ; + for (cur = calls; cur; prev = cur, cur = cur->next); prev->next = call; call->prev = prev; } @@ -154,38 +149,23 @@ struct sip_msg *call_add_message(struct sip_call *call, const char *header, cons struct sip_msg *msg; if (!(msg = malloc(sizeof(struct sip_msg)))) return NULL; - - memset(&msg->type, 0, sizeof(msg->type)); - memset(&msg->ip_from, 0, sizeof(msg->ip_from)); - memset(&msg->ip_to, 0, sizeof(msg->ip_to)); - + memset(msg, 0, sizeof(sip_msg_t)); msg->call = call; - msg->next = NULL; - msg->plines = 0; // XXX - - // Parse message header - if (msg_parse_header(msg, header) != 0) { - free(msg); - return NULL; - } - - // Parse message payload - if (msg_parse_payload(msg, payload) != 0) { - free(msg); - return NULL; - } + msg->headerptr = strdup(header); + msg->payloadptr = strdup(payload); // XXX Put this msg at the end of the msg list // Order is important!!! struct sip_msg *cur, *prev; if (!call->messages) { - call->messages = msg; + call->messages = parse_msg(msg); } else { for (cur = call->messages; cur; prev = cur, cur = cur->next) ; prev->next = msg; } - return msg; + + return msg; } /** @@ -199,6 +179,7 @@ struct sip_msg *call_add_message(struct sip_call *call, const char *header, cons int msg_parse_header(struct sip_msg *msg, const char *header) { struct tm when = { 0 }; + char time[20]; if (sscanf(header, "U %d/%d/%d %d:%d:%d.%d %s -> %s", &when.tm_year, &when.tm_mon, &when.tm_mday, &when.tm_hour, &when.tm_min, &when.tm_sec, (int*) &msg->ts.tv_usec, msg->ip_from, msg->ip_to)) { @@ -210,9 +191,8 @@ int msg_parse_header(struct sip_msg *msg, const char *header) msg->ts.tv_sec = (long int) msg - msg->timet; // Convert to string - strftime(msg->time, 20, "%H:%M:%S", localtime(&msg->timet)); - sprintf(msg->time, "%s.%06d", msg->time, (int) msg->ts.tv_usec); - + strftime(time, 20, "%H:%M:%S", localtime(&msg->timet)); + sprintf(msg->time, "%s.%06d", time, (int) msg->ts.tv_usec); return 0; } return 1; @@ -234,7 +214,6 @@ int msg_parse_payload(struct sip_msg *msg, const char *payload) char *body = strdup(payload); char * pch; char rest[256]; - int irest; for (pch = strtok(body, "\n"); pch; pch = strtok(NULL, "\n")) { // fix last ngrep line character @@ -373,7 +352,7 @@ struct sip_msg *get_next_msg(const struct sip_call *call, const struct sip_msg * if (msg == NULL) { return call->messages; } else { - return msg->next; + return parse_msg(msg->next); } } @@ -428,3 +407,32 @@ struct sip_msg *get_next_msg_ex(const struct sip_call *call, const struct sip_ms } } +sip_msg_t *parse_msg(sip_msg_t *msg){ + + // Nothing to parse + if (!msg) + return NULL; + + // Message already parsed + if (msg->parsed) + return msg; + + // Parse message header + if (msg_parse_header(msg, msg->headerptr) != 0) { + return NULL; + } + + // Parse message payload + if (msg_parse_payload(msg, msg->payloadptr) != 0) { + return NULL; + } + + // Free message pointers + free(msg->headerptr); + free(msg->payloadptr); + + // Mark as parsed + msg->parsed = 1; + // Return the parsed message + return msg; +} diff --git a/src/sip.h b/src/sip.h index 38e2b8f..271e7cd 100644 --- a/src/sip.h +++ b/src/sip.h @@ -48,11 +48,14 @@ struct sip_msg char sip_from[256]; char sip_to[256]; char type[40]; - int cseq; + int cseq; time_t timet; // FIXME not required struct timeval ts; + char *headerptr; + char *payloadptr; const char *payload[80]; // FIXME Payload in one struct int plines; // FIXME not required + int parsed; // Flag to mark if payload data has been parsed struct sip_call *call; /* Message owner */ struct sip_msg *next; /* Messages linked list */ @@ -202,4 +205,6 @@ struct sip_msg *get_next_msg(const struct sip_call *call, const struct sip_msg * */ struct sip_msg *get_next_msg_ex(const struct sip_call *call, const struct sip_msg *msg); +sip_msg_t *parse_msg(sip_msg_t *msg); + #endif diff --git a/src/ui_call_flow.c b/src/ui_call_flow.c index a765690..33fc25b 100644 --- a/src/ui_call_flow.c +++ b/src/ui_call_flow.c @@ -19,6 +19,7 @@ ** along with this program. If not, see . ** ****************************************************************************/ +#include #include #include "ui_manager.h" #include "ui_call_flow.h" @@ -30,13 +31,13 @@ */ PANEL *call_flow_create() { - PANEL *panel; - WINDOW *win; - int height, width; - call_flow_info_t *info; + PANEL *panel; + WINDOW *win; + int height, width; + call_flow_info_t *info; - // Create a new panel to fill all the screen - panel = new_panel(newwin(LINES, COLS, 0, 0)); + // Create a new panel to fill all the screen + panel = new_panel(newwin(LINES, COLS, 0, 0)); // Initialize Call List specific data info = malloc(sizeof(call_flow_info_t)); memset(info, 0, sizeof(call_flow_info_t)); @@ -72,23 +73,41 @@ PANEL *call_flow_create() mvwprintw(win, height - 2, 16, "F1: Show help"); mvwprintw(win, height - 2, 32, "X: Show Extendend"); - return panel; + return panel; +} + +void call_flow_destroy(PANEL *panel) +{ + call_flow_info_t *info; + + // Hide the panel + hide_panel(panel); + + // Free the panel information + if ((info = (call_flow_info_t*)panel_userptr(panel))) + free(info); + + // Delete panel window + delwin(panel_window(panel)); + // Delete panel + del_panel(panel); } int call_flow_draw(PANEL *panel) { - int i, height, width, cline, cseq, msgcnt, startpos = 7; - sip_msg_t *msg; + int i, height, width, cline, msgcnt, startpos = 7; + sip_msg_t *msg; + //int cseq; - // Get panel information - call_flow_info_t *info = (call_flow_info_t*) panel_userptr(panel); + // Get panel information + call_flow_info_t *info = (call_flow_info_t*) panel_userptr(panel); // This panel only makes sense with a selected call if (!info->call) return 1; // Get window of main panel WINDOW *win = panel_window(panel); - msgcnt = get_n_msgs(info->call); + msgcnt = get_n_msgs(info->call); // Get data from first message const char *from = info->call->messages->ip_from; @@ -106,20 +125,21 @@ int call_flow_draw(PANEL *panel) mvwvline(win, 7, 20, ACS_VLINE, info->linescnt); mvwvline(win, 7, 50, ACS_VLINE, info->linescnt); - for (cline = startpos, msg = info->first_msg; msg; msg = get_next_msg(info->call, msg)) { - // Print messages with differents CSeq separed by one line - //if (cseq != msg->cseq){ - // cline++; - // cseq = msg->cseq; - //} + for (cline = startpos, msg = info->first_msg; msg; msg = get_next_msg(info->call, msg)) { + // Print messages with differents CSeq separed by one line + // XXX Not for now, makes harder to control selected message and scroll + //if (cseq != msg->cseq){ + // cline++; + // cseq = msg->cseq; + //} - // Check if there are still 2 spaces for this message in the list - if (cline >= info->linescnt + startpos ) { - // Draw 2 arrow to show there are more messages + // Check if there are still 2 spaces for this message in the list + if (cline >= info->linescnt + startpos ) { + // Draw 2 arrow to show there are more messages mvwaddch(win, info->linescnt + startpos - 1, 20, ACS_DARROW); mvwaddch(win, info->linescnt + startpos - 1, 50, ACS_DARROW); - break; - } + break; + } // Print timestamp mvwprintw(win, cline, 2, "%s", msg->time); @@ -148,27 +168,27 @@ int call_flow_draw(PANEL *panel) wattroff(win, COLOR_PAIR(INCOMING_COLOR)); wattroff(win, A_REVERSE); - // One message fills 2 lines + // One message fills 2 lines cline += 2; } - // Clean the message area - for (cline = 3, i = 0; i < info->linescnt + 4; i++) - mvwprintw(win, cline++, 62, "%*s", width - 63, ""); + // Clean the message area + for (cline = 3, i = 0; i < info->linescnt + 4; i++) + mvwprintw(win, cline++, 62, "%*s", width - 63, ""); - // Print the message payload in the right side of the screen - for (cline = 3, i = 0; i < info->cur_msg->plines && i < info->linescnt + 4; i++) - mvwprintw(win, cline++, 62, "%.*s", width - 63, info->cur_msg->payload[i]); + // Print the message payload in the right side of the screen + for (cline = 3, i = 0; i < info->cur_msg->plines && i < info->linescnt + 4; i++) + mvwprintw(win, cline++, 62, "%.*s", width - 63, info->cur_msg->payload[i]); return 0; - + } int call_flow_handle_key(PANEL *panel, int key) { int i, rnpag_steps = 4; call_flow_info_t *info = (call_flow_info_t*) panel_userptr(panel); - sip_msg_t *next = NULL, *prev = NULL; + sip_msg_t *next = NULL, *prev = NULL; // Sanity check, this should not happen if (!info) return -1; @@ -188,20 +208,20 @@ int call_flow_handle_key(PANEL *panel, int key) } break; case KEY_UP: - // FIXME We start searching from the fist one - // FIXME This wont work well with a lot of msg - while ((prev = get_next_msg(info->call, prev))){ - if (prev->next == info->cur_msg) - break; - } - // We're at the first message already - if (!prev) break; - info->cur_msg = prev; - info->cur_line -= 2; - if ( info->cur_line <= 0 ){ - info->first_msg = info->cur_msg; - info->cur_line = 1; - } + // FIXME We start searching from the fist one + // FIXME This wont work well with a lot of msg + while ((prev = get_next_msg(info->call, prev))){ + if (prev->next == info->cur_msg) + break; + } + // We're at the first message already + if (!prev) break; + info->cur_msg = prev; + info->cur_line -= 2; + if ( info->cur_line <= 0 ){ + info->first_msg = info->cur_msg; + info->cur_line = 1; + } break; case KEY_NPAGE: // Next page => N key down strokes @@ -220,34 +240,33 @@ int call_flow_handle_key(PANEL *panel, int key) } return 0; - } int call_flow_help(PANEL *panel) { - return 0; + return 0; } int call_flow_set_call(sip_call_t *call) { - ui_panel_t *flow_panel; - PANEL *panel; - call_flow_info_t *info; + ui_t *flow_panel; + PANEL *panel; + call_flow_info_t *info; - if (!call) - return -1; + if (!call) + return -1; - if (!(flow_panel = ui_find_element_by_type(DETAILS_PANEL))) - return -1; - - if (!(panel = flow_panel->panel)) - return -1; + if (!(flow_panel = ui_find_by_type(DETAILS_PANEL))) + return -1; + + if (!(panel = flow_panel->panel)) + return -1; - if (!(info = (call_flow_info_t*) panel_userptr(panel))) - return -1; + if (!(info = (call_flow_info_t*) panel_userptr(panel))) + return -1; - info->call = call; - info->cur_msg = info->first_msg = call->messages; - info->cur_line = 1; - return 0; + info->call = call; + info->cur_msg = info->first_msg = call->messages; + info->cur_line = 1; + return 0; } diff --git a/src/ui_call_flow.h b/src/ui_call_flow.h index d54eb57..aed4096 100644 --- a/src/ui_call_flow.h +++ b/src/ui_call_flow.h @@ -34,13 +34,14 @@ typedef struct call_flow_info call_flow_info_t; */ struct call_flow_info { sip_call_t *call; - sip_msg_t *first_msg; + sip_msg_t *first_msg; sip_msg_t *cur_msg; - int linescnt; + int linescnt; int cur_line; }; extern PANEL *call_flow_create(); +extern void call_flow_destroy(PANEL *panel); extern int call_flow_draw(PANEL *panel); extern int call_flow_handle_key(PANEL *panel, int key); extern int call_flow_help(PANEL *panel); diff --git a/src/ui_call_flow_ex.c b/src/ui_call_flow_ex.c index a520f31..fc347b4 100644 --- a/src/ui_call_flow_ex.c +++ b/src/ui_call_flow_ex.c @@ -22,7 +22,7 @@ #include #include "ui_call_flow_ex.h" -extern struct sip_call *active_call; +struct sip_call *active_call; PANEL *call_flow_ex_create() { @@ -34,7 +34,7 @@ int call_flow_ex_draw(PANEL *panel) { int w, h, fw, fh, rw, rh, ph; int msgcnt = 0; - int padpos, highlight, entries; + int padpos, highlight; // This panel only makes sense with a selected call if (!active_call) return 1; diff --git a/src/ui_call_list.c b/src/ui_call_list.c index 157f52e..65e051a 100644 --- a/src/ui_call_list.c +++ b/src/ui_call_list.c @@ -19,10 +19,12 @@ ** along with this program. If not, see . ** ****************************************************************************/ +#include #include #include #include "ui_call_list.h" #include "ui_call_flow.h" +#include "ui_call_raw.h" #include "sip.h" // FIXME create a getter function for this at sip.c @@ -76,8 +78,8 @@ PANEL *call_list_create() // Draw columns titles for (colpos = 5, i = 0; i < info->columncnt; i++){ - // Check if the column will fit in the remaining space of the screen - if (colpos + info->columns[i].width >= width) break; + // Check if the column will fit in the remaining space of the screen + if (colpos + info->columns[i].width >= width) break; mvwprintw(win, 6, colpos, info->columns[i].title); colpos += info->columns[i].width; } @@ -129,10 +131,10 @@ int call_list_draw(PANEL *panel) // Print requested columns for (colpos = 5, i=0; i < info->columncnt; i++){ collen = info->columns[i].width; - // Check if the column will fit in the remaining space of the screen - if (colpos + collen >= width) break; - - // Display each column with it's data + // Check if the column will fit in the remaining space of the screen + if (colpos + collen >= width) break; + + // Display each column with it's data switch (info->columns[i].id) { case 0: mvwprintw(win, cline, colpos, "%.*s", collen, call->messages->sip_from); break; case 1: mvwprintw(win, cline, colpos, "%.*s", collen, call->messages->sip_to); break; @@ -148,9 +150,9 @@ int call_list_draw(PANEL *panel) } // Clean scroll information - mvwprintw(win, startline, 2, ""); + mvwprintw(win, startline, 2, " "); mvwprintw(win, startline + info->linescnt - 2, 2, " "); - mvwprintw(win, startline + info->linescnt - 1, 2, ""); + mvwprintw(win, startline + info->linescnt - 1, 2, " "); // Update the scroll information if (info->first_line > 1 ) @@ -170,8 +172,7 @@ int call_list_handle_key(PANEL *panel, int key) { int i, rnpag_steps = 10; call_list_info_t *info = (call_list_info_t*) panel_userptr(panel); - ui_panel_t *flow_panel; - struct call_flow_info *flow_info; + ui_t *next_panel; // Sanity check, this should not happen if (!info) return -1; @@ -216,12 +217,21 @@ int call_list_handle_key(PANEL *panel, int key) call_list_handle_key(panel, KEY_UP); break; case 10: + if (!info->cur_call) return -1; // KEY_ENTER , Display current call flow - flow_panel = ui_find_element_by_type(DETAILS_PANEL); - flow_panel->panel = flow_panel->create(); - call_flow_set_call(info->cur_call); - wait_for_input(flow_panel); + next_panel = ui_create(DETAILS_PANEL); + call_flow_set_call(info->cur_call); + wait_for_input(next_panel); break; + case 'r': + case 'R': + if (!info->cur_call) return -1; + // KEY_R, display current call in raw mode + next_panel = ui_create(RAW_PANEL); + call_raw_set_call(info->cur_call); + wait_for_input(next_panel); + break; + default: return -1; } @@ -261,14 +271,28 @@ int call_list_help(PANEL * ppanel) return 0; } -int call_list_add_column (PANEL *panel, int id, const char *title, int width) +void call_list_destroy(PANEL *panel) { - call_list_info_t *info = (call_list_info_t*) panel_userptr(panel); - if (!info) return -1; + call_list_info_t *info; - info->columns[info->columncnt].id = id; - info->columns[info->columncnt].title = title; - info->columns[info->columncnt].width = width; - info->columncnt++; - return 0; + // Hide the panel + hide_panel(panel); + + // Free its status data + if ((info = (call_list_info_t*) panel_userptr(panel))) + free(info); + + // Finally free the panel memory + del_panel(panel); +} + +int call_list_add_column (PANEL *panel, int id, char *title, int width) +{ + call_list_info_t *info = (call_list_info_t*) panel_userptr(panel); + if (!info) return -1; + info->columns[info->columncnt].id = id; + info->columns[info->columncnt].title = title; + info->columns[info->columncnt].width = width; + info->columncnt++; + return 0; } diff --git a/src/ui_call_list.h b/src/ui_call_list.h index af353a9..07493ce 100644 --- a/src/ui_call_list.h +++ b/src/ui_call_list.h @@ -66,5 +66,6 @@ extern PANEL *call_list_create(); extern int call_list_draw(PANEL *panel); extern int call_list_handle_key(PANEL *panel, int key); extern int call_list_help(PANEL *panel); -extern int call_list_add_column (PANEL *panel, int id, const char *title, int width); +extern void call_list_destroy(PANEL *panel); +extern int call_list_add_column (PANEL *panel, int id, char *title, int width); #endif diff --git a/src/ui_call_raw.c b/src/ui_call_raw.c index aa95a16..86ea828 100644 --- a/src/ui_call_raw.c +++ b/src/ui_call_raw.c @@ -19,51 +19,106 @@ ** along with this program. If not, see . ** ****************************************************************************/ +#include +#include +#include "ui_manager.h" #include "ui_call_raw.h" -#include "sip.h" - -struct sip_call *active_call; PANEL *call_raw_create() { - PANEL *panel = new_panel(newwin(LINES, COLS, 0, 0)); - return panel; + PANEL *panel; + call_raw_info_t *info; + + // Create a new panel to fill all the screen + panel = new_panel(newwin(LINES, COLS, 0, 0)); + // Initialize Call List specific data + info = malloc(sizeof(call_raw_info_t)); + memset(info, 0, sizeof(call_raw_info_t)); + // Store it into panel userptr + set_panel_userptr(panel, (void*) info); + + return panel; } int call_raw_draw(PANEL *panel) { - int w, h, ph, padpos, highlight, entries; + struct sip_msg *msg = NULL; + int pline = 0, raw_line; + + // Get panel information + call_raw_info_t *info = (call_raw_info_t*) panel_userptr(panel); // Get window of main panel WINDOW *win = panel_window(panel); - // Make a pad for sip message - WINDOW *raw_pad = newpad(get_n_msgs(active_call) * 100, COLS); + mvwprintw(win, pline++, 0, "%d", info->scrollpos); - int pline = 0, raw_line; - struct sip_msg *msg = NULL; - while ((msg = get_next_msg(active_call, msg))) { + while ((msg = get_next_msg(info->call, msg))) { for (raw_line = 0; raw_line < msg->plines; raw_line++) { - mvwprintw(raw_pad, pline, 0, "%s", msg->payload[raw_line]); + mvwprintw(win, pline, 0, "%s", msg->payload[raw_line]); pline++; } pline++; pline++; } - copywin(raw_pad, win, highlight - 1, 0, 0, 0, LINES - 1, COLS - 1, false); - delwin(raw_pad); - - // Update the last line - entries = pline - LINES; - return 0; } -int call_raw_handle_key(PANEL *panel, char key) +int call_raw_handle_key(PANEL *panel, int key) { - return 0; + int i, rnpag_steps = 5; + call_raw_info_t *info = (call_raw_info_t*) panel_userptr(panel); + + // Sanity check, this should not happen + if (!info) return -1; + + mvwprintw(panel_window(panel), 0, 10, "%d", key); + + switch (key) { + case KEY_DOWN: + info->scrollpos++; + break; + case KEY_UP: + info->scrollpos--; + break; + case KEY_NPAGE: + // Next page => N key down strokes + for (i=0; i < rnpag_steps; i++) + call_raw_handle_key(panel, KEY_DOWN); + break; + case KEY_PPAGE: + // Prev page => N key up strokes + for (i=0; i < rnpag_steps; i++) + call_raw_handle_key(panel, KEY_UP); + break; + default: + return -1; + } + return 0; } int call_raw_help(PANEL * ppanel) { - return 0; + return 0; +} + +int call_raw_set_call(sip_call_t *call) { + ui_t *raw_panel; + PANEL *panel; + call_raw_info_t *info; + + if (!call) + return -1; + + if (!(raw_panel = ui_find_by_type(RAW_PANEL))) + return -1; + + if (!(panel = raw_panel->panel)) + return -1; + + if (!(info = (call_raw_info_t*) panel_userptr(panel))) + return -1; + + info->call = call; + info->scrollpos = 0; + return 0; } diff --git a/src/ui_call_raw.h b/src/ui_call_raw.h index a73a4b2..7c0a448 100644 --- a/src/ui_call_raw.h +++ b/src/ui_call_raw.h @@ -21,11 +21,26 @@ ****************************************************************************/ #ifndef __UI_CALL_RAW_H #define __UI_CALL_RAW_H +#include "sip.h" #include "ui_manager.h" +//! Sorter declaration of struct call_raw_info +typedef struct call_raw_info call_raw_info_t; + +/** + * @brief Call raw status information + * This data stores the actual status of the panel. It's stored in the + * PANEL user pointer. + */ +struct call_raw_info { + sip_call_t *call; + int scrollpos; +}; + extern PANEL *call_raw_create(); extern int call_raw_draw(PANEL *panel); -extern int call_raw_handle_key(PANEL *panel, char key); +extern int call_raw_handle_key(PANEL *panel, int key); extern int call_raw_help(PANEL *panel); +extern int call_raw_set_call(sip_call_t *call); #endif diff --git a/src/ui_manager.c b/src/ui_manager.c index 4944262..f08a396 100644 --- a/src/ui_manager.c +++ b/src/ui_manager.c @@ -16,9 +16,12 @@ #include "ui_call_list.h" #include "ui_call_flow.h" #include "ui_call_flow_ex.h" +#include "ui_call_raw.h" /** * @brief Interface status data + * XXX I think this should be in the applicaton configuration structure + * avaliable everywhere in the program */ static struct ui_status { int color; @@ -32,14 +35,15 @@ static struct ui_status { * load panels as modules and provide a way to register * themselfs into the panel pool dynamically. */ -static ui_panel_t panel_pool[] = { +static ui_t panel_pool[] = { { .type = MAIN_PANEL, .panel = NULL, .create = call_list_create, .draw = call_list_draw, .handle_key = call_list_handle_key, - .help = call_list_help + .help = call_list_help, + .destroy = call_list_destroy, }, { .type = DETAILS_PANEL, @@ -47,15 +51,24 @@ static ui_panel_t panel_pool[] = { .create = call_flow_create, .draw = call_flow_draw, .handle_key = call_flow_handle_key, - .help = call_flow_help + .help = call_flow_help, + .destroy = call_flow_destroy, }, { .type = DETAILS_PANEL_EX, .panel = NULL, .create = call_flow_ex_create, .draw = call_flow_ex_draw, - .handle_key = call_flow_ex_handle_key, + //.handle_key = call_flow_ex_handle_key, .help = call_flow_ex_help +}, +{ + .type = RAW_PANEL, + .panel = NULL, + .create = call_raw_create, + .draw = call_raw_draw, + .handle_key = call_raw_handle_key, + .help = call_raw_help }}; /** @@ -64,7 +77,8 @@ static ui_panel_t panel_pool[] = { * @param ui_config UI configuration structure * @returns 0 on ncurses initialization success, 1 otherwise */ -int init_interface(const struct ui_config uicfg) +int +init_interface(const struct ui_config uicfg) { // Initialize curses initscr(); @@ -79,17 +93,155 @@ int init_interface(const struct ui_config uicfg) toggle_color((status.color = 1)); // Start showing call list - wait_for_input(ui_find_element_by_type(MAIN_PANEL)); + wait_for_input(ui_create(MAIN_PANEL)); // End ncurses mode endwin(); + return 0; } -/** - * Toggle color mode on and off - * @param on Pass 0 to turn all black&white - */ -void toggle_color(int on) +ui_t * +ui_create(int type) +{ + ui_t* ui; + + // Find the ui structure for this panel type + if (!(ui = ui_find_by_type(type))) + return NULL; + + // If already has a panel, just return it + if (ui_get_panel(ui)) + return ui; + else if (ui->create) + ui->panel = ui->create(); + + // And return it + return ui; +} + +void +ui_destroy(ui_t *ui) +{ + PANEL *panel; + // If thre is no ui panel, we're done + if (!(panel = ui_get_panel(ui))) + return; + + // If panel has a destructor function use it + if (ui->destroy) + ui->destroy(panel); + + // Initialize panel pointer + ui->panel = NULL; +} + +PANEL * +ui_get_panel(ui_t *ui) +{ + // Return panel pointer of ui struct + return (ui)?ui->panel:NULL; +} + +void +ui_draw_panel(ui_t *ui) +{ + //! Sanity check, this should not happen + if (!ui) return; + + // Create the panel if it does not exist + if (!(ui_create(ui->type))) return; + + // Make this panel the topmost panel + top_panel(ui_get_panel(ui)); + + // Request the panel to draw on the scren + if (ui->draw) + ui->draw(ui_get_panel(ui)); + + // Update panel stack + update_panels(); + doupdate(); +} + +void +ui_help(ui_t *ui) +{ + // If current ui has help function + if (ui->help) + ui->help(ui_get_panel(ui)); + + // Update the stacking order + update_panels(); + doupdate(); + // Press any key to continue + wgetch(panel_window(ui_get_panel(ui))); +} + +void +ui_handle_key(ui_t *ui, int key) +{ + if (ui->handle_key) + ui->handle_key(ui_get_panel(ui), key); +} + +ui_t * +ui_find_by_panel(PANEL *panel) +{ + int i; + int panelcnt = sizeof(panel_pool)/sizeof(ui_t); + for (i=0; i panel; + PANEL *panel; - // Get window of main panel - WINDOW *win = panel_window(panel); - keypad(win, TRUE); - - for (;;) { - ui_draw_panel(ui_panel); - int c = wgetch(win); - switch (c) { - case 'C': - case 'c': - status.color = (status.color) ? 0 : 1; - toggle_color(status.color); - break; - case 'H': - case 'h': - case 265: /* KEY_F1 */ - /* wrapper this shit */ - if (ui_panel->help(panel) == 0){ - update_panels(); // Update the stacking order - doupdate(); // Refresh screen - wgetch(win); - } - break; - case 'Q': - case 'q': - case 27: /* KEY_ESC */ - hide_panel(panel); - return; - break; - default: - ui_panel->handle_key(panel, c); - break; - } + // Get the topmost panel + if ((panel = panel_below(NULL))) { + // Get ui information for that panel + ui_draw_panel(ui_find_by_panel(panel)); } } - -void ui_draw_panel(ui_panel_t *ui_panel) -{ - //! Sanity check, this should not happen - if (!ui_panel) return; - - //! If panel does not exit, create it - if (!ui_panel->panel){ - if (ui_panel->create) - ui_panel->panel = ui_panel->create(); - } - - //! If something failed - if (!ui_panel->panel) return; - - // Make this panel the topmost panel - top_panel(ui_panel->panel); - - // Request the panel to draw on the scren - if (ui_panel->draw) - ui_panel->draw(ui_panel->panel); - - // Update panel stack - update_panels(); - doupdate(); -} - -/** - * Draw a box around passed windows with two bars (top and bottom) - * of one line each. - * - * @param win Window to draw borders on - */ -void title_foot_box(WINDOW *win) +void +title_foot_box(WINDOW *win) { int height, width; @@ -205,44 +287,3 @@ void title_foot_box(WINDOW *win) mvwaddch(win, height-3, width-1, ACS_RTEE); } - -/** - * This function is invocked asynchronously from the - * ngrep exec thread to notify a new message of the giving - * callid. If the UI is displaying this call or it's - * extended one, the topmost panel will be redraw again - * - * @param callid Call-ID from the last received message - */ -void refresh_call_ui(const char *callid) -{ - ui_panel_t *ui_panel; - PANEL *panel; - - // Get the topmost panel - if ((panel = panel_below(NULL))) { - // Get ui information for that panel - ui_draw_panel(ui_find_element_by_panel(panel)); - } -} - - -ui_panel_t *ui_find_element_by_panel(PANEL *panel) -{ - int i; - int panelcnt = sizeof(panel_pool)/sizeof(ui_panel_t); - for (i=0; i