1 /* tap-sequence-analysis.h
2 * Flow sequence analysis
4 * Copied from gtk/graph_analysis.h
6 * Copyright 2004, Verso Technologies Inc.
7 * By Alejandro Vaquero <alejandrovaquero@yahoo.com>
9 * based on rtp_analysis.c and io_stat
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #ifndef __TAP_SEQUENCE_ANALYSIS_H__
32 #define __TAP_SEQUENCE_ANALYSIS_H__
37 #include "epan/address.h"
41 #endif /* __cplusplus */
43 #define MAX_NUM_NODES 40
45 typedef enum seq_analysis_type_ {
51 /** defines an entry for the graph analysis */
52 typedef struct _seq_analysis_item {
58 gchar *frame_label; /**< the label on top of the arrow */
59 gchar *time_str; /**< timestamp */
60 gchar *comment; /**< a comment that appears at the right of the graph */
61 guint16 conv_num; /**< The conversation number. Used for coloring VoIP calls. */
62 unsigned fg_color; /**< Foreground color, 0xRRGGBB. Qt only. */
63 unsigned bg_color; /**< Background color, 0xRRGGBB. Qt only. */
64 gboolean display; /**< indicate if the packet is displayed or not in the graph */
65 guint src_node; /**< this is used by graph_analysis.c to identify the node */
66 guint dst_node; /**< a node is an IP address that will be displayed in columns */
67 guint16 line_style; /**< the arrow line width in pixels*/
68 gchar *protocol; /**< the label of the protocol defined in the IP packet */
69 } seq_analysis_item_t;
71 /** defines the graph analysis structure */
72 typedef struct _seq_analysis_info {
73 seq_analysis_type type; /**< sequence type */
74 gboolean all_packets; /**< all packets vs only displayed */
75 gboolean any_addr; /**< any addr (DL+net) vs net-only */
76 int nconv; /**< number of conversations in the list */
77 GQueue* items; /**< list of seq_analysis_info_t */
78 GHashTable *ht; /**< hash table of seq_analysis_info_t */
79 address nodes[MAX_NUM_NODES]; /**< horizontal node list */
80 guint32 num_nodes; /**< actual number of nodes */
81 } seq_analysis_info_t;
84 #define SEQ_ANALYSIS_DEBUG(...) { \
85 char *SEQ_ANALYSIS_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
86 g_warning("sequence analysis: %s:%d %s", G_STRFUNC, __LINE__, SEQ_ANALYSIS_DEBUG_MSG); \
87 g_free(SEQ_ANALYSIS_DEBUG_MSG); \
90 #define SEQ_ANALYSIS_DEBUG()
93 /** Create and initialize a seq_analysis_info_t struct
94 * @return A pointer to a newly allocated seq_analysis_info_t struct.
96 seq_analysis_info_t *sequence_analysis_info_new(void);
98 /** Free a seq_analysis_info_t struct.
99 * @param sainfo A pointer to the seq_analysis_info_t struct to be freed.
101 void sequence_analysis_info_free(seq_analysis_info_t * sainfo);
103 /** Fill in the segment list for sequence analysis
105 * @param cf Capture file to scan
106 * @param sainfo Sequence analysis information. A valid type must be set.
108 void sequence_analysis_list_get(capture_file *cf, seq_analysis_info_t *sainfo);
110 void sequence_analysis_list_sort(seq_analysis_info_t *sainfo);
112 /** Free the segment list
114 * @param sainfo Sequence analysis information.
116 void sequence_analysis_list_free(seq_analysis_info_t *sainfo);
118 /** Fill in the node address list
120 * @param sainfo Sequence analysis information.
121 * @return The number of transaction items (not nodes) processed.
123 int sequence_analysis_get_nodes(seq_analysis_info_t *sainfo);
125 /** Write an ASCII version of the sequence diagram to a file.
127 * @param pathname Pathname of the file to write.
128 * @param sainfo Sequence analysis information.
129 * @param cf Capture file associated with the diagram.
130 * @param first_node Start drawing at this node.
131 * @return TRUE on success, FALSE on failure.
133 gboolean sequence_analysis_dump_to_file(const char *pathname, seq_analysis_info_t *sainfo, capture_file *cf, unsigned int first_node);
137 #endif /* __cplusplus */
139 #endif /* __TAP_SEQUENCE_ANALYSIS_H__ */
147 * indent-tabs-mode: nil
150 * ex: set shiftwidth=4 tabstop=8 expandtab:
151 * :indentSize=4:tabSize=8:noTabs=true: