Fixes for Mate from Luis Ontanon:
authorlroland <lroland@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 23 Dec 2004 08:27:30 +0000 (08:27 +0000)
committerlroland <lroland@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 23 Dec 2004 08:27:30 +0000 (08:27 +0000)
- fixes crash at reinit when DiscardPduData=TRUE: check if there's an
avpl before deleting it.
- mate.pdu_type.RelativeTime had a dual use, add
mate.pdu_type.TimeInGop and leave the other alone.
- other fixes related to times (they now seem to be right)
- scs_subscribe doesn't use g_malloc anymore. it uses GMemChunks
(I had to rename two GMemChunks to make MSVC happy)
- fixes crash at reinit when DiscardPduData=TRUE: check if there's an
avpl before deleting it.
- mate.pdu_type.RelativeTime had a dual use, add
mate.pdu_type.TimeInGop and leave the other alone.
- other fixes related to times (they now seem to be right)
- fixed few things at reinit:
     - reset last_id
     - remove the nodes in the items hash tables

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12820 f5534014-38df-0310-8fa8-9805f1628bb7

plugins/mate/mate.h
plugins/mate/mate_runtime.c
plugins/mate/mate_setup.c
plugins/mate/mate_util.c
plugins/mate/mate_util.h
plugins/mate/matelib/isup.mate
plugins/mate/matelib/radius.mate
plugins/mate/moduleinfo.h
plugins/mate/packet-mate.c

index a6a2d9d3d75141a4989edc8481d3b0bb5a2bd28a..0a4a3665a22266bb9a19a7dc02f5b5cbcf16881a 100644 (file)
@@ -168,6 +168,7 @@ typedef struct _mate_cfg_item {
        avpl_match_mode criterium_match_mode;
        AVPL* criterium; /* must match to be created */
        int hfid_pdu_rel_time;
+       int hfid_pdu_time_in_gop;
        
        /* gop */
        AVPL* start; /* start candidate avpl */
@@ -252,11 +253,7 @@ struct _mate_item {
        mate_cfg_item* cfg; /* the type of this item */
 
        AVPL* avpl; /* the attributes of the pdu/gop/gog */
-       
-       /* these two have different uses in pdu and gop/gog */
-       gint start; /* start of the pdu in the tvb / framenum of the start of a gop */
-       gint end;  /* end of the pdu in the tvb / framenum of the stop of a gop */
-       
+               
        mate_item* next; /* in pdu: next in gop; in gop: next in gog; in gog this doesn't make any sense yet */
        
        /* union _payload { */
@@ -267,14 +264,14 @@ struct _mate_item {
                        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 */
-                       float rel_time; /* time since gop start if in gop or start of capture if unassigned */
+                       float rel_time; /* time since start of capture  */
+                       float time_in_gop; /* time since gop start */
                        mate_pdu* next_in_frame; /* points to the next pdu in this frame */
                /* } pdu; */
                
                /* struct _gop { */
                        mate_gog* gog; /* the gog of a gop */
                        mate_pdu* pdus; /* pdus that belong to a gop (NULL in gog) */
-                       float expiration; /* when will it expire once released? */
                        gboolean released; /* has this gop been released? */
                        int num_of_pdus; /* how many gops a gog has? */
                        int num_of_after_release_pdus;  /* how many pdus have arrived since it's been released */
@@ -287,6 +284,7 @@ struct _mate_item {
                
                /* struct _gog { */
                        mate_gop* gops; /* gops that belong to a gog (NULL in gop) */
+                       float expiration; /* when will it expire once released? */
                        int num_of_gops; /* how many gops a gog has? */
                        int num_of_released_gops;  /* how many of them have already been released */
                        guint last_n; /* the number of attributes the avpl had the last time we checked */
index cbe70c1c2d7a4c80d45ef4d9d15851e82671bd47..10a6dd2f6f43a9b8b3985bddfe23ca69aecc4f4d 100644 (file)
@@ -67,13 +67,14 @@ static gboolean destroy_mate_items(gpointer k _U_, gpointer v, gpointer p _U_) {
        
        if (mi->gop_key) g_free(mi->gop_key);
        if (mi->gog_keys) g_ptr_array_free (mi->gog_keys,TRUE);
-       delete_avpl(mi->avpl,TRUE);
-       
+       if (mi->avpl) delete_avpl(mi->avpl,TRUE);
        return TRUE;
 }
 
 static gboolean destroy_items_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) {
        g_hash_table_foreach_remove(((mate_cfg_item*)v)->items,destroy_mate_items,NULL);
+       ((mate_cfg_item*)v)->last_id = 0;
+       return TRUE;
 }
 
 static void delete_mate_runtime_data(mate_runtime_data*  rdat) {       
@@ -113,11 +114,10 @@ extern void initialize_mate_runtime(void) {
                /* this will be called when the mate's dissector is initialized */
                dbg_print (dbg,5,dbg_facility,"initialize_mate: entering");
 
-
                dbg_pdu = &(mc->dbg_pdu_lvl);
                dbg_gop = &(mc->dbg_gop_lvl);
                dbg_gog = &(mc->dbg_gog_lvl);
-
+               
        } else {
                rd = NULL;
        }
@@ -131,8 +131,6 @@ static mate_item* new_mate_item(mate_cfg_item* cfg) {
        
        it->id = cfg->last_id;
        it->avpl  = NULL ;
-       it->start  = 0 ;
-       it->end  = 0 ;
        it->frame  = 0 ;
        it->next  = NULL ;
        it->released  = FALSE ;
@@ -150,22 +148,22 @@ static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, guint8* key) {
 
        dbg_print (dbg_gop,1,dbg_facility,"new_gop: %s: ``%s:%d''",gop->cfg->name,gop->id,key);
        
-       gop->avpl = new_avpl("attributes");
+       gop->avpl = new_avpl(cfg->name);
        
        gop->gog = NULL;
        gop->pdus = pdu;
        gop->last_pdu = pdu;
        gop->gop_key = key;
        gop->next = NULL;
-       gop->start_time = pdu->rel_time;
+       gop->start_time = rd->now;
        gop->release_time = 0.0;
        gop->last_time = 0.0;
        
        pdu->gop = gop;
        pdu->next = NULL;
        pdu->is_start = TRUE;
-       pdu->rel_time = 0.0;
-               
+       pdu->time_in_gop = 0.0;
+       
        return gop;
 }
 
@@ -394,14 +392,11 @@ static void analize_pdu(mate_pdu* pdu) {
        
        if (!cfg) return;
        
-
-       
        candidate_gop_key_match = cfg->key;
        
        if (! candidate_gop_key_match) return;
-       avpl_str = avpl_to_str(candidate_gop_key_match);
-       dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: got candidate key: %s\n",avpl_str);
-       g_free(avpl_str);
+       
+       dbg_print (dbg_gop,3,dbg_facility,"analize_pdu: got candidate key\n");
        
        gopkey_match = new_avpl_exact_match("",pdu->avpl,candidate_gop_key_match, TRUE);
        
@@ -411,16 +406,12 @@ static void analize_pdu(mate_pdu* pdu) {
                candidate_start = cfg->start;
                
                if (candidate_start) {
-                       avpl_str = avpl_to_str(candidate_start);
-                       dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: got candidate start: %s\n",avpl_str);
-                       g_free(avpl_str);
+                       dbg_print (dbg_gop,2,dbg_facility,"analize_pdu: got candidate start\n");
                        is_start = new_avpl_exact_match("",pdu->avpl, candidate_start, FALSE);
                }
                
                if (is_start) {
-                       avpl_str = avpl_to_str(is_start);
-                       dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: got start match: %s\n",avpl_str);
-                       g_free(avpl_str);
+                       dbg_print (dbg_gop,2,dbg_facility,"analize_pdu: got start match\n");
                        delete_avpl(is_start,FALSE);    
                }
                
@@ -431,13 +422,10 @@ static void analize_pdu(mate_pdu* pdu) {
                        
                        gop_key = orig_gop_key;
                        
-                       dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: got gop: %s\n",gop_key);
+                       dbg_print (dbg_gop,2,dbg_facility,"analize_pdu: got gop: %s\n",gop_key);
                        
                        if (is_start) {
                                if ( gop->released ) {
-                                       
-                                       dbg_print (dbg_gop,1,dbg_facility,"analize_pdu: new gop on released key before key expiration\n");
-
                                        g_hash_table_remove(rd->gops,gop_key);
                                        gop = new_gop(cfg,pdu,gop_key);
                                        g_hash_table_insert(rd->gops,gop_key,gop);
@@ -452,7 +440,8 @@ static void analize_pdu(mate_pdu* pdu) {
                        if (gop->last_pdu) gop->last_pdu->next = pdu;
                        gop->last_pdu = pdu;
                        pdu->next = NULL;
-                       pdu->rel_time -= gop->start_time;
+                       pdu->time_in_gop = rd->now - gop->start_time;
+                       
                        if (gop->released) pdu->after_release = TRUE;
                        
                } else {
@@ -599,7 +588,6 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto,
        dbg_print (dbg_pdu,2,dbg_facility,"new_pdu: type=%s framenum=%i\n",cfg->name,framenum);
                
        pdu->avpl = new_avpl(cfg->name);
-       pdu->cfg = cfg;
        pdu->gop = NULL;
        pdu->next_in_frame = NULL;
        pdu->next = NULL;
@@ -607,10 +595,9 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto,
        pdu->is_start = FALSE;
        pdu->is_stop = FALSE;
        pdu->after_release = FALSE;
-       pdu->start = proto->start;
-       pdu->end = pdu->start + proto->length;
        pdu->frame = framenum;
        pdu->rel_time = rd->now;
+       pdu->time_in_gop = -1.0;
        
        data.ranges = g_ptr_array_new();
        data.pdu  = pdu;
@@ -618,8 +605,8 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto,
        
        /* first we create the proto range */
        proto_range = g_malloc(sizeof(mate_range));
-       proto_range->start = pdu->start;
-       proto_range->end = pdu->end;
+       proto_range->start = proto->start;
+       proto_range->end = proto->start + proto->length;
        g_ptr_array_add(data.ranges,proto_range);
        
        dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: proto range %u-%u\n",proto_range->start,proto_range->end);
@@ -651,8 +638,8 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto,
                                
                                dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: transport(%i) range %i-%i\n",hfid,range->start,range->end);
                        } else {
-                               
-                               /* what do I do if I miss a range? */
+                               /* what to do if we miss a range? */
+                               g_warning("mate: missed a range");
                        }
                        
                }
@@ -667,6 +654,12 @@ 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;
+}
+
+static void delete_mate_pdu(mate_pdu* pdu) {
+       if (pdu->avpl) delete_avpl(pdu->avpl,TRUE);
+       g_mem_chunk_free(rd->mate_items,pdu);   
 }
 
 extern void analyze_frame(packet_info *pinfo, proto_tree* tree) {
@@ -706,9 +699,9 @@ extern void analyze_frame(packet_info *pinfo, proto_tree* tree) {
                                                        delete_avpl(criterium_match,FALSE);
                                                }
                                                
-                                               if ( (criterium_match && cfg->criterium->name == mc->reject ) || ( ! criterium_match && cfg->criterium->name == mc->accept )) {
-                                                       delete_avpl(pdu->avpl,TRUE);
-                                                       g_mem_chunk_free(rd->mate_items,pdu);
+                                               if ( (criterium_match && cfg->criterium->name == mc->reject ) 
+                                                        || ( ! criterium_match && cfg->criterium->name == mc->accept )) {
+                                                       delete_mate_pdu(pdu);
                                                        pdu = NULL;
                                                        continue;
                                                }
index 004dbecac692f31d46d63138c290fb15d9eeb875..accbfe8708acadb4cd33b39e65a07fab30716648 100644 (file)
@@ -126,6 +126,7 @@ static mate_cfg_item* new_mate_cfg_item(guint8* name) {
 
        new->hfid = -1;
        new->hfid_pdu_rel_time = -1;
+       new->hfid_pdu_time_in_gop = -1;
        new->my_hfids = g_hash_table_new(g_str_hash,g_str_equal);
        new->items = g_hash_table_new(g_direct_hash,g_direct_equal);
 
@@ -1188,16 +1189,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_DEC;
-       hfri.hfinfo.blurb = "Seconds passed since the start of the GOP or capture if the PDU is unnassigned";
-
+       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 begining of Gop",cfg->name);
+       hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.TimeInGop",cfg->name);
+       hfri.hfinfo.type = FT_FLOAT;
+       hfri.hfinfo.display = BASE_DEC;
+       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;
@@ -1242,7 +1252,7 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p _U_) {
        g_array_append_val(matecfg->hfrs,hfri);
 
        hfri.p_id = &(cfg->hfid_gop_last_time);
-       hfri.hfinfo.name = g_strdup_printf("%s current time",cfg->name);
+       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);
 
index a508b593e6d2e5c2c5673e686438617159952b50..14c3658f8ca1d80143d2e84552b1b2767fe36496 100644 (file)
@@ -95,15 +95,51 @@ void dbg_print(const guint* which, guint how, FILE* where, guint8* fmt, ... ) {
  *
  *  Initializes the scs hash.
  **/
+/* Don't call variables "small" or "huge". They are keywords for the MSVC compiler. Rename them to "mate_small" and "mate_huge"*/
+struct _scs_collection {
+       GHashTable* hash;       /* key: a string value: guint number of subscribers */
+       GMemChunk* ctrs;
+       GMemChunk* mate_small;  
+       GMemChunk* medium;
+       GMemChunk* large;
+       GMemChunk* mate_huge;
+       guint8* buf;
+};
+
+extern void destroy_scs_collection(SCS_collection* c) {
+       if ( c->ctrs ) g_mem_chunk_destroy(c->ctrs);
+       if ( c->mate_small ) g_mem_chunk_destroy(c->mate_small);
+       if ( c->medium ) g_mem_chunk_destroy(c->medium);
+       if ( c->large ) g_mem_chunk_destroy(c->large);
+       if ( c->mate_huge ) g_mem_chunk_destroy(c->mate_huge);
+       
+       if (c->hash) g_hash_table_destroy(c->hash);
+}
 
-void scs_init(GHashTable** hash) {
-       /* key: a string
-        value: guint number of subscribers */
-
-       if (*hash) g_hash_table_destroy(*hash);
-
-       *hash =  g_hash_table_new_full(g_str_hash,g_str_equal,g_free,g_free);
+extern SCS_collection* scs_init(void) {
+       SCS_collection* c = g_malloc(sizeof(SCS_collection));
 
+       c->hash =  g_hash_table_new(g_str_hash,g_str_equal);
+       
+       c->ctrs = g_mem_chunk_new("ints_scs_chunk", sizeof(guint),
+                                                          sizeof(guint) * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
+       
+       c->mate_small = g_mem_chunk_new("small_scs_chunk", SCS_SMALL_SIZE,
+                                                          SCS_SMALL_SIZE * SCS_SMALL_CHUNK_SIZE, G_ALLOC_AND_FREE);
+       
+       c->medium = g_mem_chunk_new("medium_scs_chunk", SCS_MEDIUM_SIZE,
+                                                          SCS_MEDIUM_SIZE * SCS_MEDIUM_CHUNK_SIZE, G_ALLOC_AND_FREE);
+       
+       c->large = g_mem_chunk_new("large_scs_chunk", SCS_LARGE_SIZE,
+                                                          SCS_LARGE_SIZE * SCS_LARGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
+       
+       c->mate_huge = g_mem_chunk_new("huge_scs_chunk", SCS_HUGE_SIZE,
+                                                          SCS_HUGE_SIZE * SCS_HUGE_CHUNK_SIZE, G_ALLOC_AND_FREE);
+       
+       c->buf =  g_mem_chunk_alloc0(c->mate_huge);
+       
+       return c;
 }
 
 
@@ -119,23 +155,45 @@ void scs_init(GHashTable** hash) {
  *
  * Return value: a pointer to the subscribed string.
  **/
-guint8* scs_subscribe(GHashTable* collection, guint8* s) {
-       guint8* ok = NULL;
+guint8* scs_subscribe(SCS_collection* c, guint8* s) {
+       guint8* orig = NULL;
        guint* ip = NULL;
-
-       g_hash_table_lookup_extended(collection,s,(gpointer*)&ok,(gpointer*)&ip);
+       size_t len = 0;
+       guint8* new = NULL;
+       GMemChunk* chunk = NULL;
+       
+       g_hash_table_lookup_extended(c->hash,s,(gpointer*)&orig,(gpointer*)&ip);
 
        if (ip) {
                (*ip)++;
-               s = ok;
+               new = orig;
        } else {
-               ip = g_malloc(sizeof(int));
+               ip = g_mem_chunk_alloc(c->ctrs);
                *ip = 0;
-               s = g_strdup(s);
-               g_hash_table_insert(collection,s,ip);
+               
+               len = strlen(s) + 1;
+               if (len <= SCS_SMALL_SIZE) {
+                       chunk = c->mate_small;
+               } else if (len <= SCS_MEDIUM_SIZE) {
+                       chunk = c->medium;
+               } else if (len <= SCS_LARGE_SIZE) {
+                       chunk = c->large;
+               } else if (len < SCS_HUGE_SIZE) {
+                       chunk = c->mate_huge;
+               } else {
+                       chunk = c->mate_huge;
+                       len = SCS_HUGE_SIZE;
+                       g_warning("mate SCS: string truncated to huge size");
+               }
+               
+               --len;
+               new = g_mem_chunk_alloc(chunk);
+               strncpy(new,s,len);
+               
+               g_hash_table_insert(c->hash,new,ip);
        }
 
-       return s;
+       return new;
 }
 
 /**
@@ -146,14 +204,33 @@ guint8* scs_subscribe(GHashTable* collection, guint8* s) {
  * decreases the count of subscribers, if zero frees the internal copy of
  * the string.
  **/
-void scs_unsubscribe(GHashTable* collection, guint8* s) {
-       guint8* ok = NULL;
+void scs_unsubscribe(SCS_collection* c, guint8* s) {
+       guint8* orig = NULL;
        guint* ip = NULL;
-
-       g_hash_table_lookup_extended(collection,s,(gpointer*)&ok,(gpointer*)&ip);
+       size_t len = 0xffff;
+       GMemChunk* chunk = NULL;
+       
+       g_hash_table_lookup_extended(c->hash,s,(gpointer*)&orig,(gpointer*)&ip);
 
        if (ip) {
-               if (*ip == 0) g_hash_table_remove(collection,ok);
+               if (*ip == 0) {
+                       g_hash_table_remove(c->hash,orig);
+                       
+                       len = strlen(orig);
+                       
+                       if (len < SCS_SMALL_SIZE) {
+                               chunk = c->mate_small;
+                       } else if (len < SCS_MEDIUM_SIZE) {
+                               chunk = c->medium;
+                       } else if (len < SCS_LARGE_SIZE) {
+                               chunk = c->large;
+                       } else {
+                               chunk = c->mate_huge;
+                       } 
+                       
+                       g_mem_chunk_free(chunk,orig);
+                       g_mem_chunk_free(c->ctrs,ip);
+               }
                else (*ip)--;
        } else {
                g_warning("unsusbcribe: already deleted: '%s'?",s);
@@ -169,29 +246,14 @@ void scs_unsubscribe(GHashTable* collection, guint8* s) {
  * Return value: the stored copy of the formated string.
  *
  **/
-extern guint8* scs_subscribe_printf(GHashTable* collection, guint8* fmt, ...) {
+extern guint8* scs_subscribe_printf(SCS_collection* c, guint8* fmt, ...) {
        va_list list;
-       guint8* ok = NULL;
-       guint8* s = NULL;
-       guint* ip = NULL;
 
        va_start( list, fmt );
-       s = g_strdup_vprintf(fmt, list);
+       g_vsnprintf(c->buf, SCS_HUGE_SIZE-1 ,fmt, list);
        va_end( list );
 
-       g_hash_table_lookup_extended(collection,s,(gpointer*)&ok,(gpointer*)&ip);
-
-       if (ip) {
-               (*ip)++;
-               g_free(s);
-               s = ok;
-       } else {
-               ip = g_malloc0(sizeof(int));
-               *ip = 0;
-               g_hash_table_insert(collection,s,ip);
-       }
-
-       return s;
+       return scs_subscribe(c,c->buf);
 }
 
 
@@ -217,7 +279,7 @@ typedef union _any_avp_type {
 
 
 static GMemChunk* avp_chunk = NULL;
-static GHashTable* avp_strings = NULL;
+static SCS_collection* avp_strings = NULL;
 
 #ifdef _AVP_DEBUGGING
 static FILE* dbg_fp = NULL;
@@ -269,7 +331,7 @@ extern void setup_avp_debug(FILE* fp, int* general, int* avp, int* avp_op, int*
  **/
 extern void avp_init(void) {
 
-       scs_init(&avp_strings);
+       avp_strings = scs_init();
 
 
        if ( avp_chunk ) {
@@ -893,6 +955,7 @@ extern AVPL* new_avpl_from_avpl(guint8* name, AVPL* avpl, gboolean copy_avps) {
 
 /* BROKEN, makes no sense right now */
 /* FIXME: Use subscribe/unsubscribe */
+#if 0
 static AVP* avp_transform(AVP* src, AVP* op) {
        unsigned int i;
        guint8 c;
@@ -985,7 +1048,7 @@ static AVP* avp_transform(AVP* src, AVP* op) {
        return src;
 }
 
-
+#endif
 
 /**
 * match_avp:
index 454b6620eba3b6683bf68bc7149a3f317710aaf2..3c9ee9c253a95d4666f1be37886996102feb3699 100644 (file)
@@ -42,11 +42,23 @@ extern void dbg_print(const guint* which, guint how, FILE* where, guint8* fmt, .
 
 
 /******* single copy strings *********/
-
-extern void scs_init(GHashTable** hash);
-extern guint8* scs_subscribe(GHashTable* collection, guint8* s);
-extern void scs_unsubscribe(GHashTable* collection, guint8* s);
-extern guint8* scs_subscribe_printf(GHashTable* collection, guint8* fmt, ...);
+typedef struct _scs_collection SCS_collection;
+
+#define SCS_SMALL_SIZE 16
+#define SCS_MEDIUM_SIZE 256
+#define SCS_LARGE_SIZE 4096
+#define SCS_HUGE_SIZE 65536
+
+#define SCS_SMALL_CHUNK_SIZE 4096
+#define SCS_MEDIUM_CHUNK_SIZE 1024
+#define SCS_LARGE_CHUNK_SIZE 256
+#define SCS_HUGE_CHUNK_SIZE 128
+
+extern void destroy_scs_collection(SCS_collection* c);
+extern SCS_collection* scs_init(void);
+extern guint8* scs_subscribe(SCS_collection* collection, guint8* s);
+extern void scs_unsubscribe(SCS_collection* collection, guint8* s);
+extern guint8* scs_subscribe_printf(SCS_collection* collection, guint8* fmt, ...);
 
 /******* AVPs & Co. *********/
 #define AVP_CHUNK_SIZE 4096
index d7bafa497b7fc5024c4703f0ff882b9bf25c10e6..7b3d400809615594c07e8ca2fada6acc34ad4e24 100644 (file)
@@ -1,25 +1,23 @@
 # isup.mate
 # $Id$
 
-
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=1;              .isup_IAM=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=2;              .isup_SAM=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=3;              .isup_INR=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=4;              .isup_INF=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=5;              .isup_COT=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=6;              .isup_ACM=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=7;              .isup_CON=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=8;              .isup_FOT=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=9;              .isup_ANM=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=12;             .isup_REL=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=13;             .isup_SUS=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=14;             .isup_RES=;
-Action=Transform;  Name=isup_msg_type; Mode=Insert; Match=Strict;     isup_msg=16;             .isup_RLC=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=1;              .isup_IAM=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=2;              .isup_SAM=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=3;              .isup_INR=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=4;              .isup_INF=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=5;              .isup_COT=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=6;              .isup_ACM=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=7;              .isup_CON=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=8;              .isup_FOT=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=9;              .isup_ANM=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=12;             .isup_REL=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=13;             .isup_SUS=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=14;             .isup_RES=;
+#Action=Transform;  Name=isup_msg_type;        Mode=Insert; Match=Strict;     isup_msg=16;             .isup_RLC=;
 
 Action=PduDef; Name=isup_pdu; Proto=isup; Transport=mtp3; mtp3pc=mtp3.dpc; mtp3pc=mtp3.opc; cic=isup.cic; isup_msg=isup.message_type;
-Action=PduTransform; For=isup_pdu; Name=isup_msg_type;
+#Action=PduTransform; For=isup_pdu; Name=isup_msg_type;
 
 Action=GopDef; Name=isup_leg; On=isup_pdu; ShowPduTree=TRUE; mtp3pc; mtp3pc; cic;
-Action=GopStart; For=isup_leg; isup_IAM;
-Action=GopStop; For=isup_leg; isup_RLC;
-
+Action=GopStart; For=isup_leg; isup_msg=1;
+Action=GopStop; For=isup_leg; isup_msg=16;
index 851717557d785f33769b7694123cec86259c1ce6..3f69b56ed553e4dbd8ea97fa5179927072f65edc 100644 (file)
@@ -1,7 +1,13 @@
 # radius.mate
 # $Id$
 
+Action=Transform; Name=radius_same_port; Mode=Insert; Match=Strict; radius_port; radius_port;
+Action=Transform; Name=radius_same_port; Mode=Insert; Match=Every; radius_port; .radius_port=0;
+
 Action=PduDef; Name=radius_pdu; Proto=radius; Transport=udp/ip; radius_addr=ip.addr; radius_port=udp.port; radius_id=radius.id; radius_code=radius.code;
-Action=GopDef; Name=radius_req; On=radius_pdu; radius_id; radius_addr; radius_addr;
+Action=PduTransform; For=radius_pdu; Name=radius_same_port;
+
+Action=GopDef; Name=radius_req; On=radius_pdu; radius_id; radius_addr; radius_addr; radius_port; radius_port;
 Action=GopStart; For=radius_req; radius_code|1|4|7;
 Action=GopStop; For=radius_req; radius_code|2|3|5|8|9;
+
index 569556f83d7f25c01ae4d720a890a3bcce494c43..2e233de7cd8e2f6f6c2911de156d42e831fbb1c3 100644 (file)
@@ -12,5 +12,5 @@
 #endif
 
 /* Version number of package */
-#define VERSION "0.0.3"
+#define VERSION "0.0.3.1"
 
index 2d28f53888f196b9c6ec2bf98e37cd81b3371d4f..ce070730c6e05a47ce6ffd78f3ab9cb2d7e04899 100644 (file)
@@ -122,12 +122,10 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
                proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_start_time, tvb, 0, 0, gop->start_time);
                
                if (gop->released) { 
-                       proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_stop_time, tvb, 0, 0, gop->release_time);
-                       if (gop->release_time != gop->last_time) {
-                               proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_last_time, tvb, 0, 0, gop->last_time); 
-                       }
+                       proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_stop_time, tvb, 0, 0, gop->release_time - gop->start_time);
+                       proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_last_time, tvb, 0, 0, gop->last_time - gop->start_time); 
                } else {
-                       proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_last_time, tvb, 0, 0, gop->last_time); 
+                       proto_tree_add_float(gop_time_tree, gop->cfg->hfid_gop_last_time, tvb, 0, 0, gop->last_time - gop->start_time); 
                }
        }
 
@@ -148,26 +146,26 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
                                                                                   tvb,0,0,gop_pdus->frame,
                                                                                   "Stop PDU: in frame %i (%f : %f)",
                                                                                   gop_pdus->frame,
-                                                                                  gop_pdus->rel_time,
-                                                                                  gop_pdus->rel_time-rel_time);
+                                                                                  gop_pdus->time_in_gop,
+                                                                                  gop_pdus->time_in_gop-rel_time);
                                
                        } 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->rel_time,
-                                                                                  gop_pdus->rel_time-rel_time);
+                                                                                  gop_pdus->time_in_gop,
+                                                                                  gop_pdus->time_in_gop-rel_time);
                        } 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->rel_time,
-                                                                                  gop_pdus->rel_time-rel_time);
+                                                                                  gop_pdus->time_in_gop,
+                                                                                  gop_pdus->time_in_gop-rel_time);
                        }
                        
-                       rel_time = gop_pdus->rel_time;
+                       rel_time = gop_pdus->time_in_gop;
                        
                }
        }
@@ -177,7 +175,6 @@ void mate_gop_tree(proto_tree* tree, tvbuff_t *tvb, mate_gop* gop) {
 void mate_pdu_tree(mate_pdu *pdu, tvbuff_t *tvb, proto_tree* tree) {
        proto_item *pdu_item;
        proto_tree *pdu_tree;
-       guint32 len;
        
        if ( ! pdu ) return;
        
@@ -194,12 +191,12 @@ void mate_pdu_tree(mate_pdu *pdu, tvbuff_t *tvb, proto_tree* tree) {
                proto_item_append_text(mate_i," %s:%d",pdu->cfg->name,pdu->id);
        }
        
-       len = pdu->end - pdu->start;
-       pdu_item = proto_tree_add_uint(tree,pdu->cfg->hfid,tvb,pdu->start,len,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);           
 
        if (pdu->gop) {
+               proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_time_in_gop, tvb, 0, 0, pdu->time_in_gop);             
                mate_gop_tree(pdu_tree,tvb,pdu->gop);
 
                if (pdu->gop->gog)
@@ -220,13 +217,10 @@ extern void mate_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
        analyze_frame(pinfo,tree);
 
        if (( pdus = mate_get_pdus(pinfo->fd->num) )) {
-               
-               mate_i = proto_tree_add_text(tree,tvb,0,0,"mate");
-               
-               mate_t = proto_item_add_subtree(mate_i, mc->ett_root);
-               
                for ( ; pdus; pdus = pdus->next_in_frame) {
-                       mate_pdu_tree(pdus,tvb,mate_t);                 
+                       mate_i = proto_tree_add_text(tree,tvb,0,0,"mate");
+                       mate_t = proto_item_add_subtree(mate_i, mc->ett_root);                  
+                       mate_pdu_tree(pdus,tvb,mate_t);
                }
        }
 }