summaryrefslogtreecommitdiffstats
path: root/plugins/epan/mate/mate_setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/epan/mate/mate_setup.c')
-rw-r--r--plugins/epan/mate/mate_setup.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/plugins/epan/mate/mate_setup.c b/plugins/epan/mate/mate_setup.c
index eef97643..03ad1543 100644
--- a/plugins/epan/mate/mate_setup.c
+++ b/plugins/epan/mate/mate_setup.c
@@ -15,8 +15,8 @@
#include "mate.h"
/* appends the formatted string to the current error log */
-static void report_error(mate_config* mc, const gchar* fmt, ...) {
- static gchar error_buffer[DEBUG_BUFFER_SIZE];
+static void report_error(mate_config* mc, const char* fmt, ...) {
+ static char error_buffer[DEBUG_BUFFER_SIZE];
va_list list;
@@ -32,7 +32,7 @@ static void report_error(mate_config* mc, const gchar* fmt, ...) {
/* creates a blank pdu config
is going to be called only by the grammar
which will set all those elements that aren't set here */
-extern mate_cfg_pdu* new_pducfg(mate_config* mc, gchar* name) {
+extern mate_cfg_pdu* new_pducfg(mate_config* mc, char* name) {
mate_cfg_pdu* cfg = g_new(mate_cfg_pdu, 1);
cfg->name = g_strdup(name);
@@ -55,15 +55,15 @@ extern mate_cfg_pdu* new_pducfg(mate_config* mc, gchar* name) {
cfg->criterium_match_mode = AVPL_NO_MATCH;
cfg->criterium_accept_mode = ACCEPT_MODE;
- g_ptr_array_add(mc->pducfglist,(gpointer) cfg);
- g_hash_table_insert(mc->pducfgs,(gpointer) cfg->name,(gpointer) cfg);
+ g_ptr_array_add(mc->pducfglist,(void *) cfg);
+ g_hash_table_insert(mc->pducfgs,(void *) cfg->name,(void *) cfg);
cfg->hfids_attr = g_hash_table_new(g_int_hash,g_int_equal);
return cfg;
}
-extern mate_cfg_gop* new_gopcfg(mate_config* mc, gchar* name) {
+extern mate_cfg_gop* new_gopcfg(mate_config* mc, char* name) {
mate_cfg_gop* cfg = g_new(mate_cfg_gop, 1);
cfg->name = g_strdup(name);
@@ -93,12 +93,12 @@ extern mate_cfg_gop* new_gopcfg(mate_config* mc, gchar* name) {
cfg->gop_index = g_hash_table_new(g_str_hash,g_str_equal);
cfg->gog_index = g_hash_table_new(g_str_hash,g_str_equal);
- g_hash_table_insert(mc->gopcfgs,(gpointer) cfg->name, (gpointer) cfg);
+ g_hash_table_insert(mc->gopcfgs,(void *) cfg->name, (void *) cfg);
return cfg;
}
-extern mate_cfg_gog* new_gogcfg(mate_config* mc, gchar* name) {
+extern mate_cfg_gog* new_gogcfg(mate_config* mc, char* name) {
mate_cfg_gog* cfg = g_new(mate_cfg_gog, 1);
cfg->name = g_strdup(name);
@@ -127,16 +127,16 @@ extern mate_cfg_gog* new_gogcfg(mate_config* mc, gchar* name) {
cfg->hfid_stop_time = -1;
cfg->hfid_last_time = -1;
- g_hash_table_insert(mc->gogcfgs,(gpointer) cfg->name, (gpointer) cfg);
+ g_hash_table_insert(mc->gogcfgs,(void *) cfg->name, (void *) cfg);
return cfg;
}
-extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, GHashTable* where) {
+extern bool add_hfid(mate_config* mc, header_field_info* hfi, char* how, GHashTable* where) {
header_field_info* first_hfi = NULL;
- gboolean exists = FALSE;
- gchar* as;
- gchar* h;
+ bool exists = false;
+ char* as;
+ char* h;
int* ip;
while(hfi) {
@@ -147,18 +147,18 @@ extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, G
hfi = first_hfi;
while (hfi) {
- exists = TRUE;
+ exists = true;
ip = g_new(int, 1);
*ip = hfi->id;
- if (( as = (gchar *)g_hash_table_lookup(where,ip) )) {
+ if (( as = (char *)g_hash_table_lookup(where,ip) )) {
g_free(ip);
if (! g_str_equal(as,how)) {
report_error(mc,
"MATE Error: add field to Pdu: attempt to add %s(%i) as %s"
" failed: field already added as '%s'",hfi->abbrev,hfi->id,how,as);
- return FALSE;
+ return false;
}
} else {
h = g_strdup(how);
@@ -177,11 +177,11 @@ extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, G
#if 0
/*
- * XXX - where is this suposed to be used?
+ * XXX - where is this supposed to be used?
*/
-extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) {
- gchar** ranges;
- guint i;
+extern char* add_ranges(mate_config* mc, char* range,GPtrArray* range_ptr_arr) {
+ char** ranges;
+ unsigned i;
header_field_info* hfi;
int* hfidp;
@@ -193,7 +193,7 @@ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr)
if (hfi) {
hfidp = g_new(int, 1);
*hfidp = hfi->id;
- g_ptr_array_add(range_ptr_arr,(gpointer)hfidp);
+ g_ptr_array_add(range_ptr_arr,(void *)hfidp);
} else {
g_strfreev(ranges);
return ws_strdup_printf("no such proto: '%s'",ranges[i]);
@@ -207,7 +207,7 @@ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr)
}
#endif
-static void new_attr_hfri(mate_config* mc, gchar* item_name, GHashTable* hfids, gchar* name) {
+static void new_attr_hfri(mate_config* mc, char* item_name, GHashTable* hfids, char* name) {
int* p_id = g_new(int, 1);
hf_register_info hfri;
@@ -233,11 +233,11 @@ typedef struct {
mate_cfg_pdu* cfg;
} analyze_pdu_hfids_arg;
-static void analyze_pdu_hfids(gpointer k, gpointer v, gpointer p) {
+static void analyze_pdu_hfids(void *k, void *v, void *p) {
analyze_pdu_hfids_arg* argp = (analyze_pdu_hfids_arg*)p;
mate_config* mc = argp->mc;
mate_cfg_pdu* cfg = argp->cfg;
- new_attr_hfri(mc, cfg->name,cfg->my_hfids,(gchar*) v);
+ new_attr_hfri(mc, cfg->name,cfg->my_hfids,(char*) v);
/*
* Add this hfid to our table of wanted hfids.
@@ -246,8 +246,8 @@ static void analyze_pdu_hfids(gpointer k, gpointer v, gpointer p) {
mc->num_fields_wanted++;
}
-static void analyze_transform_hfrs(mate_config* mc, gchar* name, GPtrArray* transforms, GHashTable* hfids) {
- guint i;
+static void analyze_transform_hfrs(mate_config* mc, char* name, GPtrArray* transforms, GHashTable* hfids) {
+ unsigned i;
void* cookie = NULL;
AVPL_Transf* t;
AVP* avp;
@@ -266,7 +266,7 @@ static void analyze_transform_hfrs(mate_config* mc, gchar* name, GPtrArray* tran
static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
- gint* ett;
+ int* ett;
analyze_pdu_hfids_arg arg;
hfri.p_id = &(cfg->hfid);
@@ -281,7 +281,7 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
hfri.p_id = &(cfg->hfid_pdu_rel_time);
hfri.hfinfo.name = ws_strdup_printf("%s time",cfg->name);
hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.RelativeTime",cfg->name);
- hfri.hfinfo.type = FT_FLOAT;
+ hfri.hfinfo.type = FT_DOUBLE;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = "Seconds passed since the start of capture";
@@ -290,7 +290,7 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
hfri.p_id = &(cfg->hfid_pdu_time_in_gop);
hfri.hfinfo.name = ws_strdup_printf("%s time since beginning of Gop",cfg->name);
hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.TimeInGop",cfg->name);
- hfri.hfinfo.type = FT_FLOAT;
+ hfri.hfinfo.type = FT_DOUBLE;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = "Seconds passed since the start of the GOP";
@@ -301,7 +301,7 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
g_hash_table_foreach(cfg->hfids_attr,analyze_pdu_hfids,&arg);
/* Add the hfids of transport protocols as wanted hfids */
- for (guint i = 0; i < cfg->transport_ranges->len; i++) {
+ for (unsigned i = 0; i < cfg->transport_ranges->len; i++) {
int hfid = *((int*)g_ptr_array_index(cfg->transport_ranges,i));
mc->wanted_hfids = g_array_append_val(mc->wanted_hfids, hfid);
mc->num_fields_wanted++;
@@ -316,12 +316,12 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids);
}
-static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) {
+static void analyze_gop_config(void *k _U_, void *v, void *p) {
mate_config* mc = (mate_config*)p;
mate_cfg_gop* cfg = (mate_cfg_gop *)v;
void* cookie = NULL;
AVP* avp;
- gint* ett;
+ int* ett;
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
hfri.p_id = &(cfg->hfid);
@@ -336,7 +336,7 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) {
hfri.p_id = &(cfg->hfid_start_time);
hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name);
hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name);
- hfri.hfinfo.type = FT_FLOAT;
+ hfri.hfinfo.type = FT_DOUBLE;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name);
@@ -429,7 +429,7 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) {
g_hash_table_insert(mc->gops_by_pduname,cfg->name,cfg);
}
-static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
+static void analyze_gog_config(void *k _U_, void *v, void *p) {
mate_config* mc = (mate_config*)p;
mate_cfg_gog* cfg = (mate_cfg_gog *)v;
void* avp_cookie;
@@ -440,7 +440,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
AVPL* key_avps;
LoAL* gog_keys = NULL;
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
- gint* ett;
+ int* ett;
/* create the hf array for this gog */
hfri.p_id = &(cfg->hfid);
@@ -482,7 +482,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
hfri.p_id = &(cfg->hfid_start_time);
hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name);
hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name);
- hfri.hfinfo.type = FT_FLOAT;
+ hfri.hfinfo.type = FT_DOUBLE;
hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name);
g_array_append_val(mc->hfrs,hfri);
@@ -516,7 +516,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
g_hash_table_insert(mc->gogs_by_gopname,gog_keys->name,gog_keys);
}
- gopkey_avpl = new_avpl_from_avpl(cfg->name, avpl, TRUE);
+ gopkey_avpl = new_avpl_from_avpl(cfg->name, avpl, true);
loal_append(gog_keys,gopkey_avpl);
avp_cookie = NULL;
@@ -538,7 +538,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
/* every key_avp ios an extra as well.
one day every Member will have its own extras */
- merge_avpl(cfg->extra,key_avps,TRUE);
+ merge_avpl(cfg->extra,key_avps,true);
analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids);
@@ -561,7 +561,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
}
static void analyze_config(mate_config* mc) {
- guint i;
+ unsigned i;
for (i=0; i < mc->pducfglist->len; i++) {
analyze_pdu_config(mc, (mate_cfg_pdu*) g_ptr_array_index(mc->pducfglist,i));
@@ -572,16 +572,16 @@ static void analyze_config(mate_config* mc) {
}
-extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
+extern mate_config* mate_make_config(const char* filename, int mate_hfid) {
mate_config* mc;
- gint* ett;
+ int* ett;
avp_init();
mc = g_new(mate_config, 1);
mc->hfid_mate = mate_hfid;
- mc->wanted_hfids = g_array_new(FALSE, FALSE, (guint)sizeof(int));
+ mc->wanted_hfids = g_array_new(false, false, (unsigned)sizeof(int));
mc->num_fields_wanted = 0;
mc->dbg_facility = NULL;
@@ -599,12 +599,12 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
mc->ett_root = -1;
- mc->hfrs = g_array_new(FALSE,FALSE,sizeof(hf_register_info));
- mc->ett = g_array_new(FALSE,FALSE,sizeof(gint*));
+ mc->hfrs = g_array_new(false,false,sizeof(hf_register_info));
+ mc->ett = g_array_new(false,false,sizeof(int*));
- mc->defaults.pdu.drop_unassigned = FALSE;
- mc->defaults.pdu.discard = FALSE;
- mc->defaults.pdu.last_extracted = FALSE;
+ mc->defaults.pdu.drop_unassigned = false;
+ mc->defaults.pdu.discard = false;
+ mc->defaults.pdu.last_extracted = false;
mc->defaults.pdu.match_mode = AVPL_STRICT;
mc->defaults.pdu.replace_mode = AVPL_INSERT;
@@ -613,12 +613,12 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
mc->defaults.gop.idle_timeout = -1.0f;
mc->defaults.gop.lifetime = -1.0f;
mc->defaults.gop.pdu_tree_mode = GOP_FRAME_TREE;
- mc->defaults.gop.show_times = TRUE;
- mc->defaults.gop.drop_unassigned = FALSE;
+ mc->defaults.gop.show_times = true;
+ mc->defaults.gop.drop_unassigned = false;
/* gog prefs */
mc->defaults.gog.expiration = 5.0f;
- mc->defaults.gog.show_times = TRUE;
+ mc->defaults.gog.show_times = true;
mc->defaults.gog.gop_tree_mode = GOP_BASIC_TREE;
/* what to dbgprint */
@@ -639,14 +639,14 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
"It is recommended that you fix your config and restart Wireshark.\n"
"The reported error is:\n%s\n",mc->config_error->str);
- /* if (mc) destroy_mate_config(mc,FALSE); */
+ /* if (mc) destroy_mate_config(mc,false); */
return NULL;
}
if (mc->num_fields_wanted == 0) {
/* We have no interest in any fields, so we have no
work to do. */
- /*destroy_mate_config(mc,FALSE);*/
+ /*destroy_mate_config(mc,false);*/
return NULL;
}