diff options
Diffstat (limited to 'plugins/mate')
-rw-r--r-- | plugins/mate/mate.h | 17 | ||||
-rw-r--r-- | plugins/mate/mate_runtime.c | 11 | ||||
-rw-r--r-- | plugins/mate/mate_setup.c | 45 | ||||
-rw-r--r-- | plugins/mate/packet-mate.c | 61 |
4 files changed, 85 insertions, 49 deletions
diff --git a/plugins/mate/mate.h b/plugins/mate/mate.h index da816119ea..59aedba788 100644 --- a/plugins/mate/mate.h +++ b/plugins/mate/mate.h @@ -101,6 +101,7 @@ #define KEYWORD_INSERT "Insert" #define KEYWORD_MAP "Map" #define KEYWORD_GOGEXPIRE "GogExpiration" +#define KEYWORD_GOPTREE "GopTree" #define KEYWORD_DISCARDPDU "DiscardPduData" #define KEYWORD_LIBPATH "ThingLibPath" #define KEYWORD_SHOWPDUTREE "ShowPduTree" @@ -111,6 +112,10 @@ #define KEYWORD_LIB "Lib" #define KEYWORD_ACCEPT "Accept" #define KEYWORD_REJECT "Reject" +#define KEYWORD_NOTREE "NoTree" +#define KEYWORD_PDUTREE "PduTree" +#define KEYWORD_FRAMETREE "FrameTree" + #define KEYWORD_DEBUGFILENAME "Debug_File" #define KEYWORD_DBG_GENERAL "Debug_General" @@ -180,7 +185,7 @@ typedef struct _mate_cfg_item { AVPL* start; /* start candidate avpl */ AVPL* stop; /* stop candidate avpl */ AVPL* key; /* key candidate avpl */ - gboolean show_pdu_tree; + guint8* show_pdu_tree; gboolean show_times; gboolean drop_gop; int hfid_gop_pdu; @@ -190,6 +195,7 @@ typedef struct _mate_cfg_item { GHashTable* gog_index; /* gog */ + gboolean gop_as_subtree; LoAL* keys; float expiration; int hfid_gog_num_of_gops; @@ -204,14 +210,21 @@ typedef struct _mate_config { gboolean drop_pdu; /* destroy the pdu if not assign to a gop */ gboolean drop_gop; /* destroy the gop if not assign to a gog */ guint8* mate_lib_path; /* where to look for "Include" files first */ - gboolean show_pdu_tree; + guint8* show_pdu_tree; gboolean show_times; gboolean last_to_be_created; avpl_match_mode match_mode; avpl_replace_mode replace_mode; + gboolean gop_as_subtree; + + guint8* accept; guint8* reject; + guint8* no_tree; + guint8* frame_tree; + guint8* pdu_tree; + /* what to dbgprint */ int dbg_lvl; int dbg_cfg_lvl; diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c index 3c5cac64ae..c1273b35c3 100644 --- a/plugins/mate/mate_runtime.c +++ b/plugins/mate/mate_runtime.c @@ -561,12 +561,12 @@ static void analize_pdu(mate_pdu* pdu) { if (candidate_stop) { dbg_print (dbg_gop,4,dbg_facility,"analize_pdu: got candidate stop\n"); is_stop = new_avpl_exact_match("",pdu->avpl, candidate_stop,FALSE); + } else { + is_stop = new_avpl(""); } if(is_stop) { - avpl_str = avpl_to_str(is_stop); - dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: is_stop: %s\n",avpl_str); - g_free(avpl_str); + dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: is a `stop\n"); delete_avpl(is_stop,FALSE); if (! gop->released) { @@ -575,7 +575,8 @@ static void analize_pdu(mate_pdu* pdu) { if (gop->gog) gop->gog->num_of_released_gops++; } - pdu->is_stop = TRUE; + if (candidate_stop) pdu->is_stop = TRUE; + } else { dbg_print (dbg_gop,4,dbg_facility,"analize_pdu: is not a stop\n"); } @@ -731,7 +732,7 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, extern int mate_packet(void *prs _U_, proto_tree* tree _U_, epan_dissect_t *edt _U_, void *dummy _U_) { /* nothing to do yet */ - return 1; + return 0; } static void delete_mate_pdu(mate_pdu* pdu) { diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c index d46680dae7..417285e0f2 100644 --- a/plugins/mate/mate_setup.c +++ b/plugins/mate/mate_setup.c @@ -123,6 +123,7 @@ static mate_cfg_item* new_mate_cfg_item(guint8* name) { new->stop = NULL; new->key = NULL; new->keys = NULL; + new->gop_as_subtree = FALSE; new->hfid = -1; new->hfid_pdu_rel_time = -1; @@ -571,7 +572,7 @@ static gboolean config_settings(AVPL*avpl) { matecfg->discard_pdu_attributes = extract_named_bool(avpl, KEYWORD_DISCARDPDU,matecfg->discard_pdu_attributes); matecfg->drop_pdu = extract_named_bool(avpl, KEYWORD_DROPPDU,matecfg->drop_pdu); matecfg->drop_gop = extract_named_bool(avpl, KEYWORD_DROPGOP,matecfg->drop_gop); - matecfg->show_pdu_tree = extract_named_bool(avpl, KEYWORD_SHOWPDUTREE,matecfg->show_pdu_tree); + matecfg->show_pdu_tree = extract_named_str(avpl, KEYWORD_SHOWPDUTREE,matecfg->show_pdu_tree); matecfg->show_times = extract_named_bool(avpl, KEYWORD_SHOWGOPTIMES,matecfg->show_times); if(( avp = extract_avp_by_name(avpl,KEYWORD_DEBUGFILENAME) )) { @@ -726,7 +727,7 @@ static gboolean config_gop(AVPL* avpl) { } cfg->drop_gop = extract_named_bool(avpl, KEYWORD_DROPGOP,matecfg->drop_gop); - cfg->show_pdu_tree = extract_named_bool(avpl, KEYWORD_SHOWPDUTREE, matecfg->show_pdu_tree); + cfg->show_pdu_tree = extract_named_str(avpl, KEYWORD_SHOWPDUTREE, matecfg->show_pdu_tree); cfg->show_times = extract_named_bool(avpl, KEYWORD_SHOWGOPTIMES,matecfg->show_times); cfg->key = avpl; @@ -789,7 +790,7 @@ static gboolean config_gopextra(AVPL* avpl) { } cfg->drop_gop = extract_named_bool(avpl, KEYWORD_DROPGOP,cfg->drop_gop); - cfg->show_pdu_tree = extract_named_bool(avpl, KEYWORD_SHOWPDUTREE, cfg->show_pdu_tree); + cfg->show_pdu_tree = extract_named_str(avpl, KEYWORD_SHOWPDUTREE, cfg->show_pdu_tree); cfg->show_times = extract_named_bool(avpl, KEYWORD_SHOWGOPTIMES,cfg->show_times); merge_avpl(cfg->extra,avpl,TRUE); @@ -815,7 +816,8 @@ static gboolean config_gog(AVPL* avpl) { cfg = new_gogcfg(name); cfg->expiration = extract_named_float(avpl, KEYWORD_GOGEXPIRE,matecfg->gog_expiration); - + cfg->gop_as_subtree = extract_named_bool(avpl, KEYWORD_GOPTREE,matecfg->gop_as_subtree); + return TRUE; } @@ -872,6 +874,7 @@ static gboolean config_gogextra(AVPL* avpl) { } cfg->expiration = extract_named_float(avpl, KEYWORD_GOGEXPIRE,cfg->expiration); + cfg->gop_as_subtree = extract_named_bool(avpl, KEYWORD_GOPTREE,cfg->gop_as_subtree); merge_avpl(cfg->extra,avpl,TRUE); @@ -1276,9 +1279,16 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p _U_) { 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); - hfri.hfinfo.type = FT_FRAMENUM; - g_array_append_val(matecfg->hfrs,hfri); + if (cfg->show_pdu_tree == matecfg->frame_tree) { + hfri.hfinfo.type = FT_FRAMENUM; + g_array_append_val(matecfg->hfrs,hfri); + } else if (cfg->show_pdu_tree == matecfg->pdu_tree) { + hfri.hfinfo.type = FT_UINT32; + g_array_append_val(matecfg->hfrs,hfri); + } else { + cfg->show_pdu_tree = matecfg->no_tree; + } while(( avp = get_next_avp(cfg->key,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { @@ -1293,13 +1303,15 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p _U_) { } } - cookie = NULL; - while(( avp = get_next_avp(cfg->stop,&cookie) )) { - if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { - new_attr_hfri(cfg,avp->n); + if (cfg->stop) { + cookie = NULL; + while(( avp = get_next_avp(cfg->stop,&cookie) )) { + if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { + new_attr_hfri(cfg,avp->n); + } } } - + cookie = NULL; while(( avp = get_next_avp(cfg->extra,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { @@ -1505,7 +1517,18 @@ static void init_actions() { matecfg->reject = avp->n; insert_avp(all_keywords,avp); + avp = new_avp(KEYWORD_NOTREE,"",'='); + matecfg->no_tree = avp->n; + insert_avp(all_keywords,avp); + avp = new_avp(KEYWORD_FRAMETREE,"",'='); + matecfg->frame_tree = avp->n; + insert_avp(all_keywords,avp); + + avp = new_avp(KEYWORD_PDUTREE,"",'='); + matecfg->pdu_tree = avp->n; + insert_avp(all_keywords,avp); + if (actions) { g_hash_table_destroy(actions); } diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index 28dbbdeeb4..b585be97f1 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -99,12 +99,15 @@ void mate_gog_tree(proto_tree* tree, tvbuff_t *tvb, mate_gog* gog, mate_gop* gop for (gog_gops = gog->gops; gog_gops; gog_gops = gog_gops->next) { if (gop != gog_gops) { - mate_gop_tree(gog_gop_tree, tvb, gog_gops); + if (gog->cfg->gop_as_subtree) { + mate_gop_tree(gog_gop_tree, tvb, gog_gops); + } else { + proto_tree_add_uint(gog_gop_tree,gog_gops->cfg->hfid,tvb,0,0,gog_gops->id); + } } else { proto_tree_add_uint_format(gog_gop_tree,gop->cfg->hfid,tvb,0,0,gop->id,"%s of current frame: %d",gop->cfg->name,gop->id); } } - } void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) { @@ -117,7 +120,10 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) { mate_pdu* gop_pdus; float rel_time; float gop_time; - + guint8* pdu_str; + guint8* 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); @@ -138,43 +144,36 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) { 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); - rel_time = gop_time = gop->start_time; + if (gop->cfg->show_pdu_tree != mc->no_tree) { + + gop_pdu_tree = proto_item_add_subtree(gop_pdu_item, gop->cfg->ett_children); - gop_pdu_item = proto_tree_add_uint(gop_tree, gop->cfg->hfid_gop_num_pdus, tvb, 0, 0,gop->num_of_pdus); - gop_pdu_tree = proto_item_add_subtree(gop_pdu_item, gop->cfg->ett_children); - - if (gop->cfg->show_pdu_tree) { + rel_time = gop_time = gop->start_time; + + type_str = (gop->cfg->show_pdu_tree == mc->frame_tree ) ? "in frame:" : "id:"; + for (gop_pdus = gop->pdus; gop_pdus; gop_pdus = gop_pdus->next) { + + pdu_item = (gop->cfg->show_pdu_tree == mc->frame_tree ) ? gop_pdus->frame : gop_pdus->id; + if (gop_pdus->is_start) { - proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu, - tvb,0,0,gop_pdus->frame, - "Start PDU: in frame %i", - gop_pdus->frame); + pdu_str = "Start "; } else if (gop_pdus->is_stop) { - proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu, - tvb,0,0,gop_pdus->frame, - "Stop PDU: in frame %i (%f : %f)", - gop_pdus->frame, - gop_pdus->time_in_gop, - gop_pdus->time_in_gop-rel_time); - + pdu_str = "Stop "; } else if (gop_pdus->after_release) { - proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu, - tvb,0,0,gop_pdus->frame, - "After stop PDU: in frame %i (%f : %f)", - gop_pdus->frame, - gop_pdus->time_in_gop, - gop_pdus->time_in_gop-rel_time); + pdu_str = "After stop "; } else { - proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu, - tvb,0,0,gop_pdus->frame, - "PDU: in frame %i (%f : %f)", - gop_pdus->frame, - gop_pdus->time_in_gop, - gop_pdus->time_in_gop-rel_time); + pdu_str = ""; } + 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, + gop_pdus->time_in_gop - rel_time); + rel_time = gop_pdus->time_in_gop; } |