diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/Makefile.nmake | 3 | ||||
-rw-r--r-- | epan/dfilter/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/dissectors/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/epan.c | 17 | ||||
-rw-r--r-- | epan/ftypes/Makefile.am | 2 | ||||
-rw-r--r-- | epan/ftypes/Makefile.nmake | 2 | ||||
-rw-r--r-- | epan/ftypes/ftype-bytes.c | 40 | ||||
-rw-r--r-- | epan/ftypes/ftype-pcre.c | 192 | ||||
-rw-r--r-- | epan/ftypes/ftype-string.c | 39 | ||||
-rw-r--r-- | epan/ftypes/ftype-tvbuff.c | 51 | ||||
-rw-r--r-- | epan/ftypes/ftypes-int.h | 13 | ||||
-rw-r--r-- | epan/ftypes/ftypes.h | 8 |
13 files changed, 7 insertions, 365 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 71764a667e..04fa50bd00 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -1288,7 +1288,6 @@ set(epan_LIBS wiretap wsutil # @SSL_LIBS@ - ${PCRE_LIBRARIES} ${GLIB2_LIBRARIES} ${PCAP_LIBRARIES} # @SOCKET_LIBS@ diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake index 35b631d5a8..4efc7924cc 100644 --- a/epan/Makefile.nmake +++ b/epan/Makefile.nmake @@ -15,7 +15,7 @@ LINK= link 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) @@ -42,7 +42,6 @@ libwireshark_LIBS = \ $(GLIB_LIBS) \ $(C_ARES_LIBS) \ $(ADNS_LIBS) \ - $(PCRE_LIBS) \ $(KFW_LIBS) \ $(NETTLE_LIBS) \ $(ZLIB_LIBS) \ diff --git a/epan/dfilter/Makefile.nmake b/epan/dfilter/Makefile.nmake index 388855205b..b0a5847b89 100644 --- a/epan/dfilter/Makefile.nmake +++ b/epan/dfilter/Makefile.nmake @@ -15,7 +15,7 @@ GENERATED_CFLAGS=\ $(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) diff --git a/epan/dissectors/Makefile.nmake b/epan/dissectors/Makefile.nmake index 721dee92b4..ee966ca9de 100644 --- a/epan/dissectors/Makefile.nmake +++ b/epan/dissectors/Makefile.nmake @@ -14,7 +14,7 @@ include Makefile.common 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 diff --git a/epan/epan.c b/epan/epan.c index fb1c6494e0..f055c2dd7f 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -256,23 +256,6 @@ epan_dissect_fill_in_columns(epan_dissect_t *edt, const gboolean fill_col_exprs, 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 diff --git a/epan/ftypes/Makefile.am b/epan/ftypes/Makefile.am index 67f39d22c6..ffb0cf4b7a 100644 --- a/epan/ftypes/Makefile.am +++ b/epan/ftypes/Makefile.am @@ -40,7 +40,7 @@ INCLUDES = -I$(srcdir)/../.. -I$(srcdir)/.. 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 \ diff --git a/epan/ftypes/Makefile.nmake b/epan/ftypes/Makefile.nmake index f980bf273a..11c983743d 100644 --- a/epan/ftypes/Makefile.nmake +++ b/epan/ftypes/Makefile.nmake @@ -11,7 +11,7 @@ include 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 $< diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 95094810cd..2b67f3d0be 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -32,9 +32,6 @@ #include <epan/strutil.h> #include <epan/oids.h> -#ifdef HAVE_LIBPCRE -# include <pcre.h> -#endif #define CMP_MATCHES cmp_matches static void @@ -467,42 +464,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) } } -#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) { @@ -530,7 +491,6 @@ 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) diff --git a/epan/ftypes/ftype-pcre.c b/epan/ftypes/ftype-pcre.c index c94f541d26..b330c4b021 100644 --- a/epan/ftypes/ftype-pcre.c +++ b/epan/ftypes/ftype-pcre.c @@ -23,8 +23,6 @@ /* 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 @@ -33,192 +31,6 @@ #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> @@ -248,7 +60,7 @@ val_from_string(fvalue_t *fv, char *pattern, LogFunc logfunc) 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 */ ); @@ -351,8 +163,6 @@ ftype_register_pcre(void) ftype_register(FT_PCRE, &pcre_type); } -#endif /* HAVE_LIBPCRE */ - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * diff --git a/epan/ftypes/ftype-string.c b/epan/ftypes/ftype-string.c index 24ec502d9d..3b9aaf30af 100644 --- a/epan/ftypes/ftype-string.c +++ b/epan/ftypes/ftype-string.c @@ -28,9 +28,6 @@ #include <ftypes-int.h> #include <string.h> -#ifdef HAVE_LIBPCRE -# include <pcre.h> -#endif #define CMP_MATCHES cmp_matches #include <ctype.h> @@ -250,41 +247,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) } } -#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) { @@ -311,7 +273,6 @@ 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) diff --git a/epan/ftypes/ftype-tvbuff.c b/epan/ftypes/ftype-tvbuff.c index f87c88eed5..4e6cc970b2 100644 --- a/epan/ftypes/ftype-tvbuff.c +++ b/epan/ftypes/ftype-tvbuff.c @@ -28,9 +28,6 @@ #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 @@ -395,52 +392,6 @@ cmp_contains(fvalue_t *fv_a, fvalue_t *fv_b) 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) { @@ -480,7 +431,7 @@ cmp_matches(fvalue_t *fv_a, fvalue_t *fv_b) ENDTRY; return rc; } -#endif /* HAVE_LIBPCRE / GRegex */ + void ftype_register_tvbuff(void) { diff --git a/epan/ftypes/ftypes-int.h b/epan/ftypes/ftypes-int.h index 0e8154e400..23349c48ec 100644 --- a/epan/ftypes/ftypes-int.h +++ b/epan/ftypes/ftypes-int.h @@ -26,19 +26,6 @@ #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); diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index dd95df2720..a3a22b8741 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -90,10 +90,6 @@ enum ftrepr { 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); @@ -168,11 +164,7 @@ typedef struct _fvalue_t { 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 |