summaryrefslogtreecommitdiffstats
path: root/ui/cli
diff options
context:
space:
mode:
Diffstat (limited to 'ui/cli')
-rw-r--r--ui/cli/simple_dialog.c8
-rw-r--r--ui/cli/tap-camelsrt.c12
-rw-r--r--ui/cli/tap-credentials.c4
-rw-r--r--ui/cli/tap-diameter-avp.c60
-rw-r--r--ui/cli/tap-endpoints.c16
-rw-r--r--ui/cli/tap-expert.c20
-rw-r--r--ui/cli/tap-exportobject.c24
-rw-r--r--ui/cli/tap-exportobject.h2
-rw-r--r--ui/cli/tap-flow.c10
-rw-r--r--ui/cli/tap-follow.c50
-rw-r--r--ui/cli/tap-funnel.c24
-rw-r--r--ui/cli/tap-gsm_astat.c2
-rw-r--r--ui/cli/tap-hosts.c24
-rw-r--r--ui/cli/tap-httpstat.c26
-rw-r--r--ui/cli/tap-icmpstat.c16
-rw-r--r--ui/cli/tap-icmpv6stat.c16
-rw-r--r--ui/cli/tap-iostat.c310
-rw-r--r--ui/cli/tap-iousers.c18
-rw-r--r--ui/cli/tap-macltestat.c187
-rw-r--r--ui/cli/tap-protocolinfo.c2
-rw-r--r--ui/cli/tap-protohierstat.h4
-rw-r--r--ui/cli/tap-rlcltestat.c84
-rw-r--r--ui/cli/tap-rpcprogs.c12
-rw-r--r--ui/cli/tap-rtd.c8
-rw-r--r--ui/cli/tap-rtp.c2
-rw-r--r--ui/cli/tap-rtspstat.c26
-rw-r--r--ui/cli/tap-sctpchunkstat.c18
-rw-r--r--ui/cli/tap-simple_stattable.c6
-rw-r--r--ui/cli/tap-sipstat.c44
-rw-r--r--ui/cli/tap-smbsids.c4
-rw-r--r--ui/cli/tap-srt.c28
-rw-r--r--ui/cli/tap-stats_tree.c6
-rw-r--r--ui/cli/tap-voip.h2
-rw-r--r--ui/cli/tap-wspstat.c40
34 files changed, 556 insertions, 559 deletions
diff --git a/ui/cli/simple_dialog.c b/ui/cli/simple_dialog.c
index 5807c8b3..1916a43b 100644
--- a/ui/cli/simple_dialog.c
+++ b/ui/cli/simple_dialog.c
@@ -21,11 +21,11 @@
#include <ui/simple_dialog.h>
#include "ws_attributes.h"
-gpointer
+void *
simple_dialog(
ESD_TYPE_E type _U_,
- gint btn_mask _U_,
- const gchar * msg_format,
+ int btn_mask _U_,
+ const char * msg_format,
...
)
{
@@ -39,7 +39,7 @@ simple_dialog(
}
void
-simple_message_box(ESD_TYPE_E type _U_, gboolean *notagain _U_,
+simple_message_box(ESD_TYPE_E type _U_, bool *notagain _U_,
const char *secondary_msg, const char *msg_format, ...)
{
va_list ap;
diff --git a/ui/cli/tap-camelsrt.c b/ui/cli/tap-camelsrt.c
index 935731ac..0f98b996 100644
--- a/ui/cli/tap-camelsrt.c
+++ b/ui/cli/tap-camelsrt.c
@@ -37,7 +37,7 @@ void register_tap_listener_camelsrt(void);
/* used to keep track of the statistics for an entire program interface */
struct camelsrt_t {
char *filter;
- guint32 count[NB_CAMELSRT_CATEGORY];
+ uint32_t count[NB_CAMELSRT_CATEGORY];
timestat_t stats[NB_CAMELSRT_CATEGORY];
nstime_t delta_time[NB_CAMELSRT_CATEGORY][NUM_RAS_STATS];
};
@@ -82,14 +82,14 @@ static tap_packet_status camelsrt_packet(void *phs,
static void camelsrt_draw(void *phs)
{
struct camelsrt_t *hs = (struct camelsrt_t *)phs;
- guint j, z;
- guint32 li;
+ unsigned j, z;
+ uint32_t li;
int somme, iteration = 0;
timestat_t *rtd_temp;
double x, delay, delay_max, delay_min, delta;
double criteria[NB_CRITERIA] = { 5.0, 10.0, 75.0, 90.0, 95.0, 99.0, 99.90 };
double delay_criteria[NB_CRITERIA];
- gchar* tmp_str;
+ char* tmp_str;
printf("\n");
printf("Camel Service Response Time (SRT) Statistics:\n");
@@ -235,8 +235,8 @@ static void camelsrt_init(const char *opt_arg, void *userdata _U_)
* Whereas, with wireshark, it is not possible to have the correct display, if the stats are
* not saved along the analyze
*/
- gtcap_StatSRT = TRUE;
- gcamel_StatSRT = TRUE;
+ gtcap_StatSRT = true;
+ gcamel_StatSRT = true;
}
static stat_tap_ui camelsrt_ui = {
diff --git a/ui/cli/tap-credentials.c b/ui/cli/tap-credentials.c
index 9a54a7eb..c5e9e6c9 100644
--- a/ui/cli/tap-credentials.c
+++ b/ui/cli/tap-credentials.c
@@ -26,7 +26,7 @@
void register_tap_listener_credentials(void);
-wmem_array_t* credentials = NULL;
+wmem_array_t* credentials;
static tap_credential_t* tap_credential_clone(tap_credential_t* auth)
{
@@ -64,7 +64,7 @@ static void credentials_draw(void *p _U_)
printf("===================================================================\n");
printf("%-10s %-16s %-16s %-16s\n", "Packet", "Protocol", "Username", "Info");
printf("------ -------- -------- --------\n");
- for (guint i = 0; i < wmem_array_get_count(credentials); i++) {
+ for (unsigned i = 0; i < wmem_array_get_count(credentials); i++) {
tap_credential_t* auth = (tap_credential_t*)wmem_array_index(credentials, i);
printf("%-10u %-16s %-16s %-16s\n", auth->num, auth->proto, auth->username, auth->info ? auth->info : "");
}
diff --git a/ui/cli/tap-diameter-avp.c b/ui/cli/tap-diameter-avp.c
index eb990fa9..bc1b273d 100644
--- a/ui/cli/tap-diameter-avp.c
+++ b/ui/cli/tap-diameter-avp.c
@@ -45,54 +45,54 @@ void register_tap_listener_diameteravp(void);
/* used to keep track of the statistics for an entire program interface */
typedef struct _diameteravp_t {
- guint32 frame;
- guint32 diammsg_toprocess;
- guint32 cmd_code;
- guint32 req_count;
- guint32 ans_count;
- guint32 paired_ans_count;
- gchar *filter;
+ uint32_t frame;
+ uint32_t diammsg_toprocess;
+ uint32_t cmd_code;
+ uint32_t req_count;
+ uint32_t ans_count;
+ uint32_t paired_ans_count;
+ char *filter;
} diameteravp_t;
/* Copied from proto.c */
-static gboolean
-tree_traverse_pre_order(proto_tree *tree, proto_tree_traverse_func func, gpointer data)
+static bool
+tree_traverse_pre_order(proto_tree *tree, proto_tree_traverse_func func, void *data)
{
proto_node *pnode = tree;
proto_node *child;
proto_node *current;
if (func(pnode, data))
- return TRUE;
+ return true;
child = pnode->first_child;
while (child != NULL) {
current = child;
child = current->next;
if (tree_traverse_pre_order((proto_tree *)current, func, data))
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static gboolean
-diam_tree_to_csv(proto_node *node, gpointer data)
+static bool
+diam_tree_to_csv(proto_node *node, void * data)
{
char *val_str = NULL;
char *val_tmp = NULL;
ftenum_t ftype;
field_info *fi;
- header_field_info *hfi;
+ const header_field_info *hfi;
if (!node) {
fprintf(stderr, "traverse end: empty node. node='%p' data='%p'\n", (void *)node, (void *)data);
- return FALSE;
+ return false;
}
fi = node->finfo;
hfi = fi ? fi->hfinfo : NULL;
if (!hfi) {
fprintf(stderr, "traverse end: hfi not found. node='%p'\n", (void *)node);
- return FALSE;
+ return false;
}
ftype = fvalue_type_ftenum(fi->value);
if (ftype != FT_NONE && ftype != FT_PROTOCOL) {
@@ -109,7 +109,7 @@ diam_tree_to_csv(proto_node *node, gpointer data)
printf("%s='%s' ", hfi->name, val_str);
g_free(val_str);
}
- return FALSE;
+ return false;
}
static tap_packet_status
@@ -117,19 +117,19 @@ diameteravp_packet(void *pds, packet_info *pinfo, epan_dissect_t *edt _U_, const
{
tap_packet_status ret = TAP_PACKET_DONT_REDRAW;
double resp_time = 0.;
- gboolean is_request = TRUE;
- guint32 cmd_code = 0;
- guint32 req_frame = 0;
- guint32 ans_frame = 0;
- guint32 diam_child_node = 0;
+ bool is_request = true;
+ uint32_t cmd_code = 0;
+ uint32_t req_frame = 0;
+ uint32_t ans_frame = 0;
+ uint32_t diam_child_node = 0;
proto_node *current = NULL;
proto_node *node = NULL;
- header_field_info *hfi = NULL;
+ const header_field_info *hfi = NULL;
field_info *finfo = NULL;
const diameter_req_ans_pair_t *dp = (const diameter_req_ans_pair_t *)pdi;
diameteravp_t *ds = NULL;
- /* Validate paramerers. */
+ /* Validate parameters */
if (!dp || !edt || !edt->tree)
return ret;
@@ -206,10 +206,10 @@ static void
diameteravp_init(const char *opt_arg, void *userdata _U_)
{
diameteravp_t *ds;
- gchar *field = NULL;
- gchar **tokens;
- guint opt_count = 0;
- guint opt_idx = 0;
+ char *field = NULL;
+ char **tokens;
+ unsigned opt_count = 0;
+ unsigned opt_idx = 0;
GString *filter = NULL;
GString *error_string = NULL;
@@ -230,7 +230,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_)
while (tokens[opt_count])
opt_count++;
if (opt_count > 2) {
- /* if the token is a not-null string and it's not *, the conversion must succeeed */
+ /* if the token is a not-null string and it's not *, the conversion must succeed */
if (strlen(tokens[2]) > 0 && tokens[2][0] != '*') {
if (!ws_strtou32(tokens[2], NULL, &ds->cmd_code)) {
fprintf(stderr, "Invalid integer token: %s\n", tokens[2]);
diff --git a/ui/cli/tap-endpoints.c b/ui/cli/tap-endpoints.c
index e97dcf85..b71f39f7 100644
--- a/ui/cli/tap-endpoints.c
+++ b/ui/cli/tap-endpoints.c
@@ -33,9 +33,9 @@ endpoints_draw(void *arg)
conv_hash_t *hash = (conv_hash_t*)arg;
endpoints_t *iu = (endpoints_t *)hash->user_data;
endpoint_item_t *endpoint;
- guint64 last_frames, max_frames;
- guint i;
- gboolean display_port = (!strncmp(iu->type, "TCP", 3) || !strncmp(iu->type, "UDP", 3) || !strncmp(iu->type, "SCTP", 4)) ? TRUE : FALSE;
+ uint64_t last_frames, max_frames;
+ unsigned i;
+ bool display_port = (!strncmp(iu->type, "TCP", 3) || !strncmp(iu->type, "UDP", 3) || !strncmp(iu->type, "SCTP", 4)) ? true : false;
printf("================================================================================\n");
printf("%s Endpoints\n", iu->type);
@@ -48,7 +48,7 @@ endpoints_draw(void *arg)
do {
last_frames = 0;
for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
- guint64 tot_frames;
+ uint64_t tot_frames;
endpoint = &g_array_index(iu->hash.conv_array, endpoint_item_t, i);
tot_frames = endpoint->rx_frames + endpoint->tx_frames;
@@ -59,18 +59,18 @@ endpoints_draw(void *arg)
}
for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
- guint64 tot_frames;
- gchar *conversation_str, *port_str;
+ uint64_t tot_frames;
+ char *conversation_str, *port_str;
endpoint = &g_array_index(iu->hash.conv_array, endpoint_item_t, i);
tot_frames = endpoint->rx_frames + endpoint->tx_frames;
if (tot_frames == last_frames) {
/* XXX - TODO: make name resolution configurable (through gbl_resolv_flags?) */
- conversation_str = get_conversation_address(NULL, &endpoint->myaddress, TRUE);
+ conversation_str = get_conversation_address(NULL, &endpoint->myaddress, true);
if (display_port) {
/* XXX - TODO: make port resolution configurable (through gbl_resolv_flags?) */
- port_str = get_endpoint_port(NULL, endpoint, TRUE);
+ port_str = get_endpoint_port(NULL, endpoint, true);
printf("%-20s %5s %6" PRIu64 " %9" PRIu64
" %6" PRIu64 " %9" PRIu64 " %6"
PRIu64 " %9" PRIu64 " \n",
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c
index 3fcf0e7f..8fa812cc 100644
--- a/ui/cli/tap-expert.c
+++ b/ui/cli/tap-expert.c
@@ -39,10 +39,10 @@ static severity_level_t lowest_report_level = comment_level;
typedef struct expert_entry
{
- guint32 group;
+ uint32_t group;
int frequency;
- const gchar *protocol;
- gchar *summary;
+ const char *protocol;
+ char *summary;
} expert_entry;
@@ -57,7 +57,7 @@ typedef struct expert_tapdata_t {
static void
expert_stat_reset(void *tapdata)
{
- gint n;
+ int n;
expert_tapdata_t *etd = (expert_tapdata_t *)tapdata;
/* Free & reallocate chunk of strings */
@@ -80,7 +80,7 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U
severity_level_t severity_level;
expert_entry tmp_entry;
expert_entry *entry;
- guint n;
+ unsigned n;
switch (ei->severity) {
case PI_COMMENT:
@@ -133,12 +133,12 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U
}
/* Output for all of the items of one severity */
-static void draw_items_for_severity(GArray *items, const gchar *label)
+static void draw_items_for_severity(GArray *items, const char *label)
{
- guint n;
+ unsigned n;
expert_entry *ei;
int total = 0;
- gchar *tmp_str;
+ char *tmp_str;
/* Don't print title if no items */
if (items->len == 0) {
@@ -188,7 +188,7 @@ static void
expert_tapdata_free(expert_tapdata_t* hs)
{
for (int n = 0; n < max_level; n++) {
- g_array_free(hs->ei_array[n], TRUE);
+ g_array_free(hs->ei_array[n], true);
}
g_string_chunk_free(hs->text);
g_free(hs);
@@ -249,7 +249,7 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_)
/* Allocate GArray for each severity level */
for (n=0; n < max_level; n++) {
- hs->ei_array[n] = g_array_sized_new(FALSE, FALSE, sizeof(expert_entry), 1000);
+ hs->ei_array[n] = g_array_sized_new(false, false, sizeof(expert_entry), 1000);
}
/**********************************************/
diff --git a/ui/cli/tap-exportobject.c b/ui/cli/tap-exportobject.c
index 4a02155c..013e7a9e 100644
--- a/ui/cli/tap-exportobject.c
+++ b/ui/cli/tap-exportobject.c
@@ -31,13 +31,13 @@ typedef struct _export_object_list_gui_t {
register_eo_t* eo;
} export_object_list_gui_t;
-static GHashTable* eo_opts = NULL;
+static GHashTable* eo_opts;
static bool
list_exportobject_protocol(const void *key, void *value _U_, void *userdata _U_)
{
- fprintf(stderr, " %s\n", (const gchar*)key);
- return FALSE;
+ fprintf(stderr, " %s\n", (const char*)key);
+ return false;
}
void eo_list_object_types(void)
@@ -45,9 +45,9 @@ void eo_list_object_types(void)
eo_iterate_tables(list_exportobject_protocol, NULL);
}
-gboolean eo_tap_opt_add(const char *option_string)
+bool eo_tap_opt_add(const char *option_string)
{
- gchar** splitted;
+ char** splitted;
if (!eo_opts)
eo_opts = g_hash_table_new(g_str_hash,g_str_equal);
@@ -62,7 +62,7 @@ gboolean eo_tap_opt_add(const char *option_string)
}
else
{
- gchar* dir = (gchar*)g_hash_table_lookup(eo_opts, splitted[0]);
+ char* dir = (char*)g_hash_table_lookup(eo_opts, splitted[0]);
/* Since we're saving all objects from a protocol,
it can only be listed once */
@@ -70,7 +70,7 @@ gboolean eo_tap_opt_add(const char *option_string)
g_hash_table_insert(eo_opts, splitted[0], splitted[1]);
g_free(splitted);
- return TRUE;
+ return true;
}
else
{
@@ -79,7 +79,7 @@ gboolean eo_tap_opt_add(const char *option_string)
}
g_strfreev(splitted);
- return FALSE;
+ return false;
}
static void
@@ -105,10 +105,10 @@ eo_draw(void *tapdata)
export_object_list_gui_t *object_list = (export_object_list_gui_t*)tap_object->gui_data;
GSList *slist = object_list->entries;
export_object_entry_t *entry;
- gchar* save_in_path = (gchar*)g_hash_table_lookup(eo_opts, proto_get_protocol_filter_name(get_eo_proto_id(object_list->eo)));
+ char* save_in_path = (char*)g_hash_table_lookup(eo_opts, proto_get_protocol_filter_name(get_eo_proto_id(object_list->eo)));
GString *safe_filename = NULL;
- gchar *save_as_fullpath = NULL;
- guint count = 0;
+ char *save_as_fullpath = NULL;
+ unsigned count = 0;
if (!g_file_test(save_in_path, G_FILE_TEST_IS_DIR)) {
/* If the destination directory (or its parents) do not exist, create them. */
@@ -147,7 +147,7 @@ eo_draw(void *tapdata)
}
static void
-exportobject_handler(gpointer key, gpointer value _U_, gpointer user_data _U_)
+exportobject_handler(void *key, void *value _U_, void *user_data _U_)
{
GString *error_msg;
export_object_list_t *tap_data;
diff --git a/ui/cli/tap-exportobject.h b/ui/cli/tap-exportobject.h
index 49ebc265..9c279d00 100644
--- a/ui/cli/tap-exportobject.h
+++ b/ui/cli/tap-exportobject.h
@@ -17,7 +17,7 @@ extern "C" {
void eo_list_object_types(void);
/* will be called by main each time a --export-objects option is found */
-gboolean eo_tap_opt_add(const char *ws_optarg);
+bool eo_tap_opt_add(const char *ws_optarg);
void start_exportobjects(void);
diff --git a/ui/cli/tap-flow.c b/ui/cli/tap-flow.c
index 32e0a94f..04111e25 100644
--- a/ui/cli/tap-flow.c
+++ b/ui/cli/tap-flow.c
@@ -46,16 +46,16 @@ flow_draw(void *arg)
sequence_analysis_info_free(flow_info);
}
-static gboolean flow_arg_strncmp(const char **opt_argp, const char *strp)
+static bool flow_arg_strncmp(const char **opt_argp, const char *strp)
{
size_t len = strlen(strp);
if (strncmp(*opt_argp, strp, len) == 0)
{
*opt_argp += len;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static void
@@ -111,7 +111,7 @@ flow_register(const void *key _U_, void *value, void *userdata _U_)
register_analysis_t* analysis = (register_analysis_t*)value;
stat_tap_ui flow_ui;
GString *cmd_str = g_string_new(STR_FLOW);
- gchar *cli_string;
+ char *cli_string;
g_string_append(cmd_str, sequence_analysis_get_name(analysis));
cli_string = g_string_free(cmd_str, FALSE);
@@ -124,7 +124,7 @@ flow_register(const void *key _U_, void *value, void *userdata _U_)
flow_ui.params = NULL;
register_stat_tap_ui(&flow_ui, analysis);
g_free(cli_string);
- return FALSE;
+ return false;
}
void
diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c
index 51f8f0f7..97983dee 100644
--- a/ui/cli/tap-follow.c
+++ b/ui/cli/tap-follow.c
@@ -45,8 +45,8 @@ typedef struct _cli_follow_info {
register_follow_t* follower;
/* range */
- guint32 chunkMin;
- guint32 chunkMax;
+ uint32_t chunkMin;
+ uint32_t chunkMax;
/* filter */
int stream_index;
@@ -54,7 +54,7 @@ typedef struct _cli_follow_info {
int port[2];
address addr[2];
union {
- guint32 addrBuf_v4;
+ uint32_t addrBuf_v4;
ws_in6_addr addrBuf_v6;
} addrBuf[2];
} cli_follow_info_t;
@@ -117,12 +117,12 @@ follow_free(follow_info_t *follow_info)
static const char bin2hex[] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-static void follow_print_hex(const char *prefixp, guint32 offset, void *datap, int len)
+static void follow_print_hex(const char *prefixp, uint32_t offset, void *datap, int len)
{
int ii;
int jj;
int kk;
- guint8 val;
+ uint8_t val;
char line[LINE_LEN + 1];
for (ii = 0, jj = 0, kk = 0; ii < len; )
@@ -141,7 +141,7 @@ static void follow_print_hex(const char *prefixp, guint32 offset, void *datap, i
kk = ASCII_START;
}
- val = ((guint8 *)datap)[ii];
+ val = ((uint8_t *)datap)[ii];
line[jj++] = bin2hex[val >> 4];
line[jj++] = bin2hex[val & 0xf];
@@ -177,17 +177,17 @@ static void follow_draw(void *contextp)
follow_info_t *follow_info = (follow_info_t*)contextp;
cli_follow_info_t* cli_follow_info = (cli_follow_info_t*)follow_info->gui_data;
- gchar buf[WS_INET6_ADDRSTRLEN];
- guint32 global_client_pos = 0, global_server_pos = 0;
- guint32 *global_pos;
- guint32 ii, jj;
+ char buf[WS_INET6_ADDRSTRLEN];
+ uint32_t global_client_pos = 0, global_server_pos = 0;
+ uint32_t *global_pos;
+ uint32_t ii, jj;
char *buffer;
wmem_strbuf_t *strbuf;
GList *cur;
follow_record_t *follow_record;
- guint chunk;
- gchar *b64encoded;
- const guint32 base64_raw_len = 57; /* Encodes to 76 bytes, common in RFCs */
+ unsigned chunk;
+ char *b64encoded;
+ const uint32_t base64_raw_len = 57; /* Encodes to 76 bytes, common in RFCs */
/* Print header */
switch (cli_follow_info->show_type)
@@ -342,7 +342,7 @@ static void follow_draw(void *contextp)
printf(" data: !!binary |\n");
ii = 0;
while (ii < follow_record->data->len) {
- guint32 len = ii + base64_raw_len < follow_record->data->len
+ uint32_t len = ii + base64_raw_len < follow_record->data->len
? base64_raw_len
: follow_record->data->len - ii;
b64encoded = g_base64_encode(&follow_record->data->data[ii], len);
@@ -369,16 +369,16 @@ static void follow_draw(void *contextp)
}
}
-static gboolean follow_arg_strncmp(const char **opt_argp, const char *strp)
+static bool follow_arg_strncmp(const char **opt_argp, const char *strp)
{
size_t len = strlen(strp);
if (strncmp(*opt_argp, strp, len) == 0)
{
*opt_argp += len;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static void
@@ -431,7 +431,7 @@ follow_arg_filter(const char **opt_argp, follow_info_t *follow_info)
unsigned int ii;
char addr[ADDR_LEN];
cli_follow_info_t* cli_follow_info = (cli_follow_info_t*)follow_info->gui_data;
- gboolean is_ipv6;
+ bool is_ipv6;
if (sscanf(*opt_argp, ",%d%n", &cli_follow_info->stream_index, &len) == 1 &&
((*opt_argp)[len] == 0 || (*opt_argp)[len] == ','))
@@ -448,22 +448,22 @@ follow_arg_filter(const char **opt_argp, follow_info_t *follow_info)
}
else
{
- for (ii = 0; ii < sizeof cli_follow_info->addr/sizeof *cli_follow_info->addr; ii++)
+ for (ii = 0; ii < array_length(cli_follow_info->addr); ii++)
{
if (sscanf(*opt_argp, ADDRv6_FMT, addr, &cli_follow_info->port[ii], &len) == 2)
{
- is_ipv6 = TRUE;
+ is_ipv6 = true;
}
else if (sscanf(*opt_argp, ADDRv4_FMT, addr, &cli_follow_info->port[ii], &len) == 2)
{
- is_ipv6 = FALSE;
+ is_ipv6 = false;
}
else
{
follow_exit("Invalid address.");
}
- if (cli_follow_info->port[ii] <= 0 || cli_follow_info->port[ii] > G_MAXUINT16)
+ if (cli_follow_info->port[ii] <= 0 || cli_follow_info->port[ii] > UINT16_MAX)
{
follow_exit("Invalid port.");
}
@@ -503,7 +503,7 @@ static void follow_arg_range(const char **opt_argp, cli_follow_info_t* cli_follo
if (**opt_argp == 0)
{
cli_follow_info->chunkMin = 1;
- cli_follow_info->chunkMax = G_MAXUINT32;
+ cli_follow_info->chunkMax = UINT32_MAX;
}
else
{
@@ -605,7 +605,7 @@ follow_register(const void *key _U_, void *value, void *userdata _U_)
{
register_follow_t *follower = (register_follow_t*)value;
stat_tap_ui follow_ui;
- gchar *cli_string;
+ char *cli_string;
cli_string = follow_get_stat_tap_string(follower);
follow_ui.group = REGISTER_STAT_GROUP_GENERIC;
@@ -616,7 +616,7 @@ follow_register(const void *key _U_, void *value, void *userdata _U_)
follow_ui.params = NULL;
register_stat_tap_ui(&follow_ui, follower);
g_free(cli_string);
- return FALSE;
+ return false;
}
void
diff --git a/ui/cli/tap-funnel.c b/ui/cli/tap-funnel.c
index 9adfc296..fa30a363 100644
--- a/ui/cli/tap-funnel.c
+++ b/ui/cli/tap-funnel.c
@@ -25,13 +25,13 @@
void register_tap_listener_funnel(void);
struct _funnel_text_window_t {
- gchar *title;
+ char *title;
GString *text;
};
-static GPtrArray *text_windows = NULL;
+static GPtrArray *text_windows;
-static funnel_text_window_t *new_text_window(funnel_ops_id_t *ops_id _U_, const gchar *title) {
+static funnel_text_window_t *new_text_window(funnel_ops_id_t *ops_id _U_, const char *title) {
funnel_text_window_t *tw = g_new(funnel_text_window_t, 1);
tw->title = g_strdup(title);
tw->text = g_string_new("");
@@ -62,7 +62,7 @@ static void text_window_prepend(funnel_text_window_t *tw, const char *text) {
g_string_prepend(tw->text, text);
}
-static const gchar *text_window_get_text(funnel_text_window_t *tw) {
+static const char *text_window_get_text(funnel_text_window_t *tw) {
return tw->text->str;
}
@@ -107,7 +107,7 @@ void initialize_funnel_ops(void) {
void funnel_dump_all_text_windows(void) {
- guint i;
+ unsigned i;
if (!text_windows) return;
@@ -125,16 +125,16 @@ void funnel_dump_all_text_windows(void) {
#if 0
-GHashTable *menus = NULL;
+GHashTable *menus;
typedef struct _menu_cb_t {
- void (*callback)(gpointer);
+ void (*callback)(void *);
void *callback_data;
} menu_cb_t;
static void init_funnel_cmd(const char *opt_arg, void *data ) {
- gchar **args = g_strsplit(opt_arg, ",", 0);
- gchar **arg;
+ char **args = g_strsplit(opt_arg, ",", 0);
+ char **arg;
menu_cb_t *mcb = data;
for (arg = args; *arg ; arg++) {
@@ -149,9 +149,9 @@ static void init_funnel_cmd(const char *opt_arg, void *data ) {
static void register_menu_cb(const char *name,
register_stat_group_t group _U_,
- void (*callback)(gpointer),
- gpointer callback_data,
- gboolean retap _U_) {
+ void (*callback)(void *),
+ void *callback_data,
+ bool retap _U_) {
menu_cb_t* mcb = g_new(menu_cb_t, 1);
stat_tap_ui ui_info;
diff --git a/ui/cli/tap-gsm_astat.c b/ui/cli/tap-gsm_astat.c
index 1f0a7924..8ecf9384 100644
--- a/ui/cli/tap-gsm_astat.c
+++ b/ui/cli/tap-gsm_astat.c
@@ -125,7 +125,7 @@ gsm_a_stat_draw(
void *tapdata)
{
gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
- guint8 i;
+ uint8_t i;
printf("\n");
diff --git a/ui/cli/tap-hosts.c b/ui/cli/tap-hosts.c
index c854e9e9..60a1c2b9 100644
--- a/ui/cli/tap-hosts.c
+++ b/ui/cli/tap-hosts.c
@@ -25,13 +25,13 @@
void register_tap_listener_hosts(void);
-static gboolean dump_v4 = FALSE;
-static gboolean dump_v6 = FALSE;
+static bool dump_v4;
+static bool dump_v6;
#define TAP_NAME "hosts"
static void
-ipv4_hash_table_print_resolved(gpointer key _U_, gpointer value, gpointer user_data _U_)
+ipv4_hash_table_print_resolved(void *key _U_, void *value, void *user_data _U_)
{
hashipv4_t *ipv4_hash_table_entry = (hashipv4_t *)value;
@@ -43,7 +43,7 @@ ipv4_hash_table_print_resolved(gpointer key _U_, gpointer value, gpointer user_d
}
static void
-ipv6_hash_table_print_resolved(gpointer key _U_, gpointer value, gpointer user_data _U_)
+ipv6_hash_table_print_resolved(void *key _U_, void *value, void *user_data _U_)
{
hashipv6_t *ipv6_hash_table_entry = (hashipv6_t *)value;
@@ -88,25 +88,25 @@ static void
hosts_init(const char *opt_arg, void *userdata _U_)
{
GString *error_string;
- gchar **tokens;
- gint opt_count;
+ char **tokens;
+ int opt_count;
- dump_v4 = FALSE;
- dump_v6 = FALSE;
+ dump_v4 = false;
+ dump_v6 = false;
if (strcmp(TAP_NAME, opt_arg) == 0) {
/* No arguments; dump everything */
- dump_v4 = TRUE;
- dump_v6 = TRUE;
+ dump_v4 = true;
+ dump_v6 = true;
} else {
tokens = g_strsplit(opt_arg, ",", 0);
opt_count = 0;
while (tokens[opt_count]) {
if ((strcmp("ipv4", tokens[opt_count]) == 0) ||
(strcmp("ip", tokens[opt_count]) == 0)) {
- dump_v4 = TRUE;
+ dump_v4 = true;
} else if (strcmp("ipv6", tokens[opt_count]) == 0) {
- dump_v6 = TRUE;
+ dump_v6 = true;
} else if (opt_count > 0) {
cmdarg_err("invalid \"-z " TAP_NAME "[,ip|ipv4|ipv6]\" argument");
exit(1);
diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c
index 7a5e593e..4fe43575 100644
--- a/ui/cli/tap-httpstat.c
+++ b/ui/cli/tap-httpstat.c
@@ -39,16 +39,16 @@ typedef struct _http_stats_t {
* for example it can be { 3, 404, "Not Found" ,...}
* which means we captured 3 reply http/1.1 404 Not Found */
typedef struct _http_response_code_t {
- guint32 packets; /* 3 */
- guint response_code; /* 404 */
- const gchar *name; /* Not Found */
+ uint32_t packets; /* 3 */
+ unsigned response_code; /* 404 */
+ const char *name; /* Not Found */
httpstat_t *sp;
} http_response_code_t;
/* used to keep track of the stats for a specific request string */
typedef struct _http_request_methode_t {
- gchar *response; /* eg. : GET */
- guint32 packets;
+ char *response; /* eg. : GET */
+ uint32_t packets;
httpstat_t *sp;
} http_request_methode_t;
@@ -74,7 +74,7 @@ http_init_hash(httpstat_t *sp)
}
static void
-http_draw_hash_requests(gchar *key _U_, http_request_methode_t *data, gchar *format)
+http_draw_hash_requests(char *key _U_, http_request_methode_t *data, char *format)
{
if (data->packets == 0)
return;
@@ -82,7 +82,7 @@ http_draw_hash_requests(gchar *key _U_, http_request_methode_t *data, gchar *for
}
static void
-http_draw_hash_responses(gint * key _U_, http_response_code_t *data, char *format)
+http_draw_hash_responses(int * key _U_, http_response_code_t *data, char *format)
{
if (data == NULL) {
ws_warning("No data available, key=%d\n", *key);
@@ -98,19 +98,19 @@ http_draw_hash_responses(gint * key _U_, http_response_code_t *data, char *forma
/* NOT USED at this moment */
/*
static void
-http_free_hash(gpointer key, gpointer value, gpointer user_data _U_)
+http_free_hash(void *key, void *value, void *user_data _U_)
{
g_free(key);
g_free(value);
}
*/
static void
-http_reset_hash_responses(gchar *key _U_, http_response_code_t *data, gpointer ptr _U_)
+http_reset_hash_responses(char *key _U_, http_response_code_t *data, void *ptr _U_)
{
data->packets = 0;
}
static void
-http_reset_hash_requests(gchar *key _U_, http_request_methode_t *data, gpointer ptr _U_)
+http_reset_hash_requests(char *key _U_, http_request_methode_t *data, void *ptr _U_)
{
data->packets = 0;
}
@@ -146,7 +146,7 @@ httpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
/* Request or reply packets ? */
if (value->response_code != 0) {
http_response_code_t *sc;
- guint key = value->response_code;
+ unsigned key = value->response_code;
sc = (http_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
@@ -217,10 +217,10 @@ httpstat_draw(void *psp)
printf("* HTTP Response Status Codes Packets\n");
g_hash_table_foreach(sp->hash_responses, (GHFunc)http_draw_hash_responses,
- (gpointer)" %3d %-35s %9d\n");
+ (void *)" %3d %-35s %9d\n");
printf("* HTTP Request Methods Packets\n");
g_hash_table_foreach(sp->hash_requests, (GHFunc)http_draw_hash_requests,
- (gpointer)" %-39s %9d \n");
+ (void *)" %-39s %9d \n");
printf("===================================================================\n");
}
diff --git a/ui/cli/tap-icmpstat.c b/ui/cli/tap-icmpstat.c
index ac0f6423..673b20d7 100644
--- a/ui/cli/tap-icmpstat.c
+++ b/ui/cli/tap-icmpstat.c
@@ -36,10 +36,10 @@ void register_tap_listener_icmpstat(void);
typedef struct _icmpstat_t {
char *filter;
GSList *rt_list;
- guint num_rqsts;
- guint num_resps;
- guint min_frame;
- guint max_frame;
+ unsigned num_rqsts;
+ unsigned num_resps;
+ unsigned min_frame;
+ unsigned max_frame;
double min_msecs;
double max_msecs;
double tot_msecs;
@@ -64,11 +64,11 @@ icmpstat_reset(void *tapdata)
g_slist_free(icmpstat->rt_list);
memset(icmpstat, 0, sizeof(icmpstat_t));
- icmpstat->min_msecs = 1.0 * G_MAXUINT;
+ icmpstat->min_msecs = 1.0 * UINT_MAX;
}
-static gint compare_doubles(gconstpointer a, gconstpointer b)
+static int compare_doubles(const void *a, const void *b)
{
double ad, bd;
@@ -237,7 +237,7 @@ icmpstat_draw(void *tapdata)
100.0 * lost / icmpstat->num_rqsts);
printf("Minimum Maximum Mean Median SDeviation Min Frame Max Frame\n");
printf("%-10.3f%-10.3f%-10.3f%-10.3f%-10.3f %-10u%-10u\n",
- icmpstat->min_msecs >= G_MAXUINT ? 0.0 : icmpstat->min_msecs,
+ icmpstat->min_msecs >= UINT_MAX ? 0.0 : icmpstat->min_msecs,
icmpstat->max_msecs, mean, med, sdev,
icmpstat->min_frame, icmpstat->max_frame);
} else {
@@ -271,7 +271,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_)
exit(1);
}
memset(icmpstat, 0, sizeof(icmpstat_t));
- icmpstat->min_msecs = 1.0 * G_MAXUINT;
+ icmpstat->min_msecs = 1.0 * UINT_MAX;
icmpstat->filter = g_strdup(filter);
diff --git a/ui/cli/tap-icmpv6stat.c b/ui/cli/tap-icmpv6stat.c
index 94f8692a..627c9de2 100644
--- a/ui/cli/tap-icmpv6stat.c
+++ b/ui/cli/tap-icmpv6stat.c
@@ -37,10 +37,10 @@ void register_tap_listener_icmpv6stat(void);
typedef struct _icmpv6stat_t {
char *filter;
GSList *rt_list;
- guint num_rqsts;
- guint num_resps;
- guint min_frame;
- guint max_frame;
+ unsigned num_rqsts;
+ unsigned num_resps;
+ unsigned min_frame;
+ unsigned max_frame;
double min_msecs;
double max_msecs;
double tot_msecs;
@@ -65,11 +65,11 @@ icmpv6stat_reset(void *tapdata)
g_slist_free(icmpv6stat->rt_list);
memset(icmpv6stat, 0, sizeof(icmpv6stat_t));
- icmpv6stat->min_msecs = 1.0 * G_MAXUINT;
+ icmpv6stat->min_msecs = 1.0 * UINT_MAX;
}
-static gint compare_doubles(gconstpointer a, gconstpointer b)
+static int compare_doubles(const void *a, const void *b)
{
double ad, bd;
@@ -238,7 +238,7 @@ icmpv6stat_draw(void *tapdata)
100.0 * lost / icmpv6stat->num_rqsts);
printf("Minimum Maximum Mean Median SDeviation Min Frame Max Frame\n");
printf("%-10.3f%-10.3f%-10.3f%-10.3f%-10.3f %-10u%-10u\n",
- icmpv6stat->min_msecs >= G_MAXUINT ? 0.0 : icmpv6stat->min_msecs,
+ icmpv6stat->min_msecs >= UINT_MAX ? 0.0 : icmpv6stat->min_msecs,
icmpv6stat->max_msecs, mean, med, sdev,
icmpv6stat->min_frame, icmpv6stat->max_frame);
} else {
@@ -272,7 +272,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_)
exit(1);
}
memset(icmpv6stat, 0, sizeof(icmpv6stat_t));
- icmpv6stat->min_msecs = 1.0 * G_MAXUINT;
+ icmpv6stat->min_msecs = 1.0 * UINT_MAX;
icmpv6stat->filter = g_strdup(filter);
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index 83810b23..2ba79a2c 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -50,34 +50,37 @@ static calc_type_ent_t calc_type_table[] = {
};
typedef struct _io_stat_t {
- guint64 interval; /* The user-specified time interval (us) */
- guint invl_prec; /* Decimal precision of the time interval (1=10s, 2=100s etc) */
+ uint64_t interval; /* The user-specified time interval (us) */
+ unsigned invl_prec; /* Decimal precision of the time interval (1=10s, 2=100s etc) */
unsigned int num_cols; /* The number of columns of stats in the table */
struct _io_stat_item_t *items; /* Each item is a single cell in the table */
time_t start_time; /* Time of first frame matching the filter */
+ /* The following are all per-column fixed information arrays */
const char **filters; /* 'io,stat' cmd strings (e.g., "AVG(smb.time)smb.time") */
- guint64 *max_vals; /* The max value sans the decimal or nsecs portion in each stat column */
- guint32 *max_frame; /* The max frame number displayed in each stat column */
+ uint64_t *max_vals; /* The max value sans the decimal or nsecs portion in each stat column */
+ uint32_t *max_frame; /* The max frame number displayed in each stat column */
+ int *hf_indexes;
+ int *calc_type; /* The statistic type */
} io_stat_t;
typedef struct _io_stat_item_t {
io_stat_t *parent;
struct _io_stat_item_t *next;
struct _io_stat_item_t *prev;
- guint64 start_time; /* Time since start of capture (us)*/
- int calc_type; /* The statistic type */
+ uint64_t start_time; /* Time since start of capture (us)*/
int colnum; /* Column number of this stat (0 to n) */
- int hf_index;
- guint32 frames;
- guint32 num; /* The sample size of a given statistic (only needed for AVG) */
- guint64 counter; /* The accumulated data for the calculation of that statistic */
- gfloat float_counter;
- gdouble double_counter;
+ uint32_t frames;
+ uint32_t num; /* The sample size of a given statistic (only needed for AVG) */
+ union { /* The accumulated data for the calculation of that statistic */
+ uint64_t counter;
+ float float_counter;
+ double double_counter;
+ };
} io_stat_item_t;
-#define NANOSECS_PER_SEC G_GUINT64_CONSTANT(1000000000)
+#define NANOSECS_PER_SEC UINT64_C(1000000000)
-static guint64 last_relative_time;
+static uint64_t last_relative_time;
static tap_packet_status
iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_, tap_flags_t flags _U_)
@@ -85,10 +88,10 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
io_stat_t *parent;
io_stat_item_t *mit;
io_stat_item_t *it;
- guint64 relative_time, rt;
+ uint64_t relative_time, rt;
const nstime_t *new_time;
GPtrArray *gp;
- guint i;
+ unsigned i;
int ftype;
mit = (io_stat_item_t *) arg;
@@ -97,8 +100,8 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
/* If this frame's relative time is negative, set its relative time to last_relative_time
rather than disincluding it from the calculations. */
if ((pinfo->rel_ts.secs >= 0) && (pinfo->rel_ts.nsecs >= 0)) {
- relative_time = ((guint64)pinfo->rel_ts.secs * G_GUINT64_CONSTANT(1000000)) +
- ((guint64)((pinfo->rel_ts.nsecs+500)/1000));
+ relative_time = ((uint64_t)pinfo->rel_ts.secs * UINT64_C(1000000)) +
+ ((uint64_t)((pinfo->rel_ts.nsecs+500)/1000));
last_relative_time = relative_time;
} else {
relative_time = last_relative_time;
@@ -124,37 +127,33 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
it->start_time = it->prev->start_time + parent->interval;
it->frames = 0;
- it->counter = 0;
- it->float_counter = 0;
- it->double_counter = 0;
+ it->counter = 0; /* 64-bit, type-punning with double is fine */
it->num = 0;
- it->calc_type = it->prev->calc_type;
- it->hf_index = it->prev->hf_index;
it->colnum = it->prev->colnum;
}
/* Store info in the current structure */
it->frames++;
- switch (it->calc_type) {
+ switch (parent->calc_type[it->colnum]) {
case CALC_TYPE_FRAMES:
case CALC_TYPE_BYTES:
case CALC_TYPE_FRAMES_AND_BYTES:
it->counter += pinfo->fd->pkt_len;
break;
case CALC_TYPE_COUNT:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
it->counter += gp->len;
}
break;
case CALC_TYPE_SUM:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
- guint64 val;
+ uint64_t val;
for (i=0; i<gp->len; i++) {
- switch (proto_registrar_get_ftype(it->hf_index)) {
+ switch (proto_registrar_get_ftype(parent->hf_indexes[it->colnum])) {
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
@@ -177,18 +176,18 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT48:
case FT_INT56:
case FT_INT64:
- it->counter += (gint64)fvalue_get_sinteger64(((field_info *)gp->pdata[i])->value);
+ it->counter += (int64_t)fvalue_get_sinteger64(((field_info *)gp->pdata[i])->value);
break;
case FT_FLOAT:
it->float_counter +=
- (gfloat)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
+ (float)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
break;
case FT_DOUBLE:
it->double_counter += fvalue_get_floating(((field_info *)gp->pdata[i])->value);
break;
case FT_RELATIVE_TIME:
new_time = fvalue_get_time(((field_info *)gp->pdata[i])->value);
- val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
+ val = ((uint64_t)new_time->secs * NANOSECS_PER_SEC) + (uint64_t)new_time->nsecs;
it->counter += val;
break;
default:
@@ -203,13 +202,13 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_MIN:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
- guint64 val;
- gfloat float_val;
- gdouble double_val;
+ uint64_t val;
+ float float_val;
+ double double_val;
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
for (i=0; i<gp->len; i++) {
switch (ftype) {
case FT_UINT8:
@@ -235,7 +234,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT24:
case FT_INT32:
val = fvalue_get_sinteger(((field_info *)gp->pdata[i])->value);
- if ((it->frames == 1 && i == 0) || ((gint32)val < (gint32)it->counter)) {
+ if ((it->frames == 1 && i == 0) || ((int32_t)val < (int32_t)it->counter)) {
it->counter = val;
}
break;
@@ -244,12 +243,12 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT56:
case FT_INT64:
val = fvalue_get_sinteger64(((field_info *)gp->pdata[i])->value);
- if ((it->frames == 1 && i == 0) || ((gint64)val < (gint64)it->counter)) {
+ if ((it->frames == 1 && i == 0) || ((int64_t)val < (int64_t)it->counter)) {
it->counter = val;
}
break;
case FT_FLOAT:
- float_val = (gfloat)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
+ float_val = (float)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
if ((it->frames == 1 && i == 0) || (float_val < it->float_counter)) {
it->float_counter = float_val;
}
@@ -262,7 +261,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
break;
case FT_RELATIVE_TIME:
new_time = fvalue_get_time(((field_info *)gp->pdata[i])->value);
- val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
+ val = ((uint64_t)new_time->secs * NANOSECS_PER_SEC) + (uint64_t)new_time->nsecs;
if ((it->frames == 1 && i == 0) || (val < it->counter)) {
it->counter = val;
}
@@ -279,13 +278,13 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_MAX:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
- guint64 val;
- gfloat float_val;
- gdouble double_val;
+ uint64_t val;
+ float float_val;
+ double double_val;
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
for (i=0; i<gp->len; i++) {
switch (ftype) {
case FT_UINT8:
@@ -309,7 +308,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT24:
case FT_INT32:
val = fvalue_get_sinteger(((field_info *)gp->pdata[i])->value);
- if ((gint32)val > (gint32)it->counter)
+ if ((int32_t)val > (int32_t)it->counter)
it->counter = val;
break;
case FT_INT40:
@@ -317,11 +316,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case FT_INT56:
case FT_INT64:
val = fvalue_get_sinteger64(((field_info *)gp->pdata[i])->value);
- if ((gint64)val > (gint64)it->counter)
+ if ((int64_t)val > (int64_t)it->counter)
it->counter = val;
break;
case FT_FLOAT:
- float_val = (gfloat)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
+ float_val = (float)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
if (float_val > it->float_counter)
it->float_counter = float_val;
break;
@@ -332,7 +331,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
break;
case FT_RELATIVE_TIME:
new_time = fvalue_get_time(((field_info *)gp->pdata[i])->value);
- val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
+ val = ((uint64_t)new_time->secs * NANOSECS_PER_SEC) + (uint64_t)new_time->nsecs;
if (val > it->counter)
it->counter = val;
break;
@@ -348,11 +347,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_AVG:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
- guint64 val;
+ uint64_t val;
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
for (i=0; i<gp->len; i++) {
it->num++;
switch (ftype) {
@@ -385,14 +384,14 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
it->counter += val;
break;
case FT_FLOAT:
- it->float_counter += (gfloat)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
+ it->float_counter += (float)fvalue_get_floating(((field_info *)gp->pdata[i])->value);
break;
case FT_DOUBLE:
it->double_counter += fvalue_get_floating(((field_info *)gp->pdata[i])->value);
break;
case FT_RELATIVE_TIME:
new_time = fvalue_get_time(((field_info *)gp->pdata[i])->value);
- val = ((guint64)new_time->secs * NANOSECS_PER_SEC) + (guint64)new_time->nsecs;
+ val = ((uint64_t)new_time->secs * NANOSECS_PER_SEC) + (uint64_t)new_time->nsecs;
it->counter += val;
break;
default:
@@ -407,27 +406,27 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
break;
case CALC_TYPE_LOAD:
- gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
+ gp = proto_get_finfo_ptr_array(edt->tree, parent->hf_indexes[it->colnum]);
if (gp) {
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
if (ftype != FT_RELATIVE_TIME) {
fprintf(stderr,
"\ntshark: LOAD() is only supported for relative-time fields such as smb.time\n");
exit(10);
}
for (i=0; i<gp->len; i++) {
- guint64 val;
+ uint64_t val;
int tival;
io_stat_item_t *pit;
new_time = fvalue_get_time(((field_info *)gp->pdata[i])->value);
- val = ((guint64)new_time->secs*G_GUINT64_CONSTANT(1000000)) + (guint64)(new_time->nsecs/1000);
+ val = ((uint64_t)new_time->secs*UINT64_C(1000000)) + (uint64_t)(new_time->nsecs/1000);
tival = (int)(val % parent->interval);
it->counter += tival;
val -= tival;
pit = it->prev;
while (val > 0) {
- if (val < (guint64)parent->interval) {
+ if (val < (uint64_t)parent->interval) {
pit->counter += val;
break;
}
@@ -445,12 +444,12 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
* calc the average, round it to the next second and store the seconds. For all other calc types
* of RELATIVE_TIME fields, store the counters without modification.
* fields. */
- switch (it->calc_type) {
+ switch (parent->calc_type[it->colnum]) {
case CALC_TYPE_FRAMES:
case CALC_TYPE_FRAMES_AND_BYTES:
parent->max_frame[it->colnum] =
MAX(parent->max_frame[it->colnum], it->frames);
- if (it->calc_type == CALC_TYPE_FRAMES_AND_BYTES)
+ if (parent->calc_type[it->colnum] == CALC_TYPE_FRAMES_AND_BYTES)
parent->max_vals[it->colnum] =
MAX(parent->max_vals[it->colnum], it->counter);
break;
@@ -462,15 +461,15 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_SUM:
case CALC_TYPE_MIN:
case CALC_TYPE_MAX:
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
switch (ftype) {
case FT_FLOAT:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum], (guint64)(it->float_counter+0.5));
+ MAX(parent->max_vals[it->colnum], (uint64_t)(it->float_counter+0.5));
break;
case FT_DOUBLE:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum], (guint64)(it->double_counter+0.5));
+ MAX(parent->max_vals[it->colnum], (uint64_t)(it->double_counter+0.5));
break;
case FT_RELATIVE_TIME:
parent->max_vals[it->colnum] =
@@ -486,19 +485,19 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_AVG:
if (it->num == 0) /* avoid division by zero */
break;
- ftype = proto_registrar_get_ftype(it->hf_index);
+ ftype = proto_registrar_get_ftype(parent->hf_indexes[it->colnum]);
switch (ftype) {
case FT_FLOAT:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum], (guint64)it->float_counter/it->num);
+ MAX(parent->max_vals[it->colnum], (uint64_t)it->float_counter/it->num);
break;
case FT_DOUBLE:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum], (guint64)it->double_counter/it->num);
+ MAX(parent->max_vals[it->colnum], (uint64_t)it->double_counter/it->num);
break;
case FT_RELATIVE_TIME:
parent->max_vals[it->colnum] =
- MAX(parent->max_vals[it->colnum], ((it->counter/(guint64)it->num) + G_GUINT64_CONSTANT(500000000)) / NANOSECS_PER_SEC);
+ MAX(parent->max_vals[it->colnum], ((it->counter/(uint64_t)it->num) + UINT64_C(500000000)) / NANOSECS_PER_SEC);
break;
default:
/* UINT16-64 and INT8-64 */
@@ -511,7 +510,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
}
static unsigned int
-magnitude (guint64 val, unsigned int max_w)
+magnitude (uint64_t val, unsigned int max_w)
{
unsigned int i, mag = 0;
@@ -553,8 +552,8 @@ typedef struct {
static void
iostat_draw(void *arg)
{
- guint32 num;
- guint64 interval, duration, t, invl_end, dv;
+ uint32_t num;
+ uint64_t interval, duration, t, invl_end, dv;
unsigned int i, j, k, num_cols, num_rows, dur_secs_orig, dur_nsecs_orig, dur_secs, dur_nsecs, dur_mag,
invl_mag, invl_prec, tabrow_w, borderlen, invl_col_w, numpad = 1, namelen, len_filt, type,
maxfltr_w, ftype;
@@ -562,9 +561,9 @@ iostat_draw(void *arg)
unsigned int val_mag; /* The magnitude of the max value in this column */
char *spaces, *spaces_s, *filler_s = NULL, **fmts, *fmt = NULL;
const char *filter;
- static gchar dur_mag_s[3], invl_prec_s[3], fr_mag_s[3], val_mag_s[3], *invl_fmt, *full_fmt;
+ static char dur_mag_s[3], invl_prec_s[3], fr_mag_s[3], val_mag_s[3], *invl_fmt, *full_fmt;
io_stat_item_t *mit, **stat_cols, *item, **item_in_column;
- gboolean last_row = FALSE;
+ bool last_row = false;
io_stat_t *iot;
column_width *col_w;
struct tm *tm_time;
@@ -575,8 +574,8 @@ iostat_draw(void *arg)
num_cols = iot->num_cols;
col_w = g_new(column_width, num_cols);
fmts = (char **)g_malloc(sizeof(char *) * num_cols);
- duration = ((guint64)cfile.elapsed_time.secs * G_GUINT64_CONSTANT(1000000)) +
- (guint64)((cfile.elapsed_time.nsecs + 500) / 1000);
+ duration = ((uint64_t)cfile.elapsed_time.secs * UINT64_C(1000000)) +
+ (uint64_t)((cfile.elapsed_time.nsecs + 500) / 1000);
/* Store the pointer to each stat column */
stat_cols = (io_stat_item_t **)g_malloc(sizeof(io_stat_item_t *) * num_cols);
@@ -585,23 +584,23 @@ iostat_draw(void *arg)
/* The following prevents gross inaccuracies when the user specifies an interval that is greater
* than the capture duration. */
- if (iot->interval > duration || iot->interval == G_MAXUINT64) {
+ if (iot->interval > duration || iot->interval == UINT64_MAX) {
interval = duration;
- iot->interval = G_MAXUINT64;
+ iot->interval = UINT64_MAX;
} else {
interval = iot->interval;
}
/* Calc the capture duration's magnitude (dur_mag) */
- dur_secs = (unsigned int)(duration/G_GUINT64_CONSTANT(1000000));
+ dur_secs = (unsigned int)(duration/UINT64_C(1000000));
dur_secs_orig = dur_secs;
- dur_nsecs = (unsigned int)(duration%G_GUINT64_CONSTANT(1000000));
+ dur_nsecs = (unsigned int)(duration%UINT64_C(1000000));
dur_nsecs_orig = dur_nsecs;
- dur_mag = magnitude((guint64)dur_secs, 5);
+ dur_mag = magnitude((uint64_t)dur_secs, 5);
snprintf(dur_mag_s, 3, "%u", dur_mag);
/* Calc the interval's magnitude */
- invl_mag = magnitude(interval/G_GUINT64_CONSTANT(1000000), 5);
+ invl_mag = magnitude(interval/UINT64_C(1000000), 5);
/* Set or get the interval precision */
if (interval == duration) {
@@ -628,13 +627,13 @@ iostat_draw(void *arg)
if ((duration%dv) > 5*(dv/10)) {
duration += 5*(dv/10);
duration = (duration/dv) * dv;
- dur_secs = (unsigned int)(duration/G_GUINT64_CONSTANT(1000000));
- dur_nsecs = (unsigned int)(duration%G_GUINT64_CONSTANT(1000000));
+ dur_secs = (unsigned int)(duration/UINT64_C(1000000));
+ dur_nsecs = (unsigned int)(duration%UINT64_C(1000000));
/*
* Recalc dur_mag in case rounding has increased its magnitude */
- dur_mag = magnitude((guint64)dur_secs, 5);
+ dur_mag = magnitude((uint64_t)dur_secs, 5);
}
- if (iot->interval == G_MAXUINT64)
+ if (iot->interval == UINT64_MAX)
interval = duration;
/* Calc the width of the time interval column (incl borders and padding). */
@@ -665,7 +664,7 @@ iostat_draw(void *arg)
* is an *integer*. */
tabrow_w = invl_col_w;
for (j=0; j<num_cols; j++) {
- type = iot->items[j].calc_type;
+ type = iot->calc_type[j];
if (type == CALC_TYPE_FRAMES_AND_BYTES) {
namelen = 5;
} else {
@@ -708,7 +707,7 @@ iostat_draw(void *arg)
break;
default:
- ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
+ ftype = proto_registrar_get_ftype(iot->hf_indexes[j]);
switch (ftype) {
case FT_FLOAT:
case FT_DOUBLE:
@@ -723,7 +722,7 @@ iostat_draw(void *arg)
if (type == CALC_TYPE_LOAD) {
iot->max_vals[j] /= interval;
} else if (type != CALC_TYPE_AVG) {
- iot->max_vals[j] = (iot->max_vals[j] + G_GUINT64_CONSTANT(500000000)) / NANOSECS_PER_SEC;
+ iot->max_vals[j] = (iot->max_vals[j] + UINT64_C(500000000)) / NANOSECS_PER_SEC;
}
val_mag = magnitude(iot->max_vals[j], 15);
snprintf(val_mag_s, 3, "%u", val_mag);
@@ -808,7 +807,7 @@ iostat_draw(void *arg)
g_free(full_fmt);
full_fmt = g_strconcat("| Interval: ", invl_fmt, " secs%s|\n", NULL);
spaces_s = &spaces[18 + dur_mag];
- printf(full_fmt, (guint32)(interval/G_GUINT64_CONSTANT(1000000)), spaces_s);
+ printf(full_fmt, (uint32_t)(interval/UINT64_C(1000000)), spaces_s);
} else {
snprintf(invl_prec_s, 3, "%u", invl_prec);
invl_fmt = g_strconcat("%", dur_mag_s, "u.%0", invl_prec_s, "u", NULL);
@@ -819,8 +818,8 @@ iostat_draw(void *arg)
full_fmt = g_strconcat("| Interval: ", invl_fmt, " secs%s|\n", NULL);
spaces_s = &spaces[19 + dur_mag + invl_prec];
- printf(full_fmt, (guint32)(interval/G_GUINT64_CONSTANT(1000000)),
- (guint32)((interval%G_GUINT64_CONSTANT(1000000))/dv), spaces_s);
+ printf(full_fmt, (uint32_t)(interval/UINT64_C(1000000)),
+ (uint32_t)((interval%UINT64_C(1000000))/dv), spaces_s);
}
g_free(full_fmt);
@@ -850,24 +849,24 @@ iostat_draw(void *arg)
}
printf("|\n");
} else {
- gchar *sfilter1, *sfilter2;
- const gchar *pos;
- gsize len;
+ char *sfilter1, *sfilter2;
+ const char *pos;
+ size_t len;
unsigned int next_start, max_w = borderlen-11;
do {
if (len_filt > max_w) {
- sfilter1 = g_strndup(filter, (gsize) max_w);
+ sfilter1 = g_strndup(filter, (size_t) max_w);
/*
* Find the pos of the last space in sfilter1. If a space is found, set
* sfilter2 to the string prior to that space and print it; otherwise, wrap
* the filter at max_w. */
pos = g_strrstr(sfilter1, " ");
if (pos) {
- len = (gsize)(pos-sfilter1);
+ len = (size_t)(pos-sfilter1);
next_start = (unsigned int) len+1;
} else {
- len = (gsize) strlen(sfilter1);
+ len = (size_t) strlen(sfilter1);
next_start = (unsigned int)len;
}
sfilter2 = g_strndup(sfilter1, len);
@@ -899,10 +898,9 @@ iostat_draw(void *arg)
/* Display column number headers */
for (j=0; j<num_cols; j++) {
- item = stat_cols[j];
- if (item->calc_type == CALC_TYPE_FRAMES_AND_BYTES)
+ if (iot->calc_type[j] == CALC_TYPE_FRAMES_AND_BYTES)
spaces_s = &spaces[borderlen - (col_w[j].fr + col_w[j].val)] - 3;
- else if (item->calc_type == CALC_TYPE_FRAMES)
+ else if (iot->calc_type[j] == CALC_TYPE_FRAMES)
spaces_s = &spaces[borderlen - col_w[j].fr];
else
spaces_s = &spaces[borderlen - col_w[j].val];
@@ -939,7 +937,7 @@ iostat_draw(void *arg)
/* Display the stat label in each column */
for (j=0; j<num_cols; j++) {
- type = stat_cols[j]->calc_type;
+ type = iot->calc_type[j];
if (type == CALC_TYPE_FRAMES) {
printcenter (calc_type_table[type].func_name, col_w[j].fr, numpad);
} else if (type == CALC_TYPE_FRAMES_AND_BYTES) {
@@ -985,7 +983,7 @@ iostat_draw(void *arg)
for (i=0; i<num_rows; i++) {
if (i == num_rows-1)
- last_row = TRUE;
+ last_row = true;
/* Compute the interval for this row */
if (!last_row) {
@@ -996,7 +994,7 @@ iostat_draw(void *arg)
/* Patch for Absolute Time */
/* XXX - has a Y2.038K problem with 32-bit time_t */
- the_time = (time_t)(iot->start_time + (t/G_GUINT64_CONSTANT(1000000)));
+ the_time = (time_t)(iot->start_time + (t/UINT64_C(1000000)));
/* Display the interval for this row */
switch (timestamp_get_type()) {
@@ -1087,16 +1085,16 @@ iostat_draw(void *arg)
full_fmt = g_strconcat( dur_mag == 1 ? "| " : "| ",
invl_fmt, " <> ", "%-",
dur_mag_s, "s|", NULL);
- printf(full_fmt, (guint32)(t/G_GUINT64_CONSTANT(1000000)), "Dur");
+ printf(full_fmt, (uint32_t)(t/UINT64_C(1000000)), "Dur");
} else {
- printf(full_fmt, (guint32)(t/G_GUINT64_CONSTANT(1000000)),
- (guint32)(invl_end/G_GUINT64_CONSTANT(1000000)));
+ printf(full_fmt, (uint32_t)(t/UINT64_C(1000000)),
+ (uint32_t)(invl_end/UINT64_C(1000000)));
}
} else {
- printf(full_fmt, (guint32)(t/G_GUINT64_CONSTANT(1000000)),
- (guint32)(t%G_GUINT64_CONSTANT(1000000) / dv),
- (guint32)(invl_end/G_GUINT64_CONSTANT(1000000)),
- (guint32)(invl_end%G_GUINT64_CONSTANT(1000000) / dv));
+ printf(full_fmt, (uint32_t)(t/UINT64_C(1000000)),
+ (uint32_t)(t%UINT64_C(1000000) / dv),
+ (uint32_t)(invl_end/UINT64_C(1000000)),
+ (uint32_t)(invl_end%UINT64_C(1000000) / dv));
}
break;
/* case TS_DELTA:
@@ -1111,9 +1109,10 @@ iostat_draw(void *arg)
for (j=0; j<num_cols; j++) {
fmt = fmts[j];
item = item_in_column[j];
+ type = iot->calc_type[j];
if (item) {
- switch (item->calc_type) {
+ switch (type) {
case CALC_TYPE_FRAMES:
printf(fmt, item->frames);
break;
@@ -1128,7 +1127,7 @@ iostat_draw(void *arg)
case CALC_TYPE_SUM:
case CALC_TYPE_MIN:
case CALC_TYPE_MAX:
- ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
+ ftype = proto_registrar_get_ftype(iot->hf_indexes[j]);
switch (ftype) {
case FT_FLOAT:
printf(fmt, item->float_counter);
@@ -1137,10 +1136,10 @@ iostat_draw(void *arg)
printf(fmt, item->double_counter);
break;
case FT_RELATIVE_TIME:
- item->counter = (item->counter + G_GUINT64_CONSTANT(500)) / G_GUINT64_CONSTANT(1000);
+ item->counter = (item->counter + UINT64_C(500)) / UINT64_C(1000);
printf(fmt,
- (int)(item->counter/G_GUINT64_CONSTANT(1000000)),
- (int)(item->counter%G_GUINT64_CONSTANT(1000000)));
+ (int)(item->counter/UINT64_C(1000000)),
+ (int)(item->counter%UINT64_C(1000000)));
break;
default:
printf(fmt, item->counter);
@@ -1152,7 +1151,7 @@ iostat_draw(void *arg)
num = item->num;
if (num == 0)
num = 1;
- ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
+ ftype = proto_registrar_get_ftype(iot->hf_indexes[j]);
switch (ftype) {
case FT_FLOAT:
printf(fmt, item->float_counter/num);
@@ -1161,29 +1160,29 @@ iostat_draw(void *arg)
printf(fmt, item->double_counter/num);
break;
case FT_RELATIVE_TIME:
- item->counter = ((item->counter / (guint64)num) + G_GUINT64_CONSTANT(500)) / G_GUINT64_CONSTANT(1000);
+ item->counter = ((item->counter / (uint64_t)num) + UINT64_C(500)) / UINT64_C(1000);
printf(fmt,
- (int)(item->counter/G_GUINT64_CONSTANT(1000000)),
- (int)(item->counter%G_GUINT64_CONSTANT(1000000)));
+ (int)(item->counter/UINT64_C(1000000)),
+ (int)(item->counter%UINT64_C(1000000)));
break;
default:
- printf(fmt, item->counter / (guint64)num);
+ printf(fmt, item->counter / (uint64_t)num);
break;
}
break;
case CALC_TYPE_LOAD:
- ftype = proto_registrar_get_ftype(stat_cols[j]->hf_index);
+ ftype = proto_registrar_get_ftype(iot->hf_indexes[j]);
switch (ftype) {
case FT_RELATIVE_TIME:
if (!last_row) {
printf(fmt,
(int) (item->counter/interval),
- (int)((item->counter%interval)*G_GUINT64_CONSTANT(1000000) / interval));
+ (int)((item->counter%interval)*UINT64_C(1000000) / interval));
} else {
printf(fmt,
(int) (item->counter/(invl_end-t)),
- (int)((item->counter%(invl_end-t))*G_GUINT64_CONSTANT(1000000) / (invl_end-t)));
+ (int)((item->counter%(invl_end-t))*UINT64_C(1000000) / (invl_end-t)));
}
break;
}
@@ -1196,7 +1195,7 @@ iostat_draw(void *arg)
item_in_column[j] = item_in_column[j]->next;
}
} else {
- printf(fmt, (guint64)0, (guint64)0);
+ printf(fmt, (uint64_t)0, (uint64_t)0);
}
}
if (filler_s)
@@ -1210,8 +1209,11 @@ iostat_draw(void *arg)
}
printf("\n");
g_free(iot->items);
+ g_free((gpointer)iot->filters);
g_free(iot->max_vals);
g_free(iot->max_frame);
+ g_free(iot->hf_indexes);
+ g_free(iot->calc_type);
g_free(iot);
g_free(col_w);
g_free(invl_fmt);
@@ -1238,7 +1240,6 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
io->items[i].next = NULL;
io->items[i].parent = io;
io->items[i].start_time = 0;
- io->items[i].calc_type = CALC_TYPE_FRAMES_AND_BYTES;
io->items[i].frames = 0;
io->items[i].counter = 0;
io->items[i].num = 0;
@@ -1246,12 +1247,13 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
io->filters[i] = filter;
flt = filter;
+ io->calc_type[i] = CALC_TYPE_FRAMES_AND_BYTES;
field = NULL;
hfi = NULL;
for (j=0; calc_type_table[j].func_name; j++) {
namelen = strlen(calc_type_table[j].func_name);
if (filter && strncmp(filter, calc_type_table[j].func_name, namelen) == 0) {
- io->items[i].calc_type = calc_type_table[j].calc_type;
+ io->calc_type[i] = calc_type_table[j].calc_type;
io->items[i].colnum = i;
if (*(filter+namelen) == '(') {
p = filter+namelen+1;
@@ -1262,7 +1264,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
exit(10);
}
- if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES) {
+ if (io->calc_type[i] == CALC_TYPE_FRAMES || io->calc_type[i] == CALC_TYPE_BYTES) {
if (parenp != p) {
fprintf(stderr,
"\ntshark: %s does not require or allow a field name within the parens.\n",
@@ -1282,7 +1284,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
memcpy(field, p, parenp-p);
field[parenp-p] = '\0';
flt = parenp + 1;
- if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES)
+ if (io->calc_type[i] == CALC_TYPE_FRAMES || io->calc_type[i] == CALC_TYPE_BYTES)
break;
hfi = proto_registrar_get_byname(field);
if (!hfi) {
@@ -1292,18 +1294,18 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
exit(10);
}
- io->items[i].hf_index = hfi->id;
+ io->hf_indexes[i] = hfi->id;
break;
}
} else {
- if (io->items[i].calc_type == CALC_TYPE_FRAMES || io->items[i].calc_type == CALC_TYPE_BYTES)
+ if (io->calc_type[i] == CALC_TYPE_FRAMES || io->calc_type[i] == CALC_TYPE_BYTES)
flt = "";
io->items[i].colnum = i;
}
}
- if (hfi && !(io->items[i].calc_type == CALC_TYPE_BYTES ||
- io->items[i].calc_type == CALC_TYPE_FRAMES ||
- io->items[i].calc_type == CALC_TYPE_FRAMES_AND_BYTES)) {
+ if (hfi && !(io->calc_type[i] == CALC_TYPE_BYTES ||
+ io->calc_type[i] == CALC_TYPE_FRAMES ||
+ io->calc_type[i] == CALC_TYPE_FRAMES_AND_BYTES)) {
/* check that the type is compatible */
switch (hfi->type) {
case FT_UINT8:
@@ -1321,7 +1323,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
case FT_FLOAT:
case FT_DOUBLE:
/* these types only support SUM, COUNT, MAX, MIN, AVG */
- switch (io->items[i].calc_type) {
+ switch (io->calc_type[i]) {
case CALC_TYPE_SUM:
case CALC_TYPE_COUNT:
case CALC_TYPE_MAX:
@@ -1338,7 +1340,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
break;
case FT_RELATIVE_TIME:
/* this type only supports SUM, COUNT, MAX, MIN, AVG, LOAD */
- switch (io->items[i].calc_type) {
+ switch (io->calc_type[i]) {
case CALC_TYPE_SUM:
case CALC_TYPE_COUNT:
case CALC_TYPE_MAX:
@@ -1359,7 +1361,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
* XXX - support all operations on floating-point
* numbers?
*/
- if (io->items[i].calc_type != CALC_TYPE_COUNT) {
+ if (io->calc_type[i] != CALC_TYPE_COUNT) {
fprintf(stderr,
"\ntshark: %s doesn't have integral values, so %s(*) "
"calculations are not supported on it.\n",
@@ -1387,11 +1389,11 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
static void
iostat_init(const char *opt_arg, void *userdata _U_)
{
- gdouble interval_float;
- guint32 idx = 0;
+ double interval_float;
+ uint32_t idx = 0;
unsigned int i;
io_stat_t *io;
- const gchar *filters, *str, *pos;
+ const char *filters, *str, *pos;
if ((*(opt_arg+(strlen(opt_arg)-1)) == ',') ||
(sscanf(opt_arg, "io,stat,%lf%n", &interval_float, (int *)&idx) != 1) ||
@@ -1427,13 +1429,13 @@ iostat_init(const char *opt_arg, void *userdata _U_)
io = g_new(io_stat_t, 1);
/* If interval is 0, calculate statistics over the whole file by setting the interval to
- * G_MAXUINT64 */
+ * UINT64_MAX */
if (interval_float == 0) {
- io->interval = G_MAXUINT64;
+ io->interval = UINT64_MAX;
io->invl_prec = 0;
} else {
/* Set interval to the number of us rounded to the nearest integer */
- io->interval = (guint64)(interval_float * 1000000.0 + 0.5);
+ io->interval = (uint64_t)(interval_float * 1000000.0 + 0.5);
/*
* Determine what interval precision the user has specified */
io->invl_prec = 6;
@@ -1450,8 +1452,8 @@ iostat_init(const char *opt_arg, void *userdata _U_)
interval of 1 and the last interval becomes "9 <> 9". If the interval is instead set to
1.1, the last interval becomes
last interval is rounded up to value that is greater than the duration. */
- const gchar *invl_start = opt_arg+8;
- gchar *intv_end;
+ const char *invl_start = opt_arg+8;
+ char *intv_end;
int invl_len;
intv_end = g_strstr_len(invl_start, -1, ",");
@@ -1485,10 +1487,12 @@ iostat_init(const char *opt_arg, void *userdata _U_)
}
}
- io->items = g_new(io_stat_item_t, io->num_cols);
- io->filters = (const char **)g_malloc(sizeof(char *) * io->num_cols);
- io->max_vals = g_new(guint64, io->num_cols);
- io->max_frame = g_new(guint32, io->num_cols);
+ io->items = g_new(io_stat_item_t, io->num_cols);
+ io->filters = (const char **)g_malloc(sizeof(char *) * io->num_cols);
+ io->max_vals = g_new(uint64_t, io->num_cols);
+ io->max_frame = g_new(uint32_t, io->num_cols);
+ io->hf_indexes = g_new(int, io->num_cols);
+ io->calc_type = g_new(int, io->num_cols);
for (i=0; i<io->num_cols; i++) {
io->max_vals[i] = 0;
@@ -1499,23 +1503,23 @@ iostat_init(const char *opt_arg, void *userdata _U_)
if ((!filters) || (filters[0] == 0)) {
register_io_tap(io, 0, NULL);
} else {
- gchar *filter;
+ char *filter;
i = 0;
str = filters;
do {
- pos = (gchar*) strchr(str, ',');
+ pos = (char*) strchr(str, ',');
if (pos == str) {
register_io_tap(io, i, NULL);
} else if (pos == NULL) {
- str = (const char*) g_strstrip((gchar*)str);
+ str = (const char*) g_strstrip((char*)str);
filter = g_strdup(str);
if (*filter)
register_io_tap(io, i, filter);
else
register_io_tap(io, i, NULL);
} else {
- filter = (gchar *)g_malloc((pos-str)+1);
- (void) g_strlcpy( filter, str, (gsize) ((pos-str)+1));
+ filter = (char *)g_malloc((pos-str)+1);
+ (void) g_strlcpy( filter, str, (size_t) ((pos-str)+1));
filter = g_strstrip(filter);
register_io_tap(io, i, (char *) filter);
}
diff --git a/ui/cli/tap-iousers.c b/ui/cli/tap-iousers.c
index 742f984c..922f0bf8 100644
--- a/ui/cli/tap-iousers.c
+++ b/ui/cli/tap-iousers.c
@@ -32,10 +32,10 @@ iousers_draw(void *arg)
conv_hash_t *hash = (conv_hash_t*)arg;
io_users_t *iu = (io_users_t *)hash->user_data;
conv_item_t *iui;
- guint64 last_frames, max_frames;
+ uint64_t last_frames, max_frames;
struct tm * tm_time;
- guint i;
- gboolean display_ports = (!strncmp(iu->type, "TCP", 3) || !strncmp(iu->type, "UDP", 3) || !strncmp(iu->type, "SCTP", 4)) ? TRUE : FALSE;
+ unsigned i;
+ bool display_ports = (!strncmp(iu->type, "TCP", 3) || !strncmp(iu->type, "UDP", 3) || !strncmp(iu->type, "SCTP", 4)) ? true : false;
printf("================================================================================\n");
printf("%s Conversations\n", iu->type);
@@ -78,7 +78,7 @@ iousers_draw(void *arg)
do {
last_frames = 0;
for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
- guint64 tot_frames;
+ uint64_t tot_frames;
iui = &g_array_index(iu->hash.conv_array, conv_item_t, i);
tot_frames = iui->rx_frames + iui->tx_frames;
@@ -89,7 +89,7 @@ iousers_draw(void *arg)
}
for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
- guint64 tot_frames;
+ uint64_t tot_frames;
char *src_addr, *dst_addr;
iui = &g_array_index(iu->hash.conv_array, conv_item_t, i);
@@ -103,12 +103,12 @@ iousers_draw(void *arg)
total_bytes = format_size(iui->tx_bytes + iui->rx_bytes, FORMAT_SIZE_UNIT_BYTES, 0);
/* XXX - TODO: make name / port resolution configurable (through gbl_resolv_flags?) */
- src_addr = get_conversation_address(NULL, &iui->src_address, TRUE);
- dst_addr = get_conversation_address(NULL, &iui->dst_address, TRUE);
+ src_addr = get_conversation_address(NULL, &iui->src_address, true);
+ dst_addr = get_conversation_address(NULL, &iui->dst_address, true);
if (display_ports) {
char *src, *dst, *src_port, *dst_port;
- src_port = get_conversation_port(NULL, iui->src_port, iui->ctype, TRUE);
- dst_port = get_conversation_port(NULL, iui->dst_port, iui->ctype, TRUE);
+ src_port = get_conversation_port(NULL, iui->src_port, iui->ctype, true);
+ dst_port = get_conversation_port(NULL, iui->dst_port, iui->ctype, true);
src = wmem_strconcat(NULL, src_addr, ":", src_port, NULL);
dst = wmem_strconcat(NULL, dst_addr, ":", dst_port, NULL);
printf("%-26s <-> %-26s %6" PRIu64 " %-9s"
diff --git a/ui/cli/tap-macltestat.c b/ui/cli/tap-macltestat.c
index ffe78ad7..88785b70 100644
--- a/ui/cli/tap-macltestat.c
+++ b/ui/cli/tap-macltestat.c
@@ -26,6 +26,7 @@ void register_tap_listener_mac_lte_stat(void);
/* Table column identifiers and title strings */
enum {
+ RAT_COLUMN,
RNTI_COLUMN,
RNTI_TYPE_COLUMN,
UEID_COLUMN,
@@ -39,97 +40,93 @@ enum {
DL_BW_COLUMN,
DL_PADDING_PERCENT_COLUMN,
DL_CRC_FAILED_COLUMN,
- DL_CRC_HIGH_CODE_RATE_COLUMN,
- DL_CRC_PDSCH_LOST_COLUMN,
- DL_CRC_DUPLICATE_NONZERO_RV_COLUMN,
DL_RETX_FRAMES_COLUMN,
NUM_UE_COLUMNS
};
-static const gchar *ue_titles[] = { " RNTI", " Type", "UEId",
+static const char *ue_titles[] = { "RAT", " RNTI", " Type", "UEId",
"UL Frames", "UL Bytes", "UL Mb/sec", " UL Pad %", "UL ReTX",
- "DL Frames", "DL Bytes", "DL Mb/sec", " DL Pad %", "DL CRC Fail", "DL CRC HCR", "DL CRC PDSCH Lost", "DL CRC DupNonZeroRV", "DL ReTX"};
+ "DL Frames", "DL Bytes", "DL Mb/sec", " DL Pad %", "DL CRC Fail", "DL ReTX"};
/* Stats for one UE */
-typedef struct mac_lte_row_data {
+typedef struct mac_lte_nr_row_data {
/* Key for matching this row */
- guint16 rnti;
- guint8 rnti_type;
- guint16 ueid;
+ uint8_t rat;
+ uint16_t rnti;
+ uint8_t rnti_type;
+ uint16_t ueid;
- gboolean is_predefined_data;
+ bool is_predefined_data;
- guint32 UL_frames;
- guint32 UL_raw_bytes; /* all bytes */
- guint32 UL_total_bytes; /* payload */
+ uint32_t UL_frames;
+ uint32_t UL_raw_bytes; /* all bytes */
+ uint32_t UL_total_bytes; /* payload */
nstime_t UL_time_start;
nstime_t UL_time_stop;
- guint32 UL_padding_bytes;
- guint32 UL_CRC_errors;
- guint32 UL_retx_frames;
+ uint32_t UL_padding_bytes;
+ uint32_t UL_CRC_errors;
+ uint32_t UL_retx_frames;
- guint32 DL_frames;
- guint32 DL_raw_bytes; /* all bytes */
- guint32 DL_total_bytes;
+ uint32_t DL_frames;
+ uint32_t DL_raw_bytes; /* all bytes */
+ uint32_t DL_total_bytes;
nstime_t DL_time_start;
nstime_t DL_time_stop;
- guint32 DL_padding_bytes;
+ uint32_t DL_padding_bytes;
- guint32 DL_CRC_failures;
- guint32 DL_CRC_high_code_rate;
- guint32 DL_CRC_PDSCH_lost;
- guint32 DL_CRC_Duplicate_NonZero_RV;
- guint32 DL_retx_frames;
+ uint32_t DL_CRC_failures;
+ uint32_t DL_retx_frames;
-} mac_lte_row_data;
+} mac_lte_nr_row_data;
-/* One row/UE in the UE table */
+/* One row/UE list item in the UE table */
typedef struct mac_lte_ep {
struct mac_lte_ep *next;
- struct mac_lte_row_data stats;
+ struct mac_lte_nr_row_data stats;
} mac_lte_ep_t;
-/* Common channel stats */
+/* Common channel stats (i.e. independent of UEs) */
typedef struct mac_lte_common_stats {
- guint32 all_frames;
- guint32 mib_frames;
- guint32 sib_frames;
- guint32 sib_bytes;
- guint32 pch_frames;
- guint32 pch_bytes;
- guint32 pch_paging_ids;
- guint32 rar_frames;
- guint32 rar_entries;
-
- guint16 max_ul_ues_in_tti;
- guint16 max_dl_ues_in_tti;
+ uint32_t all_frames;
+ uint32_t mib_frames;
+ uint32_t sib_frames;
+ uint32_t sib_bytes;
+ uint32_t pch_frames;
+ uint32_t pch_bytes;
+ uint32_t pch_paging_ids;
+ uint32_t rar_frames;
+ uint32_t rar_entries;
+
+ uint16_t max_ul_ues_in_tti;
+ uint16_t max_dl_ues_in_tti;
} mac_lte_common_stats;
/* Top-level struct for MAC LTE statistics */
-typedef struct mac_lte_stat_t {
+typedef struct mac_lte_nr_stat_t {
/* Common stats */
mac_lte_common_stats common_stats;
- /* Keep track of unique rntis & ueids */
- guint8 used_ueids[65535];
- guint8 used_rntis[65535];
- guint16 number_of_ueids;
- guint16 number_of_rntis;
+ /* Keep track of unique rntis & ueids. N.B. only used for counting number of UEs - not for lookup */
+ uint8_t used_ueids[65535];
+ uint8_t used_rntis[65535];
+ uint16_t number_of_ueids;
+ uint16_t number_of_rntis;
+ /* List of UE entries */
mac_lte_ep_t *ep_list;
-} mac_lte_stat_t;
+} mac_lte_nr_stat_t;
/* Reset the statistics window */
static void
mac_lte_stat_reset(void *phs)
{
- mac_lte_stat_t *mac_lte_stat = (mac_lte_stat_t *)phs;
+ mac_lte_nr_stat_t *mac_lte_stat = (mac_lte_nr_stat_t *)phs;
mac_lte_ep_t *list = mac_lte_stat->ep_list;
/* Reset counts of unique ueids & rntis */
@@ -150,7 +147,7 @@ mac_lte_stat_reset(void *phs)
/* Allocate a mac_lte_ep_t struct to store info for new UE */
-static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_lte_tap_info *si, packet_info *pinfo _U_)
+static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_3gpp_tap_info *si, packet_info *pinfo _U_)
{
mac_lte_ep_t *ep;
@@ -180,9 +177,6 @@ static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_lte_tap_info *si, packet_
ep->stats.UL_CRC_errors = 0;
ep->stats.DL_CRC_failures = 0;
- ep->stats.DL_CRC_high_code_rate = 0;
- ep->stats.DL_CRC_PDSCH_lost = 0;
- ep->stats.DL_CRC_Duplicate_NonZero_RV = 0;
ep->stats.UL_retx_frames = 0;
ep->stats.DL_retx_frames = 0;
@@ -193,14 +187,19 @@ static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_lte_tap_info *si, packet_
/* Update counts of unique rntis & ueids */
-static void update_ueid_rnti_counts(guint16 rnti, guint16 ueid, mac_lte_stat_t *hs)
+static void update_ueid_rnti_counts(uint16_t rnti, uint16_t ueid, mac_lte_nr_stat_t *hs)
{
+ if (hs->number_of_ueids == 65535 || hs->number_of_rntis == 65535) {
+ /* Arrays are already full! */
+ return;
+ }
+
if (!hs->used_ueids[ueid]) {
- hs->used_ueids[ueid] = TRUE;
+ hs->used_ueids[ueid] = true;
hs->number_of_ueids++;
}
if (!hs->used_rntis[rnti]) {
- hs->used_rntis[rnti] = TRUE;
+ hs->used_rntis[rnti] = true;
hs->number_of_rntis++;
}
}
@@ -212,12 +211,12 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
const void *phi, tap_flags_t flags _U_)
{
/* Get reference to stat window instance */
- mac_lte_stat_t *hs = (mac_lte_stat_t *)phs;
+ mac_lte_nr_stat_t *hs = (mac_lte_nr_stat_t*)phs;
mac_lte_ep_t *tmp = NULL, *te = NULL;
int i;
/* Cast tap info struct */
- const struct mac_lte_tap_info *si = (const struct mac_lte_tap_info *)phi;
+ const struct mac_3gpp_tap_info *si = (const struct mac_3gpp_tap_info *)phi;
if (!hs) {
return TAP_PACKET_DONT_REDRAW;
@@ -253,7 +252,7 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
return TAP_PACKET_DONT_REDRAW;
}
- /* Check max UEs/tti counter */
+ /* Check/update max UEs/tti counter */
switch (si->direction) {
case DIRECTION_UPLINK:
hs->common_stats.max_ul_ues_in_tti =
@@ -276,16 +275,18 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
update_ueid_rnti_counts(si->rnti, si->ueid, hs);
} else {
/* Look among existing rows for this RNTI */
- for (tmp = hs->ep_list;(tmp != NULL); tmp = tmp->next) {
- /* Match only by RNTI and UEId together */
- if ((tmp->stats.rnti == si->rnti) &&
+ /* TODO: with different data structures, could avoid this linear search */
+ for (tmp = hs->ep_list; tmp != NULL; tmp = tmp->next) {
+ /* Match only by RAT, RNTI and UEId together */
+ if ((tmp->stats.rat == si->rat) &&
+ (tmp->stats.rnti == si->rnti) &&
(tmp->stats.ueid == si->ueid)) {
te = tmp;
break;
}
}
- /* Not found among existing, so create a new one anyway */
+ /* Not found among existing, so create a new one now */
if (te == NULL) {
if ((te = alloc_mac_lte_ep(si, pinfo))) {
/* Add new item to end of list */
@@ -308,6 +309,7 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
}
/* Update entry with details from si */
+ te->stats.rat = si->rat;
te->stats.rnti = si->rnti;
te->stats.is_predefined_data = si->isPredefinedData;
@@ -325,9 +327,9 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Update time range */
if (te->stats.UL_frames == 0) {
- te->stats.UL_time_start = si->mac_lte_time;
+ te->stats.UL_time_start = si->mac_time;
}
- te->stats.UL_time_stop = si->mac_lte_time;
+ te->stats.UL_time_stop = si->mac_time;
te->stats.UL_frames++;
@@ -338,7 +340,7 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
te->stats.UL_total_bytes += si->single_number_of_bytes;
}
else {
- for (i = 0; i < MAC_LTE_DATA_LCID_COUNT_MAX; i++) {
+ for (i = 0; i < MAC_3GPP_DATA_LCID_COUNT_MAX; i++) {
te->stats.UL_total_bytes += si->bytes_for_lcid[i];
}
}
@@ -352,32 +354,15 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
}
if (si->crcStatusValid && (si->crcStatus != crc_success)) {
- switch (si->crcStatus) {
- case crc_fail:
- te->stats.DL_CRC_failures++;
- break;
- case crc_high_code_rate:
- te->stats.DL_CRC_high_code_rate++;
- break;
- case crc_pdsch_lost:
- te->stats.DL_CRC_PDSCH_lost++;
- break;
- case crc_duplicate_nonzero_rv:
- te->stats.DL_CRC_Duplicate_NonZero_RV++;
- break;
-
- default:
- /* Something went wrong! */
- break;
- }
+ te->stats.DL_CRC_failures++;
return TAP_PACKET_REDRAW;
}
/* Update time range */
if (te->stats.DL_frames == 0) {
- te->stats.DL_time_start = si->mac_lte_time;
+ te->stats.DL_time_start = si->mac_time;
}
- te->stats.DL_time_stop = si->mac_lte_time;
+ te->stats.DL_time_stop = si->mac_time;
te->stats.DL_frames++;
@@ -388,7 +373,7 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
te->stats.DL_total_bytes += si->single_number_of_bytes;
}
else {
- for (i = 0; i < MAC_LTE_DATA_LCID_COUNT_MAX; i++) {
+ for (i = 0; i < MAC_3GPP_DATA_LCID_COUNT_MAX; i++) {
te->stats.DL_total_bytes += si->bytes_for_lcid[i];
}
}
@@ -400,11 +385,11 @@ mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Calculate and return a bandwidth figure, in Mbs */
-static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 bytes)
+static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, uint32_t bytes)
{
/* Can only calculate bandwidth if have time delta */
if (memcmp(start_time, stop_time, sizeof(nstime_t)) != 0) {
- float elapsed_ms = (((float)stop_time->secs - (float)start_time->secs) * 1000) +
+ float elapsed_ms = (((float)stop_time->secs - (float)start_time->secs) * 1000) +
(((float)stop_time->nsecs - (float)start_time->nsecs) / 1000000);
/* Only really meaningful if have a few frames spread over time...
@@ -425,11 +410,11 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt
static void
mac_lte_stat_draw(void *phs)
{
- gint i;
- guint16 number_of_ues = 0;
+ int i;
+ uint16_t number_of_ues = 0;
/* Deref the struct */
- mac_lte_stat_t *hs = (mac_lte_stat_t *)phs;
+ mac_lte_nr_stat_t *hs = (mac_lte_nr_stat_t*)phs;
mac_lte_ep_t *list = hs->ep_list, *tmp = 0;
/* System data */
@@ -475,7 +460,8 @@ mac_lte_stat_draw(void *phs)
&tmp->stats.DL_time_stop,
tmp->stats.DL_total_bytes);
- printf("%5u %7s %5u %10u %9u %10f %10f %8u %10u %9u %10f %10f %12u %11u %18u %20u %8u\n",
+ printf("%s %5u %7s %5u %10u %9u %10f %10f %8u %10u %9u %10f %10f %12u %8u\n",
+ (tmp->stats.rat == MAC_RAT_LTE) ? "LTE " : "NR ",
tmp->stats.rnti,
(tmp->stats.rnti_type == C_RNTI) ? "C-RNTI" : "SPS-RNTI",
tmp->stats.ueid,
@@ -493,9 +479,6 @@ mac_lte_stat_draw(void *phs)
(((float)tmp->stats.DL_padding_bytes / (float)tmp->stats.DL_raw_bytes) * 100.0) :
0.0,
tmp->stats.DL_CRC_failures,
- tmp->stats.DL_CRC_high_code_rate,
- tmp->stats.DL_CRC_PDSCH_lost,
- tmp->stats.DL_CRC_Duplicate_NonZero_RV,
tmp->stats.DL_retx_frames);
}
}
@@ -503,14 +486,14 @@ mac_lte_stat_draw(void *phs)
/* Create a new MAC LTE stats struct */
static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
{
- mac_lte_stat_t *hs;
+ mac_lte_nr_stat_t *hs;
const char *filter = NULL;
GString *error_string;
/* Check for a filter string */
- if (strncmp(opt_arg, "mac-lte,stat,", 13) == 0) {
+ if (strncmp(opt_arg, "mac-3gpp,stat,", 14) == 0) {
/* Skip those characters from filter to display */
- filter = opt_arg + 13;
+ filter = opt_arg + 14;
}
else {
/* No filter */
@@ -518,10 +501,10 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
}
/* Create struct */
- hs = g_new0(mac_lte_stat_t, 1);
+ hs = g_new0(mac_lte_nr_stat_t, 1);
hs->ep_list = NULL;
- error_string = register_tap_listener("mac-lte", hs,
+ error_string = register_tap_listener("mac-3gpp", hs,
filter, 0,
mac_lte_stat_reset,
mac_lte_stat_packet,
@@ -537,7 +520,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
static stat_tap_ui mac_lte_stat_ui = {
REGISTER_STAT_GROUP_GENERIC,
NULL,
- "mac-lte,stat",
+ "mac-3gpp,stat",
mac_lte_stat_init,
0,
NULL
diff --git a/ui/cli/tap-protocolinfo.c b/ui/cli/tap-protocolinfo.c
index ea47ae52..14b57a29 100644
--- a/ui/cli/tap-protocolinfo.c
+++ b/ui/cli/tap-protocolinfo.c
@@ -36,7 +36,7 @@ protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const vo
{
pci_t *rs = (pci_t *)prs;
GPtrArray *gp;
- guint i;
+ unsigned i;
char *str;
/*
diff --git a/ui/cli/tap-protohierstat.h b/ui/cli/tap-protohierstat.h
index 3a68ff18..da2a9ca3 100644
--- a/ui/cli/tap-protohierstat.h
+++ b/ui/cli/tap-protohierstat.h
@@ -23,8 +23,8 @@ typedef struct _phs_t {
char *filter;
int protocol;
const char *proto_name;
- guint32 frames;
- guint64 bytes;
+ uint32_t frames;
+ uint64_t bytes;
} phs_t;
extern phs_t * new_phs_t(phs_t *parent, const char *filter);
diff --git a/ui/cli/tap-rlcltestat.c b/ui/cli/tap-rlcltestat.c
index 9f4a2cc9..9ebf051b 100644
--- a/ui/cli/tap-rlcltestat.c
+++ b/ui/cli/tap-rlcltestat.c
@@ -18,11 +18,15 @@
#include <epan/packet.h>
#include <epan/tap.h>
#include <epan/stat_tap_ui.h>
+
#include <epan/dissectors/packet-rlc-lte.h>
+#include <epan/dissectors/packet-rlc-3gpp-common.h>
+
void register_tap_listener_rlc_lte_stat(void);
enum {
+ RAT_COLUMN,
UEID_COLUMN,
UL_FRAMES_COLUMN,
UL_BYTES_COLUMN,
@@ -39,42 +43,43 @@ enum {
NUM_UE_COLUMNS
};
-static const gchar *ue_titles[] = { " UEId",
+static const char *ue_titles[] = { "RAT", " UEId",
"UL Frames", "UL Bytes", " UL Mbs", "UL ACKs", "UL NACKs", "UL Missed",
"DL Frames", "DL Bytes", " DL Mbs", "DL ACKs", "DL NACKs", "DL Missed"};
/* Stats for one UE */
typedef struct rlc_lte_row_data {
/* Key for matching this row */
- guint16 ueid;
+ uint8_t rat;
+ uint16_t ueid;
- gboolean is_predefined_data;
+ bool is_predefined_data;
- guint32 UL_frames;
- guint32 UL_total_bytes;
+ uint32_t UL_frames;
+ uint32_t UL_total_bytes;
nstime_t UL_time_start;
nstime_t UL_time_stop;
- guint32 UL_total_acks;
- guint32 UL_total_nacks;
- guint32 UL_total_missing;
+ uint32_t UL_total_acks;
+ uint32_t UL_total_nacks;
+ uint32_t UL_total_missing;
- guint32 DL_frames;
- guint32 DL_total_bytes;
+ uint32_t DL_frames;
+ uint32_t DL_total_bytes;
nstime_t DL_time_start;
nstime_t DL_time_stop;
- guint32 DL_total_acks;
- guint32 DL_total_nacks;
- guint32 DL_total_missing;
+ uint32_t DL_total_acks;
+ uint32_t DL_total_nacks;
+ uint32_t DL_total_missing;
} rlc_lte_row_data;
-/* Common channel stats */
+/* Common channel stats (i.e. independent of UEs) */
typedef struct rlc_lte_common_stats {
- guint32 bcch_frames;
- guint32 bcch_bytes;
- guint32 pcch_frames;
- guint32 pcch_bytes;
+ uint32_t bcch_frames;
+ uint32_t bcch_bytes;
+ uint32_t pcch_frames;
+ uint32_t pcch_bytes;
} rlc_lte_common_stats;
@@ -85,10 +90,10 @@ typedef struct rlc_lte_ep {
} rlc_lte_ep_t;
-/* Used to keep track of all RLC LTE statistics */
+/* Top-level struct for RLC LTE statistics */
typedef struct rlc_lte_stat_t {
rlc_lte_ep_t *ep_list;
- guint32 total_frames;
+ uint32_t total_frames;
/* Common stats */
rlc_lte_common_stats common_stats;
@@ -115,7 +120,7 @@ rlc_lte_stat_reset(void *phs)
/* Allocate a rlc_lte_ep_t struct to store info for new UE */
-static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_info *pinfo _U_)
+static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_3gpp_tap_info *si, packet_info *pinfo _U_)
{
rlc_lte_ep_t *ep;
@@ -128,6 +133,7 @@ static rlc_lte_ep_t *alloc_rlc_lte_ep(const struct rlc_lte_tap_info *si, packet_
}
/* Copy SI data into ep->stats */
+ ep->stats.rat = si->rat;
ep->stats.ueid = si->ueid;
/* Counts for new UE are all 0 */
@@ -160,7 +166,7 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
rlc_lte_ep_t *tmp = NULL, *te = NULL;
/* Cast tap info struct */
- const struct rlc_lte_tap_info *si = (const struct rlc_lte_tap_info *)phi;
+ const struct rlc_3gpp_tap_info *si = (const struct rlc_3gpp_tap_info *)phi;
/* Need this */
if (!hs) {
@@ -194,15 +200,18 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Make it the first/only entry */
te = hs->ep_list;
} else {
- /* Look among existing rows for this UEId */
+ /* Look among existing rows for this rat/UEId */
+ /* TODO: with different data structures, could avoid this linear search */
for (tmp = hs->ep_list; (tmp != NULL); tmp = tmp->next) {
- if (tmp->stats.ueid == si->ueid) {
+ if ((tmp->stats.rat == si->rat) &&
+ (tmp->stats.ueid == si->ueid))
+ {
te = tmp;
break;
}
}
- /* Not found among existing, so create a new one anyway */
+ /* Not found among existing, so create a new one now */
if (te == NULL) {
if ((te = alloc_rlc_lte_ep(si, pinfo))) {
/* Add new item to end of list */
@@ -228,9 +237,9 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
if (si->direction == DIRECTION_UPLINK) {
/* Update time range */
if (te->stats.UL_frames == 0) {
- te->stats.UL_time_start = si->rlc_lte_time;
+ te->stats.UL_time_start = si->rlc_time;
}
- te->stats.UL_time_stop = si->rlc_lte_time;
+ te->stats.UL_time_stop = si->rlc_time;
te->stats.UL_frames++;
te->stats.UL_total_bytes += si->pduLength;
@@ -238,9 +247,9 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
else {
/* Update time range */
if (te->stats.DL_frames == 0) {
- te->stats.DL_time_start = si->rlc_lte_time;
+ te->stats.DL_time_start = si->rlc_time;
}
- te->stats.DL_time_stop = si->rlc_lte_time;
+ te->stats.DL_time_stop = si->rlc_time;
te->stats.DL_frames++;
te->stats.DL_total_bytes += si->pduLength;
@@ -267,7 +276,7 @@ rlc_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Calculate and return a bandwidth figure, in Mbs */
-static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 bytes)
+static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, uint32_t bytes)
{
/* Can only calculate bandwidth if have time delta */
if (memcmp(start_time, stop_time, sizeof(nstime_t)) != 0) {
@@ -292,8 +301,8 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt
static void
rlc_lte_stat_draw(void *phs)
{
- guint16 number_of_ues = 0;
- gint i;
+ uint16_t number_of_ues = 0;
+ int i;
/* Look up the statistics struct */
rlc_lte_stat_t *hs = (rlc_lte_stat_t *)phs;
@@ -330,7 +339,8 @@ rlc_lte_stat_draw(void *phs)
&tmp->stats.DL_time_stop,
tmp->stats.DL_total_bytes);
- printf("%5u %10u %9u %10f %8u %9u %10u %10u %9u %10f %8u %9u %10u\n",
+ printf("%s %5u %10u %9u %10f %8u %9u %10u %10u %9u %10f %8u %9u %10u\n",
+ (tmp->stats.rat == RLC_RAT_LTE) ? "LTE" : "NR ",
tmp->stats.ueid,
tmp->stats.UL_frames,
tmp->stats.UL_total_bytes, UL_bw,
@@ -356,9 +366,9 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
GString *error_string;
/* Check for a filter string */
- if (strncmp(opt_arg, "rlc-lte,stat,", 13) == 0) {
+ if (strncmp(opt_arg, "rlc-3gpp,stat,", 14) == 0) {
/* Skip those characters from filter to display */
- filter = opt_arg + 13;
+ filter = opt_arg + 14;
}
else {
/* No filter */
@@ -374,7 +384,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
/* Register the tap listener */
/**********************************************/
- error_string = register_tap_listener("rlc-lte", hs,
+ error_string = register_tap_listener("rlc-3gpp", hs,
filter, 0,
rlc_lte_stat_reset,
rlc_lte_stat_packet,
@@ -393,7 +403,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
static stat_tap_ui rlc_lte_stat_ui = {
REGISTER_STAT_GROUP_GENERIC,
NULL,
- "rlc-lte,stat",
+ "rlc-3gpp,stat",
rlc_lte_stat_init,
0,
NULL
diff --git a/ui/cli/tap-rpcprogs.c b/ui/cli/tap-rpcprogs.c
index e64c93bc..28ad353c 100644
--- a/ui/cli/tap-rpcprogs.c
+++ b/ui/cli/tap-rpcprogs.c
@@ -35,16 +35,16 @@ void register_tap_listener_rpcprogs(void);
/* used to keep track of statistics for a specific program/version */
typedef struct _rpc_program_t {
struct _rpc_program_t *next;
- guint32 program;
- guint32 version;
+ uint32_t program;
+ uint32_t version;
int num;
nstime_t min;
nstime_t max;
nstime_t tot;
} rpc_program_t;
-static rpc_program_t *prog_list = NULL;
-static int already_enabled = 0;
+static rpc_program_t *prog_list;
+static int already_enabled;
static tap_packet_status
rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri, tap_flags_t flags _U_)
@@ -167,7 +167,7 @@ rpcprogs_packet(void *dummy1 _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
static void
rpcprogs_draw(void *dummy _U_)
{
- guint64 td;
+ uint64_t td;
rpc_program_t *rp;
char str[64];
@@ -181,7 +181,7 @@ rpcprogs_draw(void *dummy _U_)
continue;
}
/* Scale the average SRT in units of 1us and round to the nearest us. */
- td = ((guint64)(rp->tot.secs)) * NANOSECS_PER_SEC + rp->tot.nsecs;
+ td = ((uint64_t)(rp->tot.secs)) * NANOSECS_PER_SEC + rp->tot.nsecs;
td = ((td / rp->num) + 500) / 1000;
snprintf(str, sizeof(str), "%s(%d)", rpc_prog_name(rp->program), rp->program);
diff --git a/ui/cli/tap-rtd.c b/ui/cli/tap-rtd.c
index ad56c4c5..93a1bd33 100644
--- a/ui/cli/tap-rtd.c
+++ b/ui/cli/tap-rtd.c
@@ -34,8 +34,8 @@ rtd_draw(void *arg)
{
rtd_data_t* rtd_data = (rtd_data_t*)arg;
rtd_t* rtd = (rtd_t*)rtd_data->user_data;
- gchar* tmp_str;
- guint i, j;
+ char* tmp_str;
+ unsigned i, j;
/* printing results */
printf("\n");
@@ -135,7 +135,7 @@ register_rtd_tables(const void *key _U_, void *value, void *userdata _U_)
{
register_rtd_t *rtd = (register_rtd_t*)value;
stat_tap_ui ui_info;
- gchar *cli_string;
+ char *cli_string;
cli_string = rtd_table_get_tap_string(rtd);
ui_info.group = REGISTER_STAT_GROUP_RESPONSE_TIME;
@@ -146,7 +146,7 @@ register_rtd_tables(const void *key _U_, void *value, void *userdata _U_)
ui_info.params = NULL;
register_stat_tap_ui(&ui_info, rtd);
g_free(cli_string);
- return FALSE;
+ return false;
}
/*
diff --git a/ui/cli/tap-rtp.c b/ui/cli/tap-rtp.c
index b7937cd0..ab68ed7f 100644
--- a/ui/cli/tap-rtp.c
+++ b/ui/cli/tap-rtp.c
@@ -44,7 +44,7 @@ static void rtpstreams_stat_draw_cb(rtpstream_tapinfo_t *tapinfo);
*/
static rtpstream_tapinfo_t the_tapinfo_struct =
{ NULL, rtpstreams_stat_draw_cb, NULL,
- NULL, 0, NULL, NULL, 0, TAP_ANALYSE, NULL, NULL, NULL, FALSE, FALSE
+ NULL, 0, NULL, NULL, 0, TAP_ANALYSE, NULL, NULL, NULL, false, false
};
static void
diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c
index a42be606..accc0f85 100644
--- a/ui/cli/tap-rtspstat.c
+++ b/ui/cli/tap-rtspstat.c
@@ -42,16 +42,16 @@ typedef struct _rtsp_stats_t {
* for example it can be { 3, 404, "Not Found" ,...}
* which means we captured 3 reply rtsp/1.1 404 Not Found */
typedef struct _rtsp_response_code_t {
- guint32 packets; /* 3 */
- guint response_code; /* 404 */
- const gchar *name; /* Not Found */
+ uint32_t packets; /* 3 */
+ unsigned response_code; /* 404 */
+ const char *name; /* Not Found */
rtspstat_t *sp;
} rtsp_response_code_t;
/* used to keep track of the stats for a specific request string */
typedef struct _rtsp_request_methode_t {
- gchar *response; /* eg. : SETUP */
- guint32 packets;
+ char *response; /* eg. : SETUP */
+ uint32_t packets;
rtspstat_t *sp;
} rtsp_request_methode_t;
@@ -76,7 +76,7 @@ rtsp_init_hash( rtspstat_t *sp)
sp->hash_requests = g_hash_table_new( g_str_hash, g_str_equal);
}
static void
-rtsp_draw_hash_requests( gchar *key _U_ , rtsp_request_methode_t *data, gchar * format)
+rtsp_draw_hash_requests( char *key _U_ , rtsp_request_methode_t *data, char * format)
{
if (data->packets == 0)
return;
@@ -84,7 +84,7 @@ rtsp_draw_hash_requests( gchar *key _U_ , rtsp_request_methode_t *data, gchar *
}
static void
-rtsp_draw_hash_responses( gpointer* key _U_ , rtsp_response_code_t *data, char * format)
+rtsp_draw_hash_responses( void ** key _U_ , rtsp_response_code_t *data, char * format)
{
if (data == NULL) {
ws_warning("No data available, key=%d\n", GPOINTER_TO_INT(key));
@@ -101,19 +101,19 @@ rtsp_draw_hash_responses( gpointer* key _U_ , rtsp_response_code_t *data, char *
/* NOT USED at this moment */
/*
static void
-rtsp_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
+rtsp_free_hash( void *key, void *value, void *user_data _U_ )
{
g_free(key);
g_free(value);
}
*/
static void
-rtsp_reset_hash_responses(gchar *key _U_ , rtsp_response_code_t *data, gpointer ptr _U_ )
+rtsp_reset_hash_responses(char *key _U_ , rtsp_response_code_t *data, void *ptr _U_ )
{
data->packets = 0;
}
static void
-rtsp_reset_hash_requests(gchar *key _U_ , rtsp_request_methode_t *data, gpointer ptr _U_ )
+rtsp_reset_hash_requests(char *key _U_ , rtsp_request_methode_t *data, void *ptr _U_ )
{
data->packets = 0;
}
@@ -143,7 +143,7 @@ rtspstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
sp->hash_responses,
GINT_TO_POINTER(value->response_code));
if (sc == NULL) {
- gint key;
+ int key;
/* non standard status code ; we classify it as others
* in the relevant category (Informational,Success,Redirection,Client Error,Server Error)
*/
@@ -209,10 +209,10 @@ rtspstat_draw(void *psp )
printf("* RTSP Response Status Codes Packets\n");
g_hash_table_foreach( sp->hash_responses, (GHFunc)rtsp_draw_hash_responses,
- (gpointer)" %3d %-35s %9d\n");
+ (void *)" %3d %-35s %9d\n");
printf("* RTSP Request Methods Packets\n");
g_hash_table_foreach( sp->hash_requests, (GHFunc)rtsp_draw_hash_requests,
- (gpointer)" %-39s %9d\n");
+ (void *)" %-39s %9d\n");
printf("===================================================================\n");
}
diff --git a/ui/cli/tap-sctpchunkstat.c b/ui/cli/tap-sctpchunkstat.c
index 21e081eb..4d51f8bf 100644
--- a/ui/cli/tap-sctpchunkstat.c
+++ b/ui/cli/tap-sctpchunkstat.c
@@ -32,21 +32,21 @@ typedef struct sctp_ep {
struct sctp_ep *next;
address src;
address dst;
- guint16 sport;
- guint16 dport;
- guint32 chunk_count[256];
+ uint16_t sport;
+ uint16_t dport;
+ uint32_t chunk_count[256];
} sctp_ep_t;
/* used to keep track of the statistics for an entire program interface */
typedef struct _sctpstat_t {
char *filter;
- guint32 number_of_packets;
+ uint32_t number_of_packets;
sctp_ep_t *ep_list;
} sctpstat_t;
#define CHUNK_TYPE_OFFSET 0
-#define CHUNK_TYPE(x)(tvb_get_guint8((x), CHUNK_TYPE_OFFSET))
+#define CHUNK_TYPE(x)(tvb_get_uint8((x), CHUNK_TYPE_OFFSET))
static void
sctpstat_reset(void *phs)
@@ -54,7 +54,7 @@ sctpstat_reset(void *phs)
sctpstat_t *sctp_stat = (sctpstat_t *)phs;
sctp_ep_t *list = (sctp_ep_t *)sctp_stat->ep_list;
sctp_ep_t *tmp = NULL;
- guint16 chunk_type;
+ uint16_t chunk_type;
if (!list)
return;
@@ -71,7 +71,7 @@ static sctp_ep_t *
alloc_sctp_ep(const struct _sctp_info *si)
{
sctp_ep_t *ep;
- guint16 chunk_type;
+ uint16_t chunk_type;
if (!si)
return NULL;
@@ -99,8 +99,8 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
sctpstat_t *hs = (sctpstat_t *)phs;
sctp_ep_t *tmp = NULL, *te = NULL;
const struct _sctp_info *si = (const struct _sctp_info *)phi;
- guint32 tvb_number;
- guint8 chunk_type;
+ uint32_t tvb_number;
+ uint8_t chunk_type;
if (!hs)
return (TAP_PACKET_DONT_REDRAW);
diff --git a/ui/cli/tap-simple_stattable.c b/ui/cli/tap-simple_stattable.c
index cca34320..0dc9230c 100644
--- a/ui/cli/tap-simple_stattable.c
+++ b/ui/cli/tap-simple_stattable.c
@@ -30,11 +30,11 @@ simple_draw(void *arg)
stat_data_t* stat_data = (stat_data_t*)arg;
table_stat_t* stats = (table_stat_t*)stat_data->user_data;
size_t i;
- guint table_index, element, field_index;
+ unsigned table_index, element, field_index;
stat_tap_table_item* field;
stat_tap_table* table;
stat_tap_table_item_type* field_data;
- gchar fmt_string[250];
+ char fmt_string[250];
/* printing results */
printf("\n");
@@ -152,7 +152,7 @@ register_simple_stat_tables(const void *key, void *value, void *userdata _U_)
ui_info.params = stat_tap->params;
register_stat_tap_ui(&ui_info, stat_tap);
- return FALSE;
+ return false;
}
/*
diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c
index 92d1463d..87717eb3 100644
--- a/ui/cli/tap-sipstat.c
+++ b/ui/cli/tap-sipstat.c
@@ -33,13 +33,13 @@ void register_tap_listener_sipstat(void);
/* used to keep track of the statictics for an entire program interface */
typedef struct _sip_stats_t {
char *filter;
- guint32 packets; /* number of sip packets, including continuations */
- guint32 resent_packets;
- guint32 average_setup_time;
- guint32 max_setup_time;
- guint32 min_setup_time;
- guint32 no_of_completed_calls;
- guint64 total_setup_time;
+ uint32_t packets; /* number of sip packets, including continuations */
+ uint32_t resent_packets;
+ uint32_t average_setup_time;
+ uint32_t max_setup_time;
+ uint32_t min_setup_time;
+ uint32_t no_of_completed_calls;
+ uint64_t total_setup_time;
GHashTable *hash_responses;
GHashTable *hash_requests;
} sipstat_t;
@@ -48,16 +48,16 @@ typedef struct _sip_stats_t {
* for example it can be { 3, 404, "Not Found" ,...}
* which means we captured 3 reply sip/1.1 404 Not Found */
typedef struct _sip_response_code_t {
- guint32 packets; /* 3 */
- guint response_code; /* 404 */
- const gchar *name; /* Not Found */
+ uint32_t packets; /* 3 */
+ unsigned response_code; /* 404 */
+ const char *name; /* Not Found */
sipstat_t *sp;
} sip_response_code_t;
/* used to keep track of the stats for a specific request string */
typedef struct _sip_request_method_t {
- gchar *response; /* eg. : INVITE */
- guint32 packets;
+ char *response; /* eg. : INVITE */
+ uint32_t packets;
sipstat_t *sp;
} sip_request_method_t;
@@ -74,7 +74,7 @@ sip_init_hash(sipstat_t *sp)
/* Add all response codes */
for (i=0; sip_response_code_vals[i].strptr; i++)
{
- gint *key = g_new (gint, 1);
+ int *key = g_new (int, 1);
sip_response_code_t *sc = g_new (sip_response_code_t, 1);
*key = sip_response_code_vals[i].value;
sc->packets = 0;
@@ -89,7 +89,7 @@ sip_init_hash(sipstat_t *sp)
}
static void
-sip_draw_hash_requests( gchar *key _U_, sip_request_method_t *data, gchar *format)
+sip_draw_hash_requests( char *key _U_, sip_request_method_t *data, char *format)
{
if (data->packets == 0)
return;
@@ -97,7 +97,7 @@ sip_draw_hash_requests( gchar *key _U_, sip_request_method_t *data, gchar *forma
}
static void
-sip_draw_hash_responses( gint *key _U_ , sip_response_code_t *data, char *format)
+sip_draw_hash_responses( int *key _U_ , sip_response_code_t *data, char *format)
{
if (data == NULL) {
ws_warning("C'est quoi ce borderl key=%d\n", *key);
@@ -111,7 +111,7 @@ sip_draw_hash_responses( gint *key _U_ , sip_response_code_t *data, char *format
/* NOT USED at this moment */
/*
static void
-sip_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
+sip_free_hash( void *key, void *value, void *user_data _U_ )
{
g_free(key);
g_free(value);
@@ -119,12 +119,12 @@ sip_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
*/
static void
-sip_reset_hash_responses(gchar *key _U_ , sip_response_code_t *data, gpointer ptr _U_ )
+sip_reset_hash_responses(char *key _U_ , sip_response_code_t *data, void *ptr _U_ )
{
data->packets = 0;
}
static void
-sip_reset_hash_requests(gchar *key _U_ , sip_request_method_t *data, gpointer ptr _U_ )
+sip_reset_hash_requests(char *key _U_ , sip_request_method_t *data, void *ptr _U_ )
{
data->packets = 0;
}
@@ -176,7 +176,7 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
sp->min_setup_time = value->setup_time;
}
/* Calculate average */
- sp->average_setup_time = (guint32)(sp->total_setup_time / sp->no_of_completed_calls);
+ sp->average_setup_time = (uint32_t)(sp->total_setup_time / sp->no_of_completed_calls);
}
}
@@ -191,7 +191,7 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
if (value->response_code != 0)
{
/* Responses */
- guint key;
+ unsigned key;
sip_response_code_t *sc;
/* Look up response code in hash table */
@@ -291,10 +291,10 @@ sipstat_draw(void *psp )
printf("\nNumber of resent SIP messages: %u\n", sp->resent_packets);
printf( "\n* SIP Status Codes in reply packets\n");
g_hash_table_foreach(sp->hash_responses, (GHFunc)sip_draw_hash_responses,
- (gpointer)" SIP %3d %-15s : %5d Packets\n");
+ (void *)" SIP %3d %-15s : %5d Packets\n");
printf("\n* List of SIP Request methods\n");
g_hash_table_foreach(sp->hash_requests, (GHFunc)sip_draw_hash_requests,
- (gpointer)" %-15s : %5d Packets\n");
+ (void *)" %-15s : %5d Packets\n");
printf( "\n* Average setup time %u ms\n Min %u ms\n Max %u ms\n", sp->average_setup_time, sp->min_setup_time, sp->max_setup_time);
printf("===================================================================\n");
}
diff --git a/ui/cli/tap-smbsids.c b/ui/cli/tap-smbsids.c
index f92037c9..a0ac4d40 100644
--- a/ui/cli/tap-smbsids.c
+++ b/ui/cli/tap-smbsids.c
@@ -34,7 +34,7 @@ smbsids_packet(void *pss _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, c
}
static void
-enum_sids(gpointer key, gpointer value, gpointer userdata _U_)
+enum_sids(void *key, void *value, void *userdata _U_)
{
const char *sid = (const char *)key;
const char *name = (const char *)value;
@@ -62,7 +62,7 @@ smbsids_init(const char *opt_arg _U_, void *userdata _U_)
fprintf(stderr, "The -z smb,sids function needs SMB/SID-Snooping to be enabled.\n");
fprintf(stderr, "Either enable Edit/Preferences/Protocols/SMB/Snoop SID name mappings in wireshark\n");
fprintf(stderr, "or override the preference file by specifying\n");
- fprintf(stderr, " -o \"smb.sid_name_snooping=TRUE\"\n");
+ fprintf(stderr, " -o \"smb.sid_name_snooping=true\"\n");
fprintf(stderr, "on the tshark command line.\n");
exit(1);
}
diff --git a/ui/cli/tap-srt.c b/ui/cli/tap-srt.c
index 62cef3af..3b7c08c4 100644
--- a/ui/cli/tap-srt.c
+++ b/ui/cli/tap-srt.c
@@ -29,11 +29,11 @@ typedef struct _srt_t {
} srt_t;
static void
-draw_srt_table_data(srt_stat_table *rst, gboolean draw_footer, const char *subfilter)
+draw_srt_table_data(srt_stat_table *rst, bool draw_footer, const char *subfilter)
{
int i;
- guint64 td;
- guint64 sum;
+ uint64_t td;
+ uint64_t sum;
if (rst->num_procs > 0) {
if (rst->filter_string != NULL && subfilter != NULL) {
@@ -56,7 +56,7 @@ draw_srt_table_data(srt_stat_table *rst, gboolean draw_footer, const char *subfi
depending uon the platform. After casting tot.secs to 64 bits, it
would take a capture with a duration of over 136 *years* to
overflow the secs portion of td. */
- td = ((guint64)(rst->procedures[i].stats.tot.secs))*NANOSECS_PER_SEC + rst->procedures[i].stats.tot.nsecs;
+ td = ((uint64_t)(rst->procedures[i].stats.tot.secs))*NANOSECS_PER_SEC + rst->procedures[i].stats.tot.nsecs;
sum = (td + 500) / 1000;
td = ((td / rst->procedures[i].stats.num) + 500) / 1000;
@@ -77,11 +77,11 @@ draw_srt_table_data(srt_stat_table *rst, gboolean draw_footer, const char *subfi
static void
srt_draw(void *arg)
{
- guint i = 0;
+ unsigned i = 0;
srt_data_t* data = (srt_data_t*)arg;
srt_t *ui = (srt_t *)data->user_data;
srt_stat_table *srt_table;
- gboolean need_newline = FALSE;
+ bool need_newline = false;
printf("\n");
printf("===================================================================\n");
@@ -90,7 +90,7 @@ srt_draw(void *arg)
srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
draw_srt_table_data(srt_table, data->srt_array->len == 1, ui->filter);
if (srt_table->num_procs > 0) {
- need_newline = TRUE;
+ need_newline = true;
}
for (i = 1; i < data->srt_array->len; i++)
@@ -98,12 +98,12 @@ srt_draw(void *arg)
if (need_newline)
{
printf("\n");
- need_newline = FALSE;
+ need_newline = false;
}
srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
draw_srt_table_data(srt_table, i == data->srt_array->len-1, ui->filter);
if (srt_table->num_procs > 0) {
- need_newline = TRUE;
+ need_newline = true;
}
}
}
@@ -142,7 +142,7 @@ dissector_srt_init(const char *opt_arg, void* userdata)
srt_table_get_filter(srt, opt_arg, &filter, &err);
if (err != NULL)
{
- gchar* cmd_str = srt_table_get_tap_string(srt);
+ char* cmd_str = srt_table_get_tap_string(srt);
cmdarg_err("invalid \"-z %s,%s\" argument", cmd_str, err);
g_free(cmd_str);
g_free(err);
@@ -150,7 +150,7 @@ dissector_srt_init(const char *opt_arg, void* userdata)
}
/* Need to create the SRT array now */
- global_srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
+ global_srt_array = g_array_new(false, true, sizeof(srt_stat_table*));
srt_table_dissector_init(srt, global_srt_array);
init_srt_tables(srt, filter);
@@ -163,12 +163,12 @@ register_srt_tables(const void *key _U_, void *value, void *userdata _U_)
register_srt_t *srt = (register_srt_t*)value;
const char* short_name = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt)));
stat_tap_ui ui_info;
- gchar *cli_string;
+ char *cli_string;
/* XXX - CAMEL dissector hasn't been converted over due seemingly different tap packet
handling functions. So let the existing TShark CAMEL tap keep its registration */
if (strcmp(short_name, "CAMEL") == 0)
- return FALSE;
+ return false;
cli_string = srt_table_get_tap_string(srt);
ui_info.group = REGISTER_STAT_GROUP_RESPONSE_TIME;
@@ -179,7 +179,7 @@ register_srt_tables(const void *key _U_, void *value, void *userdata _U_)
ui_info.params = NULL;
register_stat_tap_ui(&ui_info, srt);
g_free(cli_string);
- return FALSE;
+ return false;
}
/*
diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c
index 64557e40..5e2bc895 100644
--- a/ui/cli/tap-stats_tree.c
+++ b/ui/cli/tap-stats_tree.c
@@ -32,7 +32,7 @@ struct _tree_pres {
};
struct _tree_cfg_pres {
- gchar *init_string;
+ char *init_string;
};
static void
@@ -94,7 +94,7 @@ init_stats_tree(const char *opt_arg, void *userdata _U_)
NULL);
if (error_string) {
- report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->name, error_string->str);
+ report_failure("stats_tree for: %s failed to attach to the tap: %s", cfg->path, error_string->str);
return;
}
@@ -103,7 +103,7 @@ init_stats_tree(const char *opt_arg, void *userdata _U_)
}
static void
-register_stats_tree_tap (gpointer k _U_, gpointer v, gpointer p _U_)
+register_stats_tree_tap (void *k _U_, void *v, void *p _U_)
{
stats_tree_cfg *cfg = (stats_tree_cfg *)v;
stat_tap_ui ui_info;
diff --git a/ui/cli/tap-voip.h b/ui/cli/tap-voip.h
index 45c436f5..6d02c260 100644
--- a/ui/cli/tap-voip.h
+++ b/ui/cli/tap-voip.h
@@ -18,7 +18,7 @@ extern "C" {
/* store the chosen calls in a bit-array */
#define VOIP_CONV_BITS (sizeof(int) * 8)
-#define VOIP_CONV_NUM ((1<<(sizeof(guint16) * 8))/VOIP_CONV_BITS)
+#define VOIP_CONV_NUM ((1<<(sizeof(uint16_t) * 8))/VOIP_CONV_BITS)
#define VOIP_CONV_MAX (VOIP_CONV_BITS * VOIP_CONV_NUM)
extern voip_calls_tapinfo_t tapinfo_;
diff --git a/ui/cli/tap-wspstat.c b/ui/cli/tap-wspstat.c
index 89daed31..d4fb6f13 100644
--- a/ui/cli/tap-wspstat.c
+++ b/ui/cli/tap-wspstat.c
@@ -33,35 +33,35 @@ void register_tap_listener_wspstat(void);
/* used to keep track of the stats for a specific PDU type*/
typedef struct _wsp_pdu_t {
- const gchar *type;
- guint32 packets;
+ const char *type;
+ uint32_t packets;
} wsp_pdu_t;
/* used to keep track of SRT statistics */
typedef struct _wsp_status_code_t {
- const gchar *name;
- guint32 packets;
+ const char *name;
+ uint32_t packets;
} wsp_status_code_t;
/* used to keep track of the statictics for an entire program interface */
typedef struct _wsp_stats_t {
char *filter;
wsp_pdu_t *pdu_stats;
- guint32 num_pdus;
+ uint32_t num_pdus;
GHashTable *hash;
} wspstat_t;
static void
-wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_)
+wsp_reset_hash(char *key _U_ , wsp_status_code_t *data, void *ptr _U_)
{
data->packets = 0;
}
static void
-wsp_print_statuscode(gpointer key, wsp_status_code_t *data, char *format)
+wsp_print_statuscode(void *key, wsp_status_code_t *data, char *format)
{
if (data && (data->packets != 0))
printf(format, GPOINTER_TO_INT(key), data->packets , data->name);
}
static void
-wsp_free_hash_table( gpointer key, gpointer value, gpointer user_data _U_ )
+wsp_free_hash_table( void *key, void *value, void *user_data _U_ )
{
g_free(key);
g_free(value);
@@ -70,7 +70,7 @@ static void
wspstat_reset(void *psp)
{
wspstat_t *sp = (wspstat_t *)psp;
- guint32 i;
+ uint32_t i;
for (i=1; i<=sp->num_pdus; i++)
{
@@ -91,8 +91,8 @@ wspstat_reset(void *psp)
* ALL packets and not just the ones we are collecting stats for.
*
*/
-static gint
-pdut2index(gint pdut)
+static int
+pdut2index(int pdut)
{
if (pdut <= 0x09)
return pdut;
@@ -105,8 +105,8 @@ pdut2index(gint pdut)
}
return 0;
}
-static gint
-index2pdut(gint pdut)
+static int
+index2pdut(int pdut)
{
if (pdut <= 0x09)
return pdut;
@@ -121,7 +121,7 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
{
wspstat_t *sp = (wspstat_t *)psp;
const wsp_info_value_t *value = (const wsp_info_value_t *)pri;
- gint idx = pdut2index(value->pdut);
+ int idx = pdut2index(value->pdut);
tap_packet_status retour = TAP_PACKET_DONT_REDRAW;
if (value->status_code != 0) {
@@ -168,7 +168,7 @@ static void
wspstat_draw(void *psp)
{
wspstat_t *sp = (wspstat_t *)psp;
- guint32 i;
+ uint32_t i;
printf("\n");
printf("===================================================================\n");
@@ -176,7 +176,7 @@ wspstat_draw(void *psp)
printf("%-23s %9s || %-23s %9s\n", "PDU Type", "Packets", "PDU Type", "Packets");
for (i=1; i <= ((sp->num_pdus+1)/2); i++)
{
- guint32 ii = i+sp->num_pdus/2;
+ uint32_t ii = i+sp->num_pdus/2;
printf("%-23s %9u", sp->pdu_stats[i ].type, sp->pdu_stats[i ].packets);
printf(" || ");
if (ii< (sp->num_pdus) )
@@ -187,7 +187,7 @@ wspstat_draw(void *psp)
printf("\nStatus code in reply packets\n");
printf( "Status Code Packets Description\n");
g_hash_table_foreach( sp->hash, (GHFunc) wsp_print_statuscode,
- (gpointer)" 0x%02X %9d %s\n" ) ;
+ (void *)" 0x%02X %9d %s\n" ) ;
printf("===================================================================\n");
}
@@ -203,7 +203,7 @@ wspstat_init(const char *opt_arg, void *userdata _U_)
{
wspstat_t *sp;
const char *filter = NULL;
- guint32 i;
+ uint32_t i;
GString *error_string;
wsp_status_code_t *sc;
const value_string *wsp_vals_status_p;
@@ -220,9 +220,9 @@ wspstat_init(const char *opt_arg, void *userdata _U_)
wsp_vals_status_p = VALUE_STRING_EXT_VS_P(&wsp_vals_status_ext);
for (i=0; wsp_vals_status_p[i].strptr; i++ )
{
- gint *key;
+ int *key;
sc = g_new(wsp_status_code_t, 1);
- key = g_new(gint, 1);
+ key = g_new(int, 1);
sc->packets = 0;
sc->name = wsp_vals_status_p[i].strptr;
*key = wsp_vals_status_p[i].value;