aboutsummaryrefslogtreecommitdiffstats
path: root/epan/frame_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/frame_set.c')
-rw-r--r--epan/frame_set.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/epan/frame_set.c b/epan/frame_set.c
index 572c43b..99e7524 100644
--- a/epan/frame_set.c
+++ b/epan/frame_set.c
@@ -12,6 +12,17 @@
#include <epan/frame_set.h>
+static int
+frame_cmp(gconstpointer a, gconstpointer b, gpointer user_data _U_)
+{
+ const frame_data *fdata1 = (const frame_data *) a;
+ const frame_data *fdata2 = (const frame_data *) b;
+
+ return (fdata1->num < fdata2->num) ? -1 :
+ (fdata1->num > fdata2->num) ? 1 :
+ 0;
+}
+
const char *
frame_set_get_interface_name(frame_set *fs, guint32 interface_id)
{
@@ -55,3 +66,25 @@ frame_set_get_interface_description(frame_set *fs, guint32 interface_id)
}
return NULL;
}
+
+const char *
+frame_set_get_user_comment(frame_set *fs, const frame_data *fd)
+{
+ if (fs->frames_user_comments)
+ return (const char *)g_tree_lookup(fs->frames_user_comments, fd);
+
+ /* g_warning? */
+ return NULL;
+}
+
+void
+frame_set_set_user_comment(frame_set *fs, frame_data *fd, const char *new_comment)
+{
+ if (!fs->frames_user_comments)
+ fs->frames_user_comments = g_tree_new_full(frame_cmp, NULL, NULL, g_free);
+
+ /* insert new packet comment */
+ g_tree_replace(fs->frames_user_comments, fd, g_strdup(new_comment));
+
+ fd->flags.has_user_comment = TRUE;
+}