diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-04-27 04:11:37 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-04-27 04:11:37 +0000 |
commit | ad98c396ee7ef837733e885e502853b1ac236bbf (patch) | |
tree | 0348c7d60169fd31d87d96e4b7c6337cededc9a0 /frame_data_sequence.c | |
parent | 317ed8c69a459ac239648ef1d5b30f5cba5175a8 (diff) |
Make the frame_data_sequence structure opaque, and move some other
implementation details into frame_data_sequence.c as well.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36886 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'frame_data_sequence.c')
-rw-r--r-- | frame_data_sequence.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/frame_data_sequence.c b/frame_data_sequence.c index ed1cb746a9..04016023ff 100644 --- a/frame_data_sequence.c +++ b/frame_data_sequence.c @@ -32,16 +32,23 @@ #include "frame_data_sequence.h" -frame_data_sequence * -new_frame_data_sequence(void) -{ - frame_data_sequence *fds; +/* + * We store the frame_data structures in a radix tree, with 1024 + * elements per level. The leaf nodes are arrays of 1024 frame_data + * structures; the nodes above them are arrays of 1024 pointers to + * the nodes below them. The capture_file structure has a pointer + * to the root node. + * + * As frame numbers are 32 bits, and as 1024 is 2^10, that gives us + * up to 4 levels of tree. + */ +#define LOG2_NODES_PER_LEVEL 10 +#define NODES_PER_LEVEL (1<<LOG2_NODES_PER_LEVEL) - fds = g_malloc(sizeof *fds); - fds->count = 0; - fds->ptree_root = NULL; - return fds; -} +struct _frame_data_sequence { + guint32 count; /* Total number of frames */ + void *ptree_root; /* Pointer to the root node */ +}; /* * For a given frame number, calculate the indices into a level 3 @@ -56,6 +63,17 @@ new_frame_data_sequence(void) #define LEAF_INDEX(framenum) \ (((framenum) >> (0*LOG2_NODES_PER_LEVEL)) & (NODES_PER_LEVEL - 1)) +frame_data_sequence * +new_frame_data_sequence(void) +{ + frame_data_sequence *fds; + + fds = g_malloc(sizeof *fds); + fds->count = 0; + fds->ptree_root = NULL; + return fds; +} + /* * Add a new frame_data structure to a frame_data_sequence. */ |