5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 /* Uncomment to track some statistics (const strings, etc.) */
26 /* #define NEW_PACKET_LIST_STATISTICS */
28 #ifndef __NEW_PACKET_LIST_H__
29 #define __NEW_PACKET_LIST_H__
31 #ifdef NEW_PACKET_LIST
35 #include "epan/column_info.h"
36 #include "epan/frame_data.h"
38 #define PACKETLIST_TYPE_LIST (packet_list_get_type())
39 #define PACKET_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PACKETLIST_TYPE_LIST, PacketList))
40 #define PACKETLIST_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CART((klass), PACKETLIST_TYPE_LIST))
41 #define PACKETLIST_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PACKETLIST_TYPE_LIST))
42 #define PACKETLIST_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE(klass), PACKETLIST_TYPE_LIST)
43 #define PACKETLIST_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PACKETLIST_TYPE_LIST, PacketListClass))
45 typedef struct _PacketListRecord PacketListRecord;
46 typedef struct _PacketList PacketList;
47 typedef struct _PacketListClass PacketListClass;
49 #define PACKET_LIST_RECORD_GET(rows, pos) ((PacketListRecord*) g_ptr_array_index((rows), (pos)))
50 #define PACKET_LIST_RECORD_SET(rows, pos, item) g_ptr_array_index((rows), (pos)) = (item)
51 #define PACKET_LIST_RECORD_APPEND(rows, item) g_ptr_array_add((rows), (item))
52 #define PACKET_LIST_RECORD_COUNT(rows) ((rows) ? (rows)->len : 0)
53 #define PACKET_LIST_RECORD_INDEX_VALID(rows, idx) ((rows) ? (((guint) (idx)) < (rows)->len) : FALSE)
55 /* PacketListRecord: represents a row */
56 struct _PacketListRecord
58 /* Has this record been columnized? */
60 /* Has this record been colorized? */
64 /* admin stuff used by the custom list model */
65 /* position within the physical array */
67 /* position within the visible array */
71 /* PacketListRecord: Everything for our model implementation. */
74 GObject parent; /* MUST be first */
76 GPtrArray *visible_rows;
77 /* Array of pointers to the PacketListRecord structure for each row. */
78 GPtrArray *physical_rows;
80 /* Has the entire file been columnized? */
84 /* Note: We need one extra column to store the entire PacketListRecord */
85 GType column_types[NUM_COL_FMTS+1];
86 GtkWidget *view; /* XXX - Does this really belong here?? */
89 GtkSortType sort_order;
91 GStringChunk *string_pool;
93 /* Random integer to check whether an iter belongs to our model. */
96 #ifdef NEW_PACKET_LIST_STATISTICS
102 /* PacketListClass: more boilerplate GObject stuff */
103 struct _PacketListClass
105 GObjectClass parent_class;
108 GType packet_list_list_get_type(void);
109 PacketList *new_packet_list_new(void);
110 void new_packet_list_store_clear(PacketList *packet_list);
111 guint packet_list_recreate_visible_rows(PacketList *packet_list);
112 gboolean packet_list_visible_record(PacketList *packet_list, GtkTreeIter *iter);
113 gint packet_list_append_record(PacketList *packet_list, frame_data *fdata);
114 void packet_list_change_record(PacketList *packet_list, guint row, gint col, column_info *cinfo);
115 void packet_list_dissect_and_cache_iter(PacketList *packet_list, GtkTreeIter *iter, gboolean dissect_columns, gboolean dissect_color);
116 void packet_list_reset_colorized(PacketList *packet_list);
117 const char* packet_list_get_widest_column_string(PacketList *packet_list, gint col);
119 #endif /* NEW_PACKET_LIST */
121 #endif /* __NEW_PACKET_LIST_H__ */