Add ability to follow UDP stream by index
[metze/wireshark/wip.git] / dftest.c
index 939f77be11f6eab03e2d9c3bbe8055ead4ab93cd..5c28cc6eeb2313eebf4c47d01283f6f17a64e4da 100644 (file)
--- a/dftest.c
+++ b/dftest.c
@@ -1,8 +1,6 @@
 /* dftest.c
  * Shows display filter byte-code, for debugging dfilter routines.
  *
- * $Id$
- *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 
 #include <glib.h>
-#include <epan/epan.h>
 
+#include <epan/epan.h>
 #include <epan/timestamp.h>
-#include <epan/plugins.h>
-#include <epan/filesystem.h>
-#include <wsutil/privileges.h>
 #include <epan/prefs.h>
+#include <epan/dfilter/dfilter.h>
+
+#ifdef HAVE_PLUGINS
+#include <wsutil/plugins.h>
+#endif
+#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
+#include <wsutil/report_err.h>
+
 #include "ui/util.h"
-#include "epan/dfilter/dfilter.h"
 #include "register.h"
 
 static void failure_message(const char *msg_format, va_list ap);
@@ -74,21 +75,27 @@ main(int argc, char **argv)
                        init_progfile_dir_error);
        }
 
+       init_report_err(failure_message, open_failure_message,
+                       read_failure_message, write_failure_message);
+
        timestamp_set_type(TS_RELATIVE);
        timestamp_set_seconds_type(TS_SECONDS_DEFAULT);
 
+#ifdef HAVE_PLUGINS
+       /* Register all the plugin types we have. */
+       epan_register_plugin_types(); /* Types known to libwireshark */
+
+       /* Scan for plugins.  This does *not* call their registration routines;
+          that's done later. */
+       scan_plugins();
+#endif
+
        /* Register all dissectors; we must do this before checking for the
           "-g" flag, as the "-g" flag dumps a list of fields registered
           by the dissectors, and we must do it before we read the preferences,
           in case any dissectors register preferences. */
-       epan_init(register_all_protocols,
-                 register_all_protocol_handoffs, NULL, NULL,
-                 failure_message, open_failure_message, read_failure_message,
-                 write_failure_message);
-
-       /* now register the preferences for any non-dissector modules.
-       we must do that before we read the preferences as well. */
-       prefs_register_modules();
+       epan_init(register_all_protocols, register_all_protocol_handoffs,
+                 NULL, NULL);
 
        /* set the c-language locale to the native environment. */
        setlocale(LC_ALL, "");
@@ -142,9 +149,8 @@ main(int argc, char **argv)
                epan_cleanup();
                exit(2);
        }
-       printf("dfilter ptr = 0x%08x\n", GPOINTER_TO_INT(df));
 
-       printf("\n\n");
+       printf("\n");
 
        if (df == NULL)
                printf("Filter is empty\n");
@@ -197,3 +203,16 @@ write_failure_message(const char *filename, int err)
        fprintf(stderr, "dftest: An error occurred while writing to the file \"%s\": %s.\n",
                filename, g_strerror(err));
 }
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */