Whitespace cleanup (remove trailing blanks from lines).

svn path=/trunk/; revision=35711
This commit is contained in:
Bill Meier 2011-01-30 22:57:00 +00:00
parent 17281958a2
commit 6e079af172
3 changed files with 182 additions and 182 deletions

View File

@ -1,5 +1,5 @@
/* mate.h
* MATE -- Meta Analysis and Tracing Engine
* MATE -- Meta Analysis and Tracing Engine
*
* Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org>
*
@ -13,12 +13,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -35,7 +35,7 @@
#ifndef ENABLE_STATIC
#include "moduleinfo.h"
#include <gmodule.h>
#else
#else
#include <glib.h>
#endif
@ -97,18 +97,18 @@ typedef struct _mate_cfg_pdu {
GHashTable* items; /* all the items of this type */
GPtrArray* transforms; /* transformations to be applied */
int hfid;
int hfid_proto;
int hfid_pdu_rel_time;
int hfid_pdu_time_in_gop;
GHashTable* my_hfids; /* for creating register info */
gint ett;
gint ett_attr;
GHashTable* hfids_attr; /* k=hfid v=avp_name */
gboolean discard;
@ -117,7 +117,7 @@ typedef struct _mate_cfg_pdu {
GPtrArray* transport_ranges; /* hfids of candidate transport ranges from which to extract attributes */
GPtrArray* payload_ranges; /* hfids of candidate payload ranges from which to extract attributes */
avpl_match_mode criterium_match_mode;
accept_mode_t criterium_accept_mode;
AVPL* criterium;
@ -136,15 +136,15 @@ typedef struct _mate_cfg_gop {
AVPL* start; /* start candidate avpl */
AVPL* stop; /* stop candidate avpl */
AVPL* extra; /* attributes to be added */
float expiration;
float idle_timeout;
float lifetime;
gboolean drop_unassigned;
gop_pdu_tree_t pdu_tree_mode;
gboolean show_times;
GHashTable* my_hfids; /* for creating register info */
int hfid;
int hfid_start_time;
@ -152,12 +152,12 @@ typedef struct _mate_cfg_gop {
int hfid_last_time;
int hfid_gop_pdu;
int hfid_gop_num_pdus;
gint ett;
gint ett_attr;
gint ett_times;
gint ett_children;
GHashTable* gop_index;
GHashTable* gog_index;
} mate_cfg_gop;
@ -168,7 +168,7 @@ typedef struct _mate_cfg_gog {
GHashTable* items; /* all the items of this type */
guint last_id; /* keeps the last id given to an item of this kind */
GPtrArray* transforms; /* transformations to be applied */
LoAL* keys;
@ -177,13 +177,13 @@ typedef struct _mate_cfg_gog {
float expiration;
gop_tree_mode_t gop_tree_mode;
gboolean show_times;
GHashTable* my_hfids; /* for creating register info */
int hfid;
int hfid_gog_num_of_gops;
int hfid_gog_gop;
int hfid_gog_gopstart;
int hfid_gog_gopstop;
int hfid_gog_gopstop;
int hfid_start_time;
int hfid_stop_time;
int hfid_last_time;
@ -198,66 +198,66 @@ typedef struct _mate_config {
gchar* mate_config_file; /* name of the config file */
int hfid_mate;
GString* fields_filter; /* "ip.addr || dns.id || ... " for the tap */
GString* protos_filter; /* "dns || ftp || ..." for the tap */
gchar* tap_filter;
FILE* dbg_facility; /* where to dump dbgprint output g_message if null */
gchar* mate_lib_path; /* where to look for "Include" files first */
GHashTable* pducfgs; /* k=pducfg->name v=pducfg */
GHashTable* gopcfgs; /* k=gopcfg->name v=gopcfg */
GHashTable* gogcfgs; /* k=gogcfg->name v=gogcfg */
GHashTable* transfs; /* k=transform->name v=transform */
GPtrArray* pducfglist; /* pducfgs in order of "execution" */
GHashTable* gops_by_pduname; /* k=pducfg->name v=gopcfg */
GHashTable* gogs_by_gopname; /* k=gopname v=loal where avpl->name == matchedgop->name */
GArray* hfrs;
gint ett_root;
GArray* ett;
/* defaults */
struct _mate_cfg_defaults {
struct _pdu_defaults {
avpl_match_mode match_mode;
avpl_replace_mode replace_mode;
gboolean last_extracted;
gboolean drop_unassigned;
gboolean discard;
} pdu;
struct _gop_defaults {
float expiration;
float idle_timeout;
float lifetime;
gop_pdu_tree_t pdu_tree_mode;
gboolean show_times;
gboolean drop_unassigned;
} gop;
struct _gog_defaults {
float expiration;
gboolean show_times;
gop_tree_mode_t gop_tree_mode;
} gog;
} defaults;
/* what to dbgprint */
int dbg_lvl;
int dbg_lvl;
int dbg_pdu_lvl;
int dbg_gop_lvl;
int dbg_gog_lvl;
GPtrArray* config_stack;
GString* config_error;
} mate_config;
@ -272,9 +272,9 @@ typedef struct _mate_runtime_data {
GMemChunk* mate_items;
float now;
guint highest_analyzed_frame;
GHashTable* frames; /* k=frame.num v=pdus */
} mate_runtime_data;
typedef struct _mate_pdu mate_pdu;
@ -287,39 +287,39 @@ struct _mate_pdu {
mate_cfg_pdu* cfg; /* the type of this item */
AVPL* avpl;
guint32 frame; /* wich frame I belog to? */
mate_pdu* next_in_frame; /* points to the next pdu in this frame */
float rel_time; /* time since start of capture */
mate_gop* gop; /* the gop the pdu belongs to (if any) */
mate_pdu* next; /* next in gop */
float time_in_gop; /* time since gop start */
gboolean first; /* is this the first pdu in this frame? */
gboolean is_start; /* this is the start pdu for this gop */
gboolean is_stop; /* this is the stop pdu for this gop */
gboolean after_release; /* this pdu comes after the stop */
};
struct _mate_gop {
guint32 id;
mate_cfg_gop* cfg;
mate_cfg_gop* cfg;
gchar* gop_key;
AVPL* avpl; /* the attributes of the pdu/gop/gog */
guint last_n;
mate_gog* gog; /* the gog of a gop */
mate_gop* next; /* next in gog; */
float expiration; /* when will it expire after release (all gops releases if gog)? */
float idle_expiration; /* when will it expire if no new pdus are assigned to it */
float time_to_die;
float time_to_timeout;
float start_time; /* time of start */
float release_time; /* when this gop/gog was released */
float last_time; /* the rel_time at which the last pdu has been added (to gop or gog's gop) */
@ -329,31 +329,31 @@ struct _mate_gop {
int num_of_after_release_pdus; /* how many pdus have arrived since it's been released */
mate_pdu* pdus; /* pdus that belong to a gop (NULL in gog) */
mate_pdu* last_pdu; /* last pdu in pdu's list */
gboolean released; /* has this gop been released? */
};
struct _mate_gog {
guint32 id;
mate_cfg_gog* cfg;
mate_cfg_gog* cfg;
AVPL* avpl; /* the attributes of the pdu/gop/gog */
guint last_n; /* the number of attributes the avpl had the last time we checked */
gboolean released; /* has this gop been released? */
float expiration; /* when will it expire after release (all gops releases if gog)? */
float idle_expiration; /* when will it expire if no new pdus are assigned to it */
/* on gop and gog: */
float start_time; /* time of start */
float release_time; /* when this gog was released */
float last_time; /* the rel_time at which the last pdu has been added */
mate_gop* gops; /* gops that belong to a gog (NULL in gop) */
mate_gop* last_gop; /* last gop in gop's list */
int num_of_gops; /* how many gops a gog has? */
int num_of_counting_gops; /* how many of them count for gog release */
int num_of_released_gops; /* how many of them have already been released */

View File

@ -34,14 +34,14 @@ static void report_error(const gchar* fmt, ...) {
static gchar error_buffer[DEBUG_BUFFER_SIZE];
va_list list;
va_start( list, fmt );
g_vsnprintf(error_buffer,DEBUG_BUFFER_SIZE,fmt,list);
va_end( list );
g_string_append(matecfg->config_error,error_buffer);
g_string_append_c(matecfg->config_error,'\n');
}
/* creates a blank pdu config
@ -57,19 +57,19 @@ extern mate_cfg_pdu* new_pducfg(gchar* name) {
cfg->transforms = NULL;
cfg->hfid = -1;
cfg->hfid_pdu_rel_time = -1;
cfg->hfid_pdu_time_in_gop = -1;
cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
cfg->ett = -1;
cfg->ett_attr = -1;
cfg->ett_attr = -1;
cfg->criterium = NULL;
cfg->criterium_match_mode = AVPL_NO_MATCH;
cfg->criterium_accept_mode = ACCEPT_MODE;
g_ptr_array_add(matecfg->pducfglist,(gpointer) cfg);
g_hash_table_insert(matecfg->pducfgs,(gpointer) cfg->name,(gpointer) cfg);
@ -80,17 +80,17 @@ extern mate_cfg_pdu* new_pducfg(gchar* name) {
extern mate_cfg_gop* new_gopcfg(gchar* name) {
mate_cfg_gop* cfg = g_malloc(sizeof(mate_cfg_gop));
cfg->name = g_strdup(name);
cfg->last_id = 0;
cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal);
cfg->transforms = NULL;
cfg->extra = new_avpl("extra");
cfg->hfid = -1;
cfg->ett = -1;
cfg->ett_attr = -1;
cfg->ett_times = -1;
@ -115,33 +115,33 @@ extern mate_cfg_gop* new_gopcfg(gchar* name) {
extern mate_cfg_gog* new_gogcfg(gchar* name) {
mate_cfg_gog* cfg = g_malloc(sizeof(mate_cfg_gop));
cfg->name = g_strdup(name);
cfg->last_id = 0;
cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal);
cfg->transforms = NULL;
cfg->extra = new_avpl("extra");
cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
cfg->hfid = -1;
cfg->ett = -1;
cfg->ett_attr = -1;
cfg->ett_times = -1;
cfg->ett_children = -1;
cfg->ett_gog_gop = -1;
cfg->hfid_gog_num_of_gops = -1;
cfg->hfid_gog_gop = -1;
cfg->hfid_gog_gopstart = -1;
cfg->hfid_gog_gopstop = -1;
cfg->hfid_start_time = -1;
cfg->hfid_stop_time = -1;
cfg->hfid_last_time = -1;
g_hash_table_insert(matecfg->gogcfgs,(gpointer) cfg->name, (gpointer) cfg);
return cfg;
@ -185,7 +185,7 @@ extern gboolean add_hfid(header_field_info* hfi, gchar* how, GHashTable* where)
if (! exists) {
report_error("MATE Error: cannot find field for attribute %s",how);
}
}
return exists;
}
@ -196,7 +196,7 @@ extern gchar* add_ranges(gchar* range,GPtrArray* range_ptr_arr) {
int* hfidp;
ranges = g_strsplit(range,"/",0);
if (ranges) {
for (i=0; ranges[i]; i++) {
hfi = proto_registrar_get_byname(ranges[i]);
@ -210,10 +210,10 @@ extern gchar* add_ranges(gchar* range,GPtrArray* range_ptr_arr) {
return g_strdup_printf("no such proto: '%s'",ranges[i]);;
}
}
g_strfreev(ranges);
}
return NULL;
}
@ -283,25 +283,25 @@ static void analyze_pdu_config(mate_cfg_pdu* cfg) {
hfri.hfinfo.display = BASE_DEC;
g_array_append_val(matecfg->hfrs,hfri);
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;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = "Seconds passed since the start of capture";
g_array_append_val(matecfg->hfrs,hfri);
hfri.p_id = &(cfg->hfid_pdu_time_in_gop);
hfri.hfinfo.name = g_strdup_printf("%s time since beginning of Gop",cfg->name);
hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.TimeInGop",cfg->name);
hfri.hfinfo.type = FT_FLOAT;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = "Seconds passed since the start of the GOP";
g_array_append_val(matecfg->hfrs,hfri);
g_hash_table_foreach(cfg->hfids_attr,analyze_pdu_hfids,cfg);
ett = &cfg->ett;
@ -391,7 +391,7 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p _U_) {
}
}
}
if (cfg->stop) {
cookie = NULL;
while(( avp = get_next_avp(cfg->stop,&cookie) )) {
@ -400,7 +400,7 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p _U_) {
}
}
}
cookie = NULL;
while(( avp = get_next_avp(cfg->extra,&cookie) )) {
if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) {
@ -446,49 +446,49 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p _U_) {
hfri.hfinfo.display = BASE_DEC;
g_array_append_val(matecfg->hfrs,hfri);
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);
g_array_append_val(matecfg->hfrs,hfri);
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;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = g_strdup("The start frame of a GOP");
g_array_append_val(matecfg->hfrs,hfri);
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;
hfri.hfinfo.display = BASE_NONE;
hfri.hfinfo.blurb = g_strdup("The stop frame of a GOP");
g_array_append_val(matecfg->hfrs,hfri);
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;
hfri.hfinfo.blurb = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name);
g_array_append_val(matecfg->hfrs,hfri);
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);
g_array_append_val(matecfg->hfrs,hfri);
/* this might become mate.gogname.gopname */
hfri.p_id = &(cfg->hfid_gog_gop);
hfri.hfinfo.name = "a GOP";
@ -502,15 +502,15 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p _U_) {
/* index the keys of gog for every gop
and insert the avps of the keys to the hfarray */
key_avps = new_avpl("");
avpl_cookie = NULL;
while (( avpl = get_next_avpl(cfg->keys,&avpl_cookie) )) {
if (! ( gog_keys = g_hash_table_lookup(matecfg->gogs_by_gopname,avpl->name))) {
gog_keys = new_loal(avpl->name);
g_hash_table_insert(matecfg->gogs_by_gopname,gog_keys->name,gog_keys);
}
gopkey_avpl = new_avpl_from_avpl(cfg->name, avpl, TRUE);
loal_append(gog_keys,gopkey_avpl);
@ -530,12 +530,12 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p _U_) {
new_attr_hfri(cfg->name,cfg->my_hfids,avp->n);
}
}
/* every key_avp ios an extra as well.
one day every Member will have its own extras */
merge_avpl(cfg->extra,key_avps,TRUE);
analyze_transform_hfrs(cfg->name,cfg->transforms,cfg->my_hfids);
ett = &cfg->ett;
@ -549,10 +549,10 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p _U_) {
ett = &cfg->ett_times;
g_array_append_val(matecfg->ett,ett);
ett = &cfg->ett_gog_gop;
ett = &cfg->ett_gog_gop;
g_array_append_val(matecfg->ett,ett);
}
static void analyze_config(void) {
@ -578,34 +578,34 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
matecfg = g_malloc(sizeof(mate_config));
matecfg->hfid_mate = mate_hfid;
matecfg->fields_filter = g_string_new("");
matecfg->protos_filter = g_string_new("");
matecfg->protos_filter = g_string_new("");
matecfg->dbg_facility = NULL;
matecfg->mate_lib_path = g_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP);;
matecfg->pducfgs = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->gopcfgs = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->gogcfgs = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->transfs = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->pducfglist = g_ptr_array_new();
matecfg->gops_by_pduname = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->gogs_by_gopname = g_hash_table_new(g_str_hash,g_str_equal);
matecfg->ett_root = -1;
matecfg->hfrs = g_array_new(FALSE,FALSE,sizeof(hf_register_info));
matecfg->ett = g_array_new(FALSE,FALSE,sizeof(gint*));
matecfg->defaults.pdu.drop_unassigned = FALSE;
matecfg->defaults.pdu.discard = FALSE;
matecfg->defaults.pdu.last_extracted = FALSE;
matecfg->defaults.pdu.match_mode = AVPL_STRICT;
matecfg->defaults.pdu.replace_mode = AVPL_INSERT;
/* gop prefs */
matecfg->defaults.gop.expiration = -1.0;
matecfg->defaults.gop.idle_timeout = -1.0;
@ -613,30 +613,30 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) {
matecfg->defaults.gop.pdu_tree_mode = GOP_FRAME_TREE;
matecfg->defaults.gop.show_times = TRUE;
matecfg->defaults.gop.drop_unassigned = FALSE;
/* gog prefs */
matecfg->defaults.gog.expiration = 5.0;
matecfg->defaults.gog.show_times = TRUE;
matecfg->defaults.gog.gop_tree_mode = GOP_BASIC_TREE;
/* what to dbgprint */
matecfg->dbg_lvl = 0;
matecfg->dbg_lvl = 0;
matecfg->dbg_pdu_lvl = 0;
matecfg->dbg_gop_lvl = 0;
matecfg->dbg_gog_lvl = 0;
matecfg->config_error = g_string_new("");
ett = &matecfg->ett_root;
g_array_append_val(matecfg->ett,ett);
if ( mate_load_config(filename,matecfg) ) {
analyze_config();
} else {
report_failure("MATE failed to configure!\n"
"It is recommended that you fix your config and restart Wireshark.\n"
"The reported error is:\n%s\n",matecfg->config_error->str);
/* if (matecfg) destroy_mate_config(matecfg,FALSE); */
matecfg = NULL;
return NULL;

View File

@ -13,12 +13,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -47,13 +47,13 @@ static void pdu_attrs_tree(proto_tree* tree, tvbuff_t *tvb, mate_pdu* pdu) {
proto_item *avpl_i;
proto_tree *avpl_t;
int* hfi_p;
avpl_i = proto_tree_add_text(tree,tvb,0,0,"%s Attributes",pdu->cfg->name);
avpl_t = proto_item_add_subtree(avpl_i, pdu->cfg->ett_attr);
for ( c = pdu->avpl->null.next; c->avp; c = c->next) {
hfi_p = g_hash_table_lookup(pdu->cfg->my_hfids,(char*)c->avp->n);
if (hfi_p) {
proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v);
} else {
@ -68,13 +68,13 @@ static void gop_attrs_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
proto_item *avpl_i;
proto_tree *avpl_t;
int* hfi_p;
avpl_i = proto_tree_add_text(tree,tvb,0,0,"%s Attributes",gop->cfg->name);
avpl_t = proto_item_add_subtree(avpl_i, gop->cfg->ett_attr);
for ( c = gop->avpl->null.next; c->avp; c = c->next) {
hfi_p = g_hash_table_lookup(gop->cfg->my_hfids,(char*)c->avp->n);
if (hfi_p) {
proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v);
} else {
@ -89,13 +89,13 @@ static void gog_attrs_tree(proto_tree* tree, tvbuff_t *tvb, mate_gog* gog) {
proto_item *avpl_i;
proto_tree *avpl_t;
int* hfi_p;
avpl_i = proto_tree_add_text(tree,tvb,0,0,"%s Attributes",gog->cfg->name);
avpl_t = proto_item_add_subtree(avpl_i, gog->cfg->ett_attr);
for ( c = gog->avpl->null.next; c->avp; c = c->next) {
hfi_p = g_hash_table_lookup(gog->cfg->my_hfids,(char*)c->avp->n);
if (hfi_p) {
proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v);
} else {
@ -118,57 +118,57 @@ static void mate_gog_tree(proto_tree* tree, tvbuff_t *tvb, mate_gog* gog, mate_g
proto_item *gog_gop_item;
proto_tree *gog_gop_tree;
mate_pdu* pdu;
#ifdef _MATE_DEBUGGING
proto_item* gog_key_item;
proto_tree* gog_key_tree;
guint i;
#endif
gog_item = proto_tree_add_uint(tree,gog->cfg->hfid,tvb,0,0,gog->id);
gog_tree = proto_item_add_subtree(gog_item,gog->cfg->ett);
gog_attrs_tree(gog_tree,tvb,gog);
if (gog->cfg->show_times) {
gog_time_item = proto_tree_add_text(gog_tree,tvb,0,0,"%s Times",gog->cfg->name);
gog_time_tree = proto_item_add_subtree(gog_time_item, gog->cfg->ett_times);
proto_tree_add_float(gog_time_tree, gog->cfg->hfid_start_time, tvb, 0, 0, gog->start_time);
proto_tree_add_float(gog_time_tree, gog->cfg->hfid_last_time, tvb, 0, 0, gog->last_time - gog->start_time);
proto_tree_add_float(gog_time_tree, gog->cfg->hfid_last_time, tvb, 0, 0, gog->last_time - gog->start_time);
}
gog_gops_item = proto_tree_add_uint(gog_tree, gog->cfg->hfid_gog_num_of_gops,
tvb, 0, 0, gog->num_of_gops);
gog_gops_tree = proto_item_add_subtree(gog_gops_item, gog->cfg->ett_children);
for (gog_gops = gog->gops; gog_gops; gog_gops = gog_gops->next) {
if (gop != gog_gops) {
if (gog->cfg->gop_tree_mode == GOP_FULL_TREE) {
mate_gop_tree(gog_gops_tree, tvb, gog_gops);
} else {
gog_gop_item = proto_tree_add_uint(gog_gops_tree,gog_gops->cfg->hfid,tvb,0,0,gog_gops->id);
if (gog->cfg->gop_tree_mode == GOP_BASIC_TREE) {
gog_gop_tree = proto_item_add_subtree(gog_gop_item, gog->cfg->ett_gog_gop);
proto_tree_add_text(gog_gop_tree, tvb,0,0, "Started at: %f", gog_gops->start_time);
proto_tree_add_text(gog_gop_tree, tvb,0,0, "%s Duration: %f",
gog_gops->cfg->name, gog_gops->last_time - gog_gops->start_time);
if (gog_gops->released)
proto_tree_add_text(gog_gop_tree, tvb,0,0, "%s has been released, Time: %f",
gog_gops->cfg->name, gog_gops->release_time - gog_gops->start_time);
proto_tree_add_text(gog_gop_tree, tvb,0,0, "Number of Pdus: %u",gog_gops->num_of_pdus);
if (gop->pdus && gop->cfg->pdu_tree_mode != GOP_NO_TREE) {
proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstart,tvb,0,0,gog_gops->pdus->frame);
for (pdu = gog_gops->pdus->next ; pdu; pdu = pdu->next) {
if (pdu->is_stop) {
proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstop,tvb,0,0,pdu->frame);
@ -177,7 +177,7 @@ static void mate_gog_tree(proto_tree* tree, tvbuff_t *tvb, mate_gog* gog, mate_g
}
}
}
}
} else {
proto_tree_add_uint_format(gog_gops_tree,gop->cfg->hfid,tvb,0,0,gop->id,"current %s Gop: %d",gop->cfg->name,gop->id);
@ -199,38 +199,38 @@ static void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
const gchar* pdu_str;
const gchar* type_str;
guint32 pdu_item;
gop_item = proto_tree_add_uint(tree,gop->cfg->hfid,tvb,0,0,gop->id);
gop_tree = proto_item_add_subtree(gop_item, gop->cfg->ett);
if (gop->gop_key) proto_tree_add_text(gop_tree,tvb,0,0,"GOP Key: %s",gop->gop_key);
gop_attrs_tree(gop_tree,tvb,gop);
if (gop->cfg->show_times) {
gop_time_item = proto_tree_add_text(gop_tree,tvb,0,0,"%s Times",gop->cfg->name);
gop_time_tree = proto_item_add_subtree(gop_time_item, gop->cfg->ett_times);
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_start_time, tvb, 0, 0, gop->start_time);
if (gop->released) {
if (gop->released) {
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_stop_time, tvb, 0, 0, gop->release_time - gop->start_time);
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time);
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time);
} else {
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time);
proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time);
}
}
gop_pdu_item = proto_tree_add_uint(gop_tree, gop->cfg->hfid_gop_num_pdus, tvb, 0, 0,gop->num_of_pdus);
if (gop->cfg->pdu_tree_mode != GOP_NO_TREE) {
gop_pdu_tree = proto_item_add_subtree(gop_pdu_item, gop->cfg->ett_children);
rel_time = gop_time = gop->start_time;
type_str = (gop->cfg->pdu_tree_mode == GOP_FRAME_TREE ) ? "in frame:" : "id:";
for (gop_pdus = gop->pdus; gop_pdus; gop_pdus = gop_pdus->next) {
pdu_item = (gop->cfg->pdu_tree_mode == GOP_FRAME_TREE ) ? gop_pdus->frame : gop_pdus->id;
@ -244,16 +244,16 @@ static void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
} else {
pdu_str = "";
}
pdu_rel_time = gop_pdus->time_in_gop != 0.0 ? gop_pdus->time_in_gop - rel_time : (float) 0.0;
proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu,tvb,0,0,pdu_item,
"%sPDU: %s %i (%f : %f)",pdu_str, type_str,
pdu_item, gop_pdus->time_in_gop,
pdu_rel_time);
rel_time = gop_pdus->time_in_gop;
}
}
}
@ -262,9 +262,9 @@ static void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
static void mate_pdu_tree(mate_pdu *pdu, tvbuff_t *tvb, proto_tree* tree) {
proto_item *pdu_item;
proto_tree *pdu_tree;
if ( ! pdu ) return;
if (pdu->gop && pdu->gop->gog) {
proto_item_append_text(mate_i," %s:%d->%s:%d->%s:%d",
pdu->cfg->name,pdu->id,
@ -277,19 +277,19 @@ static void mate_pdu_tree(mate_pdu *pdu, tvbuff_t *tvb, proto_tree* tree) {
} else {
proto_item_append_text(mate_i," %s:%d",pdu->cfg->name,pdu->id);
}
pdu_item = proto_tree_add_uint(tree,pdu->cfg->hfid,tvb,0,0,pdu->id);
pdu_tree = proto_item_add_subtree(pdu_item, pdu->cfg->ett);
proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_rel_time, tvb, 0, 0, pdu->rel_time);
proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_rel_time, tvb, 0, 0, pdu->rel_time);
if (pdu->gop) {
proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_time_in_gop, tvb, 0, 0, pdu->time_in_gop);
proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_time_in_gop, tvb, 0, 0, pdu->time_in_gop);
mate_gop_tree(tree,tvb,pdu->gop);
if (pdu->gop->gog)
mate_gog_tree(tree,tvb,pdu->gop->gog,pdu->gop);
}
if (pdu->avpl) {
pdu_attrs_tree(pdu_tree,tvb,pdu);
}
@ -298,7 +298,7 @@ static void mate_pdu_tree(mate_pdu *pdu, tvbuff_t *tvb, proto_tree* tree) {
static void mate_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
mate_pdu* pdus;
proto_tree *mate_t;
if ( ! mc || ! tree ) return;
mate_analyze_frame(pinfo,tree);
@ -306,7 +306,7 @@ static void mate_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (( pdus = mate_get_pdus(pinfo->fd->num) )) {
for ( ; pdus; pdus = pdus->next_in_frame) {
mate_i = proto_tree_add_protocol_format(tree,mc->hfid_mate,tvb,0,0,"MATE");
mate_t = proto_item_add_subtree(mate_i, mc->ett_root);
mate_t = proto_item_add_subtree(mate_i, mc->ett_root);
mate_pdu_tree(pdus,tvb,mate_t);
}
}
@ -322,38 +322,38 @@ void
proto_reg_handoff_mate(void)
{
GString* tap_error = NULL;
if ( *pref_mate_config_filename != '\0' ) {
if (current_mate_config_filename) {
report_failure("Mate cannot reconfigure itself.\n"
"for changes to be applied you have to restart wireshark\n");
return;
}
if (!mc) {
}
if (!mc) {
mc = mate_make_config(pref_mate_config_filename,proto_mate);
if (mc) {
/* XXX: alignment warnings, what do they mean? */
proto_register_field_array(proto_mate, (hf_register_info*) mc->hfrs->data, mc->hfrs->len );
proto_register_subtree_array((gint**) mc->ett->data, mc->ett->len);
register_init_routine(initialize_mate_runtime);
tap_error = register_tap_listener("frame", &mate_tap_data,
(char*) mc->tap_filter,
0,
(tap_reset_cb) NULL,
mate_packet,
(tap_draw_cb) NULL);
if ( tap_error ) {
g_warning("mate: couldn't (re)register tap: %s",tap_error->str);
g_string_free(tap_error, TRUE);
mate_tap_data = 0;
return;
}
}
initialize_mate_runtime();
}
@ -369,7 +369,7 @@ proto_register_mate(void)
{
module_t *mate_module;
dissector_handle_t mate_handle;
proto_mate = proto_register_protocol("Meta Analysis Tracing Engine", "MATE", "mate");
register_dissector("mate",mate_tree,proto_mate);
mate_module = prefs_register_protocol(proto_mate, proto_reg_handoff_mate);