From Irene Ruengeler: Fix TSN handling in graphs.
svn path=/trunk/; revision=21894
This commit is contained in:
parent
ddb6768db2
commit
ab125d0d43
|
@ -349,8 +349,7 @@ void
|
|||
sctp_set_filter (GtkButton *button _U_, struct sctp_analyse* u_data)
|
||||
{
|
||||
gchar *f_string = NULL;
|
||||
guint32 framenumber=0;
|
||||
GList *list, *srclist, *dstlist;
|
||||
GList *srclist, *dstlist;
|
||||
gchar *str=NULL;
|
||||
GString *gstring=NULL;
|
||||
struct sockaddr_in *infosrc=NULL;
|
||||
|
@ -358,107 +357,87 @@ sctp_set_filter (GtkButton *button _U_, struct sctp_analyse* u_data)
|
|||
sctp_assoc_info_t *selected_stream;
|
||||
gchar *filter_string = NULL;
|
||||
selected_stream=u_data->assoc;
|
||||
|
||||
if (selected_stream->n_packets > 8)
|
||||
{
|
||||
if (selected_stream->check_address==FALSE)
|
||||
{
|
||||
f_string = g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) || "
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || sctp.shutdown_complete_t_bit==1)))) ||"
|
||||
"(sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) ||"
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || sctp.shutdown_complete_t_bit==1)))))",
|
||||
selected_stream->port1,
|
||||
selected_stream->port2,
|
||||
selected_stream->verification_tag1,
|
||||
/*selected_stream->verification_tag2,*/
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->port2,
|
||||
selected_stream->port1,
|
||||
selected_stream->verification_tag2,
|
||||
/*selected_stream->verification_tag1,*/
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag1);
|
||||
filter_string = f_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
gstring = g_string_new(g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && (ip.src==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr))));
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str = g_strdup_printf(")) || (sctp.dstport==%u && sctp.srcport==%u && (ip.dst==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
str = g_strdup_printf(")))");
|
||||
g_string_append(gstring, str);
|
||||
filter_string = gstring->str;
|
||||
g_string_free(gstring,FALSE);
|
||||
}
|
||||
|
||||
if (selected_stream->check_address==FALSE)
|
||||
{
|
||||
f_string = g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) || "
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || sctp.shutdown_complete_t_bit==1)))) ||"
|
||||
"(sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) ||"
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || sctp.shutdown_complete_t_bit==1)))))",
|
||||
selected_stream->port1,
|
||||
selected_stream->port2,
|
||||
selected_stream->verification_tag1,
|
||||
/*selected_stream->verification_tag2,*/
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->port2,
|
||||
selected_stream->port1,
|
||||
selected_stream->verification_tag2,
|
||||
/*selected_stream->verification_tag1,*/
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag1);
|
||||
filter_string = f_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("else\n");
|
||||
list = g_list_first(selected_stream->frame_numbers);
|
||||
framenumber = *((guint32 *)(list->data));
|
||||
gstring = g_string_new(g_strdup_printf("frame.number==%u",framenumber));
|
||||
list = g_list_next(list);
|
||||
while (list)
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
gstring = g_string_new(g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && (ip.src==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr))));
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
framenumber = *((guint32 *)(list->data));
|
||||
str =g_strdup_printf(" || frame.number==%u",framenumber);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
list = g_list_next(list);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str = g_strdup_printf(")) || (sctp.dstport==%u && sctp.srcport==%u && (ip.dst==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
str = g_strdup_printf(")))");
|
||||
g_string_append(gstring, str);
|
||||
filter_string = gstring->str;
|
||||
g_string_free(gstring,FALSE);
|
||||
}
|
||||
|
|
|
@ -1061,7 +1061,7 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda
|
|||
}
|
||||
else
|
||||
{
|
||||
x_value = ((event->x-LEFT_BORDER-u_data->io->offset) * ((u_data->io->x2_tmp_sec+u_data->io->x2_tmp_usec/1000000.0)-(u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0)) / (u_data->io->pixmap_width-LEFT_BORDER-u_data->io->offset))+u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0;
|
||||
x_value = ((event->x-LEFT_BORDER-u_data->io->offset) * ((u_data->io->x2_tmp_sec+u_data->io->x2_tmp_usec/1000000.0)-(u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0)) / (u_data->io->pixmap_width-LEFT_BORDER-RIGHT_BORDER-u_data->io->offset))+u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0;
|
||||
y_value = (guint32) floor((u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-event->y) * (max_tsn - min_tsn) / (u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset)) + min_tsn;
|
||||
text_color = u_data->io->draw_area->style->black_gc;
|
||||
|
||||
|
|
|
@ -363,8 +363,8 @@ static void sctp_graph_draw(struct sctp_udata *u_data)
|
|||
}
|
||||
else
|
||||
{
|
||||
u_data->io->min_x=((guint32)(u_data->io->x1_tmp_sec*1000000.0))+u_data->io->x1_tmp_usec;
|
||||
u_data->io->max_x=((guint32)(u_data->io->x2_tmp_sec*1000000.0))+u_data->io->x2_tmp_usec;
|
||||
u_data->io->min_x=u_data->io->x1_tmp_sec*1000000.0+u_data->io->x1_tmp_usec;
|
||||
u_data->io->max_x=u_data->io->x2_tmp_sec*1000000.0+u_data->io->x2_tmp_usec;
|
||||
u_data->io->uoff = FALSE;
|
||||
}
|
||||
|
||||
|
@ -981,16 +981,15 @@ static gint
|
|||
on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_udata *u_data)
|
||||
{
|
||||
sctp_graph_t *ios;
|
||||
guint32 helpx, helpy, x1_tmp, x2_tmp, y_value, frame, tmpnum=0, count=0, tsnumber=0;
|
||||
guint32 helpx, helpy, x1_tmp, x2_tmp, y_value, t_size=0, s_size=0, i, y_tolerance;
|
||||
gint label_width, label_height;
|
||||
gdouble x_value, position, tfirst, s_diff, t_diff;
|
||||
gdouble x_value, position, s_diff=0, t_diff=0, x_tolerance=0.0001;
|
||||
gint lwidth;
|
||||
char label_string[30];
|
||||
GdkGC *text_color;
|
||||
GList *tsnlist=NULL, *tlist=NULL, *sacklist=NULL;
|
||||
tsn_t *tsn, *tmptsn, *tmpsack, *sack;
|
||||
guint8 type;
|
||||
gboolean sack_type = FALSE;
|
||||
GPtrArray *tsnlist = NULL, *sacklist=NULL;
|
||||
struct tsn_sort *tsn, *sack=NULL;
|
||||
gboolean sack_found = FALSE;
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GdkFont *font;
|
||||
|
@ -1105,119 +1104,71 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda
|
|||
}
|
||||
else
|
||||
{
|
||||
x_value = ((event->x-LEFT_BORDER-u_data->io->offset) * ((u_data->io->x2_tmp_sec+u_data->io->x2_tmp_usec/1000000.0)-(u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0)) / (u_data->io->pixmap_width-LEFT_BORDER-u_data->io->offset))+u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0;
|
||||
y_value = (gint)floor((u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-event->y) * (max_tsn - min_tsn) / (u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset)) + min_tsn;
|
||||
x_value = ((event->x-LEFT_BORDER-u_data->io->offset) * ((u_data->io->x2_tmp_sec+u_data->io->x2_tmp_usec/1000000.0)-(u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0)) / (u_data->io->pixmap_width-LEFT_BORDER-RIGHT_BORDER-u_data->io->offset))+u_data->io->x1_tmp_sec+u_data->io->x1_tmp_usec/1000000.0;
|
||||
y_value = (gint)rint((u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset-event->y) * (max_tsn - min_tsn) / (u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset)) + min_tsn;
|
||||
text_color = u_data->io->draw_area->style->black_gc;
|
||||
|
||||
if (u_data->dir == 1)
|
||||
{
|
||||
tsnlist = g_list_last(u_data->assoc->tsn1);
|
||||
sacklist = g_list_last(u_data->assoc->sack1);
|
||||
tsnlist = u_data->assoc->sort_tsn1;
|
||||
t_size = u_data->assoc->n_data_chunks_ep1;
|
||||
sacklist = u_data->assoc->sort_sack1;
|
||||
s_size = u_data->assoc->n_sack_chunks_ep1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsnlist = g_list_last(u_data->assoc->tsn2);
|
||||
sacklist = g_list_last(u_data->assoc->sack2);
|
||||
tsnlist = u_data->assoc->sort_tsn2;
|
||||
t_size = u_data->assoc->n_data_chunks_ep2;
|
||||
sacklist = u_data->assoc->sort_sack2;
|
||||
s_size = u_data->assoc->n_sack_chunks_ep2;
|
||||
}
|
||||
x_tolerance = (gdouble)((u_data->io->tmp_width / u_data->io->axis_width*1.0))*5/1000000.0;
|
||||
y_tolerance = (guint32)(((u_data->io->max_y - u_data->io->min_y) / (u_data->io->pixmap_height-TOP_BORDER-BOTTOM_BORDER-u_data->io->offset)) * 2.0);
|
||||
if (y_tolerance==0)
|
||||
y_tolerance = 2;
|
||||
else if (y_tolerance > 5)
|
||||
y_tolerance = 5;
|
||||
|
||||
for (i=0; i<s_size; i++)
|
||||
{
|
||||
sack = (struct tsn_sort*)(g_ptr_array_index(sacklist, i));
|
||||
if (abs(sack->tsnumber - y_value)<y_tolerance)
|
||||
{
|
||||
s_diff = fabs((sack->secs+sack->usecs/1000000.0)- x_value);
|
||||
if (s_diff < x_tolerance)
|
||||
sack_found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tsn = (tsn_t*) (tsnlist->data);
|
||||
tmptsn =(tsn_t*)(tsnlist->data);
|
||||
tfirst = tsn->secs + tsn->usecs/1000000.0;
|
||||
frame = tsn->frame_number;
|
||||
|
||||
while (tsnlist)
|
||||
for (i=0; i<t_size; i++)
|
||||
{
|
||||
tsnlist = g_list_previous(tsnlist);
|
||||
tsn = (tsn_t*) (tsnlist->data);
|
||||
if (tsn->secs+tsn->usecs/1000000.0<x_value)
|
||||
tsn = (struct tsn_sort*)(g_ptr_array_index(tsnlist, i));
|
||||
if (abs(tsn->tsnumber - y_value)<y_tolerance)
|
||||
{
|
||||
tfirst = tsn->secs+tsn->usecs/1000000.0;
|
||||
tmptsn =tsn;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tfirst+tsn->secs+tsn->usecs/1000000.0)/2.0<x_value)
|
||||
t_diff = fabs((tsn->secs+tsn->usecs/1000000.0)- x_value);
|
||||
if (sack_found && s_diff < t_diff)
|
||||
{
|
||||
t_diff = tsn->secs+tsn->usecs/1000000.0 - x_value;
|
||||
tmptsn = tsn;
|
||||
cf_goto_frame(&cfile, sack->framenumber);
|
||||
x_value = sack->secs+sack->usecs/1000000.0;
|
||||
y_value = sack->tsnumber;
|
||||
}
|
||||
else
|
||||
t_diff = x_value - tmptsn->secs+tmptsn->usecs/1000000.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sack = (tsn_t*) (sacklist->data);
|
||||
tmpsack =(tsn_t*)(sacklist->data);
|
||||
tfirst = sack->secs + sack->usecs/1000000.0;
|
||||
|
||||
while (sacklist)
|
||||
{
|
||||
sacklist = g_list_previous(sacklist);
|
||||
sack = (tsn_t*) (sacklist->data);
|
||||
if (sack->secs+sack->usecs/1000000.0<x_value)
|
||||
{
|
||||
tfirst = sack->secs+sack->usecs/1000000.0;
|
||||
tmpsack =sack;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tfirst+sack->secs+sack->usecs/1000000.0)/2.0<x_value)
|
||||
else if (t_diff < x_tolerance)
|
||||
{
|
||||
s_diff = sack->secs+sack->usecs/1000000.0 - x_value;
|
||||
tmpsack = sack;
|
||||
}
|
||||
else
|
||||
s_diff = x_value - tmpsack->secs+tmpsack->usecs/1000000.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s_diff < t_diff)
|
||||
{
|
||||
cf_goto_frame(&cfile, tmpsack->frame_number);
|
||||
x_value = tmpsack->secs+tmpsack->usecs/1000000.0;
|
||||
tlist = g_list_first(tmpsack->tsns);
|
||||
sack_type = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
cf_goto_frame(&cfile, tmptsn->frame_number);
|
||||
x_value = tmptsn->secs+tmptsn->usecs/1000000.0;
|
||||
tlist = g_list_first(tmptsn->tsns);
|
||||
sack_type = FALSE;
|
||||
}
|
||||
count++;
|
||||
while (tlist)
|
||||
{
|
||||
type = ((struct chunk_header *)tlist->data)->type;
|
||||
if (type == SCTP_DATA_CHUNK_ID && !sack_type)
|
||||
tsnumber = g_ntohl(((struct data_chunk_header *)tlist->data)->tsn);
|
||||
else if (type == SCTP_SACK_CHUNK_ID && sack_type)
|
||||
tsnumber = g_ntohl(((struct sack_chunk_header *)tlist->data)->cum_tsn_ack);
|
||||
if (tsnumber < y_value && g_list_length(tlist)-count>0)
|
||||
{
|
||||
tmpnum = tsnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tmpnum+tsnumber)/2 < y_value)
|
||||
{
|
||||
y_value = tsnumber;
|
||||
tmpnum = tsnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
y_value = tmpnum;
|
||||
cf_goto_frame(&cfile, tsn->framenumber);
|
||||
x_value = tsn->secs+tsn->usecs/1000000.0;
|
||||
y_value = tsn->tsnumber;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tlist = g_list_next(tlist);
|
||||
count++;
|
||||
}
|
||||
|
||||
g_snprintf(label_string, 30, "(%.6lf, %u)", x_value, y_value);
|
||||
|
||||
label_set = TRUE;
|
||||
|
||||
gdk_draw_line(u_data->io->pixmap,text_color, (gint)(event->x-2), (gint)(event->y), (gint)(event->x+2), (gint)(event->y));
|
||||
gdk_draw_line(u_data->io->pixmap,text_color, (gint)(event->x), (gint)(event->y-2), (gint)(event->x), (gint)(event->y+2));
|
||||
gdk_draw_line(u_data->io->pixmap,text_color, event->x-2, event->y, event->x+2, event->y);
|
||||
gdk_draw_line(u_data->io->pixmap,text_color, event->x, event->y-2, event->x, event->y+2);
|
||||
if (event->x+150>=u_data->io->pixmap_width)
|
||||
position = event->x - 150;
|
||||
else
|
||||
|
@ -1241,8 +1192,6 @@ on_button_release (GtkWidget *widget _U_, GdkEventButton *event, struct sctp_uda
|
|||
layout);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ios=(sctp_graph_t *)OBJECT_GET_DATA(u_data->io->draw_area, "sctp_graph_t");
|
||||
|
||||
if(!ios){
|
||||
|
|
|
@ -307,7 +307,7 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
|
|||
(a->port2 == b->port2) &&
|
||||
(a->verification_tag1 == b->verification_tag1) && a->verification_tag1==0 && a->initiate_tag != 0 &&
|
||||
(a->initiate_tag != b->initiate_tag ))
|
||||
return(ASSOC_NOT_FOUND);
|
||||
return(ASSOC_NOT_FOUND); /* two INITs that belong to different assocs */
|
||||
|
||||
/* assoc known*/
|
||||
if ((a->port1 == b->port1) &&
|
||||
|
@ -524,7 +524,7 @@ static int
|
|||
packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const void *data)
|
||||
{
|
||||
struct _sctp_info *sctp_info;
|
||||
guint32 chunk_number = 0, tsnumber;
|
||||
guint32 chunk_number = 0, tsnumber,framenumber;
|
||||
sctp_tmp_info_t tmp_info;
|
||||
sctp_assoc_info_t *info = NULL;
|
||||
sctp_error_info_t *error = NULL;
|
||||
|
@ -547,6 +547,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
sctp_info = (struct _sctp_info *) data;
|
||||
max =0xFFFFFFFF;
|
||||
|
||||
framenumber=pinfo->fd->num;
|
||||
|
||||
type = sctp_info->ip_src.type;
|
||||
|
||||
if (type == AT_IPv4)
|
||||
|
@ -680,7 +682,9 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn = g_malloc(sizeof(tsn_t));
|
||||
sack = g_malloc(sizeof(tsn_t));
|
||||
tsn->tsns = NULL;
|
||||
tsn->first_tsn = 0;
|
||||
sack->tsns = NULL;
|
||||
sack->first_tsn = 0;
|
||||
sack->src.type=tsn->src.type = tmp_info.src.type;
|
||||
sack->src.len=tsn->src.len = tmp_info.src.len;
|
||||
addr = g_malloc(tmp_info.src.len);
|
||||
|
@ -774,6 +778,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
sack = g_malloc(sizeof(tsn_t));
|
||||
tsn->tsns = NULL;
|
||||
sack->tsns = NULL;
|
||||
tsn->first_tsn = 0;
|
||||
sack->first_tsn = 0;
|
||||
}
|
||||
for (chunk_number = 0; chunk_number < sctp_info->number_of_tvbs; chunk_number++)
|
||||
{
|
||||
|
@ -805,6 +811,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
info->n_data_bytes_ep1+=length;
|
||||
info->max_tsn1 = tsnumber;
|
||||
}
|
||||
if (tsn->first_tsn == 0)
|
||||
tsn->first_tsn = tsnumber;
|
||||
t_s_n = g_malloc(16);
|
||||
tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16);
|
||||
tsn->tsns = g_list_append(tsn->tsns, t_s_n);
|
||||
|
@ -814,6 +822,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn_s->secs = tsn->secs;
|
||||
tsn_s->usecs = tsn->usecs;
|
||||
tsn_s->offset = 0;
|
||||
tsn_s->framenumber = framenumber;
|
||||
tsn_s->length = length-DATA_CHUNK_HEADER_LENGTH;
|
||||
g_ptr_array_add(info->sort_tsn1, tsn_s);
|
||||
info->n_array_tsn1++;
|
||||
|
@ -827,6 +836,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
info->max_tsn2 = tsnumber;
|
||||
info->n_sack_chunks_ep2++;
|
||||
length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET);
|
||||
if (sack->first_tsn == 0)
|
||||
sack->first_tsn = tsnumber;
|
||||
t_s_n = g_malloc(length);
|
||||
tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, length);
|
||||
sack->tsns = g_list_append(sack->tsns, t_s_n);
|
||||
|
@ -836,6 +847,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn_s->secs = tsn->secs;
|
||||
tsn_s->usecs = tsn->usecs;
|
||||
tsn_s->offset = 0;
|
||||
tsn_s->framenumber = framenumber;
|
||||
tsn_s->length = tvb_get_ntohl(sctp_info->tvb[chunk_number], SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET);
|
||||
if (tsn_s->length > info->max_window1)
|
||||
info->max_window1 = tsn_s->length;
|
||||
|
@ -894,7 +906,9 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn = g_malloc(sizeof(tsn_t));
|
||||
sack = g_malloc(sizeof(tsn_t));
|
||||
tsn->tsns = NULL;
|
||||
tsn->first_tsn = 0;
|
||||
sack->tsns = NULL;
|
||||
sack->first_tsn = 0;
|
||||
sack->src.type = tsn->src.type = tmp_info.src.type;
|
||||
sack->src.len = tsn->src.len = tmp_info.src.len;
|
||||
addr = g_malloc(tmp_info.src.len);
|
||||
|
@ -1034,8 +1048,10 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
{
|
||||
sack = g_malloc(sizeof(tsn_t));
|
||||
sack->tsns = NULL;
|
||||
sack->first_tsn = 0;
|
||||
tsn = g_malloc(sizeof(tsn_t));
|
||||
tsn->tsns = NULL;
|
||||
tsn->first_tsn = 0;
|
||||
}
|
||||
for (chunk_number = 0; chunk_number < sctp_info->number_of_tvbs; chunk_number++)
|
||||
{
|
||||
|
@ -1060,6 +1076,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_DATA_CHUNK_ID)
|
||||
{
|
||||
tsnumber = tvb_get_ntohl((sctp_info->tvb)[chunk_number], DATA_CHUNK_TSN_OFFSET);
|
||||
if (tsn->first_tsn == 0)
|
||||
tsn->first_tsn = tsnumber;
|
||||
t_s_n = g_malloc(16);
|
||||
tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16);
|
||||
tsn->tsns = g_list_append(tsn->tsns, t_s_n);
|
||||
|
@ -1072,6 +1090,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn_s->secs = tsn->secs;
|
||||
tsn_s->usecs = tsn->usecs;
|
||||
tsn_s->offset = 0;
|
||||
tsn_s->framenumber = framenumber;
|
||||
tsn_s->length = length;
|
||||
|
||||
if (info->direction == 1)
|
||||
|
@ -1131,6 +1150,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
{
|
||||
tsnumber = tvb_get_ntohl((sctp_info->tvb)[chunk_number], SACK_CHUNK_CUMULATIVE_TSN_ACK_OFFSET);
|
||||
length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET);
|
||||
if (sack->first_tsn == 0)
|
||||
sack->first_tsn = tsnumber;
|
||||
t_s_n = g_malloc(length);
|
||||
tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, length);
|
||||
sack->tsns = g_list_append(sack->tsns, t_s_n);
|
||||
|
@ -1140,6 +1161,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
|
|||
tsn_s->secs = tsn->secs;
|
||||
tsn_s->usecs = tsn->usecs;
|
||||
tsn_s->offset = 0;
|
||||
tsn_s->framenumber = framenumber;
|
||||
tsn_s->length = tvb_get_ntohl(sctp_info->tvb[chunk_number], SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET);
|
||||
|
||||
|
||||
|
|
|
@ -83,13 +83,13 @@
|
|||
#define MAX_ADDRESS_LEN 47
|
||||
#define NUM_CHUNKS 13
|
||||
|
||||
|
||||
typedef struct _tsn {
|
||||
guint32 frame_number;
|
||||
guint32 secs; /* Absolute seconds */
|
||||
guint32 usecs;
|
||||
address src;
|
||||
address dst;
|
||||
guint32 first_tsn;
|
||||
GList *tsns;
|
||||
} tsn_t;
|
||||
|
||||
|
@ -122,6 +122,7 @@ struct tsn_sort{
|
|||
guint32 usecs;
|
||||
guint32 offset;
|
||||
guint32 length;
|
||||
guint32 framenumber;
|
||||
};
|
||||
|
||||
typedef struct _sctp_addr_chunk {
|
||||
|
|
|
@ -57,7 +57,6 @@ static GtkWidget *bt_afilter = NULL, *bt_unselect=NULL, *bt_analyse=NULL, *bt_fi
|
|||
static gboolean prevent_update = FALSE, filter_applied = FALSE;
|
||||
|
||||
#define NUM_COLS 9
|
||||
#define FRAME_LIMIT 8
|
||||
|
||||
typedef struct column_arrows {
|
||||
GtkWidget *table;
|
||||
|
@ -273,8 +272,7 @@ static void
|
|||
sctp_stat_on_filter (GtkButton *button _U_, gpointer user_data _U_)
|
||||
{
|
||||
gchar *f_string = NULL;
|
||||
guint32 framenumber=0;
|
||||
GList *list, *srclist, *dstlist;
|
||||
GList *srclist, *dstlist;
|
||||
gchar *str=NULL;
|
||||
GString *gstring=NULL;
|
||||
struct sockaddr_in *infosrc=NULL;
|
||||
|
@ -285,106 +283,87 @@ sctp_stat_on_filter (GtkButton *button _U_, gpointer user_data _U_)
|
|||
return;
|
||||
}
|
||||
|
||||
if (selected_stream->n_packets>FRAME_LIMIT)
|
||||
if (selected_stream->check_address==FALSE)
|
||||
{
|
||||
if (selected_stream->check_address==FALSE)
|
||||
{
|
||||
f_string = g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && "
|
||||
"((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) || "
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || "
|
||||
"sctp.shutdown_complete_t_bit==1)))) ||"
|
||||
"(sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x "
|
||||
"&& sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) ||"
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 ||"
|
||||
" sctp.shutdown_complete_t_bit==1)))))",
|
||||
selected_stream->port1,
|
||||
selected_stream->port2,
|
||||
selected_stream->verification_tag1,
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->port2,
|
||||
selected_stream->port1,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag1);
|
||||
filter_string = f_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
gstring = g_string_new(g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && (ip.src==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr))));
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str = g_strdup_printf(")) || (sctp.dstport==%u && sctp.srcport==%u && (ip.dst==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
str = g_strdup_printf(")))");
|
||||
g_string_append(gstring, str);
|
||||
filter_string = gstring->str;
|
||||
g_string_free(gstring,FALSE);
|
||||
}
|
||||
f_string = g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && "
|
||||
"((sctp.verification_tag==0x%x && sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) || "
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 || "
|
||||
"sctp.shutdown_complete_t_bit==1)))) ||"
|
||||
"(sctp.srcport==%u && sctp.dstport==%u && ((sctp.verification_tag==0x%x "
|
||||
"&& sctp.verification_tag!=0x0) || "
|
||||
"(sctp.verification_tag==0x0 && sctp.initiate_tag==0x%x) ||"
|
||||
"(sctp.verification_tag==0x%x && (sctp.abort_t_bit==1 ||"
|
||||
" sctp.shutdown_complete_t_bit==1)))))",
|
||||
selected_stream->port1,
|
||||
selected_stream->port2,
|
||||
selected_stream->verification_tag1,
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->port2,
|
||||
selected_stream->port1,
|
||||
selected_stream->verification_tag2,
|
||||
selected_stream->initiate_tag,
|
||||
selected_stream->verification_tag1);
|
||||
filter_string = f_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = g_list_first(selected_stream->frame_numbers);
|
||||
framenumber = *((guint32 *)(list->data));
|
||||
gstring = g_string_new(g_strdup_printf("frame.number==%u",framenumber));
|
||||
list = g_list_next(list);
|
||||
while (list)
|
||||
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
gstring = g_string_new(g_strdup_printf("((sctp.srcport==%u && sctp.dstport==%u && (ip.src==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr))));
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
framenumber = *((guint32 *)(list->data));
|
||||
str =g_strdup_printf(" || frame.number==%u",framenumber);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
list = g_list_next(list);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
srclist = g_list_first(selected_stream->addr1);
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str = g_strdup_printf(")) || (sctp.dstport==%u && sctp.srcport==%u && (ip.dst==%s",
|
||||
selected_stream->port1, selected_stream->port2, ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
|
||||
while (srclist)
|
||||
{
|
||||
infosrc=(struct sockaddr_in *) (srclist->data);
|
||||
str =g_strdup_printf("|| ip.dst==%s",ip_to_str((const guint8 *)&(infosrc->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
srclist= g_list_next(srclist);
|
||||
}
|
||||
|
||||
dstlist = g_list_first(selected_stream->addr2);
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str = g_strdup_printf(") && (ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
while (dstlist)
|
||||
{
|
||||
infodst=(struct sockaddr_in *) (dstlist->data);
|
||||
str =g_strdup_printf("|| ip.src==%s",ip_to_str((const guint8 *)&(infodst->sin_addr.s_addr)));
|
||||
g_string_append(gstring, str);
|
||||
dstlist= g_list_next(dstlist);
|
||||
}
|
||||
str = g_strdup_printf(")))");
|
||||
g_string_append(gstring, str);
|
||||
filter_string = gstring->str;
|
||||
g_string_free(gstring,FALSE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue