2 * MATE -- Meta Analysis Tracing Engine
4 * Copyright 2004, Luis E. Garcia Ontanon <luis@ontanon.org>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 typedef struct _mate_range mate_range;
35 typedef struct _tmp_pdu_data {
42 typedef struct _gogkey {
48 static mate_runtime_data* rd = NULL;
49 static mate_config* mc = NULL;
53 static int* dbg = &zero;
54 static int* dbg_pdu = &zero;
55 static int* dbg_gop = &zero;
56 static int* dbg_gog = &zero;
57 static FILE* dbg_facility = NULL;
59 static gboolean destroy_mate_pdus(gpointer k _U_, gpointer v, gpointer p _U_) {
60 mate_pdu* pdu = (mate_pdu*) v;
61 if (pdu->avpl) delete_avpl(pdu->avpl,TRUE);
62 g_slice_free(mate_max_size, (mate_max_size *)pdu);
66 static gboolean destroy_mate_gops(gpointer k _U_, gpointer v, gpointer p _U_) {
67 mate_gop* gop = (mate_gop*) v;
69 if (gop->avpl) delete_avpl(gop->avpl,TRUE);
72 if (g_hash_table_lookup(gop->cfg->gop_index,gop->gop_key) == gop) {
73 g_hash_table_remove(gop->cfg->gop_index,gop->gop_key);
79 g_slice_free(mate_max_size,(mate_max_size*)gop);
85 static void gog_remove_keys (mate_gog* gog);
87 static gboolean destroy_mate_gogs(gpointer k _U_, gpointer v, gpointer p _U_) {
88 mate_gog* gog = (mate_gog*) v;
90 if (gog->avpl) delete_avpl(gog->avpl,TRUE);
94 g_ptr_array_free(gog->gog_keys,FALSE);
97 g_slice_free(mate_max_size,(mate_max_size*)gog);
102 static gboolean return_true(gpointer k _U_, gpointer v _U_, gpointer p _U_) {
106 static void destroy_pdus_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) {
107 mate_cfg_pdu* c = (mate_cfg_pdu *)v;
108 g_hash_table_foreach_remove(c->items,destroy_mate_pdus,NULL);
113 static void destroy_gops_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) {
114 mate_cfg_gop* c = (mate_cfg_gop *)v;
116 g_hash_table_foreach_remove(c->gop_index,return_true,NULL);
117 g_hash_table_destroy(c->gop_index);
118 c->gop_index = g_hash_table_new(g_str_hash,g_str_equal);
120 g_hash_table_foreach_remove(c->gog_index,return_true,NULL);
121 g_hash_table_destroy(c->gog_index);
122 c->gog_index = g_hash_table_new(g_str_hash,g_str_equal);
124 g_hash_table_foreach_remove(c->items,destroy_mate_gops,NULL);
128 static void destroy_gogs_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) {
129 mate_cfg_gog* c = (mate_cfg_gog *)v;
130 g_hash_table_foreach_remove(c->items,destroy_mate_gogs,NULL);
134 extern void initialize_mate_runtime(void) {
136 dbg_print (dbg,5,dbg_facility,"initialize_mate: entering");
138 if (( mc = mate_cfg() )) {
140 rd = (mate_runtime_data *)g_malloc(sizeof(mate_runtime_data));
142 g_hash_table_foreach(mc->pducfgs,destroy_pdus_in_cfg,NULL);
143 g_hash_table_foreach(mc->gopcfgs,destroy_gops_in_cfg,NULL);
144 g_hash_table_foreach(mc->gogcfgs,destroy_gogs_in_cfg,NULL);
146 g_hash_table_destroy(rd->frames);
149 rd->current_items = 0;
151 rd->highest_analyzed_frame = 0;
152 rd->frames = g_hash_table_new(g_direct_hash,g_direct_equal);
155 /*mc->dbg_gop_lvl = 5;
158 dbg_pdu = &(mc->dbg_pdu_lvl);
159 dbg_gop = &(mc->dbg_gop_lvl);
160 dbg_gog = &(mc->dbg_gog_lvl);
161 dbg = &(mc->dbg_lvl);
162 dbg_facility = mc->dbg_facility;
164 dbg_print(dbg, 1, dbg_facility, "starting mate");
172 static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, gchar* key) {
173 mate_gop* gop = (mate_gop*)g_slice_new(mate_max_size);
175 gop->id = ++(cfg->last_id);
178 dbg_print(dbg_gop, 1, dbg_facility, "new_gop: %s: ``%s:%d''", key, gop->cfg->name, gop->id);
181 gop->avpl = new_avpl(cfg->name);
187 gop->expiration = cfg->expiration > 0.0 ? cfg->expiration + rd->now : (float) -1.0 ;
188 gop->idle_expiration = cfg->idle_timeout > 0.0 ? cfg->idle_timeout + rd->now : (float) -1.0 ;
189 gop->time_to_die = cfg->lifetime > 0.0 ? cfg->lifetime + rd->now : (float) -1.0 ;
190 gop->time_to_timeout = 0.0f;
192 gop->last_time = gop->start_time = rd->now;
193 gop->release_time = 0.0f;
195 gop->num_of_pdus = 0;
196 gop->num_of_after_release_pdus = 0;
201 gop->released = FALSE;
205 pdu->is_start = TRUE;
206 pdu->time_in_gop = 0.0f;
208 g_hash_table_insert(cfg->gop_index,gop->gop_key,gop);
212 static void adopt_gop(mate_gog* gog, mate_gop* gop) {
213 dbg_print (dbg_gog,5,dbg_facility,"adopt_gop: gog=%p gop=%p",gog,gop);
218 if (gop->cfg->start) {
219 gog->num_of_counting_gops++;
225 gog->last_gop->next = gop;
236 static mate_gog* new_gog(mate_cfg_gog* cfg, mate_gop* gop) {
237 mate_gog* gog = (mate_gog*)g_slice_new(mate_max_size);
238 gog->id = ++(cfg->last_id);
241 dbg_print (dbg_gog,1,dbg_facility,"new_gog: %s:%u for %s:%u",gog->cfg->name,gog->id,gop->cfg->name,gop->id);
243 gog->avpl = new_avpl(cfg->name);
246 gog->expiration = 0.0f;
247 gog->idle_expiration = 0.0f;
249 gog->start_time = rd->now;
250 gog->release_time = 0.0f;
251 gog->last_time = 0.0f;
254 gog->last_gop = NULL;
256 gog->num_of_gops = 0;
257 gog->num_of_counting_gops = 0;
258 gog->num_of_released_gops = 0;
260 gog->gog_keys = g_ptr_array_new();
267 static void apply_transforms(GPtrArray* transforms, AVPL* avpl) {
268 AVPL_Transf* transform = NULL;
271 for (i = 0; i < transforms->len; i++) {
272 transform = (AVPL_Transf *)g_ptr_array_index(transforms,i);
273 avpl_transform(avpl, transform);
278 /* applies the extras for which type to what avpl */
279 static void apply_extras(AVPL* from, AVPL* to, AVPL* extras) {
280 AVPL* our_extras = new_avpl_loose_match("",from, extras, FALSE) ;
283 merge_avpl(to,our_extras,TRUE);
284 delete_avpl(our_extras,FALSE);
288 static void gog_remove_keys (mate_gog* gog) {
291 while (gog->gog_keys->len) {
292 gog_key = (gogkey *)g_ptr_array_remove_index_fast(gog->gog_keys,0);
294 if (g_hash_table_lookup(gog_key->cfg->gog_index,gog_key->key) == gog) {
295 g_hash_table_remove(gog_key->cfg->gog_index,gog_key->key);
298 g_free(gog_key->key);
304 static void reanalyze_gop(mate_gop* gop) {
305 LoAL* gog_keys = NULL;
306 AVPL* curr_gogkey = NULL;
307 mate_cfg_gop* gop_cfg = NULL;
309 AVPL* gogkey_match = NULL;
310 mate_gog* gog = gop->gog;
315 gog->last_time = rd->now;
317 dbg_print (dbg_gog,1,dbg_facility,"reanalyze_gop: %s:%d",gop->cfg->name,gop->id);
319 apply_extras(gop->avpl,gog->avpl,gog->cfg->extra);
321 /* XXX: Instead of using the length of the avpl to check if an avpl has changed,
322 which is not accurate at all, we should have apply_extras,
323 apply_transformations and other functions that can modify the avpl
324 to flag the avpl if it has changed, then we'll check for the flag
325 and clear it after analysis */
327 if (gog->last_n != gog->avpl->len) {
329 dbg_print (dbg_gog,2,dbg_facility,"reanalyze_gop: gog has new attributes let's look for new keys");
331 gog_keys = gog->cfg->keys;
333 while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) {
334 gop_cfg = (mate_cfg_gop *)g_hash_table_lookup(mc->gopcfgs,curr_gogkey->name);
336 if (( gogkey_match = new_avpl_exact_match(gop_cfg->name,gog->avpl,curr_gogkey,FALSE) )) {
338 gog_key = (gogkey *)g_malloc(sizeof(gogkey));
340 gog_key->key = avpl_to_str(gogkey_match);
341 delete_avpl(gogkey_match,FALSE);
343 gog_key->cfg = gop_cfg;
345 if (g_hash_table_lookup(gop_cfg->gog_index,gog_key->key)) {
346 g_free(gog_key->key);
352 /* XXX: since these gogs actually share key info
353 we should try to merge (non released) gogs
354 that happen to have equal keys */
356 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: new key for gog=%s:%d : %s",gog->cfg->name,gog->id,gog_key->key);
357 g_ptr_array_add(gog->gog_keys,gog_key);
358 g_hash_table_insert(gog_key->cfg->gog_index,gog_key->key,gog);
364 gog->last_n = gog->avpl->len;
367 if (gog->num_of_released_gops == gog->num_of_counting_gops) {
368 gog->released = TRUE;
369 gog->expiration = gog->cfg->expiration + rd->now;
371 gog->released = FALSE;
375 static void analyze_gop(mate_gop* gop) {
376 mate_cfg_gog* cfg = NULL;
377 LoAL* gog_keys = NULL;
378 AVPL* curr_gogkey = NULL;
380 AVPL* gogkey_match = NULL;
381 mate_gog* gog = NULL;
385 /* no gog, let's either find one or create it if due */
386 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gog");
388 gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,gop->cfg->name);
391 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gog_keys for this gop");
395 /* We have gog_keys! look for matching gogkeys */
397 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got gog_keys: %s",gog_keys->name) ;
399 while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) {
400 if (( gogkey_match = new_avpl_exact_match(gop->cfg->name,gop->avpl,curr_gogkey,TRUE) )) {
402 key = avpl_to_str(gogkey_match);
404 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got gogkey_match: %s",key);
406 if (( gog = (mate_gog *)g_hash_table_lookup(gop->cfg->gog_index,key) )) {
407 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got already a matching gog");
409 if (gog->num_of_counting_gops == gog->num_of_released_gops && gog->expiration < rd->now) {
410 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: this is a new gog, not the old one, let's create it");
412 gog_remove_keys(gog);
414 new_gog(gog->cfg,gop);
418 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: this is our gog");
420 if (! gop->gog ) adopt_gop(gog,gop);
425 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no such gog in hash, let's create a new %s",curr_gogkey->name);
427 cfg = (mate_cfg_gog *)g_hash_table_lookup(mc->gogcfgs,curr_gogkey->name);
430 gog = new_gog(cfg,gop);
431 gog->num_of_gops = 1;
433 if (gop->cfg->start) {
434 gog->num_of_counting_gops = 1;
438 dbg_print (dbg_gog,0,dbg_facility,"analyze_gop: no such gog_cfg: %s",curr_gogkey->name);
444 /** Can't get here because of "breaks" above */
445 g_assert_not_reached();
448 dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gogkey_match: %s",key);
454 if (gogkey_match) delete_avpl(gogkey_match,TRUE);
462 static void analyze_pdu(mate_pdu* pdu) {
464 return a g_boolean to tell we've destroyed the pdu when the pdu is unnassigned
465 destroy the unassigned pdu
467 mate_cfg_gop* cfg = NULL;
468 mate_gop* gop = NULL;
470 gchar* orig_gop_key = NULL;
471 AVPL* candidate_start = NULL;
472 AVPL* candidate_stop = NULL;
473 AVPL* is_start = NULL;
474 AVPL* is_stop = NULL;
475 AVPL* gopkey_match = NULL;
476 LoAL* gog_keys = NULL;
477 AVPL* curr_gogkey = NULL;
479 AVPL* gogkey_match = NULL;
480 gchar* gogkey_str = NULL;
482 dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: %s",pdu->cfg->name);
484 if (! (cfg = (mate_cfg_gop *)g_hash_table_lookup(mc->gops_by_pduname,pdu->cfg->name)) )
487 if ((gopkey_match = new_avpl_exact_match("gop_key_match",pdu->avpl,cfg->key, TRUE))) {
488 gop_key = avpl_to_str(gopkey_match);
490 g_hash_table_lookup_extended(cfg->gop_index,(gconstpointer)gop_key,(gpointer *)&orig_gop_key,(gpointer *)&gop);
495 /* is the gop dead ? */
496 if ( ! gop->released &&
497 ( ( gop->cfg->lifetime > 0.0 && gop->time_to_die >= rd->now) ||
498 ( gop->cfg->idle_timeout > 0.0 && gop->time_to_timeout >= rd->now) ) ) {
499 dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: expiring released gop");
500 gop->released = TRUE;
502 if (gop->gog && gop->cfg->start) gop->gog->num_of_released_gops++;
505 /* TODO: is the gop expired? */
507 gop_key = orig_gop_key;
509 dbg_print (dbg_gop,2,dbg_facility,"analyze_pdu: got gop: %s",gop_key);
511 if (( candidate_start = cfg->start )) {
513 dbg_print (dbg_gop,2,dbg_facility,"analyze_pdu: got candidate start");
515 if (( is_start = new_avpl_exact_match("",pdu->avpl, candidate_start, FALSE) )) {
516 delete_avpl(is_start,FALSE);
517 if ( gop->released ) {
518 dbg_print (dbg_gop,3,dbg_facility,"analyze_pdu: start on released gop, let's create a new gop");
520 g_hash_table_remove(cfg->gop_index,gop_key);
522 gop = new_gop(cfg,pdu,gop_key);
523 g_hash_table_insert(cfg->gop_index,gop_key,gop);
525 dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: duplicate start on gop");
532 if (gop->last_pdu) gop->last_pdu->next = pdu;
535 pdu->time_in_gop = rd->now - gop->start_time;
537 if (gop->released) pdu->after_release = TRUE;
541 dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: no gop already");
543 if ( ! cfg->start ) {
544 /* there is no GopStart, we'll check for matching GogKeys
545 if we have one we'll create the Gop */
547 apply_extras(pdu->avpl,gopkey_match,cfg->extra);
549 gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,cfg->name);
553 while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) {
554 if (( gogkey_match = new_avpl_exact_match(cfg->name,gopkey_match,curr_gogkey,FALSE) )) {
555 gogkey_str = avpl_to_str(gogkey_match);
557 if (g_hash_table_lookup(cfg->gog_index,gogkey_str)) {
558 gop = new_gop(cfg,pdu,gop_key);
559 g_hash_table_insert(cfg->gop_index,gop_key,gop);
560 delete_avpl(gogkey_match,FALSE);
564 delete_avpl(gogkey_match,FALSE);
572 delete_avpl(gopkey_match,TRUE);
578 delete_avpl(gopkey_match,TRUE);
583 candidate_start = cfg->start;
585 if (( is_start = new_avpl_exact_match("",pdu->avpl, candidate_start, FALSE) )) {
586 delete_avpl(is_start,FALSE);
587 gop = new_gop(cfg,pdu,gop_key);
597 if (gop->last_pdu) gop->last_pdu->next = pdu;
601 pdu->time_in_gop = rd->now - gop->start_time;
604 gop->time_to_timeout = cfg->idle_timeout > 0.0 ? cfg->idle_timeout + rd->now : (float) -1.0 ;
606 dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: merge with key");
608 merge_avpl(gop->avpl,gopkey_match,TRUE);
609 delete_avpl(gopkey_match,TRUE);
611 dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: apply extras");
613 apply_extras(pdu->avpl,gop->avpl,gop->cfg->extra);
615 gop->last_time = pdu->rel_time;
617 if ( ! gop->released) {
618 candidate_stop = cfg->stop;
620 if (candidate_stop) {
621 is_stop = new_avpl_exact_match("",pdu->avpl, candidate_stop,FALSE);
623 is_stop = new_avpl("");
627 dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: is a `stop");
628 delete_avpl(is_stop,FALSE);
630 if (! gop->released) {
631 gop->released = TRUE;
632 gop->release_time = pdu->rel_time;
633 if (gop->gog && gop->cfg->start) gop->gog->num_of_released_gops++;
641 if (gop->last_n != gop->avpl->len) apply_transforms(gop->cfg->transforms,gop->avpl);
643 gop->last_n = gop->avpl->len;
652 dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: no match for this pdu");
658 static void get_pdu_fields(gpointer k, gpointer v, gpointer p) {
659 int hfid = *((int*) k);
660 gchar* name = (gchar*) v;
661 tmp_pdu_data* data = (tmp_pdu_data*) p;
665 mate_range* curr_range;
672 fis = proto_get_finfo_ptr_array(data->tree, hfid);
675 for (i = 0; i < fis->len; i++) {
676 fi = (field_info*) g_ptr_array_index(fis,i);
680 end = fi->start + fi->length;
682 dbg_print(dbg_pdu,5,dbg_facility,"get_pdu_fields: found field %i-%i",start,end);
684 for (j = 0; j < data->ranges->len; j++) {
686 curr_range = (mate_range*) g_ptr_array_index(data->ranges,j);
688 if (curr_range->end >= end && curr_range->start <= start) {
689 avp = new_avp_from_finfo(name, fi);
693 dbg_print(dbg_pdu,0,dbg_facility,"get_pdu_fields: got %s",s);
697 if (! insert_avp(data->pdu->avpl,avp) ) {
707 static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, proto_tree* tree) {
708 mate_pdu* pdu = (mate_pdu*)g_slice_new(mate_max_size);
712 mate_range* proto_range;
716 field_info* range_fi;
722 dbg_print (dbg_pdu,1,dbg_facility,"new_pdu: type=%s framenum=%i",cfg->name,framenum);
724 pdu->id = ++(cfg->last_id);
727 pdu->avpl = new_avpl(cfg->name);
729 pdu->frame = framenum;
730 pdu->next_in_frame = NULL;
731 pdu->rel_time = rd->now;
735 pdu->time_in_gop = -1.0f;
738 pdu->is_start = FALSE;
739 pdu->is_stop = FALSE;
740 pdu->after_release = FALSE;
742 data.ranges = g_ptr_array_new();
746 /* first we create the proto range */
747 proto_range = (mate_range *)g_malloc(sizeof(mate_range));
748 proto_range->start = proto->start;
749 proto_range->end = proto->start + proto->length;
750 g_ptr_array_add(data.ranges,proto_range);
752 dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: proto range %u-%u",proto_range->start,proto_range->end);
754 last_start = proto_range->start;
756 /* we move forward in the tranport */
757 for (i = cfg->transport_ranges->len; i--; ) {
758 hfid = *((int*)g_ptr_array_index(cfg->transport_ranges,i));
759 ptrs = proto_get_finfo_ptr_array(tree, hfid);
764 for (j=0; j < ptrs->len; j++) {
765 cfi = (field_info*) g_ptr_array_index(ptrs,j);
766 if (cfi->start < last_start && min_dist >= (last_start - cfi->start) ) {
768 min_dist = last_start - cfi->start;
773 range = (mate_range *)g_malloc(sizeof(*range));
774 range->start = range_fi->start;
775 range->end = range_fi->start + range_fi->length;
776 g_ptr_array_add(data.ranges,range);
778 last_start = range_fi->start;
780 dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: transport(%i) range %i-%i",hfid,range->start,range->end);
782 /* we missed a range */
783 dbg_print(dbg_pdu,6,dbg_facility,"new_pdu: transport(%i) missed",hfid);
789 if (cfg->payload_ranges) {
791 first_end = proto_range->end;
793 for (i = 0 ; i < cfg->payload_ranges->len; i++) {
794 hfid = *((int*)g_ptr_array_index(cfg->payload_ranges,i));
795 ptrs = proto_get_finfo_ptr_array(tree, hfid);
800 for (j=0; j < ptrs->len; j++) {
801 cfi = (field_info*) g_ptr_array_index(ptrs,j);
802 curr_end = cfi->start + cfi->length;
803 if (curr_end > first_end && min_dist >= (curr_end - first_end) ) {
805 min_dist = curr_end - first_end;
810 range = (mate_range *)g_malloc(sizeof(*range));
811 range->start = range_fi->start;
812 range->end = range_fi->start + range_fi->length;
813 g_ptr_array_add(data.ranges,range);
815 dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: payload(%i) range %i-%i",hfid,range->start,range->end);
817 /* we missed a range */
818 dbg_print(dbg_pdu,5,dbg_facility,"new_pdu: payload(%i) missed",hfid);
825 g_hash_table_foreach(cfg->hfids_attr,get_pdu_fields,&data);
827 apply_transforms(pdu->cfg->transforms,pdu->avpl);
829 g_ptr_array_free(data.ranges,TRUE);
835 extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree) {
840 AVPL* criterium_match;
842 mate_pdu* pdu = NULL;
843 mate_pdu* last = NULL;
845 rd->now = (float) nstime_to_sec(&pinfo->rel_ts);
847 if ( proto_tracking_interesting_fields(tree)
848 && rd->highest_analyzed_frame < pinfo->fd->num ) {
849 for ( i = 0; i < mc->pducfglist->len; i++ ) {
851 cfg = (mate_cfg_pdu *)g_ptr_array_index(mc->pducfglist,i);
853 dbg_print (dbg_pdu,4,dbg_facility,"mate_analyze_frame: trying to extract: %s",cfg->name);
854 protos = proto_get_finfo_ptr_array(tree, cfg->hfid_proto);
859 for (j = 0; j < protos->len; j++) {
861 dbg_print (dbg_pdu,3,dbg_facility,"mate_analyze_frame: found matching proto, extracting: %s",cfg->name);
863 proto = (field_info*) g_ptr_array_index(protos,j);
864 pdu = new_pdu(cfg, pinfo->fd->num, proto, tree);
866 if (cfg->criterium) {
867 criterium_match = new_avpl_from_match(cfg->criterium_match_mode,"",pdu->avpl,cfg->criterium,FALSE);
869 if (criterium_match) {
870 delete_avpl(criterium_match,FALSE);
873 if ( (criterium_match && cfg->criterium_accept_mode == REJECT_MODE )
874 || ( ! criterium_match && cfg->criterium_accept_mode == ACCEPT_MODE )) {
876 delete_avpl(pdu->avpl,TRUE);
877 g_slice_free(mate_max_size,(mate_max_size*)pdu);
886 if ( ! pdu->gop && cfg->drop_unassigned) {
887 delete_avpl(pdu->avpl,TRUE);
888 g_slice_free(mate_max_size,(mate_max_size*)pdu);
893 if ( cfg->discard ) {
894 delete_avpl(pdu->avpl,TRUE);
899 g_hash_table_insert(rd->frames,GINT_TO_POINTER(pinfo->fd->num),pdu);
902 last->next_in_frame = pdu;
908 if ( pdu && cfg->last_extracted ) break;
912 rd->highest_analyzed_frame = pinfo->fd->num;
916 extern mate_pdu* mate_get_pdus(guint32 framenum) {
919 return (mate_pdu*) g_hash_table_lookup(rd->frames,GUINT_TO_POINTER(framenum));