set(PACKAGELIST ${PACKAGELIST} GNUTLS)
endif()
-# Regular expressions lib
-if(ENABLE_PCRE)
- set(PACKAGELIST ${PACKAGELIST} PCRE)
-endif()
-
# Kerberos
if(ENABLE_KERBEROS)
set(PACKAGELIST ${PACKAGELIST} KERBEROS)
# @SSL_LIBS@ # -lcrypto
epan
# $(plugin_ldadd) # in case of static
- ${PCRE_LIBRARIES}
${PCAP_LIBRARIES}
${CARES_LIBRARIES}
${ADNS_LIBRARIES}
option(ENABLE_THREADS "Build with threads support" ON)
option(ENABLE_ADNS "Build with adns support" ON)
-option(ENABLE_PCRE "Build with pcre support" OFF)
option(ENABLE_PORTAUDIO "Build with portaudio support" ON)
option(ENABLE_ZLIB "Build with zlib compression support" ON)
option(ENABLE_LUA "Build with lua dissector support" ON)
wsutil/libwsutil.la \
@SSL_LIBS@ \
$(plugin_ldadd) \
- @PCRE_LIBS@ \
@PCAP_LIBS@ \
@GTK_LIBS@ -lm \
@C_ARES_LIBS@ \
wsutil/libwsutil.la \
@SSL_LIBS@ \
$(plugin_ldadd) \
- @PCRE_LIBS@ \
@GLIB_LIBS@ -lm \
@PCAP_LIBS@ \
@SOCKET_LIBS@ \
wsutil/libwsutil.la \
@SSL_LIBS@ \
$(plugin_ldadd) \
- @PCRE_LIBS@ \
@GLIB_LIBS@ -lm \
@PCAP_LIBS@ \
@SOCKET_LIBS@ \
epan/libwireshark.la \
@SSL_LIBS@ \
$(plugin_ldadd) \
- @PCRE_LIBS@ \
@GLIB_LIBS@ -lm \
@PCAP_LIBS@ \
@SOCKET_LIBS@ \
cmake/modules/FindLYNX.cmake \
cmake/modules/FindM.cmake \
cmake/modules/FindPCAP.cmake \
- cmake/modules/FindPCRE.cmake \
cmake/modules/FindPOD.cmake \
cmake/modules/FindPORTAUDIO.cmake \
cmake/modules/FindPYTHON.cmake \
fi
])
-#
-# AC_WIRESHARK_LIBPCRE_CHECK
-#
-AC_DEFUN([AC_WIRESHARK_LIBPCRE_CHECK],
-[
- if test "x$pcre_dir" != "x"
- then
- #
- # The user specified a directory in which libpcre resides,
- # so add the "include" subdirectory of that directory to
- # the include file search path and the "lib" subdirectory
- # of that directory to the library search path.
- #
- # XXX - if there's also a libpcre in a directory that's
- # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
- # make us find the version in the specified directory,
- # as the compiler and/or linker will search that other
- # directory before it searches the specified directory.
- #
- wireshark_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -I$pcre_dir/include"
- wireshark_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -I$pcre_dir/include"
- wireshark_save_LIBS="$LIBS"
- LIBS="$LIBS -lpcre"
- wireshark_save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -L$pcre_dir/lib"
- fi
-
- #
- # Make sure we have "pcre.h". If we don't, it means we probably
- # don't have libpcre, so don't use it.
- #
- AC_CHECK_HEADER(pcre.h,,
- [
- if test "x$pcre_dir" != "x"
- then
- #
- # The user used "--with-pcre=" to specify a directory
- # containing libpcre, but we didn't find the header file
- # there; that either means they didn't specify the
- # right directory or are confused about whether libpcre
- # is, in fact, installed. Report the error and give up.
- #
- AC_MSG_ERROR([libpcre header not found in directory specified in --with-pcre])
- else
- if test "x$want_pcre" = "xyes"
- then
- #
- # The user tried to force us to use the library, but we
- # couldn't find the header file; report an error.
- #
- AC_MSG_ERROR(Header file pcre.h not found.)
- else
- #
- # We couldn't find the header file; don't use the
- # library, as it's probably not present.
- #
- want_pcre=no
- fi
- fi
- ])
-
- if test "x$want_pcre" != "xno"
- then
- #
- # Well, we at least have the pcre header file.
- #
- # We're only using standard functions from libpcre,
- # so we don't need to perform extra checks.
- #
- AC_CHECK_LIB(pcre, pcre_compile,
- [
- if test "x$pcre_dir" != "x"
- then
- #
- # Put the "-I" and "-L" flags for pcre at
- # the beginning of CFLAGS, CPPFLAGS,
- # LDFLAGS, and LIBS.
- #
- PCRE_LIBS="-L$pcre_dir/lib -lpcre $wireshark_save_LIBS"
- else
- PCRE_LIBS="-lpcre"
- fi
- AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library])
- ],[
- if test "x$pcre_dir" != "x"
- then
- #
- # Restore the versions of CFLAGS, CPPFLAGS,
- # LDFLAGS, and LIBS before we added the
- # "--with-pcre=" directory, as we didn't
- # actually find pcre there.
- #
- CFLAGS="$wireshark_save_CFLAGS"
- CPPFLAGS="$wireshark_save_CPPFLAGS"
- LDFLAGS="$wireshark_save_LDFLAGS"
- LIBS="$wireshark_save_LIBS"
- PCRE_LIBS=""
- fi
- want_pcre=no
- ])
- AC_SUBST(PCRE_LIBS)
- fi
-])
-
#
# AC_WIRESHARK_LIBLUA_CHECK
#
+++ /dev/null
-#
-# $Id$
-#
-# - Find pcre
-# Find the native PCRE includes and library
-#
-# PCRE_INCLUDE_DIRS - where to find pcre.h, etc.
-# PCRE_LIBRARIES - List of libraries when using pcre.
-# PCRE_FOUND - True if pcre found.
-
-
-IF (PCRE_INCLUDE_DIRS)
- # Already in cache, be silent
- SET(PCRE_FIND_QUIETLY TRUE)
-ENDIF (PCRE_INCLUDE_DIRS)
-
-FIND_PATH(PCRE_INCLUDE_DIR pcre.h)
-
-SET(PCRE_NAMES pcre)
-FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} )
-
-# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
-
-IF(PCRE_FOUND)
- SET( PCRE_LIBRARIES ${PCRE_LIBRARY} )
- SET( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} )
-ELSE(PCRE_FOUND)
- SET( PCRE_LIBRARIES )
- SET( PCRE_INCLUDE_DIRS )
-ENDIF(PCRE_FOUND)
-
-MARK_AS_ADVANCED( PCRE_LIBRARIES PCRE_INCLUDE_DIRS )
/* Define to use libpcap library */
#cmakedefine HAVE_LIBPCAP 1
-/* Define to use libpcre library */
-#cmakedefine HAVE_LIBPCRE 1
-
/* Define to use dbus-glib library */
#cmakedefine HAVE_LIBDBUS 1
#
# Arrange that we search for header files in the source directory
# and in its "wiretap" subdirectory, as well as in "/usr/local/include",
- # as various packages we use ("libpcap", "zlib", "adns", "pcre")
+ # as various packages we use ("libpcap", "zlib", "adns")
# may have been installed under "/usr/local/include".
#
CFLAGS="$CFLAGS -I/usr/local/include"
fi
fi
-dnl pcre check
-AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters)
-
-AC_ARG_WITH(pcre,
- AC_HELP_STRING( [--with-pcre@<:@=DIR@:>@],
- [use libpcre (located in directory DIR, if supplied) to use in dfilter regular expressions. Not needed if you have GLib 2.14 or later @<:@default=no@:>@]),
-[
- if test $withval = no
- then
- want_pcre=no
- elif test $withval = yes
- then
- want_pcre=yes
- else
- want_pcre=yes
- pcre_dir=$withval
- fi
-],[
- want_pcre=no
- pcre_dir=
-])
-if test "x$want_pcre" = "xno" ; then
- AC_MSG_RESULT(no)
-else
- AC_MSG_RESULT(yes)
- AC_WIRESHARK_LIBPCRE_CHECK
- if test "x$want_pcre" = "xno" ; then
- AC_MSG_RESULT(libpcre not found)
- fi
-fi
-
-
dnl Lua check
AC_MSG_CHECKING(whether to use liblua for the Lua scripting plugin)
zlib_message="yes"
fi
-if test "x$want_pcre" = "xno" ; then
- pcre_message="no (using GRegex instead)"
-else
- pcre_message="yes"
-fi
-
if test "x$want_lua" = "xyes" ; then
lua_message="yes"
else
echo " Build profile binaries : $enable_profile_build"
echo " Use pcap library : $want_pcap"
echo " Use zlib library : $zlib_message"
-echo " Use pcre library : $pcre_message"
echo " Use kerberos library : $krb5_message"
echo " Use c-ares library : $c_ares_message"
echo " Use GNU ADNS library : $adns_message"
X-Orig-Uploaders: Joost Yervante Damad <andete@debian.org>
Standards-Version: 3.8.1.0
Homepage: http://www.wireshark.org
-Build-Depends: libgtk2.0-dev (>=2.4.0-0), libpcap0.8-dev, flex, libz-dev, dpatch, debhelper (>= 6), libtool, python, automake1.9, autoconf, autotools-dev, libc-ares-dev, xsltproc, docbook-xsl (>= 1.64.1.0-0), libpcre3-dev, libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], bison, libgnutls-dev, python-support (>= 0.3), portaudio19-dev, libkrb5-dev, liblua5.1-0-dev, libsmi2-dev, libgeoip-dev
+Build-Depends: libgtk2.0-dev (>=2.4.0-0), libpcap0.8-dev, flex, libz-dev, dpatch, debhelper (>= 6), libtool, python, automake1.9, autoconf, autotools-dev, libc-ares-dev, xsltproc, docbook-xsl (>= 1.64.1.0-0), libcap-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], bison, libgnutls-dev, python-support (>= 0.3), portaudio19-dev, libkrb5-dev, liblua5.1-0-dev, libsmi2-dev, libgeoip-dev
Build-Conflicts: libsnmp4.2-dev, libsnmp-dev
XS-Python-Version: all
should be changed to include that file.
You may not need to include all the headers listed in the skeleton
-below, and you may need to include additional headers. For example, the
-code inside
-
- #ifdef HAVE_LIBPCRE
-
- ...
-
- #endif
-
-is needed only if you are using a function from libpcre, e.g. the
-"pcre_compile()" function.
+below, and you may need to include additional headers.
The stdio.h, stdlib.h and string.h header files should be included only as needed.
</section>
- <section id="ChLibsPCRE">
- <title>PCRE (optional)</title>
- <para>
- "Perl compatible regular expressions". PCRE provides the pattern matching
- functionality required for the "matches" display filter operator.
- </para>
- <para>
- You probably don't need this. GRegex, part of GLib 2.14 and later is a
- wrapper around PCRE. Wireshark's configure script will use it instead of
- PCRE if it is present.
- </para>
-
- <section id="ChLibsUnixPCRE">
- <title>Unix</title>
- <para>
- If this library isn't already installed or available as a
- package for your platform, you can get it at:
- <ulink url="http://www.pcre.org/"/>.
- </para>
- </section>
-
- <section id="ChLibsWin32PCRE">
- <title>Win32 MSVC</title>
- <para>
- You can get the latest version at:
- <ulink url="http://gnuwin32.sourceforge.net/packages/pcre.htm"/>
- </para>
- </section>
-
- </section>
-
-
<section id="ChLibsZlib">
<title>zlib (optional)</title>
<para>
wiretap
wsutil
# @SSL_LIBS@
- ${PCRE_LIBRARIES}
${GLIB2_LIBRARIES}
${PCAP_LIBRARIES}
# @SOCKET_LIBS@
GENERATED_CFLAGS=\
$(STANDARD_CFLAGS) \
/I. /I.. /I../wiretap $(GLIB_CFLAGS) \
- $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) \
+ $(ZLIB_CFLAGS) $(C_ARES_CFLAGS) $(ADNS_CFLAGS) \
$(LUA_CFLAGS) $(GNUTLS_CFLAGS) /I$(PCAP_DIR)\include \
$(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
$(GLIB_LIBS) \
$(C_ARES_LIBS) \
$(ADNS_LIBS) \
- $(PCRE_LIBS) \
$(KFW_LIBS) \
$(NETTLE_LIBS) \
$(ZLIB_LIBS) \
$(STANDARD_CFLAGS) \
/I. /I.. /I..\.. $(GLIB_CFLAGS) \
/I$(LEMON) \
- $(PCRE_CFLAGS) /I$(PCAP_DIR)\include
+ /I$(PCAP_DIR)\include
CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
CFLAGS= $(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
/I. /I.. /I../.. $(GLIB_CFLAGS) \
$(ZLIB_CFLAGS) \
- $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
+ $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
$(KFW_CFLAGS) $(AIRPCAP_CFLAGS) $(GEOIP_CFLAGS) \
/I$(PCAP_DIR)\include
void
epan_get_compiled_version_info(GString *str)
{
- /* PCRE */
- g_string_append(str, ", ");
-#ifdef HAVE_LIBPCRE
- g_string_append(str, "with libpcre ");
-#ifdef PCRE_MAJOR
-#ifdef PCRE_MINOR
- g_string_append_printf(str, "%u.%u", PCRE_MAJOR, PCRE_MINOR);
-#else /* PCRE_MINOR */
- g_string_append_printf(str, "%u", PCRE_MAJOR);
-#endif /* PCRE_MINOR */
-#else /* PCRE_MAJOR */
- g_string_append(str, "(version unknown)");
-#endif /* PCRE_MAJOR */
-#else /* HAVE_LIBPCRE */
- g_string_append(str, "without libpcre");
-#endif /* HAVE_LIBPCRE */
-
/* SNMP */
g_string_append(str, ", ");
#ifdef HAVE_LIBSMI
libftypes_la_SOURCES = $(NONGENERATED_C_FILES) $(NONGENERATED_HEADER_FILES)
-libftypes_la_LIBADD = @GLIB_LIBS@ @PCRE_LIBS@
+libftypes_la_LIBADD = @GLIB_LIBS@
EXTRA_DIST = \
Makefile.common \
CFLAGS=$(WARNINGS_ARE_ERRORS) $(STANDARD_CFLAGS) \
/I. /I.. /I../.. $(GLIB_CFLAGS) \
- $(PCRE_CFLAGS) /I$(PCAP_DIR)\include
+ /I$(PCAP_DIR)\include
.c.obj::
$(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
#include <epan/strutil.h>
#include <epan/oids.h>
-#ifdef HAVE_LIBPCRE
-# include <pcre.h>
-#endif
#define CMP_MATCHES cmp_matches
static void
}
}
-#ifdef HAVE_LIBPCRE
-static gboolean
-cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
-{
- GByteArray *a = fv_a->value.bytes;
- pcre_tuple_t *pcre_t = fv_b->value.re;
- int options = 0;
- int rc;
-
- /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have
- * warned us. For the same reason (and because we're using g_malloc()),
- * fv_b->value.re is not NULL.
- */
- if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) {
- return FALSE;
- }
- if (! pcre_t) {
- return FALSE;
- }
- rc = pcre_exec(
- pcre_t->re, /* Compiled PCRE */
- pcre_t->ex, /* PCRE extra from pcre_study() */
- a->data, /* The data to check for the pattern... */
- (int)a->len, /* ... and its length */
- 0, /* Start offset within data */
- options, /* PCRE options */
- NULL, /* We are not interested in the matched string */
- 0 /* of the pattern; only in success or failure. */
- );
- /* NOTE - DO NOT g_free(data) */
- if (rc == 0) {
- return TRUE;
- }
- return FALSE;
-}
-#else /* GRegex */
static gboolean
cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
{
);
/* NOTE - DO NOT g_free(data) */
}
-#endif /* HAVE_LIBPCRE / GRegex */
void
ftype_register_bytes(void)
/* Perl-Compatible Regular Expression (PCRE) internal field type.
* Used with the "matches" dfilter operator, allowing efficient
* compilation and studying of a PCRE pattern in dfilters.
- *
- * PCRE is provided with libpcre (http://www.pcre.org/).
*/
#ifdef HAVE_CONFIG_H
#include <ftypes-int.h>
-#ifdef HAVE_LIBPCRE
-
-#include <string.h>
-
-#include <pcre.h>
-
-/* Create a pcre_tuple_t object based on the given string pattern */
-static pcre_tuple_t *
-pcre_tuple_new(const char *value)
-{
- pcre_tuple_t *tuple;
- const char *pcre_error_text;
- int pcre_error_offset;
-
- tuple = g_malloc(sizeof(pcre_tuple_t));
- tuple->string = g_strdup(value); /* The RE as string */
- tuple->ex = NULL;
- /* Compile the RE */
- tuple->re = pcre_compile(
- value, /* pattern */
- 0, /* PCRE options */
- &pcre_error_text, /* PCRE constant error string */
- &pcre_error_offset, /* Start offset of error in pattern */
- NULL /* Default char tables (C locale) */
- );
- if (pcre_error_text) {
- tuple->error = g_strdup_printf("In regular expression \"%s\":\n"
- "%s (character position %d)",
- value, pcre_error_text, pcre_error_offset);
- return tuple;
- } else {
- tuple->error = NULL;
- }
- /* Study the RE */
- tuple->ex = pcre_study(tuple->re, 0, &pcre_error_text);
- if (pcre_error_text) {
- if (tuple->error) {
- tuple->error = g_strdup_printf("In regular expression \"%s\":\n"
- "%s. %s",
- value, tuple->error, pcre_error_text);
- } else {
- tuple->error = g_strdup_printf("In regular expression \"%s\":\n"
- "%s",
- value, pcre_error_text);
- }
- }
- return tuple;
-}
-
-static void
-pcre_tuple_free(pcre_tuple_t *tuple)
-{
- if (tuple) {
- g_free(tuple->string);
- g_free(tuple->re);
- g_free(tuple->ex);
- g_free(tuple->error);
- g_free(tuple);
- }
-}
-
-static void
-pcre_fvalue_new(fvalue_t *fv)
-{
- fv->value.re = NULL;
-}
-
-static void
-pcre_fvalue_free(fvalue_t *fv)
-{
- if (fv->value.re) {
- pcre_tuple_free(fv->value.re);
- }
-}
-
-/* Generate a FT_PCRE from a parsed string pattern.
- * Uses the specified logfunc() to report errors. */
-static gboolean
-val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc)
-{
- /* Free up the old value, if we have one */
- pcre_fvalue_free(fv);
-
- fv->value.re = pcre_tuple_new(pattern);
- if (fv->value.re->error) {
- logfunc(fv->value.re->error);
- return FALSE;
- }
- return TRUE;
-}
-
-/* Generate a FT_PCRE from an unparsed string pattern.
- * Uses the specified logfunc() to report errors. */
-static gboolean
-val_from_unparsed(fvalue_t *fv, char *pattern, gboolean allow_partial_value _U_, LogFunc logfunc)
-{
- /* Free up the old value, if we have one */
- pcre_fvalue_free(fv);
- g_assert(! allow_partial_value);
-
- fv->value.re = pcre_tuple_new(pattern);
- if (fv->value.re->error) {
- logfunc(fv->value.re->error);
- return FALSE;
- }
- return TRUE;
-}
-
-static int
-pcre_repr_len(fvalue_t *fv, ftrepr_t rtype)
-{
- g_assert(rtype == FTREPR_DFILTER);
- return (int)strlen(fv->value.re->string);
-}
-
-static void
-pcre_to_repr(fvalue_t *fv, ftrepr_t rtype, char *buf)
-{
- g_assert(rtype == FTREPR_DFILTER);
- strcpy(buf, fv->value.re->string);
-}
-
-/* BEHOLD - value contains the string representation of the regular expression,
- * and we want to store the compiled PCRE RE object into the value. */
-static void
-pcre_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied)
-{
- g_assert(value != NULL);
- /* Free up the old value, if we have one */
- pcre_fvalue_free(fv);
- g_assert(! already_copied);
- fv->value.re = pcre_tuple_new(value);
-}
-
-static gpointer
-pcre_fvalue_get(fvalue_t *fv)
-{
- return fv->value.re;
-}
-
-void
-ftype_register_pcre(void)
-{
- static ftype_t pcre_type = {
- FT_PCRE, /* ftype */
- "FT_PCRE", /* name */
- "Compiled Perl-Compatible Regular Expression object", /* pretty_name */
- 0, /* wire_size */
- pcre_fvalue_new, /* new_value */
- pcre_fvalue_free, /* free_value */
- val_from_unparsed, /* val_from_unparsed */
- val_from_string, /* val_from_string */
- pcre_to_repr, /* val_to_string_repr */
- pcre_repr_len, /* len_string_repr */
-
- pcre_fvalue_set, /* set_value */
- NULL, /* set_value_uinteger */
- NULL, /* set_value_sinteger */
- NULL, /* set_value_integer64 */
- NULL, /* set_value_floating */
-
- pcre_fvalue_get, /* get_value */
- NULL, /* get_value_uinteger */
- NULL, /* get_value_sinteger */
- NULL, /* get_value_integer64 */
- NULL, /* get_value_floating */
-
- NULL, /* cmp_eq */
- NULL, /* cmp_ne */
- NULL, /* cmp_gt */
- NULL, /* cmp_ge */
- NULL, /* cmp_lt */
- NULL, /* cmp_le */
- NULL, /* cmp_bitwise_and */
- NULL, /* cmp_contains */
- NULL, /* cmp_matches */
-
- NULL, /* len */
- NULL, /* slice */
- };
- ftype_register(FT_PCRE, &pcre_type);
-}
-
-#else /* No HAVE_LIBPCRE. Try falling back to GRegex. */
-
-
#include <glib.h>
#include <string.h>
fv->value.re = g_regex_new(
pattern, /* pattern */
- G_REGEX_OPTIMIZE, /* Compile options (G_REGEX_OPTIMIZE = pcre_study) */
+ G_REGEX_OPTIMIZE, /* Compile options */
0, /* Match options */
®ex_error /* Compile / study errors */
);
ftype_register(FT_PCRE, &pcre_type);
}
-#endif /* HAVE_LIBPCRE */
-
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
#include <ftypes-int.h>
#include <string.h>
-#ifdef HAVE_LIBPCRE
-# include <pcre.h>
-#endif
#define CMP_MATCHES cmp_matches
#include <ctype.h>
}
}
-#ifdef HAVE_LIBPCRE
-static gboolean
-cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
-{
- char *str = fv_a->value.string;
- pcre_tuple_t *pcre_t = fv_b->value.re;
- int options = 0;
- int rc;
-
- /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have
- * warned us. For the same reason (and because we're using g_malloc()),
- * fv_b->value.re is not NULL.
- */
- if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) {
- return FALSE;
- }
- if (! pcre_t) {
- return FALSE;
- }
- rc = pcre_exec(
- pcre_t->re, /* Compiled PCRE */
- pcre_t->ex, /* PCRE extra from pcre_study() */
- str, /* The data to check for the pattern... */
- (int)strlen(str), /* ... and its length */
- 0, /* Start offset within data */
- options, /* PCRE options */
- NULL, /* We are not interested in the matched string */
- 0 /* of the pattern; only in success or failure. */
- );
- if (rc == 0) {
- return TRUE;
- }
- return FALSE;
-}
-#else /* GRegex */
static gboolean
cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
{
NULL /* We don't want error information */
);
}
-#endif /* HAVE_LIBPCRE / GRegex */
void
ftype_register_string(void)
#include <ftypes-int.h>
#include <string.h>
-#ifdef HAVE_LIBPCRE
-# include <pcre.h>
-#endif
#define CMP_MATCHES cmp_matches
#define tvb_is_private fvalue_gboolean1
return FALSE;
}
-#ifdef HAVE_LIBPCRE
-static gboolean
-cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
-{
- tvbuff_t *tvb = fv_a->value.tvb;
- pcre_tuple_t *pcre_t = fv_b->value.re;
- int options = 0;
- volatile int rc = 1;
- const char *data = NULL; /* tvb data */
- guint32 tvb_len; /* tvb length */
-
- /* fv_b is always a FT_PCRE, otherwise the dfilter semcheck() would have
- * warned us. For the same reason (and because we're using g_malloc()),
- * fv_b->value.re is not NULL.
- */
- if (strcmp(fv_b->ftype->name, "FT_PCRE") != 0) {
- return FALSE;
- }
- if (! pcre_t) {
- return FALSE;
- }
- TRY {
- tvb_len = tvb_length(tvb);
- data = (const char *)tvb_get_ptr(tvb, 0, tvb_len);
- rc = pcre_exec(
- pcre_t->re, /* Compiled PCRE */
- pcre_t->ex, /* PCRE extra from pcre_study() */
- data, /* The data to check for the pattern... */
- tvb_len, /* ... and its length */
- 0, /* Start offset within data */
- options, /* PCRE options */
- NULL, /* We are not interested in the matched string */
- 0 /* of the pattern; only in success or failure. */
- );
- /* NOTE - DO NOT g_free(data) */
- }
- CATCH_ALL {
- return FALSE;
- }
- ENDTRY;
- if (rc == 0) {
- return TRUE;
- }
- return FALSE;
-}
-#else /* GRegex */
static gboolean
cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b)
{
ENDTRY;
return rc;
}
-#endif /* HAVE_LIBPCRE / GRegex */
+
void
ftype_register_tvbuff(void)
{
#include <epan/packet.h>
#include "ftypes.h"
-#ifdef HAVE_LIBPCRE
-#include <pcre.h>
-#endif /* HAVE_LIBPCRE */
-
-
-#ifdef HAVE_LIBPCRE
-struct _pcre_tuple_t {
- char *string;
- pcre *re;
- pcre_extra *ex;
- char *error;
-};
-#endif /* HAVE_LIBPCRE */
void
ftype_register(enum ftenum ftype, ftype_t *ft);
typedef enum ftrepr ftrepr_t;
-#ifdef HAVE_LIBPCRE
-typedef struct _pcre_tuple_t pcre_tuple_t;
-#endif /* HAVE_LIBPCRE */
-
/* Initialize the ftypes subsytem. Called once. */
void
ftypes_initialize(void);
e_guid_t guid;
nstime_t time;
tvbuff_t *tvb;
-#ifdef HAVE_LIBPCRE
- pcre_tuple_t *re;
-#else /* Try falling back to GRegex. */
GRegex *re;
-#endif /* HAVE_LIBPCRE */
} value;
/* The following is provided for private use
#include <zlib.h> /* to get the libz version number */
#endif
-#ifdef HAVE_LIBPCRE
-#include <pcre.h> /* to get the libpcre version number */
-#endif /* HAVE_LIBPCRE */
-
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif