aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-24 06:45:14 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-24 06:45:14 +0000
commitca8f79df3d8d042806e24a70a738bd5c92b2dc90 (patch)
tree8d38b419307a3b72caa6f51744641c2cf2772ce1
parentb767826991ba30b900ae917a290927871bc62976 (diff)
Get rid of "init_all_protocols()"; instead, have a routine
"init_dissection()" which calls "epan_conversation_init()", does the work that "init_all_protocols()" did, and then calls "reassemble_init()", so that the standard sequence of dissection initialization is done in one place, rather than having multiple places call the same sequence of routines. svn path=/trunk/; revision=4797
-rw-r--r--epan/packet.c19
-rw-r--r--epan/packet.h6
-rw-r--r--file.c31
-rw-r--r--tethereal.c29
4 files changed, 29 insertions, 56 deletions
diff --git a/epan/packet.c b/epan/packet.c
index ce3a5fee74..7efceae46d 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.60 2002/02/18 01:08:41 guy Exp $
+ * $Id: packet.c,v 1.61 2002/02/24 06:45:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -81,6 +81,8 @@
#include "plugins.h"
#include "epan_dissect.h"
+#include "../reassemble.h"
+
static gint proto_malformed = -1;
static dissector_handle_t frame_handle = NULL;
static dissector_handle_t data_handle = NULL;
@@ -135,7 +137,7 @@ register_init_routine(void (*func)(void))
init_routines = g_slist_append(init_routines, func);
}
-/* Call all the registered "init" routines. */
+/* Initialize all data structures used for dissection. */
static void
call_init_routine(gpointer routine, gpointer dummy)
{
@@ -145,11 +147,20 @@ call_init_routine(gpointer routine, gpointer dummy)
}
void
-init_all_protocols(void)
+init_dissection(void)
{
+ /* Initialize the table of conversations. */
+ epan_conversation_init();
+
+ /* Initialize protocol-specific variables. */
g_slist_foreach(init_routines, &call_init_routine, NULL);
-}
+ /* Initialize the common data structures for fragment reassembly.
+ Must be done *after* calling init routines, as those routines
+ may free up space for fragments, which they find by using the
+ data structures that "reassemble_init()" frees. */
+ reassemble_init();
+}
/* Allow protocols to register a "cleanup" routine to be
* run after the initial sequential run through the packets.
diff --git a/epan/packet.h b/epan/packet.h
index 35aa9d1da6..3adb41364e 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.52 2002/02/18 01:08:42 guy Exp $
+ * $Id: packet.h,v 1.53 2002/02/24 06:45:14 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -216,8 +216,8 @@ extern void set_actual_length(tvbuff_t *tvb, guint specified_len);
or "colorize packets" pass over the current capture file). */
extern void register_init_routine(void (*func)(void));
-/* Call all the registered "init" routines. */
-extern void init_all_protocols(void);
+/* Initialize all data structures used for dissection. */
+extern void init_dissection(void);
/* Allow protocols to register a "cleanup" routine to be
* run after the initial sequential run through the packets.
diff --git a/file.c b/file.c
index 72bb5197c8..c561f54aaa 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.262 2002/02/19 03:43:43 guy Exp $
+ * $Id: file.c,v 1.263 2002/02/24 06:45:12 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -89,7 +89,6 @@
#include "gtk/packet_win.h"
#include <epan/dfilter/dfilter.h>
#include <epan/conversation.h>
-#include "reassemble.h"
#include "globals.h"
#include "gtk/colors.h"
#include <epan/epan_dissect.h>
@@ -148,17 +147,8 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
and fill in the information for this file. */
close_cap_file(cf);
- /* Initialize the table of conversations. */
- epan_conversation_init();
-
- /* Initialize protocol-specific variables */
- init_all_protocols();
-
- /* Initialize the common data structures for fragment reassembly.
- Must be done *after* "init_all_protocols()", as "init_all_protocols()"
- may free up space for fragments, which it finds by using the
- data structures that "reassemble_init()" frees. */
- reassemble_init();
+ /* Initialize all data structures used for dissection. */
+ init_dissection();
/* We're about to start reading the file. */
cf->state = FILE_READ_IN_PROGRESS;
@@ -928,17 +918,8 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
which might cause the state information to be constructed differently
by that dissector. */
- /* Initialize the table of conversations. */
- epan_conversation_init();
-
- /* Initialize protocol-specific variables */
- init_all_protocols();
-
- /* Initialize the common data structures for fragment reassembly.
- Must be done *after* "init_all_protocols()", as "init_all_protocols()"
- may free up space for fragments, which it finds by using the
- data structures that "reassemble_init()" frees. */
- reassemble_init();
+ /* Initialize all data structures used for dissection. */
+ init_dissection();
}
/* Freeze the packet list while we redo it, so we don't get any
@@ -1010,7 +991,7 @@ rescan_packets(capture_file *cf, const char *action, gboolean refilter,
/* Since all state for the frame was destroyed, mark the frame
* as not visited, free the GSList referring to the state
* data (the per-frame data itself was freed by
- * "init_all_protocols()"), and null out the GSList pointer. */
+ * "init_dissection()"), and null out the GSList pointer. */
fdata->flags.visited = 0;
if (fdata->pfd) {
g_slist_free(fdata->pfd);
diff --git a/tethereal.c b/tethereal.c
index 33d7b82a7e..3c0b187272 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.125 2002/02/24 06:01:01 guy Exp $
+ * $Id: tethereal.c,v 1.126 2002/02/24 06:45:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -102,7 +102,6 @@
#include "pcap-util.h"
#endif
#include <epan/conversation.h>
-#include "reassemble.h"
#include <epan/plugins.h>
#include "register.h"
#include "conditions.h"
@@ -811,17 +810,8 @@ capture(volatile int packet_count, int out_file_type)
struct pcap_stat stats;
gboolean dump_ok;
- /* Initialize the table of conversations. */
- epan_conversation_init();
-
- /* Initialize protocol-specific variables */
- init_all_protocols();
-
- /* Initialize the common data structures for fragment reassembly.
- Must be done *after* "init_all_protocols()", as "init_all_protocols()"
- may free up space for fragments, which it finds by using the
- data structures that "reassemble_init()" frees. */
- reassemble_init();
+ /* Initialize all data structures used for dissection. */
+ init_dissection();
ld.linktype = WTAP_ENCAP_UNKNOWN;
ld.pdh = NULL;
@@ -1748,17 +1738,8 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
/* The open succeeded. Fill in the information for this file. */
- /* Initialize the table of conversations. */
- epan_conversation_init();
-
- /* Initialize protocol-specific variables */
- init_all_protocols();
-
- /* Initialize the common data structures for fragment reassembly.
- Must be done *after* "init_all_protocols()", as "init_all_protocols()"
- may free up space for fragments, which it finds by using the
- data structures that "reassemble_init()" frees. */
- reassemble_init();
+ /* Initialize all data structures used for dissection. */
+ init_dissection();
cf->wth = wth;
cf->filed = fd;