aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-03-19 00:36:42 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-03-19 00:36:42 +0000
commit529c65f713a781f5dd58a16d69503662e206850e (patch)
tree3c78a5ffa30a9c5c435c247a8274dc44a0a1fa89
parentd3120ba5075b04f1dcdcb98c758b4feef4833622 (diff)
downloadwireshark-529c65f713a781f5dd58a16d69503662e206850e.tar.gz
wireshark-529c65f713a781f5dd58a16d69503662e206850e.tar.bz2
wireshark-529c65f713a781f5dd58a16d69503662e206850e.zip
voip_calls.c:
- instead of wrongly using the h248 call counter use tapinfo's counter graph_analysis.c: - beautify the code (I was trying to the bug that got fixed by bzeroing m3ua tap data however this looks better!). svn path=/trunk/; revision=21063
-rw-r--r--gtk/graph_analysis.c90
-rw-r--r--gtk/voip_calls.c9
2 files changed, 24 insertions, 75 deletions
diff --git a/gtk/graph_analysis.c b/gtk/graph_analysis.c
index f5c9e1c421..3189b27adf 100644
--- a/gtk/graph_analysis.c
+++ b/gtk/graph_analysis.c
@@ -1654,96 +1654,46 @@ static void dialog_graph_create_window(graph_analysis_data_t* user_data)
* and Return -2 if the array is full
*/
/****************************************************************************/
-static gint is_node_array(graph_analysis_data_t* user_data, address* node)
-{
- int i;
- for (i=0; i<MAX_NUM_NODES; i++){
- if (user_data->nodes[i].type == AT_NONE) return -1; /* it is not in the array */
- if (ADDRESSES_EQUAL((&user_data->nodes[i]),node)) return i; /* it is in the array */
+static gint add_or_get_node(graph_analysis_data_t* user_data, address* node) {
+ guint i;
+
+ if (node->type == AT_NONE) return NODE_OVERFLOW;
+
+ for (i=0; i<MAX_NUM_NODES && i < user_data->num_nodes ; i++){
+ if ( CMP_ADDRESS(&(user_data->nodes[i]), node) == 0 ) return i; /* it is in the array */
+ }
+
+ if (i == MAX_NUM_NODES) {
+ return NODE_OVERFLOW;
+ } else {
+ user_data->num_nodes++;
+ COPY_ADDRESS(&(user_data->nodes[i]),node);
+ return i;
}
- return -2; /* array full */
}
-
/* Get the nodes from the list */
/****************************************************************************/
static void get_nodes(graph_analysis_data_t* user_data)
{
GList* list;
graph_analysis_item_t *gai;
- gint index;
/* fill the node array */
list = g_list_first(user_data->graph_info->list);
while (list)
{
gai = list->data;
- if (gai->display){
+ if (gai->display) {
user_data->num_items++;
if (!user_data->dlg.inverse) {
- /* check source node address */
- index = is_node_array(user_data, &(gai->src_addr));
- switch(index){
- case -2: /* array full */
- gai->src_node = NODE_OVERFLOW;
- break;
- case -1: /* not in array */
- COPY_ADDRESS(&(user_data->nodes[user_data->num_nodes]),&(gai->src_addr));
- gai->src_node = user_data->num_nodes;
- user_data->num_nodes++;
- break;
- default: /* it is in the array, just update the src_node */
- gai->src_node = (guint16)index;
- }
-
- /* check destination node address*/
- index = is_node_array(user_data, &(gai->dst_addr));
- switch(index){
- case -2: /* array full */
- gai->dst_node = NODE_OVERFLOW;
- break;
- case -1: /* not in array */
- COPY_ADDRESS(&(user_data->nodes[user_data->num_nodes]),&(gai->dst_addr));
- gai->dst_node = user_data->num_nodes;
- user_data->num_nodes++;
- break;
- default: /* it is in the array, just update the dst_node */
- gai->dst_node = (guint16)index;
- }
+ gai->src_node = (guint16)add_or_get_node(user_data, &(gai->src_addr));
+ gai->dst_node = (guint16)add_or_get_node(user_data, &(gai->dst_addr));
} else {
- /* check destination node address*/
- index = is_node_array(user_data, &(gai->dst_addr));
- switch(index){
- case -2: /* array full */
- gai->dst_node = NODE_OVERFLOW;
- break;
- case -1: /* not in array */
- COPY_ADDRESS(&(user_data->nodes[user_data->num_nodes]),&(gai->dst_addr));
- gai->dst_node = user_data->num_nodes;
- user_data->num_nodes++;
- break;
- default: /* it is in the array, just update the dst_node */
- gai->dst_node = (guint16)index;
- }
-
- /* check source node address */
- index = is_node_array(user_data, &(gai->src_addr));
- switch(index){
- case -2: /* array full */
- gai->src_node = NODE_OVERFLOW;
- break;
- case -1: /* not in array */
- COPY_ADDRESS(&(user_data->nodes[user_data->num_nodes]),&(gai->src_addr));
- gai->src_node = user_data->num_nodes;
- user_data->num_nodes++;
- break;
- default: /* it is in the array, just update the src_node */
- gai->src_node = (guint16)index;
- }
-
+ gai->dst_node = (guint16)add_or_get_node(user_data, &(gai->src_addr));
+ gai->src_node = (guint16)add_or_get_node(user_data, &(gai->dst_addr));
}
}
-
list = g_list_next(list);
}
}
diff --git a/gtk/voip_calls.c b/gtk/voip_calls.c
index 5f9ab6e872..66022ae02e 100644
--- a/gtk/voip_calls.c
+++ b/gtk/voip_calls.c
@@ -2724,7 +2724,6 @@ remove_tap_listener_actrace_calls(void)
/**************************** TAP for H248 **********************************/
static gboolean have_h248_tap_listener = FALSE;
-static guint16 h248_call_num = 0;
#define h248_is_req(type) ( type == H248_CMD_ADD_REQ || type == H248_CMD_MOVE_REQ || type == H248_CMD_MOD_REQ || \
type == H248_CMD_SUB_REQ || type == H248_CMD_AUDITCAP_REQ || type == H248_CMD_AUDITVAL_REQ || \
@@ -2788,7 +2787,7 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
COPY_ADDRESS(&(strinfo->initial_speaker), mgc);
strinfo->protocol = TEL_H248;
- strinfo->call_num = h248_call_num++;
+ strinfo->call_num = tapinfo->ncalls++;
strinfo->start_sec=pinfo->fd->rel_ts.secs;
strinfo->start_usec=pinfo->fd->rel_ts.nsecs;
strinfo->stop_sec=pinfo->fd->rel_ts.secs;
@@ -2825,7 +2824,9 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
++(tapinfo->npackets);
}
- add_to_graph(tapinfo, pinfo, cmd->str, "", strinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, cmd->str,
+ ep_strdup_printf("TrxId = %d, CtxId = %.8x",cmd->trx->id,cmd->ctx->id),
+ strinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
tapinfo->redraw = TRUE;
@@ -2853,8 +2854,6 @@ void h248_calls_init_tap(void)
have_h248_tap_listener=TRUE;
}
-
- h248_call_num = 0;
}
void