aboutsummaryrefslogtreecommitdiffstats
path: root/ui/cli/cli_service_response_time_table.h
blob: 4f6afe402f84065b866f1541cc808ca0171b20eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* cli_service_response_time_table.h
 * TShark service_response_time_table based on GTK version by Ronnie Sahlberg
 * Helper routines common to all service response time statistics
 * tap.
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __CLI_SERVICE_RESPONSE_TIME_TABLE_H__
#define __CLI_SERVICE_RESPONSE_TIME_TABLE_H__

#include "wsutil/nstime.h"
#include "epan/timestats.h"

/** @file
 *  Helper routines common to all service response time statistics tap.
 */

/** Procedure data */
typedef struct _srt_procedure_t {
	int  index;
	timestat_t stats;   /**< stats */
	char *procedure;   /**< column entries */
} srt_procedure_t;

/** Statistics table */
typedef struct _srt_stat_table {
	const char *name;   /**< table name */
	char *filter_string;        /**< append procedure number (%d) to this string
				to create a display filter */
	int num_procs;              /**< number of elements on procedures array */
	const char *proc_column_name;   /**< procedure column name (if different from default) */
	srt_procedure_t *procedures;/**< the procedures array */
} srt_stat_table;

/** Init an srt table data structure.
 *
 * @param name the table name
 * @param rst the srt table to init
 * @param num_procs number of procedures
 * @param proc_column_name procedure column name (if different from "Procedure")
 * @param filter_string filter string or NULL
 */
void init_srt_table(const char *name, srt_stat_table *rst, int num_procs, const char* proc_column_name, const char *filter_string);

/** Init an srt table row data structure.
 *
 * @param rst the srt table
 * @param index number of procedure
 * @param procedure the procedures name
 */
void init_srt_table_row(srt_stat_table *rst, int index, const char *procedure);

/** Add srt response to table row data. This will not draw the data!
 *
 * @param rst the srt table
 * @param index number of procedure
 * @param req_time the time of the corresponding request
 * @param pinfo current packet info
 */
void add_srt_table_data(srt_stat_table *rst, int index, const nstime_t *req_time, packet_info *pinfo);

/** Draw the srt table data.
 *
 * @param rst the srt table
 * @param draw_header draw the header
 * @param draw_footer draw the footer
 */
void draw_srt_table_data(srt_stat_table *rst, gboolean draw_header, gboolean draw_footer);

/** Reset the srt table data.
 *
 * @param rst the srt table
 */
void reset_srt_table_data(srt_stat_table *rst);

/** Free the srt table data.
 *
 * @param rst the srt table
 */
void free_srt_table_data(srt_stat_table *rst);

#endif /* __CLI_SERVICE_RESPONSE_TIME_TABLE_H__ */