2004-12-11 01:00:17 +00:00
|
|
|
/* mate_setup.c
|
2018-04-30 19:55:30 +00:00
|
|
|
* MATE -- Meta Analysis Tracing Engine
|
|
|
|
*
|
|
|
|
* Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
#include "mate.h"
|
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
/* appends the formatted string to the current error log */
|
2017-04-17 01:22:48 +00:00
|
|
|
static void report_error(mate_config* mc, const gchar* fmt, ...) {
|
2005-05-16 13:28:35 +00:00
|
|
|
static gchar error_buffer[DEBUG_BUFFER_SIZE];
|
2005-01-10 02:37:19 +00:00
|
|
|
|
|
|
|
va_list list;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-01-10 02:37:19 +00:00
|
|
|
va_start( list, fmt );
|
|
|
|
g_vsnprintf(error_buffer,DEBUG_BUFFER_SIZE,fmt,list);
|
|
|
|
va_end( list );
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_string_append(mc->config_error,error_buffer);
|
|
|
|
g_string_append_c(mc->config_error,'\n');
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-01-10 02:37:19 +00:00
|
|
|
}
|
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
/* 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 */
|
2017-04-17 01:22:48 +00:00
|
|
|
extern mate_cfg_pdu* new_pducfg(mate_config* mc, gchar* name) {
|
2013-03-21 03:07:23 +00:00
|
|
|
mate_cfg_pdu* cfg = (mate_cfg_pdu *)g_malloc(sizeof(mate_cfg_pdu));
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->name = g_strdup(name);
|
|
|
|
cfg->last_id = 0;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal);
|
|
|
|
cfg->transforms = NULL;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid_pdu_rel_time = -1;
|
|
|
|
cfg->hfid_pdu_time_in_gop = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->ett = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
cfg->ett_attr = -1;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->criterium = NULL;
|
|
|
|
cfg->criterium_match_mode = AVPL_NO_MATCH;
|
|
|
|
cfg->criterium_accept_mode = ACCEPT_MODE;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_ptr_array_add(mc->pducfglist,(gpointer) cfg);
|
|
|
|
g_hash_table_insert(mc->pducfgs,(gpointer) cfg->name,(gpointer) cfg);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfids_attr = g_hash_table_new(g_int_hash,g_int_equal);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
return cfg;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
extern mate_cfg_gop* new_gopcfg(mate_config* mc, gchar* name) {
|
2013-03-21 03:07:23 +00:00
|
|
|
mate_cfg_gop* cfg = (mate_cfg_gop *)g_malloc(sizeof(mate_cfg_gop));
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->name = g_strdup(name);
|
|
|
|
cfg->last_id = 0;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal);
|
|
|
|
cfg->transforms = NULL;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->extra = new_avpl("extra");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->ett = -1;
|
|
|
|
cfg->ett_attr = -1;
|
|
|
|
cfg->ett_times = -1;
|
|
|
|
cfg->ett_children = -1;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid_start_time = -1;
|
|
|
|
cfg->hfid_stop_time = -1;
|
|
|
|
cfg->hfid_last_time = -1;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid_gop_pdu = -1;
|
|
|
|
cfg->hfid_gop_num_pdus = -1;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
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);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_hash_table_insert(mc->gopcfgs,(gpointer) cfg->name, (gpointer) cfg);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
return cfg;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
extern mate_cfg_gog* new_gogcfg(mate_config* mc, gchar* name) {
|
2013-03-21 03:07:23 +00:00
|
|
|
mate_cfg_gog* cfg = (mate_cfg_gog *)g_malloc(sizeof(mate_cfg_gop));
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->name = g_strdup(name);
|
|
|
|
cfg->last_id = 0;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal);
|
|
|
|
cfg->transforms = NULL;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->extra = new_avpl("extra");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
cfg->hfid = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->ett = -1;
|
|
|
|
cfg->ett_attr = -1;
|
|
|
|
cfg->ett_times = -1;
|
|
|
|
cfg->ett_children = -1;
|
|
|
|
cfg->ett_gog_gop = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid_gog_num_of_gops = -1;
|
|
|
|
cfg->hfid_gog_gop = -1;
|
|
|
|
cfg->hfid_gog_gopstart = -1;
|
2010-04-14 18:39:00 +00:00
|
|
|
cfg->hfid_gog_gopstop = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->hfid_start_time = -1;
|
|
|
|
cfg->hfid_stop_time = -1;
|
|
|
|
cfg->hfid_last_time = -1;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_hash_table_insert(mc->gogcfgs,(gpointer) cfg->name, (gpointer) cfg);
|
2005-01-07 18:07:18 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
return cfg;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, GHashTable* where) {
|
2004-12-11 01:00:17 +00:00
|
|
|
header_field_info* first_hfi = NULL;
|
|
|
|
gboolean exists = FALSE;
|
2005-05-16 13:28:35 +00:00
|
|
|
gchar* as;
|
|
|
|
gchar* h;
|
2004-12-11 01:00:17 +00:00
|
|
|
int* ip;
|
|
|
|
|
|
|
|
while(hfi) {
|
|
|
|
first_hfi = hfi;
|
2013-08-06 20:53:47 +00:00
|
|
|
hfi = (hfi->same_name_prev_id != -1) ? proto_registrar_get_nth(hfi->same_name_prev_id) : NULL;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hfi = first_hfi;
|
|
|
|
|
|
|
|
while (hfi) {
|
|
|
|
exists = TRUE;
|
2013-03-21 03:07:23 +00:00
|
|
|
ip = (int *)g_malloc(sizeof(int));
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
*ip = hfi->id;
|
|
|
|
|
2013-03-21 03:07:23 +00:00
|
|
|
if (( as = (gchar *)g_hash_table_lookup(where,ip) )) {
|
2004-12-11 01:00:17 +00:00
|
|
|
g_free(ip);
|
|
|
|
if (! g_str_equal(as,how)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
report_error(mc,
|
2017-04-17 01:18:11 +00:00
|
|
|
"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);
|
2004-12-11 01:00:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
h = g_strdup(how);
|
|
|
|
g_hash_table_insert(where,ip,h);
|
|
|
|
}
|
|
|
|
|
|
|
|
hfi = hfi->same_name_next;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! exists) {
|
2017-04-17 01:22:48 +00:00
|
|
|
report_error(mc, "MATE Error: cannot find field for attribute %s",how);
|
2011-01-30 22:57:00 +00:00
|
|
|
}
|
2004-12-11 01:00:17 +00:00
|
|
|
return exists;
|
|
|
|
}
|
|
|
|
|
2017-04-12 02:53:48 +00:00
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* XXX - where is this suposed to be used?
|
|
|
|
*/
|
2017-04-17 01:22:48 +00:00
|
|
|
extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) {
|
2005-02-18 22:33:16 +00:00
|
|
|
gchar** ranges;
|
|
|
|
guint i;
|
|
|
|
header_field_info* hfi;
|
|
|
|
int* hfidp;
|
|
|
|
|
|
|
|
ranges = g_strsplit(range,"/",0);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-02-18 22:33:16 +00:00
|
|
|
if (ranges) {
|
|
|
|
for (i=0; ranges[i]; i++) {
|
|
|
|
hfi = proto_registrar_get_byname(ranges[i]);
|
|
|
|
if (hfi) {
|
2013-03-21 03:07:23 +00:00
|
|
|
hfidp = (int *)g_malloc(sizeof(int));
|
2005-02-18 22:33:16 +00:00
|
|
|
*hfidp = hfi->id;
|
|
|
|
g_ptr_array_add(range_ptr_arr,(gpointer)hfidp);
|
|
|
|
} else {
|
|
|
|
g_strfreev(ranges);
|
2012-04-13 20:22:31 +00:00
|
|
|
return g_strdup_printf("no such proto: '%s'",ranges[i]);
|
2005-02-18 22:33:16 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-02-18 22:33:16 +00:00
|
|
|
g_strfreev(ranges);
|
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2017-04-12 02:53:48 +00:00
|
|
|
#endif
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
static void new_attr_hfri(mate_config* mc, gchar* item_name, GHashTable* hfids, gchar* name) {
|
2013-03-21 03:07:23 +00:00
|
|
|
int* p_id = (int *)g_malloc(sizeof(int));
|
2005-02-04 00:22:00 +00:00
|
|
|
hf_register_info hfri;
|
|
|
|
|
2005-02-04 10:32:28 +00:00
|
|
|
memset(&hfri, 0, sizeof hfri);
|
2010-04-14 18:39:00 +00:00
|
|
|
*p_id = -1;
|
2005-02-04 00:22:00 +00:00
|
|
|
hfri.p_id = p_id;
|
2009-03-27 14:46:54 +00:00
|
|
|
hfri.hfinfo.name = g_strdup(name);
|
2005-05-16 13:28:35 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.%s",item_name,name);
|
2005-02-04 00:22:00 +00:00
|
|
|
hfri.hfinfo.type = FT_STRING;
|
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
|
|
|
hfri.hfinfo.strings = NULL;
|
|
|
|
hfri.hfinfo.bitmask = 0;
|
2005-05-16 13:28:35 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("%s attribute of %s",name,item_name);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
*p_id = -1;
|
2005-05-16 13:28:35 +00:00
|
|
|
g_hash_table_insert(hfids,name,p_id);
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-04-17 01:18:11 +00:00
|
|
|
typedef struct {
|
2017-04-17 01:22:48 +00:00
|
|
|
mate_config* mc;
|
2017-04-17 01:18:11 +00:00
|
|
|
mate_cfg_pdu* cfg;
|
|
|
|
} analyze_pdu_hfids_arg;
|
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
static void analyze_pdu_hfids(gpointer k, gpointer v, gpointer p) {
|
2017-04-17 01:18:11 +00:00
|
|
|
analyze_pdu_hfids_arg* argp = (analyze_pdu_hfids_arg*)p;
|
2017-04-17 01:22:48 +00:00
|
|
|
mate_config* mc = argp->mc;
|
2017-04-17 01:18:11 +00:00
|
|
|
mate_cfg_pdu* cfg = argp->cfg;
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,(gchar*) v);
|
2005-05-16 13:28:35 +00:00
|
|
|
|
2017-04-12 02:53:48 +00:00
|
|
|
/*
|
2017-04-17 01:29:26 +00:00
|
|
|
* Add this hfid to our table of wanted hfids.
|
2017-04-12 02:53:48 +00:00
|
|
|
*/
|
2017-04-17 01:29:26 +00:00
|
|
|
mc->wanted_hfids = g_array_append_val(mc->wanted_hfids, *(int *)k);
|
2017-04-17 02:37:00 +00:00
|
|
|
mc->num_fields_wanted++;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
static void analyze_transform_hfrs(mate_config* mc, gchar* name, GPtrArray* transforms, GHashTable* hfids) {
|
2004-12-11 01:00:17 +00:00
|
|
|
guint i;
|
|
|
|
void* cookie = NULL;
|
|
|
|
AVPL_Transf* t;
|
|
|
|
AVP* avp;
|
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
for (i=0; i < transforms->len;i++) {
|
2013-03-21 03:07:23 +00:00
|
|
|
for (t = (AVPL_Transf *)g_ptr_array_index(transforms,i); t; t=t->next ) {
|
2004-12-11 01:00:17 +00:00
|
|
|
cookie = NULL;
|
|
|
|
while(( avp = get_next_avp(t->replace,&cookie) )) {
|
2005-05-16 13:28:35 +00:00
|
|
|
if (! g_hash_table_lookup(hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, name,hfids,avp->n);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) {
|
2004-12-11 01:00:17 +00:00
|
|
|
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
|
2004-12-16 19:36:23 +00:00
|
|
|
gint* ett;
|
2017-04-17 01:18:11 +00:00
|
|
|
analyze_pdu_hfids_arg arg;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
hfri.p_id = &(cfg->hfid);
|
2009-03-27 14:46:54 +00:00
|
|
|
hfri.hfinfo.name = g_strdup(cfg->name);
|
2004-12-12 23:40:44 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name);
|
2004-12-12 16:58:59 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("%s id",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
|
|
|
hfri.hfinfo.display = BASE_DEC;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_pdu_rel_time);
|
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s time",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.RelativeTime",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FLOAT;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2004-12-23 08:27:30 +00:00
|
|
|
hfri.hfinfo.blurb = "Seconds passed since the start of capture";
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-23 08:27:30 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_pdu_time_in_gop);
|
2006-01-05 13:01:08 +00:00
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s time since beginning of Gop",cfg->name);
|
2004-12-23 08:27:30 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.TimeInGop",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FLOAT;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2004-12-23 08:27:30 +00:00
|
|
|
hfri.hfinfo.blurb = "Seconds passed since the start of the GOP";
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
arg.mc = mc;
|
2017-04-17 01:18:11 +00:00
|
|
|
arg.cfg = cfg;
|
|
|
|
g_hash_table_foreach(cfg->hfids_attr,analyze_pdu_hfids,&arg);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2018-10-20 08:56:59 +00:00
|
|
|
/* Add the hfids of transport protocols as wanted hfids */
|
|
|
|
for (guint 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++;
|
|
|
|
}
|
|
|
|
|
2004-12-16 19:36:23 +00:00
|
|
|
ett = &cfg->ett;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_attr;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:18:11 +00:00
|
|
|
static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) {
|
2017-04-17 01:22:48 +00:00
|
|
|
mate_config* mc = (mate_config*)p;
|
2013-03-21 03:07:23 +00:00
|
|
|
mate_cfg_gop* cfg = (mate_cfg_gop *)v;
|
2004-12-11 01:00:17 +00:00
|
|
|
void* cookie = NULL;
|
|
|
|
AVP* avp;
|
2004-12-16 19:36:23 +00:00
|
|
|
gint* ett;
|
2004-12-11 01:00:17 +00:00
|
|
|
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
|
|
|
|
|
|
|
|
hfri.p_id = &(cfg->hfid);
|
2009-03-27 14:46:54 +00:00
|
|
|
hfri.hfinfo.name = g_strdup(cfg->name);
|
2004-12-12 23:40:44 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name);
|
2004-12-12 16:58:59 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("%s id",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
|
|
|
hfri.hfinfo.display = BASE_DEC;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_start_time);
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s start time",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FLOAT;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2006-01-05 13:01:08 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_stop_time);
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s hold time",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Time",cfg->name);
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Duration in seconds from start to stop of this %s",cfg->name);
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_last_time);
|
2004-12-23 08:27:30 +00:00
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s duration",cfg->name);
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name);
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name);
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
hfri.p_id = &(cfg->hfid_gop_num_pdus);
|
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s number of PDUs",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfPdus",cfg->name);
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Number of PDUs assigned to this %s",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_DEC;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
hfri.p_id = &(cfg->hfid_gop_pdu);
|
|
|
|
hfri.hfinfo.name = g_strdup_printf("A PDU of %s",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Pdu",cfg->name);
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("A PDU assigned to this %s",cfg->name);
|
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
if (cfg->pdu_tree_mode == GOP_FRAME_TREE) {
|
2005-01-06 12:39:54 +00:00
|
|
|
hfri.hfinfo.type = FT_FRAMENUM;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2005-05-16 13:28:35 +00:00
|
|
|
} else if (cfg->pdu_tree_mode == GOP_PDU_TREE) {
|
2005-01-06 12:39:54 +00:00
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2005-01-06 12:39:54 +00:00
|
|
|
} else {
|
2005-05-16 13:28:35 +00:00
|
|
|
cfg->pdu_tree_mode = GOP_NO_TREE;
|
2005-01-06 12:39:54 +00:00
|
|
|
}
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
while(( avp = get_next_avp(cfg->key,&cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-06 20:37:02 +00:00
|
|
|
if(cfg->start) {
|
|
|
|
cookie = NULL;
|
|
|
|
while(( avp = get_next_avp(cfg->start,&cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2005-02-06 20:37:02 +00:00
|
|
|
}
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-01-06 12:39:54 +00:00
|
|
|
if (cfg->stop) {
|
|
|
|
cookie = NULL;
|
|
|
|
while(( avp = get_next_avp(cfg->stop,&cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2005-01-06 12:39:54 +00:00
|
|
|
}
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
cookie = NULL;
|
|
|
|
while(( avp = get_next_avp(cfg->extra,&cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_attr;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_times;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_children;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_hash_table_insert(mc->gops_by_pduname,cfg->name,cfg);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:18:11 +00:00
|
|
|
static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) {
|
2017-04-17 01:22:48 +00:00
|
|
|
mate_config* mc = (mate_config*)p;
|
2013-03-21 03:07:23 +00:00
|
|
|
mate_cfg_gog* cfg = (mate_cfg_gog *)v;
|
2004-12-11 01:00:17 +00:00
|
|
|
void* avp_cookie;
|
|
|
|
void* avpl_cookie;
|
|
|
|
AVP* avp;
|
|
|
|
AVPL* avpl;
|
2005-05-22 00:44:34 +00:00
|
|
|
AVPL* gopkey_avpl;
|
2004-12-31 14:27:38 +00:00
|
|
|
AVPL* key_avps;
|
2005-05-22 00:44:34 +00:00
|
|
|
LoAL* gog_keys = NULL;
|
2004-12-11 01:00:17 +00:00
|
|
|
hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}};
|
2004-12-16 19:36:23 +00:00
|
|
|
gint* ett;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-22 00:44:34 +00:00
|
|
|
/* create the hf array for this gog */
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.p_id = &(cfg->hfid);
|
2009-03-27 14:46:54 +00:00
|
|
|
hfri.hfinfo.name = g_strdup(cfg->name);
|
2004-12-12 23:40:44 +00:00
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name);
|
2004-12-12 16:58:59 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("%s Id",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
|
|
|
hfri.hfinfo.display = BASE_DEC;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_gog_num_of_gops);
|
|
|
|
hfri.hfinfo.name = "number of GOPs";
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfGops",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_UINT32;
|
|
|
|
hfri.hfinfo.display = BASE_DEC;
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Number of GOPs assigned to this %s",cfg->name);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-02-18 20:02:40 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_gog_gopstart);
|
|
|
|
hfri.hfinfo.name = "GopStart frame";
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.GopStart",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FRAMENUM;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2005-02-18 20:02:40 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup("The start frame of a GOP");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-02-20 02:21:04 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_gog_gopstop);
|
|
|
|
hfri.hfinfo.name = "GopStop frame";
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.GopStop",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FRAMENUM;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2005-02-20 02:21:04 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup("The stop frame of a GOP");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_start_time);
|
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s start time",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_FLOAT;
|
2006-01-05 13:01:08 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_last_time);
|
|
|
|
hfri.hfinfo.name = g_strdup_printf("%s duration",cfg->name);
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name);
|
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
/* this might become mate.gogname.gopname */
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.p_id = &(cfg->hfid_gog_gop);
|
|
|
|
hfri.hfinfo.name = "a GOP";
|
|
|
|
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Gop",cfg->name);
|
|
|
|
hfri.hfinfo.type = FT_STRING;
|
2010-04-14 14:20:16 +00:00
|
|
|
hfri.hfinfo.display = BASE_NONE;
|
2004-12-11 01:00:17 +00:00
|
|
|
hfri.hfinfo.blurb = g_strdup_printf("a GOPs assigned to this %s",cfg->name);
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->hfrs,hfri);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2005-05-22 00:44:34 +00:00
|
|
|
/* index the keys of gog for every gop
|
|
|
|
and insert the avps of the keys to the hfarray */
|
2004-12-31 14:27:38 +00:00
|
|
|
key_avps = new_avpl("");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
avpl_cookie = NULL;
|
|
|
|
while (( avpl = get_next_avpl(cfg->keys,&avpl_cookie) )) {
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
if (! ( gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,avpl->name))) {
|
2005-05-22 00:44:34 +00:00
|
|
|
gog_keys = new_loal(avpl->name);
|
2017-04-17 01:22:48 +00:00
|
|
|
g_hash_table_insert(mc->gogs_by_gopname,gog_keys->name,gog_keys);
|
2005-05-22 00:44:34 +00:00
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-22 00:44:34 +00:00
|
|
|
gopkey_avpl = new_avpl_from_avpl(cfg->name, avpl, TRUE);
|
|
|
|
loal_append(gog_keys,gopkey_avpl);
|
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
avp_cookie = NULL;
|
|
|
|
while (( avp = get_next_avp(avpl,&avp_cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2004-12-31 14:27:38 +00:00
|
|
|
insert_avp(key_avps,avp);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-22 00:44:34 +00:00
|
|
|
/* insert the extra avps to the hfarray */
|
2004-12-11 01:00:17 +00:00
|
|
|
avp_cookie = NULL;
|
|
|
|
while (( avp = get_next_avp(cfg->extra,&avp_cookie) )) {
|
|
|
|
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
|
2017-04-17 01:22:48 +00:00
|
|
|
new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n);
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2005-05-22 00:44:34 +00:00
|
|
|
/* every key_avp ios an extra as well.
|
|
|
|
one day every Member will have its own extras */
|
2004-12-31 14:27:38 +00:00
|
|
|
merge_avpl(cfg->extra,key_avps,TRUE);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_attr;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_children;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2004-12-16 19:36:23 +00:00
|
|
|
|
2004-12-31 14:27:38 +00:00
|
|
|
ett = &cfg->ett_times;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
|
|
|
ett = &cfg->ett_gog_gop;
|
2017-04-17 01:22:48 +00:00
|
|
|
g_array_append_val(mc->ett,ett);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
static void analyze_config(mate_config* mc) {
|
2004-12-11 01:00:17 +00:00
|
|
|
guint i;
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
for (i=0; i < mc->pducfglist->len; i++) {
|
|
|
|
analyze_pdu_config(mc, (mate_cfg_pdu*) g_ptr_array_index(mc->pducfglist,i));
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
g_hash_table_foreach(mc->gopcfgs,analyze_gop_config,mc);
|
|
|
|
g_hash_table_foreach(mc->gogcfgs,analyze_gog_config,mc);
|
2004-12-11 01:00:17 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-07-23 11:41:25 +00:00
|
|
|
extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
|
2017-04-17 01:22:48 +00:00
|
|
|
mate_config* mc;
|
2004-12-16 19:36:23 +00:00
|
|
|
gint* ett;
|
2004-12-11 01:00:17 +00:00
|
|
|
avp_init();
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc = (mate_config *)g_malloc(sizeof(mate_config));
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->hfid_mate = mate_hfid;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:29:26 +00:00
|
|
|
mc->wanted_hfids = g_array_new(FALSE, FALSE, (guint)sizeof(int));
|
2017-04-17 02:37:00 +00:00
|
|
|
mc->num_fields_wanted = 0;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->dbg_facility = NULL;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->mate_lib_path = g_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->pducfgs = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
mc->gopcfgs = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
mc->gogcfgs = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
mc->transfs = g_hash_table_new(g_str_hash,g_str_equal);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->pducfglist = g_ptr_array_new();
|
|
|
|
mc->gops_by_pduname = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
mc->gogs_by_gopname = g_hash_table_new(g_str_hash,g_str_equal);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->ett_root = -1;
|
2004-12-11 01:00:17 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->hfrs = g_array_new(FALSE,FALSE,sizeof(hf_register_info));
|
|
|
|
mc->ett = g_array_new(FALSE,FALSE,sizeof(gint*));
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
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;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2010-04-14 18:39:00 +00:00
|
|
|
/* gop prefs */
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->defaults.gop.expiration = -1.0f;
|
|
|
|
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;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2010-04-14 18:39:00 +00:00
|
|
|
/* gog prefs */
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->defaults.gog.expiration = 5.0f;
|
|
|
|
mc->defaults.gog.show_times = TRUE;
|
|
|
|
mc->defaults.gog.gop_tree_mode = GOP_BASIC_TREE;
|
2004-12-12 23:40:44 +00:00
|
|
|
|
2005-05-16 13:28:35 +00:00
|
|
|
/* what to dbgprint */
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->dbg_lvl = 0;
|
|
|
|
mc->dbg_pdu_lvl = 0;
|
|
|
|
mc->dbg_gop_lvl = 0;
|
|
|
|
mc->dbg_gog_lvl = 0;
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
mc->config_error = g_string_new("");
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
ett = &mc->ett_root;
|
|
|
|
g_array_append_val(mc->ett,ett);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
if ( mate_load_config(filename,mc) ) {
|
|
|
|
analyze_config(mc);
|
2004-12-11 01:00:17 +00:00
|
|
|
} else {
|
2008-12-22 15:24:18 +00:00
|
|
|
report_failure("MATE failed to configure!\n"
|
|
|
|
"It is recommended that you fix your config and restart Wireshark.\n"
|
2017-04-17 01:22:48 +00:00
|
|
|
"The reported error is:\n%s\n",mc->config_error->str);
|
2011-01-30 22:57:00 +00:00
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
/* if (mc) destroy_mate_config(mc,FALSE); */
|
2004-12-11 01:00:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-04-17 02:37:00 +00:00
|
|
|
if (mc->num_fields_wanted == 0) {
|
|
|
|
/* We have no interest in any fields, so we have no
|
|
|
|
work to do. */
|
2017-04-17 01:22:48 +00:00
|
|
|
/*destroy_mate_config(mc,FALSE);*/
|
2004-12-11 01:00:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-04-17 01:22:48 +00:00
|
|
|
return mc;
|
2004-12-11 01:00:17 +00:00
|
|
|
}
|
|
|
|
|
2014-10-06 01:34:19 +00:00
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|