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 PACKET_LIST_STATISTICS */
28 #ifndef __PACKET_LIST_STORE_H__
29 #define __PACKET_LIST_STORE_H__
33 #include "epan/column-info.h"
34 #include "epan/frame_data.h"
37 * The packet list store
38 * @ingroup main_window_group
40 extern GType
packet_list_get_type(void);
41 #define PACKETLIST_TYPE_LIST (packet_list_get_type())
42 #define PACKET_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PACKETLIST_TYPE_LIST, PacketList))
43 #define PACKETLIST_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CART((klass), PACKETLIST_TYPE_LIST))
44 #define PACKETLIST_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PACKETLIST_TYPE_LIST))
45 #define PACKETLIST_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE(klass), PACKETLIST_TYPE_LIST)
46 #define PACKETLIST_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PACKETLIST_TYPE_LIST, PacketListClass))
48 typedef struct _PacketList PacketList
;
49 typedef struct _PacketListClass PacketListClass
;
51 #define PACKET_LIST_RECORD_GET(rows, pos) ((PacketListRecord*) g_ptr_array_index((rows), (pos)))
52 #define PACKET_LIST_RECORD_SET(rows, pos, item) g_ptr_array_index((rows), (pos)) = (item)
53 #define PACKET_LIST_RECORD_APPEND(rows, item) g_ptr_array_add((rows), (item))
54 #define PACKET_LIST_RECORD_COUNT(rows) ((rows) ? (rows)->len : 0)
55 #define PACKET_LIST_RECORD_INDEX_VALID(rows, idx) ((rows) ? (((guint) (idx)) < (rows)->len) : FALSE)
57 /** PacketList: Everything for our model implementation. */
60 GObject parent
; /** MUST be first */
62 /** Array of pointers to the PacketListRecord structure for each visible row. */
63 GPtrArray
*visible_rows
;
64 /** Array of pointers to the PacketListRecord structure for each row. */
65 GPtrArray
*physical_rows
;
67 /** Has the entire file been columnized? */
70 gint n_cols
; /* copy of cfile.cinfo.num_cols */
71 gint n_text_cols
; /* number of cols not based on frame, which we need to store text */
72 gint
*col_to_text
; /* mapping from column number to col_text index, when -1 column is based on frame_data */
76 GtkSortType sort_order
;
78 GStringChunk
*string_pool
;
80 /** Random integer to check whether an iter belongs to our model. */
83 #ifdef PACKET_LIST_STATISTICS
89 /** PacketListClass: more boilerplate GObject stuff */
90 struct _PacketListClass
92 GObjectClass parent_class
;
95 GType
packet_list_list_get_type(void);
96 PacketList
*packet_list_new(void);
97 void packet_list_store_clear(PacketList
*packet_list
);
98 guint
packet_list_recreate_visible_rows_list(PacketList
*packet_list
);
99 gint
packet_list_append_record(PacketList
*packet_list
, frame_data
*fdata
);
100 gboolean
packet_list_do_packet_list_dissect_and_cache_all(PacketList
*packet_list
, gint sort_col_id
);
101 void packet_list_reset_colorized(PacketList
*packet_list
);
102 const char* packet_list_get_widest_column_string(PacketList
*packet_list
, gint col
);
104 #endif /* __PACKET_LIST_STORE_H__ */