Don't keep the first frame around for circuits; we assume that a given
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Nov 2002 08:12:07 +0000 (08:12 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 28 Nov 2002 08:12:07 +0000 (08:12 +0000)
circuit begins either at the beginning of the capture or right after the
previous circuit ends.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6694 f5534014-38df-0310-8fa8-9805f1628bb7

epan/circuit.c
epan/circuit.h

index e8cbbef0daca91d70c7a46986d1be0e2913413d6..f2439c7cd31eed41f5b526fa9f1f7e53b5cae543 100644 (file)
@@ -1,7 +1,7 @@
 /* circuit.c
  * Routines for building lists of packets that are part of a "circuit"
  *
- * $Id: circuit.c,v 1.5 2002/11/27 22:44:41 guy Exp $
+ * $Id: circuit.c,v 1.6 2002/11/28 08:12:07 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -144,7 +144,6 @@ circuit_new(circuit_type ctype, guint32 circuit_id, guint32 first_frame)
 
        circuit = g_mem_chunk_alloc(circuit_chunk);
        circuit->next = NULL;
-       circuit->first_frame = first_frame;
        circuit->last_frame = 0;        /* not known yet */
        circuit->index = new_index;
        circuit->data_list = NULL;
@@ -193,7 +192,7 @@ circuit_t *
 find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
 {
        circuit_key key;
-       circuit_t *circuit;
+       circuit_t *circuit, *prev_circuit;
 
        key.ctype = ctype;
        key.circuit_id = circuit_id;
@@ -202,20 +201,22 @@ find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
         * OK, search the list of circuits with that type and ID for
         * a circuit whose range of frames includes that frame number.
         */
-       for (circuit = g_hash_table_lookup(circuit_hashtable, &key);
-           circuit != NULL; circuit = circuit->next) {
+       for (circuit = g_hash_table_lookup(circuit_hashtable, &key), prev_circuit = NULL;
+           circuit != NULL; prev_circuit = circuit, circuit = circuit->next) {
                /*
-                * The frame includes that frame number if:
+                * This circuit includes that frame number if:
                 *
-                *      the circuit's first frame is unknown or is at or
-                *      before that frame
+                *      there is no previous circuit or the previous
+                *      circuit's last frame is before that frame
+                *      (so that the previous circuit doesn't include
+                *      that frame)
                 *
                 * and
                 *
                 *      the circuit's last frame is unknown or is at or
                 *      after that frame.
                 */
-               if ((circuit->first_frame == 0 || circuit->first_frame <= frame)
+               if ((prev_circuit == NULL || prev_circuit->last_frame < frame)
                    && (circuit->last_frame == 0 || circuit->last_frame >= frame))
                        break;
        }
index c635336c606c4b68044445ef03005a0bd9ed79d4..d6690f400a4acbd963b68d9cd8a03b92a1adef0e 100644 (file)
@@ -1,7 +1,7 @@
 /* circuit.h
  * Routines for building lists of packets that are part of a "circuit"
  *
- * $Id: circuit.h,v 1.3 2002/11/08 01:00:07 guy Exp $
+ * $Id: circuit.h,v 1.4 2002/11/28 08:12:07 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -37,7 +37,6 @@ typedef struct circuit_key {
 
 typedef struct circuit {
        struct circuit *next;           /* pointer to next circuit with given circuit ID */
-       guint32 first_frame;            /* # of first frame for that circuit */
        guint32 last_frame;             /* # of last frame for that circuit */
        guint32 index;                  /* unique ID for circuit */
        GSList *data_list;              /* list of data associated with circuit */