aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2024-03-31 11:10:36 -0700
committerAndersBroman <a.broman58@gmail.com>2024-04-01 08:14:53 +0000
commitcd3588d52f9fa023c0521068432fa03e0f566633 (patch)
treec9910472a956dde07765377710351f8ff8b08b49
parentd81488c1674d6589026c9f2e110267498c18d9cb (diff)
ui: Convert the CLI code to C99 types
Ping #19116
-rw-r--r--ui/cli/simple_dialog.c6
-rw-r--r--ui/cli/tap-camelsrt.c14
-rw-r--r--ui/cli/tap-credentials.c4
-rw-r--r--ui/cli/tap-diameter-avp.c46
-rw-r--r--ui/cli/tap-endpoints.c18
-rw-r--r--ui/cli/tap-expert.c22
-rw-r--r--ui/cli/tap-exportobject.c26
-rw-r--r--ui/cli/tap-exportobject.h2
-rw-r--r--ui/cli/tap-flow.c14
-rw-r--r--ui/cli/tap-follow.c50
-rw-r--r--ui/cli/tap-gsm_astat.c4
-rw-r--r--ui/cli/tap-hosts.c26
-rw-r--r--ui/cli/tap-httpstat.c28
-rw-r--r--ui/cli/tap-icmpstat.c18
-rw-r--r--ui/cli/tap-icmpv6stat.c18
-rw-r--r--ui/cli/tap-iostat.c214
-rw-r--r--ui/cli/tap-iousers.c20
-rw-r--r--ui/cli/tap-macltestat.c80
-rw-r--r--ui/cli/tap-protocolinfo.c4
-rw-r--r--ui/cli/tap-protohierstat.c2
-rw-r--r--ui/cli/tap-protohierstat.h4
-rw-r--r--ui/cli/tap-rlcltestat.c44
-rw-r--r--ui/cli/tap-rpcprogs.c10
-rw-r--r--ui/cli/tap-rtd.c10
-rw-r--r--ui/cli/tap-rtp.c2
-rw-r--r--ui/cli/tap-rtspstat.c28
-rw-r--r--ui/cli/tap-sctpchunkstat.c18
-rw-r--r--ui/cli/tap-simple_stattable.c8
-rw-r--r--ui/cli/tap-sipstat.c46
-rw-r--r--ui/cli/tap-smbsids.c6
-rw-r--r--ui/cli/tap-srt.c30
-rw-r--r--ui/cli/tap-stats_tree.c6
-rw-r--r--ui/cli/tap-sv.c2
-rw-r--r--ui/cli/tap-voip.h2
-rw-r--r--ui/cli/tap-wspstat.c42
35 files changed, 437 insertions, 437 deletions
diff --git a/ui/cli/simple_dialog.c b/ui/cli/simple_dialog.c
index a357c5156d..1916a43bef 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,
...
)
{
diff --git a/ui/cli/tap-camelsrt.c b/ui/cli/tap-camelsrt.c
index 935731ac34..b76602c7cc 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");
@@ -225,7 +225,7 @@ static void camelsrt_init(const char *opt_arg, void *userdata _U_)
g_free(p_camelsrt);
cmdarg_err("Couldn't register camel,srt tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
@@ -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 9a54a7eb28..c9b4ca56c5 100644
--- a/ui/cli/tap-credentials.c
+++ b/ui/cli/tap-credentials.c
@@ -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 : "");
}
@@ -81,7 +81,7 @@ static void credentials_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) {
/* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register credentials tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-diameter-avp.c b/ui/cli/tap-diameter-avp.c
index 2abda9c093..42842fc95a 100644
--- a/ui/cli/tap-diameter-avp.c
+++ b/ui/cli/tap-diameter-avp.c
@@ -45,34 +45,34 @@ 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 bool
@@ -117,11 +117,11 @@ 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;
@@ -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;
@@ -254,7 +254,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_)
g_string_append(filter, field);
}
g_strfreev(tokens);
- ds->filter = g_string_free(filter, FALSE);
+ ds->filter = g_string_free(filter, false);
error_string = register_tap_listener("diameter", ds, ds->filter, 0, NULL, diameteravp_packet, diameteravp_draw, NULL);
if (error_string) {
@@ -263,7 +263,7 @@ diameteravp_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register diam,csv tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-endpoints.c b/ui/cli/tap-endpoints.c
index e97dcf85f2..f32bbaa12e 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",
@@ -114,7 +114,7 @@ void init_endpoints(struct register_ct *ct, const char *filter)
g_free(iu);
cmdarg_err("Couldn't register endpoint tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c
index 3fcf0e7fb0..50a582b8c4 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);
}
/**********************************************/
@@ -264,7 +264,7 @@ static void expert_stat_init(const char *opt_arg, void *userdata _U_)
(tap_finish_cb)expert_tapdata_free);
if (error_string) {
printf("Expert tap error (%s)!\n", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
expert_tapdata_free(hs);
exit(1);
}
diff --git a/ui/cli/tap-exportobject.c b/ui/cli/tap-exportobject.c
index 4a02155c37..fbc677f2ce 100644
--- a/ui/cli/tap-exportobject.c
+++ b/ui/cli/tap-exportobject.c
@@ -36,8 +36,8 @@ static GHashTable* eo_opts = NULL;
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. */
@@ -136,7 +136,7 @@ eo_draw(void *tapdata)
EXPORT_OBJECT_MAXFILELEN, count);
}
save_as_fullpath = g_build_filename(save_in_path, safe_filename->str, NULL);
- g_string_free(safe_filename, TRUE);
+ g_string_free(safe_filename, true);
} while (g_file_test(save_as_fullpath, G_FILE_TEST_EXISTS) && ++count < prefs.gui_max_export_objects);
count = 0;
write_file_binary_mode(save_as_fullpath, entry->payload_data, entry->payload_len);
@@ -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;
@@ -176,7 +176,7 @@ exportobject_handler(gpointer key, gpointer value _U_, gpointer user_data _U_)
if (error_msg) {
cmdarg_err("Can't register %s tap: %s", (const char*)key, error_msg->str);
- g_string_free(error_msg, TRUE);
+ g_string_free(error_msg, true);
g_free(tap_data);
g_free(object_list);
return;
diff --git a/ui/cli/tap-exportobject.h b/ui/cli/tap-exportobject.h
index 49ebc265ca..9c279d0031 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 32e0a94f7e..c98dcba1b7 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
@@ -100,7 +100,7 @@ flow_init(const char *opt_argp, void *userdata)
{
sequence_analysis_list_free(flow_info);
sequence_analysis_info_free(flow_info);
- g_string_free(errp, TRUE);
+ g_string_free(errp, true);
flow_exit("Error registering tap listener.");
}
}
@@ -111,10 +111,10 @@ 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);
+ cli_string = g_string_free(cmd_str, false);
flow_ui.group = REGISTER_STAT_GROUP_GENERIC;
flow_ui.title = NULL; /* construct this from the protocol info? */
@@ -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 51f8f0f72d..8edb385cce 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] == ','))
@@ -452,18 +452,18 @@ follow_arg_filter(const char **opt_argp, follow_info_t *follow_info)
{
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
{
@@ -595,7 +595,7 @@ static void follow_stream(const char *opt_argp, void *userdata)
if (errp != NULL)
{
follow_free(follow_info);
- g_string_free(errp, TRUE);
+ g_string_free(errp, true);
follow_exit("Error registering tap listener.");
}
}
@@ -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-gsm_astat.c b/ui/cli/tap-gsm_astat.c
index 1f0a792408..e53f22bf45 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");
@@ -324,7 +324,7 @@ gsm_a_stat_init(const char *opt_arg _U_, void *userdata _U_)
if (err_p != NULL)
{
g_free(stat_p);
- g_string_free(err_p, TRUE);
+ g_string_free(err_p, true);
exit(1);
}
diff --git a/ui/cli/tap-hosts.c b/ui/cli/tap-hosts.c
index c854e9e911..cb5bf57c5c 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 = false;
+static bool dump_v6 = false;
#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);
@@ -122,7 +122,7 @@ hosts_init(const char *opt_arg, void *userdata _U_)
/* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register " TAP_NAME " tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c
index 7a5e593e4c..08c6a14839 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");
}
@@ -261,7 +261,7 @@ httpstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp);
cmdarg_err("Couldn't register http,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-icmpstat.c b/ui/cli/tap-icmpstat.c
index ac0f642329..820fb1bf36 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(gconstpointer a, gconstpointer 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);
@@ -294,7 +294,7 @@ icmpstat_init(const char *opt_arg, void *userdata _U_)
g_free(icmpstat);
cmdarg_err("Couldn't register icmp,srt tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-icmpv6stat.c b/ui/cli/tap-icmpv6stat.c
index 94f8692acb..ca95d22c1f 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(gconstpointer a, gconstpointer 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);
@@ -294,7 +294,7 @@ icmpv6stat_init(const char *opt_arg, void *userdata _U_)
g_free(icmpv6stat);
cmdarg_err("Couldn't register icmpv6,srt tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index 83810b2333..d322261f42 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -50,34 +50,34 @@ 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 */
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 */
} 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)*/
+ uint64_t start_time; /* Time since start of capture (us)*/
int calc_type; /* The statistic type */
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) */
+ uint64_t counter; /* The accumulated data for the calculation of that statistic */
+ 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 +85,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 +97,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;
@@ -151,7 +151,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_SUM:
gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
if (gp) {
- guint64 val;
+ uint64_t val;
for (i=0; i<gp->len; i++) {
switch (proto_registrar_get_ftype(it->hf_index)) {
@@ -177,18 +177,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:
@@ -205,9 +205,9 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_MIN:
gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
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);
for (i=0; i<gp->len; i++) {
@@ -235,7 +235,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 +244,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 +262,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;
}
@@ -281,9 +281,9 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_MAX:
gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
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);
for (i=0; i<gp->len; i++) {
@@ -309,7 +309,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 +317,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 +332,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;
@@ -350,7 +350,7 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
case CALC_TYPE_AVG:
gp = proto_get_finfo_ptr_array(edt->tree, it->hf_index);
if (gp) {
- guint64 val;
+ uint64_t val;
ftype = proto_registrar_get_ftype(it->hf_index);
for (i=0; i<gp->len; i++) {
@@ -385,14 +385,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:
@@ -416,18 +416,18 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
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;
}
@@ -466,11 +466,11 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
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] =
@@ -490,15 +490,15 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
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 +511,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 +553,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 +562,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 +575,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 +585,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 +628,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). */
@@ -723,7 +723,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 +808,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 +819,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 +850,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);
@@ -985,7 +985,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 +996,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 +1087,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:
@@ -1137,10 +1137,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);
@@ -1161,13 +1161,13 @@ 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;
@@ -1179,11 +1179,11 @@ iostat_draw(void *arg)
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 +1196,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)
@@ -1379,7 +1379,7 @@ register_io_tap(io_stat_t *io, unsigned int i, const char *filter)
g_free(io);
fprintf(stderr, "\ntshark: Couldn't register io,stat tap: %s\n",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
@@ -1387,11 +1387,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 +1427,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 +1450,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, ",");
@@ -1487,8 +1487,8 @@ 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->max_vals = g_new(uint64_t, io->num_cols);
+ io->max_frame = g_new(uint32_t, io->num_cols);
for (i=0; i<io->num_cols; i++) {
io->max_vals[i] = 0;
@@ -1499,23 +1499,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 742f984c96..fe6b97e8d5 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"
@@ -247,7 +247,7 @@ void init_iousers(struct register_ct *ct, const char *filter)
g_free(iu);
cmdarg_err("Couldn't register conversations tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-macltestat.c b/ui/cli/tap-macltestat.c
index 25dfbe4fbf..8b1b9bd686 100644
--- a/ui/cli/tap-macltestat.c
+++ b/ui/cli/tap-macltestat.c
@@ -45,7 +45,7 @@ enum {
};
-static const gchar *ue_titles[] = { "RAT", " 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 ReTX"};
@@ -54,30 +54,30 @@ static const gchar *ue_titles[] = { "RAT", " RNTI", " Type", "UEId",
typedef struct mac_lte_nr_row_data {
/* Key for matching this row */
uint8_t rat;
- guint16 rnti;
- guint8 rnti_type;
- guint16 ueid;
+ 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_retx_frames;
+ uint32_t DL_CRC_failures;
+ uint32_t DL_retx_frames;
} mac_lte_nr_row_data;
@@ -91,18 +91,18 @@ typedef struct mac_lte_ep {
/* 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;
@@ -112,10 +112,10 @@ typedef struct mac_lte_nr_stat_t {
mac_lte_common_stats common_stats;
/* Keep track of unique rntis & ueids. N.B. only used for counting number of UEs - not for lookup */
- guint8 used_ueids[65535];
- guint8 used_rntis[65535];
- guint16 number_of_ueids;
- guint16 number_of_rntis;
+ 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;
@@ -187,7 +187,7 @@ static mac_lte_ep_t *alloc_mac_lte_ep(const struct mac_3gpp_tap_info *si, packet
/* Update counts of unique rntis & ueids */
-static void update_ueid_rnti_counts(guint16 rnti, guint16 ueid, mac_lte_nr_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! */
@@ -195,11 +195,11 @@ static void update_ueid_rnti_counts(guint16 rnti, guint16 ueid, mac_lte_nr_stat_
}
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++;
}
}
@@ -385,7 +385,7 @@ 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) {
@@ -410,8 +410,8 @@ 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_nr_stat_t *hs = (mac_lte_nr_stat_t*)phs;
@@ -511,7 +511,7 @@ static void mac_lte_stat_init(const char *opt_arg, void *userdata _U_)
mac_lte_stat_draw,
NULL);
if (error_string) {
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
g_free(hs);
exit(1);
}
diff --git a/ui/cli/tap-protocolinfo.c b/ui/cli/tap-protocolinfo.c
index ea47ae52d2..6c99284022 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;
/*
@@ -113,7 +113,7 @@ protocolinfo_init(const char *opt_arg, void *userdata _U_)
/* error, we failed to attach to the tap. complain and clean up */
cmdarg_err("Couldn't register proto,colinfo tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
g_free(rs->filter);
g_free(rs);
diff --git a/ui/cli/tap-protohierstat.c b/ui/cli/tap-protohierstat.c
index 2628fdcf3c..fabfd49e3a 100644
--- a/ui/cli/tap-protohierstat.c
+++ b/ui/cli/tap-protohierstat.c
@@ -210,7 +210,7 @@ protohierstat_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register io,phs tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-protohierstat.h b/ui/cli/tap-protohierstat.h
index 3a68ff18c7..da2a9ca33f 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 9eea09f700..02cc98a2c6 100644
--- a/ui/cli/tap-rlcltestat.c
+++ b/ui/cli/tap-rlcltestat.c
@@ -43,7 +43,7 @@ enum {
NUM_UE_COLUMNS
};
-static const gchar *ue_titles[] = { "RAT", " 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"};
@@ -51,35 +51,35 @@ static const gchar *ue_titles[] = { "RAT", " UEId",
typedef struct rlc_lte_row_data {
/* Key for matching this row */
uint8_t rat;
- guint16 ueid;
+ 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 (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;
@@ -93,7 +93,7 @@ typedef struct rlc_lte_ep {
/* 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;
@@ -276,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) {
@@ -301,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;
@@ -391,7 +391,7 @@ static void rlc_lte_stat_init(const char *opt_arg, void *userdata _U_)
rlc_lte_stat_draw,
NULL);
if (error_string) {
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
g_free(hs);
exit(1);
}
diff --git a/ui/cli/tap-rpcprogs.c b/ui/cli/tap-rpcprogs.c
index e64c93bc05..cf627f2d3d 100644
--- a/ui/cli/tap-rpcprogs.c
+++ b/ui/cli/tap-rpcprogs.c
@@ -35,8 +35,8 @@ 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;
@@ -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);
@@ -212,7 +212,7 @@ rpcprogs_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) {
cmdarg_err("Couldn't register rpc,programs tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-rtd.c b/ui/cli/tap-rtd.c
index ad56c4c5f2..38b68029c2 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");
@@ -106,7 +106,7 @@ init_rtd_tables(register_rtd_t* rtd, const char *filter)
if (error_string) {
free_rtd_table(&ui->rtd.stat_table);
cmdarg_err("Couldn't register srt tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
@@ -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 b7937cd0d1..ab68ed7fc9 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 a42be6067e..b24cd84fab 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");
}
@@ -253,7 +253,7 @@ rtspstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp);
cmdarg_err("Couldn't register rtsp,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-sctpchunkstat.c b/ui/cli/tap-sctpchunkstat.c
index 21e081eb65..40abd2205d 100644
--- a/ui/cli/tap-sctpchunkstat.c
+++ b/ui/cli/tap-sctpchunkstat.c
@@ -32,16 +32,16 @@ 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;
@@ -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);
@@ -209,7 +209,7 @@ sctpstat_init(const char *opt_arg, void *userdata _U_)
cmdarg_err("Couldn't register sctp,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-simple_stattable.c b/ui/cli/tap-simple_stattable.c
index cca343209d..ef8264c2a2 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");
@@ -115,7 +115,7 @@ init_stat_table(stat_tap_table_ui *stat_tap, const char *filter)
if (error_string) {
/* free_rtd_table(&ui->rtd.stat_table); */
cmdarg_err("Couldn't register tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
@@ -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 92d1463d2d..d6db04c2e6 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");
}
@@ -332,7 +332,7 @@ sipstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp);
cmdarg_err("Couldn't register sip,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
diff --git a/ui/cli/tap-smbsids.c b/ui/cli/tap-smbsids.c
index f92037c99f..2742561789 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);
}
@@ -72,7 +72,7 @@ smbsids_init(const char *opt_arg _U_, void *userdata _U_)
if (error_string) {
cmdarg_err("Couldn't register smb,sids tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-srt.c b/ui/cli/tap-srt.c
index 62cef3af64..09107f1926 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;
}
}
}
@@ -127,7 +127,7 @@ init_srt_tables(register_srt_t* srt, const char *filter)
free_srt_table(srt, global_srt_array);
g_free(ui);
cmdarg_err("Couldn't register srt tap: %s", error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
@@ -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 71a18bcf0b..0aa5ebacb1 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
@@ -45,7 +45,7 @@ draw_stats_tree(void *psp)
stats_tree_is_default_sort_DESC(st));
printf("%s", s->str);
- g_string_free(s, TRUE);
+ g_string_free(s, true);
}
static void
@@ -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-sv.c b/ui/cli/tap-sv.c
index d724c0d4eb..b2bbdbf8e8 100644
--- a/ui/cli/tap-sv.c
+++ b/ui/cli/tap-sv.c
@@ -61,7 +61,7 @@ svstat_init(const char *opt_arg _U_, void *userdata _U_)
/* error, we failed to attach to the tap. clean up */
cmdarg_err("Couldn't register sv,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}
diff --git a/ui/cli/tap-voip.h b/ui/cli/tap-voip.h
index 45c436f5ba..6d02c2609a 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 89daed3171..27a9538b8c 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;
@@ -259,7 +259,7 @@ wspstat_init(const char *opt_arg, void *userdata _U_)
g_free(sp);
cmdarg_err("Couldn't register wsp,stat tap: %s",
error_string->str);
- g_string_free(error_string, TRUE);
+ g_string_free(error_string, true);
exit(1);
}
}