From 0b9b02c6ea4bbf4a7792aa1493b507fd68e8a87b Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Sat, 5 Jan 2002 04:12:17 +0000 Subject: Long NCP traces can easily have many packets whose "uniqueness" variables wrap-around. Since the request/reply packets are related via a hash based on these uniqueness variables, long NCP traces can have mis-matches reqeust/reply records. Thus, only do the hash-lookup for the reply packet during the first sequential scan of the trace file. Once the pertinent info is found, store it in the packet's private data area. Since the memory allocated for the hash and for the structures that make up the keys are no longer needed after the first sequential run through the trace file, arrange to free that memory after the first sequential run. Similar to the register_init_routine() that allows dissectors to register callbacks for calling *before* a capture file is loaded, set up a register_postseq_cleanup_routine() function that allows dissectors to register callbacks for calling *after* the first sequential run-through of the trace file is made. This is not a *final* cleanup callback, since Ethereal will still have that trace file open for random-access reading. I didn't have tethereal call postseq_cleanup_all_protocols() since tethereal doesn't keep the trace file open for random-access reading. I could easily be swayed to make tethereal call that function, however. svn path=/trunk/; revision=4484 --- file.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index 04ced07bf8..284ba530db 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.256 2002/01/03 22:27:44 guy Exp $ + * $Id: file.c,v 1.257 2002/01/05 04:12:14 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -380,6 +380,10 @@ read_cap_file(capture_file *cf, int *err) /* Close the sequential I/O side, to free up memory it requires. */ wtap_sequential_close(cf->wth); + /* Allow the protocol dissectors to free up memory that they + * don't need after the sequential run-through of the packets. */ + postseq_cleanup_all_protocols(); + /* Set the file encapsulation type now; we don't know what it is until we've looked at all the packets, as we don't know until then whether there's more than one type (and thus whether it's @@ -558,6 +562,10 @@ finish_tail_cap_file(capture_file *cf, int *err) sequential I/O side, to free up memory it requires. */ wtap_sequential_close(cf->wth); + /* Allow the protocol dissectors to free up memory that they + * don't need after the sequential run-through of the packets. */ + postseq_cleanup_all_protocols(); + /* Set the file encapsulation type now; we don't know what it is until we've looked at all the packets, as we don't know until then whether there's more than one type (and thus whether it's -- cgit v1.2.3