From 53967ebd9facfd59a2e0a7b949bf538638dd5da6 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Mon, 29 May 2017 16:57:47 +0200 Subject: [PATCH] added first EPAN prototype --- configure.ac | 22 ++++++ src/modules/protocol/epan/Makefile.am | 16 +++++ src/modules/protocol/epan/protocol_epan.c | 83 +++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 src/modules/protocol/epan/Makefile.am create mode 100644 src/modules/protocol/epan/protocol_epan.c diff --git a/configure.ac b/configure.ac index b9fa2a46..c2ddb96a 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,16 @@ AC_ARG_ENABLE(mysql, AC_MSG_RESULT([$MYSQL]) AC_SUBST([MYSQL]) +useEpan=no +AC_ARG_ENABLE(compression, + [ --enable-epan Enable EPAN support / Wireshark dissectors)], + [EPAN="$enableval"] + useEpan=yes, + [EPAN="no"] +) +AC_MSG_RESULT([$EPAN]) +AC_SUBST([EPAN]) + usePCRE=no AC_MSG_CHECKING([whether to use pcre]) @@ -216,6 +226,17 @@ if test "$ZLIB" = "yes"; then AC_DEFINE(USE_ZLIB, 1, [Use ZIP library]) fi +dnl +dnl check for epan library +dnl + +if test "$EPAN" = "yes"; then + AC_CHECKING([for epan Library and Header files]) + AC_CHECK_HEADER(epan.h,,[AC_MSG_ERROR([epan.h headers not found.])]) + AC_CHECK_LIB(wireshark, epan_get_version, [ ], [AC_MSG_ERROR([$PACKAGE_NAME requires but cannot find wireshark libraries])]) + AC_DEFINE(USE_EPAN, 1, [Use EPAN library]) +fi + dnl dnl check for redis library @@ -352,5 +373,6 @@ echo Build with REDIS............ : $useRedis echo Build with MySQL............ : $useMysql echo Build with PCRE............. : $usePCRE echo Build with LibUV............ : $useLIBUV +echo Build with EPAN............. : $useEPAN echo diff --git a/src/modules/protocol/epan/Makefile.am b/src/modules/protocol/epan/Makefile.am new file mode 100644 index 00000000..ab63aedc --- /dev/null +++ b/src/modules/protocol/epan/Makefile.am @@ -0,0 +1,16 @@ +include $(top_srcdir)/modules.am + +SUBDIRS = \ + . + +noinst_HEADERS = +# +protocol_epan_la_SOURCES = protocol_epan.c +protocol_epan_la_CFLAGS = -Wall ${MODULE_CFLAGS} +protocol_epan_la_LDFLAGS = -module -avoid-version +protocol_epan_la_LIBADD = ${PTHREAD_LIBS} ${EXPAT_LIBS} ${PCAP_LIBS} +protocol_epan_laconfdir = $(confdir) +protocol_epan_laconf_DATA = $(top_srcdir)/conf/protocol_epan.xml + +mod_LTLIBRARIES = protocol_epan.la + diff --git a/src/modules/protocol/epan/protocol_epan.c b/src/modules/protocol/epan/protocol_epan.c new file mode 100644 index 00000000..b1b7d2fc --- /dev/null +++ b/src/modules/protocol/epan/protocol_epan.c @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * captagent - Homer capture agent. Modular + * Duplicate SIP messages in Homer Encapulate Protocol [HEP] [ipv6 version] + * + * Author: Alexandr Dubovikov + * (C) Homer Project 2016 (http://www.sipcapture.org) + * + * Homer capture agent 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 + * + * Homer capture agent is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * +*/ + +#include +#include +#include +#include +#include + +#include +#include + + +static uint64_t module_serial = 0; + +static cmd_export_t epan_cmds[] = { + { + .name = "parse_epan", + .function = epan_parse, + .param_no = 0, + .flags = 0, + .fixup_flags = 0, + }, + { 0, }, +}; + +struct module_exports exports = { + .name = "protocol_epan", + .cmds = epan_cmds, + .load_f = epan_load_module, + .unload_f = epan_unload_module, + .description_f = epan_description, + .stats_f = epan_statistic, + .serial_f = epan_serial_module, +}; + + +static int epan_load_module(xml_node *config) +{ + return 0; +} + +static int epan_unload_module(void) +{ + return 0; +} + +static int epan_description(char *description) +{ + return 1; +} + +static int epan_statistic(char *buf, size_t len) +{ + return 1; +} + +static uint64_t epan_serial_module(void) +{ + return module_serial; +}