forked from Mirrors/sngrep
Refactoring ui
This commit is contained in:
parent
d304ecbfe0
commit
8d92bcde70
|
@ -0,0 +1,464 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# src/Makefile. Generated from Makefile.in by configure.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
|
||||
|
||||
pkgdatadir = $(datadir)/sngrep
|
||||
pkgincludedir = $(includedir)/sngrep
|
||||
pkglibdir = $(libdir)/sngrep
|
||||
pkglibexecdir = $(libexecdir)/sngrep
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
bin_PROGRAMS = sngrep$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_sngrep_OBJECTS = exec.$(OBJEXT) pcap.$(OBJEXT) sip.$(OBJEXT) \
|
||||
main.$(OBJEXT) ui_manager.$(OBJEXT) ui_call_list.$(OBJEXT) \
|
||||
ui_call_flow.$(OBJEXT) ui_call_flow_ex.$(OBJEXT)
|
||||
sngrep_OBJECTS = $(am_sngrep_OBJECTS)
|
||||
sngrep_LDADD = $(LDADD)
|
||||
DEFAULT_INCLUDES = -I.
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(sngrep_SOURCES)
|
||||
DIST_SOURCES = $(sngrep_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = ${SHELL} /usr/src/sngrep/missing --run aclocal-1.11
|
||||
AMTAR = ${SHELL} /usr/src/sngrep/missing --run tar
|
||||
AUTOCONF = ${SHELL} /usr/src/sngrep/missing --run autoconf
|
||||
AUTOHEADER = ${SHELL} /usr/src/sngrep/missing --run autoheader
|
||||
AUTOMAKE = ${SHELL} /usr/src/sngrep/missing --run automake-1.11
|
||||
AWK = gawk
|
||||
CC = gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O0
|
||||
CPP = gcc -E
|
||||
CPPFLAGS =
|
||||
CXX = g++
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
CXXFLAGS = -O0
|
||||
CYGPATH_W = echo
|
||||
DEFS = -DPACKAGE_NAME=\"sngrep\" -DPACKAGE_TARNAME=\"sngrep\" -DPACKAGE_VERSION=\"0.0-alpha\" -DPACKAGE_STRING=\"sngrep\ 0.0-alpha\" -DPACKAGE_BUGREPORT=\"kaian@irontec.com\" -DPACKAGE_URL=\"http://www.irontec.com/\" -DPACKAGE=\"sngrep\" -DVERSION=\"0.0-alpha\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DHAVE_LIBNCURSES=1 -DHAVE_LIBPANEL=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBPCAP=1 -DSTDBUF_BIN=\"/usr/bin/stdbuf\" -DNGREP_BIN=\"/usr/bin/ngrep\"
|
||||
DEPDIR = .deps
|
||||
ECHO_C =
|
||||
ECHO_N = -n
|
||||
ECHO_T =
|
||||
EGREP = /bin/grep -E
|
||||
EXEEXT =
|
||||
GREP = /bin/grep
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
||||
LDFLAGS =
|
||||
LIBOBJS =
|
||||
LIBS = -lpcap -lpthread -lpanel -lncurses
|
||||
LN_S = ln -s
|
||||
LTLIBOBJS =
|
||||
MAKEINFO = ${SHELL} /usr/src/sngrep/missing --run makeinfo
|
||||
MKDIR_P = /bin/mkdir -p
|
||||
NGREP = /usr/bin/ngrep
|
||||
OBJEXT = o
|
||||
PACKAGE = sngrep
|
||||
PACKAGE_BUGREPORT = kaian@irontec.com
|
||||
PACKAGE_NAME = sngrep
|
||||
PACKAGE_STRING = sngrep 0.0-alpha
|
||||
PACKAGE_TARNAME = sngrep
|
||||
PACKAGE_URL = http://www.irontec.com/
|
||||
PACKAGE_VERSION = 0.0-alpha
|
||||
PATH_SEPARATOR = :
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STDBUF = /usr/bin/stdbuf
|
||||
STRIP =
|
||||
VERSION = 0.0-alpha
|
||||
abs_builddir = /usr/src/sngrep/src
|
||||
abs_srcdir = /usr/src/sngrep/src
|
||||
abs_top_builddir = /usr/src/sngrep
|
||||
abs_top_srcdir = /usr/src/sngrep
|
||||
ac_ct_CC = gcc
|
||||
ac_ct_CXX = g++
|
||||
am__include = include
|
||||
am__leading_dot = .
|
||||
am__quote =
|
||||
am__tar = ${AMTAR} chof - "$$tardir"
|
||||
am__untar = ${AMTAR} xf -
|
||||
bindir = ${exec_prefix}/bin
|
||||
build_alias =
|
||||
builddir = .
|
||||
datadir = ${datarootdir}
|
||||
datarootdir = ${prefix}/share
|
||||
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
|
||||
dvidir = ${docdir}
|
||||
exec_prefix = ${prefix}
|
||||
host_alias =
|
||||
htmldir = ${docdir}
|
||||
includedir = ${prefix}/include
|
||||
infodir = ${datarootdir}/info
|
||||
install_sh = ${SHELL} /usr/src/sngrep/install-sh
|
||||
libdir = ${exec_prefix}/lib
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
mandir = ${datarootdir}/man
|
||||
mkdir_p = /bin/mkdir -p
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /usr/local
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
sharedstatedir = ${prefix}/com
|
||||
srcdir = .
|
||||
sysconfdir = ${prefix}/etc
|
||||
target_alias =
|
||||
top_build_prefix = ../
|
||||
top_builddir = ..
|
||||
top_srcdir = ..
|
||||
sngrep_SOURCES = exec.c pcap.c sip.c main.c ui_manager.c ui_call_list.c ui_call_flow.c ui_call_flow_ex.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES)
|
||||
@rm -f sngrep$(EXEEXT)
|
||||
$(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
include ./$(DEPDIR)/exec.Po
|
||||
include ./$(DEPDIR)/main.Po
|
||||
include ./$(DEPDIR)/pcap.Po
|
||||
include ./$(DEPDIR)/sip.Po
|
||||
include ./$(DEPDIR)/ui_call_flow.Po
|
||||
include ./$(DEPDIR)/ui_call_flow_ex.Po
|
||||
include ./$(DEPDIR)/ui_call_list.Po
|
||||
include ./$(DEPDIR)/ui_manager.Po
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
# source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
|
||||
# $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
# source='$<' object='$@' libtool=no \
|
||||
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
|
||||
# $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(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
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -1,3 +1,2 @@
|
|||
bin_PROGRAMS=sngrep
|
||||
sngrep_SOURCES=curses.c exec.c pcap.c sip.c main.c
|
||||
#include_HEADERS=curses.h exec.h pcap.h sip.h
|
||||
sngrep_SOURCES=exec.c pcap.c sip.c main.c ui_manager.c ui_call_list.c ui_call_flow.c ui_call_flow_ex.c
|
||||
|
|
|
@ -44,8 +44,9 @@ CONFIG_CLEAN_FILES =
|
|||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_sngrep_OBJECTS = curses.$(OBJEXT) exec.$(OBJEXT) pcap.$(OBJEXT) \
|
||||
sip.$(OBJEXT) main.$(OBJEXT)
|
||||
am_sngrep_OBJECTS = exec.$(OBJEXT) pcap.$(OBJEXT) sip.$(OBJEXT) \
|
||||
main.$(OBJEXT) ui_manager.$(OBJEXT) ui_call_list.$(OBJEXT) \
|
||||
ui_call_flow.$(OBJEXT) ui_call_flow_ex.$(OBJEXT)
|
||||
sngrep_OBJECTS = $(am_sngrep_OBJECTS)
|
||||
sngrep_LDADD = $(LDADD)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
|
@ -54,20 +55,8 @@ 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_$(V))
|
||||
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_$(V))
|
||||
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(sngrep_SOURCES)
|
||||
DIST_SOURCES = $(sngrep_SOURCES)
|
||||
ETAGS = etags
|
||||
|
@ -75,7 +64,6 @@ 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@
|
||||
|
@ -167,7 +155,7 @@ target_alias = @target_alias@
|
|||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
sngrep_SOURCES = curses.c exec.c pcap.c sip.c main.c
|
||||
sngrep_SOURCES = exec.c pcap.c sip.c main.c ui_manager.c ui_call_list.c ui_call_flow.c ui_call_flow_ex.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
@ -241,7 +229,7 @@ clean-binPROGRAMS:
|
|||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
sngrep$(EXEEXT): $(sngrep_OBJECTS) $(sngrep_DEPENDENCIES)
|
||||
@rm -f sngrep$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS)
|
||||
$(LINK) $(sngrep_OBJECTS) $(sngrep_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
@ -249,24 +237,25 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curses.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcap.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_call_flow.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_call_flow_ex.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_call_list.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui_manager.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@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@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||||
@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@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
@ -469,7 +458,6 @@ uninstall-am: uninstall-binPROGRAMS
|
|||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS
|
||||
|
||||
#include_HEADERS=curses.h exec.h pcap.h sip.h
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "sip.h"
|
||||
#include "curses.h"
|
||||
#include "ui_manager.h"
|
||||
|
||||
#define STDBUF_ARGS "-i0 -o0 -e0"
|
||||
#define NGREP_ARGS "-qpt -W byline"
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include "exec.h"
|
||||
#include "curses.h"
|
||||
#include "pcap.h"
|
||||
#include "ui_manager.h"
|
||||
|
||||
/**
|
||||
* Usage function
|
||||
|
@ -68,8 +68,8 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
} else if (argc == 2) {
|
||||
// Show ofline mode in ui
|
||||
config.online = 0;
|
||||
config.fname = argv[1];
|
||||
//config.online = 0;
|
||||
//config.fname = argv[1];
|
||||
|
||||
// Assume Offline mode with pcap file
|
||||
if (load_pcap_file(argv[1]) != 0) {
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include "ui_call_flow.h"
|
||||
|
||||
extern struct sip_call *active_call;
|
||||
|
||||
PANEL *call_flow_create()
|
||||
{
|
||||
PANEL *panel = new_panel(newwin(LINES, COLS, 0, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
int call_flow_draw(PANEL *panel)
|
||||
{
|
||||
int h, w, fw, fh, rw, rh, ph;
|
||||
int msgcnt = 0;
|
||||
int padpos, highlight, entries;
|
||||
|
||||
// This panel only makes sense with a selected call
|
||||
if (!active_call) return 1;
|
||||
|
||||
// Get window of main panel
|
||||
WINDOW *win = panel_window(panel);
|
||||
|
||||
// Get panel info
|
||||
struct panel_info *pinfo = (struct panel_info*) panel_userptr(panel);
|
||||
entries = get_n_msgs(active_call);
|
||||
|
||||
// Get data from first message
|
||||
const char *from = active_call->messages->ip_from;
|
||||
|
||||
// Get window size
|
||||
getmaxyx(win, h, w);
|
||||
// Get flow size
|
||||
fw = 65;
|
||||
fh = h - 3 - 3;
|
||||
// Get the raw size
|
||||
rw = w - fw - 2;
|
||||
rh = h - 3 - 3;
|
||||
|
||||
// Window borders
|
||||
wattron(win,COLOR_PAIR(DETAIL_BORDER_COLOR));
|
||||
title_foot_box(win);
|
||||
mvwaddch(win, 2, fw, ACS_TTEE);
|
||||
mvwvline(win, 3, fw, ACS_VLINE, fh);
|
||||
mvwaddch(win, 4, 0, ACS_LTEE);
|
||||
mvwhline(win, 4, 1, ACS_HLINE, fw);
|
||||
mvwaddch(win, 4, fw, ACS_RTEE);
|
||||
mvwaddch(win, 3+fh, fw, ACS_BTEE);
|
||||
wattroff(win,COLOR_PAIR(DETAIL_BORDER_COLOR));
|
||||
|
||||
// Window title
|
||||
mvwprintw(win, 1, (w - 45) / 2, "Call Details for %s", active_call->callid);
|
||||
// Callflow box title
|
||||
mvwprintw(win, 3, 30, "Call Flow");
|
||||
|
||||
// Hosts and lines in callflow
|
||||
mvwprintw(win, 5, 13, "%-22s", active_call->messages->ip_from);
|
||||
mvwprintw(win, 5, 42, "%-22s", active_call->messages->ip_to);
|
||||
mvwhline(win, 6, 11, ACS_HLINE, 20);
|
||||
mvwhline(win, 6, 40, ACS_HLINE, 20);
|
||||
mvwaddch(win, 6, 20, ACS_TTEE);
|
||||
mvwaddch(win, 6, 50, ACS_TTEE);
|
||||
|
||||
mvwprintw(win, h - 2, 2,
|
||||
"Q: Quit C: Toggle color F: Show raw messages X: Show Extended Call-Flow");
|
||||
|
||||
// Make the pad long enough to contain all messages and some extra space
|
||||
WINDOW *flow_pad = newpad(fh + get_n_msgs(active_call) * 2, fw);
|
||||
mvwvline(flow_pad, 0, 20, ACS_VLINE, fh+get_n_msgs(active_call)*2);
|
||||
mvwvline(flow_pad, 0, 50, ACS_VLINE, fh+get_n_msgs(active_call)*2);
|
||||
|
||||
// Make a pad for sip message
|
||||
WINDOW *raw_pad = newpad(rh, rw);
|
||||
|
||||
int cline = 0;
|
||||
struct sip_msg *msg = NULL;
|
||||
while ((msg = get_next_msg(active_call, msg))) {
|
||||
msgcnt++;
|
||||
|
||||
if (msgcnt == highlight) {
|
||||
int raw_line = 0, pcount = 0;
|
||||
for (raw_line = 0; raw_line < msg->plines; raw_line++, pcount++) {
|
||||
mvwprintw(raw_pad, pcount, 0, "%.*s", rw, msg->payload[raw_line]);
|
||||
}
|
||||
}
|
||||
|
||||
// Print timestamp
|
||||
mvwprintw(flow_pad, cline, 2, "%s", msg->time);
|
||||
|
||||
if (msgcnt == highlight) wattron(flow_pad,A_REVERSE);
|
||||
|
||||
// Determine the message direction
|
||||
if (!strcmp(msg->ip_from, from)) {
|
||||
wattron(flow_pad,COLOR_PAIR(OUTGOING_COLOR));
|
||||
mvwhline(flow_pad, cline+1, 22, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline+1, 47, ACS_RARROW);
|
||||
} else {
|
||||
wattron(flow_pad,COLOR_PAIR(INCOMING_COLOR));
|
||||
mvwhline(flow_pad, cline+1, 22, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline+1, 22, ACS_LARROW);
|
||||
}
|
||||
|
||||
// Draw message type or status and line
|
||||
mvwprintw(flow_pad, cline, 22, "%26s", "");
|
||||
int msglen = strlen(msg->type);
|
||||
if (msglen > 24) msglen = 24;
|
||||
mvwprintw(flow_pad, cline, 22 + (24 - msglen) / 2, "%.24s", msg->type);
|
||||
|
||||
// Turn off colors
|
||||
wattroff(flow_pad,COLOR_PAIR(OUTGOING_COLOR));
|
||||
wattroff(flow_pad,COLOR_PAIR(INCOMING_COLOR));
|
||||
wattroff(flow_pad, A_REVERSE);
|
||||
|
||||
cline++;
|
||||
cline++;
|
||||
}
|
||||
|
||||
/* Calculate the space the pad will be covering in the screen */
|
||||
ph = fh - 3 /* CF header */- 2 /* Addresses */;
|
||||
/* Make it even */
|
||||
ph -= ph % 2;
|
||||
|
||||
/* Calculate the highlight position */
|
||||
// The highlight position is below the last displayed position?
|
||||
if (highlight * 2 > ph + padpos) {
|
||||
// Scrolling down
|
||||
padpos += 2;
|
||||
// The highlight position is above the first displayed position?
|
||||
} else if (highlight * 2 <= padpos) {
|
||||
// Scroll up
|
||||
padpos -= 2;
|
||||
}
|
||||
|
||||
/* Draw some fancy arrow to indicate scrolling */
|
||||
if (padpos > 0) {
|
||||
mvwaddch(flow_pad, padpos, 20, ACS_UARROW);
|
||||
mvwaddch(flow_pad, padpos, 50, ACS_UARROW);
|
||||
}
|
||||
if (get_n_msgs(active_call) * 2 > ph + padpos) {
|
||||
mvwaddch(flow_pad, ph+padpos-1, 20, ACS_DARROW);
|
||||
mvwaddch(flow_pad, ph+padpos-1, 50, ACS_DARROW);
|
||||
}
|
||||
|
||||
// Copy the callflow into the screen
|
||||
copywin(flow_pad, win, padpos, 1, 3 + 2 + 2, 1, 6 + ph, fw - 1, false);
|
||||
delwin(flow_pad);
|
||||
// Copy the rawmessage into the screen
|
||||
copywin(raw_pad, win, 0, 0, 3, fw + 1, rh, fw + rw, false);
|
||||
delwin(raw_pad);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int call_flow_handle_key(PANEL *panel, char key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int call_flow_help(PANEL *panel)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef __UI_CALL_FLOW_H
|
||||
#define __UI_CALL_FLOW_H
|
||||
#include "ui_manager.h"
|
||||
|
||||
extern PANEL *call_flow_create();
|
||||
extern int call_flow_draw(PANEL *panel);
|
||||
extern int call_flow_handle_key(PANEL *panel, char key);
|
||||
extern int call_flow_help(PANEL *panel);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,220 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include "ui_call_flow_ex.h"
|
||||
|
||||
extern struct sip_call *active_call;
|
||||
|
||||
PANEL *call_flow_ex_create()
|
||||
{
|
||||
PANEL *panel = new_panel(newwin(LINES, COLS, 0, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
int call_flow_ex_draw(PANEL *panel)
|
||||
{
|
||||
int w, h, fw, fh, rw, rh, ph;
|
||||
int msgcnt = 0;
|
||||
int padpos, highlight, entries;
|
||||
|
||||
// This panel only makes sense with a selected call
|
||||
if (!active_call) return 1;
|
||||
|
||||
// Get window of main panel
|
||||
WINDOW *win = panel_window(panel);
|
||||
|
||||
// Get other call data
|
||||
struct sip_call *call = active_call;
|
||||
struct sip_call *call2 = get_ex_call(call);
|
||||
|
||||
if (!call2) return 1;
|
||||
|
||||
const char *from, *to, *via;
|
||||
const char *callid1, *callid2;
|
||||
|
||||
const struct sip_msg *first = get_next_msg_ex(call, NULL);
|
||||
if (!strcmp(call->callid, first->call->callid)) {
|
||||
from = call->messages->ip_from;
|
||||
via = call->messages->ip_to;
|
||||
to = call2->messages->ip_to;
|
||||
callid1 = call->callid;
|
||||
callid2 = call2->callid;
|
||||
} else {
|
||||
from = call2->messages->ip_from;
|
||||
via = call2->messages->ip_to;
|
||||
to = call->messages->ip_to;
|
||||
callid1 = call2->callid;
|
||||
callid2 = call->callid;
|
||||
}
|
||||
|
||||
// Get window size
|
||||
getmaxyx(win, h, w);
|
||||
// Get flow size
|
||||
fw = 95;
|
||||
fh = h - 3 - 3;
|
||||
// Get the raw size
|
||||
rw = w - fw - 2;
|
||||
rh = h - 3 - 3;
|
||||
|
||||
// Window borders
|
||||
wattron(win,COLOR_PAIR(DETAIL_BORDER_COLOR));
|
||||
title_foot_box(win);
|
||||
mvwaddch(win, 2, fw, ACS_TTEE);
|
||||
mvwvline(win, 3, fw, ACS_VLINE, fh);
|
||||
mvwaddch(win, 4, 0, ACS_LTEE);
|
||||
mvwhline(win, 4, 1, ACS_HLINE, fw);
|
||||
mvwaddch(win, 4, fw, ACS_RTEE);
|
||||
mvwaddch(win, 3+fh, fw, ACS_BTEE);
|
||||
wattroff(win,COLOR_PAIR(DETAIL_BORDER_COLOR));
|
||||
|
||||
// Window title
|
||||
mvwprintw(win, 1, (w - 45) / 2, "Call Details for %s", call->callid);
|
||||
// Callflow box title
|
||||
mvwprintw(win, 3, 40, "Call Flow Extended");
|
||||
|
||||
// Hosts and lines in callflow
|
||||
mvwprintw(win, 5, 13, "%-22s", from);
|
||||
mvwprintw(win, 5, 42, "%-22s", via);
|
||||
mvwprintw(win, 5, 72, "%-22s", to);
|
||||
mvwhline(win, 6, 11, ACS_HLINE, 20);
|
||||
mvwhline(win, 6, 40, ACS_HLINE, 20);
|
||||
mvwhline(win, 6, 70, ACS_HLINE, 20);
|
||||
mvwaddch(win, 6, 20, ACS_TTEE);
|
||||
mvwaddch(win, 6, 50, ACS_TTEE);
|
||||
mvwaddch(win, 6, 80, ACS_TTEE);
|
||||
mvwprintw(win, h - 2, 2,
|
||||
"Q: Quit C: Toggle color F: Show raw messages X: Show Call-Flow");
|
||||
|
||||
int msgcntex = get_n_msgs(call) + get_n_msgs(call2);
|
||||
|
||||
// Make the pad long enough to contain all messages and some extra space
|
||||
WINDOW *flow_pad = newpad(fh + msgcntex * 2, fw);
|
||||
mvwvline(flow_pad, 0, 20, ACS_VLINE, fh+msgcntex*2);
|
||||
mvwvline(flow_pad, 0, 50, ACS_VLINE, fh+msgcntex*2);
|
||||
mvwvline(flow_pad, 0, 80, ACS_VLINE, fh+msgcntex*2);
|
||||
|
||||
// Make a pad for sip message
|
||||
WINDOW *raw_pad = newpad(rh, rw);
|
||||
|
||||
struct sip_msg *msg = NULL;
|
||||
|
||||
int cline = 0;
|
||||
while ((msg = get_next_msg_ex(call, msg))) {
|
||||
msgcnt++;
|
||||
|
||||
// Set raw content for selected text
|
||||
if (msgcnt == highlight) {
|
||||
int raw_line = 0, pcount = 0;
|
||||
for (raw_line = 0; raw_line < msg->plines; raw_line++, pcount++) {
|
||||
mvwprintw(raw_pad, pcount, 0, "%.*s", rw, msg->payload[raw_line]);
|
||||
}
|
||||
}
|
||||
|
||||
// Print timestamp
|
||||
mvwprintw(flow_pad, cline, 2, "%s", msg->time);
|
||||
|
||||
if (msgcnt == highlight) wattron(flow_pad,A_REVERSE);
|
||||
|
||||
int msglen = strlen(msg->type);
|
||||
if (msglen > 24) msglen = 24;
|
||||
|
||||
// Determine the message direction
|
||||
if (!strcmp(msg->call->callid, callid1) && !strcmp(msg->ip_from, from)) {
|
||||
wattron(flow_pad,COLOR_PAIR(OUTGOING_COLOR));
|
||||
mvwprintw(flow_pad, cline, 22, "%26s", "");
|
||||
mvwprintw(flow_pad, cline++, 22 + (24 - msglen) / 2, "%.24s", msg->type);
|
||||
mvwhline(flow_pad, cline, 22, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline++, 47, ACS_RARROW);
|
||||
} else if (!strcmp(msg->call->callid, callid1) && !strcmp(msg->ip_to, from)) {
|
||||
wattron(flow_pad,COLOR_PAIR(INCOMING_COLOR));
|
||||
mvwprintw(flow_pad, cline, 22, "%26s", "");
|
||||
mvwprintw(flow_pad, cline++, 22 + (24 - msglen) / 2, "%.24s", msg->type);
|
||||
mvwhline(flow_pad, cline, 22, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline++, 22, ACS_LARROW);
|
||||
} else if (!strcmp(msg->call->callid, callid2) && !strcmp(msg->ip_from, via)) {
|
||||
wattron(flow_pad,COLOR_PAIR(OUTGOING_COLOR));
|
||||
mvwprintw(flow_pad, cline, 52, "%26s", "");
|
||||
mvwprintw(flow_pad, cline++, 54 + (24 - msglen) / 2, "%.24s", msg->type);
|
||||
mvwhline(flow_pad, cline, 52, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline++, 77, ACS_RARROW);
|
||||
} else {
|
||||
wattron(flow_pad,COLOR_PAIR(INCOMING_COLOR));
|
||||
mvwprintw(flow_pad, cline, 52, "%26s", "");
|
||||
mvwprintw(flow_pad, cline++, 54 + (24 - msglen) / 2, "%.24s", msg->type);
|
||||
mvwhline(flow_pad, cline, 52, ACS_HLINE, 26);
|
||||
mvwaddch(flow_pad, cline++, 52, ACS_LARROW);
|
||||
}
|
||||
|
||||
wattroff(flow_pad,COLOR_PAIR(OUTGOING_COLOR));
|
||||
wattroff(flow_pad,COLOR_PAIR(INCOMING_COLOR));
|
||||
wattroff(flow_pad, A_REVERSE);
|
||||
}
|
||||
|
||||
/* Calculate the space the pad will be covering in the screen */
|
||||
ph = fh - 3 /* CF header */- 2 /* Addresses */;
|
||||
/* Make it even */
|
||||
ph -= ph % 2;
|
||||
|
||||
/* Calculate the highlight position */
|
||||
// The highlight position is below the last displayed position?
|
||||
if (highlight * 2 > ph + padpos) {
|
||||
// Scrolling down
|
||||
padpos += 2;
|
||||
// The highlight position is above the first displayed position?
|
||||
} else if (highlight * 2 <= padpos) {
|
||||
// Scroll up
|
||||
padpos -= 2;
|
||||
}
|
||||
|
||||
/* Draw some fancy arrow to indicate scrolling */
|
||||
if (padpos > 0) {
|
||||
mvwaddch(flow_pad, padpos, 20, ACS_UARROW);
|
||||
mvwaddch(flow_pad, padpos, 50, ACS_UARROW);
|
||||
mvwaddch(flow_pad, padpos, 80, ACS_UARROW);
|
||||
}
|
||||
if (msgcntex * 2 > ph + padpos) {
|
||||
mvwaddch(flow_pad, ph+padpos-1, 20, ACS_DARROW);
|
||||
mvwaddch(flow_pad, ph+padpos-1, 50, ACS_DARROW);
|
||||
mvwaddch(flow_pad, ph+padpos-1, 80, ACS_DARROW);
|
||||
}
|
||||
|
||||
// Copy the callflow into the screen
|
||||
copywin(flow_pad, win, padpos, 1, 3 + 2 + 2, 1, 6 + ph, fw - 1, false);
|
||||
delwin(flow_pad);
|
||||
// Copy the rawmessage into the screen
|
||||
copywin(raw_pad, win, 0, 0, 3, fw + 1, rh, fw + rw, false);
|
||||
delwin(raw_pad);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int call_flow_ex_handle_key(PANEL *panel, char key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int call_flow_ex_help(PANEL *panel)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef __UI_CALL_flow_ex_EX_H
|
||||
#define __UI_CALL_flow_ex_EX_H
|
||||
#include "ui_manager.h"
|
||||
|
||||
extern PANEL *call_flow_ex_create();
|
||||
extern int call_flow_ex_draw(PANEL *panel);
|
||||
extern int call_flow_ex_handle_key(PANEL *panel, char key);
|
||||
extern int call_flow_ex_help(PANEL *panel);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,159 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "ui_call_list.h"
|
||||
#include "sip.h"
|
||||
|
||||
extern struct sip_call *calls;
|
||||
struct sip_call *active_call;
|
||||
|
||||
PANEL *call_list_create()
|
||||
{
|
||||
PANEL *panel = new_panel(newwin(LINES, COLS, 0, 0));
|
||||
return panel;
|
||||
}
|
||||
|
||||
int call_list_draw(PANEL *panel)
|
||||
{
|
||||
int y = 1, x = 5;
|
||||
int w, h, ph, padpos, highlight, entries;
|
||||
|
||||
// Get window of main panel
|
||||
WINDOW *win = panel_window(panel);
|
||||
|
||||
// Get panel info
|
||||
entries = get_n_calls();
|
||||
|
||||
// Get window size
|
||||
getmaxyx(win, h, w);
|
||||
|
||||
title_foot_box(win);
|
||||
mvwprintw(win, y, (w - 45) / 2, "sngrep - SIP message interface for ngrep");
|
||||
mvwprintw(win, y + 2, 2, "Current Mode: %s", "Online");
|
||||
mvwaddch(win, y+4, 0, ACS_LTEE);
|
||||
mvwhline(win, y+4, 1, ACS_HLINE, w - 2);
|
||||
mvwaddch(win, y+4, w-1, ACS_RTEE);
|
||||
mvwprintw(win, y + 5, x + 2, "From SIP");
|
||||
mvwprintw(win, y + 5, x + 51, "To SIP");
|
||||
mvwprintw(win, y + 5, x + 109, "Msg");
|
||||
mvwprintw(win, y + 5, x + 116, "From");
|
||||
mvwprintw(win, y + 5, x + 136, "To");
|
||||
mvwprintw(win, y + 5, x + 155, "Starting");
|
||||
mvwaddch(win, y+6, 0, ACS_LTEE);
|
||||
mvwhline(win, y+6, 1, ACS_HLINE, w - 2);
|
||||
mvwaddch(win, y+6, w-1, ACS_RTEE);
|
||||
|
||||
WINDOW *main_pad = newpad(get_n_calls() + h, w);
|
||||
|
||||
struct sip_call *call = calls;
|
||||
int cline = 0, callcnt = 1;
|
||||
while (call) {
|
||||
if (callcnt == highlight) {
|
||||
active_call = call;
|
||||
wattron(main_pad,COLOR_PAIR(HIGHLIGHT_COLOR));
|
||||
}
|
||||
|
||||
mvwprintw(main_pad, cline, x + 2, "%*s", w - x * 2 - 4, ""); /* Highlight all the line */
|
||||
mvwprintw(main_pad, cline, x, "%.50s", call->messages->sip_from);
|
||||
mvwprintw(main_pad, cline, x + 50, "%.50s", call->messages->sip_to);
|
||||
mvwprintw(main_pad, cline, x + 109, "%d", get_n_msgs(call));
|
||||
mvwprintw(main_pad, cline, x + 115, "%s", call->messages->ip_from);
|
||||
mvwprintw(main_pad, cline, x + 135, "%s", call->messages->ip_to);
|
||||
mvwprintw(main_pad, cline, x + 155, "%s", call->messages->type);
|
||||
wattroff(main_pad, COLOR_PAIR(HIGHLIGHT_COLOR));
|
||||
cline++;
|
||||
callcnt++;
|
||||
call = call->next;
|
||||
}
|
||||
|
||||
/* Calculate the space the pad will be covering in the screen */
|
||||
ph = h - 2 /* Title */- 5 /* Header */- 2 /* Footer */;
|
||||
|
||||
/* Calculate the highlight position */
|
||||
// The highlight position is below the last displayed position?
|
||||
if (highlight > ph + padpos - 2) {
|
||||
// Scrolling down
|
||||
padpos++;
|
||||
// The highlight position is above the first displayed position?
|
||||
} else if (highlight <= padpos) {
|
||||
// Scroll up
|
||||
padpos--;
|
||||
}
|
||||
|
||||
/* Draw some fancy arrow to indicate scrolling */
|
||||
if (padpos > 0) {
|
||||
mvwaddch(main_pad, padpos, 3, ACS_UARROW);
|
||||
}
|
||||
if (get_n_calls() > ph + padpos) {
|
||||
mvwaddch(main_pad, ph+padpos-3, 3, ACS_DARROW);
|
||||
}
|
||||
|
||||
// Copy the rawmessage into the screen
|
||||
copywin(main_pad, win, padpos, 1, 2 + 5 + 1, 1, 5 + ph, w - 2, false);
|
||||
delwin(main_pad);
|
||||
|
||||
mvwprintw(
|
||||
win,
|
||||
h - 2,
|
||||
2,
|
||||
"Q: Quit C: Toggle color F: Show raw messages H: Help ENTER: Show Call-flow X: Show Extended Call-Flow");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int call_list_handle_key(PANEL *panel, char key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int call_list_help(PANEL * ppanel)
|
||||
{
|
||||
int cline = 1;
|
||||
int width, height;
|
||||
|
||||
PANEL *panel = new_panel(newwin(20, 50, LINES / 4, COLS / 4));
|
||||
// Get window of main panel
|
||||
WINDOW *win = panel_window(panel);
|
||||
|
||||
// Get window size
|
||||
getmaxyx(win, height, width);
|
||||
|
||||
box(win, 0, 0);
|
||||
mvwprintw(win, cline++, 15, "Help - Dialogs Window ");
|
||||
mvwaddch(win, cline, 0, ACS_LTEE);
|
||||
mvwhline(win, cline, 1, ACS_HLINE, width - 2);
|
||||
mvwaddch(win, cline++, width-1, ACS_RTEE);
|
||||
wattron(win,COLOR_PAIR(HELP_COLOR));
|
||||
mvwprintw(win, cline, 3, "F1/h:");
|
||||
mvwprintw(win, cline + 1, 3, "ESC/q:");
|
||||
mvwprintw(win, cline + 2, 3, "Up:");
|
||||
mvwprintw(win, cline + 3, 3, "Down:");
|
||||
mvwprintw(win, cline + 4, 3, "Enter:");
|
||||
wattroff(win,COLOR_PAIR(HELP_COLOR));
|
||||
mvwprintw(win, cline, 15, "Show this screen :)");
|
||||
mvwprintw(win, cline + 1, 15, "Exit sngrep");
|
||||
mvwprintw(win, cline + 2, 15, "Select Previous dialog");
|
||||
mvwprintw(win, cline + 3, 15, "Select Next dialog");
|
||||
mvwprintw(win, cline + 4, 15, "Show dialog details");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef __UI_CALL_LIST_H
|
||||
#define __UI_CALL_LIST_H
|
||||
#include "ui_manager.h"
|
||||
|
||||
extern PANEL *call_list_create();
|
||||
extern int call_list_draw(PANEL *panel);
|
||||
extern int call_list_handle_key(PANEL *panel, char key);
|
||||
extern int call_list_help(PANEL *panel);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,219 @@
|
|||
/******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011-2012 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This file may be used under the terms of the GNU General Public
|
||||
** License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of
|
||||
** this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
******************************************************************************/
|
||||
#include "curses.h"
|
||||
#include "ui_manager.h"
|
||||
#include "ui_call_list.h"
|
||||
#include "ui_call_flow.h"
|
||||
#include "ui_call_flow_ex.h"
|
||||
|
||||
/**
|
||||
* @brief Interface status data
|
||||
*/
|
||||
static struct ui_status {
|
||||
int color;
|
||||
} status;
|
||||
|
||||
/**
|
||||
* @brief Available panel windows list
|
||||
* This list contein the available list of windows
|
||||
* and pointer to their main functions.
|
||||
* XXX If the panel count increase a lot, it will be required to
|
||||
* load panels as modules and provide a way to register
|
||||
* themselfs into the panel pool dynamically.
|
||||
*/
|
||||
static ui_panel_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
|
||||
},
|
||||
{
|
||||
.type = DETAILS_PANEL,
|
||||
.panel = NULL,
|
||||
.create = call_flow_create,
|
||||
.draw = call_flow_draw,
|
||||
.handle_key = call_flow_handle_key,
|
||||
.help = call_flow_help
|
||||
},
|
||||
{
|
||||
.type = DETAILS_PANEL_EX,
|
||||
.panel = NULL,
|
||||
.create = call_flow_ex_create,
|
||||
.draw = call_flow_ex_draw,
|
||||
.handle_key = call_flow_ex_draw,
|
||||
.help = call_flow_ex_help
|
||||
}};
|
||||
|
||||
/**
|
||||
* Initialize ncurses mode and create a main window
|
||||
*
|
||||
* @param ui_config UI configuration structure
|
||||
* @returns 0 on ncurses initialization success, 1 otherwise
|
||||
*/
|
||||
int init_interface(const struct ui_config uicfg)
|
||||
{
|
||||
// Initialize curses
|
||||
initscr();
|
||||
cbreak();
|
||||
// Dont write user input on screen
|
||||
noecho();
|
||||
// Hide the cursor
|
||||
curs_set(0);
|
||||
// Only delay ESC Sequences 25 ms (we dont want Escape sequences)
|
||||
ESCDELAY = 25;
|
||||
start_color();
|
||||
toggle_color((status.color = 1));
|
||||
|
||||
// Start showing call list
|
||||
// Fixme for a wrapper ui_panel_show(ui_panel_t*);
|
||||
panel_pool->panel = panel_pool->create();
|
||||
wait_for_input(panel_pool);
|
||||
|
||||
// End ncurses mode
|
||||
endwin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle color mode on and off
|
||||
* @param on Pass 0 to turn all black&white
|
||||
*/
|
||||
void toggle_color(int on)
|
||||
{
|
||||
if (on) {
|
||||
// Initialize some colors
|
||||
init_pair(HIGHLIGHT_COLOR, COLOR_WHITE, COLOR_BLUE);
|
||||
init_pair(HELP_COLOR, COLOR_CYAN, COLOR_BLACK);
|
||||
init_pair(OUTGOING_COLOR, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(INCOMING_COLOR, COLOR_GREEN, COLOR_BLACK);
|
||||
init_pair(DETAIL_BORDER_COLOR, COLOR_BLUE, COLOR_BLACK);
|
||||
} else {
|
||||
init_pair(HIGHLIGHT_COLOR, COLOR_BLACK, COLOR_WHITE);
|
||||
init_pair(HELP_COLOR, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(OUTGOING_COLOR, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(INCOMING_COLOR, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(DETAIL_BORDER_COLOR, COLOR_WHITE, COLOR_BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wait for user input.
|
||||
* This function manages all user input in all panel types and
|
||||
* redraws the panel using its own draw function
|
||||
*
|
||||
* @param panel the topmost panel
|
||||
*/
|
||||
void wait_for_input(ui_panel_t *ui_panel)
|
||||
{
|
||||
|
||||
PANEL *panel = ui_panel->panel;
|
||||
// Get window of main panel
|
||||
WINDOW *win = panel_window(panel);
|
||||
keypad(win, TRUE);
|
||||
|
||||
for (;;) {
|
||||
// Put this panel on top
|
||||
top_panel(panel);
|
||||
|
||||
// Paint the panel
|
||||
ui_panel->draw(panel);
|
||||
|
||||
update_panels(); // Update the stacking order
|
||||
doupdate(); // Refresh screen
|
||||
|
||||
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 */
|
||||
ui_panel->help(panel);
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 27: /* KEY_ESC */
|
||||
hide_panel(panel);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
ui_panel->handle_key(panel, c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
int height, width;
|
||||
|
||||
// Get window size
|
||||
getmaxyx(win, height, width);
|
||||
box(win, 0, 0);
|
||||
mvwaddch(win, 2, 0, ACS_LTEE);
|
||||
mvwhline(win, 2, 1, ACS_HLINE, width - 2);
|
||||
mvwaddch(win, 2, width-1, ACS_RTEE);
|
||||
mvwaddch(win, height-3, 0, ACS_LTEE);
|
||||
mvwhline(win, height-3, 1, ACS_HLINE, width - 2);
|
||||
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)
|
||||
{
|
||||
// Get the topmost panel
|
||||
PANEL *panel = panel_below(NULL);
|
||||
|
||||
if (panel) {
|
||||
// Get panel info
|
||||
struct panel_info *pinfo;
|
||||
pinfo = (struct panel_info*) panel_userptr(panel);
|
||||
if (!pinfo) return;
|
||||
|
||||
/** FIXME
|
||||
* If panel type is DETAILS or DETAILS_EX, it should
|
||||
* be only be refreshed if active_call Call-ID or its
|
||||
* ex_call Call-ID are the one being updated
|
||||
*/
|
||||
|
||||
// Paint the panel
|
||||
//if ((pinfo->draw)(panel) != 0) return;
|
||||
|
||||
update_panels(); // Update the stacking order
|
||||
doupdate(); // Refresh screen
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/**************************************************************************
|
||||
**
|
||||
** sngrep - Ncurses ngrep interface for SIP
|
||||
**
|
||||
** Copyright (C) 2013 Ivan Alonso (Kaian)
|
||||
** Copyright (C) 2013 Irontec SL. All rights reserved.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef __SNGREP_UI_MANAGER_H
|
||||
#define __SNGREP_UI_MANAGER_H
|
||||
#include <ncurses.h>
|
||||
#include <panel.h>
|
||||
#include "sip.h"
|
||||
|
||||
/**
|
||||
* The actual UI is not very flexible. It requires a lot of space to
|
||||
* be correctyle drawn.. It would be nice to be more adaptative and hide
|
||||
* some columns in main panel depending on the available columns
|
||||
*/
|
||||
#define UI_MIN_COLS 175
|
||||
|
||||
//! Shorter declaration of ui_panel structure
|
||||
typedef struct ui_panel ui_panel_t;
|
||||
|
||||
/**
|
||||
* @brief Panel information structure
|
||||
* This struct contains the panel related data, including
|
||||
* a pointer to the function that manages its drawing
|
||||
*/
|
||||
struct ui_panel
|
||||
{
|
||||
//! Panel Type @see panel_types enum
|
||||
int type;
|
||||
//! The actual ncurses panel pointer
|
||||
PANEL *panel;
|
||||
//! Constructor for this panel
|
||||
PANEL *(*create)();
|
||||
//! Reques the panel to redraw its data
|
||||
int (*draw)(PANEL*);
|
||||
//! Handle a custom keybind on this panel
|
||||
int (*handle_key)(PANEL*, char key);
|
||||
//! Show help window for this panel (if any)
|
||||
int (*help)(PANEL *);
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum for available color pairs
|
||||
* Colors for each pair are chosen in toggle_colors function
|
||||
*/
|
||||
enum sngrep_colors
|
||||
{
|
||||
HIGHLIGHT_COLOR = 1,
|
||||
HELP_COLOR,
|
||||
OUTGOING_COLOR,
|
||||
INCOMING_COLOR,
|
||||
DETAIL_BORDER_COLOR,
|
||||
DETAIL_WIN_COLOR,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum for available panel types
|
||||
* Mostly used for managing keybindings and offloop ui refresh
|
||||
*/
|
||||
enum panel_types
|
||||
{
|
||||
MAIN_PANEL = 0,
|
||||
MHELP_PANEL,
|
||||
DETAILS_PANEL,
|
||||
DETAILS_PANEL_EX,
|
||||
RAW_PANEL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface configuration.
|
||||
* If some day a rc file is created, its data will be loaded
|
||||
* into this structure.
|
||||
* By now, we'll store some ui information.
|
||||
*/
|
||||
struct ui_config
|
||||
{
|
||||
int color;
|
||||
int online; /* 0 - Offline, 1 - Online */
|
||||
const char *fname; /* Filename in offline mode */
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize ncurses mode and create a main window
|
||||
*
|
||||
* @param ui_config UI configuration structure
|
||||
* @returns 0 on ncurses initialization success, 1 otherwise
|
||||
*/
|
||||
int init_interface(const struct ui_config);
|
||||
|
||||
/**
|
||||
* @brief Toggle color mode on and off
|
||||
* @param on Pass 0 to turn all black&white
|
||||
*/
|
||||
void toggle_color(int on);
|
||||
|
||||
/**
|
||||
* @brief Wait for user input.
|
||||
* This function manages all user input in all panel types and
|
||||
* redraws the panel using its own draw function
|
||||
*
|
||||
* @param panel the topmost panel ui structure
|
||||
*/
|
||||
void wait_for_input(ui_panel_t *ui_panel);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
#endif // __SNGREP_UI_MANAGER_H
|
Loading…
Reference in New Issue