diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2009-08-21 20:10:51 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2009-08-21 20:10:51 +0000 |
commit | cc11620041f8c2c13e8d74064de6ac5998547cda (patch) | |
tree | fc4b451a34319f17b5deda4456aeeabbd0fdca2c | |
parent | 9661baf23767c48085c6d94010cf445a6120ef59 (diff) |
From Irene Ruengeler: Fix two bugs regarding plotted TSNs reported by
Christian Constantin.
svn path=/trunk/; revision=29498
-rw-r--r-- | gtk/sctp_graph_dlg.c | 10 | ||||
-rw-r--r-- | gtk/sctp_stat.c | 78 |
2 files changed, 75 insertions, 13 deletions
diff --git a/gtk/sctp_graph_dlg.c b/gtk/sctp_graph_dlg.c index 051d89d5c4..fda7045bbe 100644 --- a/gtk/sctp_graph_dlg.c +++ b/gtk/sctp_graph_dlg.c @@ -226,7 +226,7 @@ static void draw_sack_graph(struct sctp_udata *u_data) yvalue = (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-POINT_SIZE-u_data->io->offset-((SUB_32(j+tsnumber,min_tsn))*u_data->io->y_interval)); if (xvalue >= LEFT_BORDER+u_data->io->offset && xvalue <= u_data->io->pixmap_width-RIGHT_BORDER+u_data->io->offset && - yvalue >= TOP_BORDER-u_data->io->offset && + yvalue >= TOP_BORDER-u_data->io->offset-5 && yvalue <= u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) gdk_draw_arc(u_data->io->pixmap,green_gc,TRUE, xvalue, @@ -249,7 +249,7 @@ static void draw_sack_graph(struct sctp_udata *u_data) yvalue = (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-POINT_SIZE -u_data->io->offset-((SUB_32(tsnumber,min_tsn))*u_data->io->y_interval)); if (xvalue >= LEFT_BORDER+u_data->io->offset && xvalue <= u_data->io->pixmap_width-RIGHT_BORDER+u_data->io->offset && - yvalue >= TOP_BORDER-u_data->io->offset && + yvalue >= TOP_BORDER-u_data->io->offset-5 && yvalue <= u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) gdk_draw_arc(u_data->io->pixmap,red_gc,TRUE, xvalue, @@ -368,7 +368,7 @@ static void draw_nr_sack_graph(struct sctp_udata *u_data) yvalue = (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-POINT_SIZE-u_data->io->offset-((SUB_32(j+tsnumber,min_tsn))*u_data->io->y_interval)); if (xvalue >= LEFT_BORDER+u_data->io->offset && xvalue <= u_data->io->pixmap_width-RIGHT_BORDER+u_data->io->offset && - yvalue >= TOP_BORDER-u_data->io->offset && + yvalue >= TOP_BORDER-u_data->io->offset-5 && yvalue <= u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) { /* Check if this is an GAP ACK or NR GAP ACK */ @@ -418,7 +418,7 @@ static void draw_nr_sack_graph(struct sctp_udata *u_data) yvalue = (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-POINT_SIZE -u_data->io->offset-((SUB_32(tsnumber,min_tsn))*u_data->io->y_interval)); if (xvalue >= LEFT_BORDER+u_data->io->offset && xvalue <= u_data->io->pixmap_width-RIGHT_BORDER+u_data->io->offset && - yvalue >= TOP_BORDER-u_data->io->offset && + yvalue >= TOP_BORDER-u_data->io->offset-5 && yvalue <= u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) gdk_draw_arc(u_data->io->pixmap,red_gc,TRUE, xvalue, @@ -493,7 +493,7 @@ static void draw_tsn_graph(struct sctp_udata *u_data) yvalue = (guint32)(u_data->io->pixmap_height-BOTTOM_BORDER-POINT_SIZE-u_data->io->offset-((SUB_32(tsnumber,min_tsn))*u_data->io->y_interval)); if (xvalue >= LEFT_BORDER+u_data->io->offset && xvalue <= u_data->io->pixmap_width-RIGHT_BORDER+u_data->io->offset && - yvalue >= TOP_BORDER-u_data->io->offset && + yvalue >= TOP_BORDER-u_data->io->offset-5 && yvalue <= u_data->io->pixmap_height-BOTTOM_BORDER-u_data->io->offset) gdk_draw_arc(u_data->io->pixmap,u_data->io->draw_area->style->black_gc,TRUE, xvalue, diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c index 2672ca886c..dd7ea9b80c 100644 --- a/gtk/sctp_stat.c +++ b/gtk/sctp_stat.c @@ -840,11 +840,26 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v datachunk = TRUE; tsn_s = g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; - tsn_s->secs = tsn->secs; - tsn_s->usecs = tsn->usecs; + tsn_s->secs = tsn->secs = (guint32)pinfo->fd->rel_ts.secs; + tsn_s->usecs = tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; tsn_s->offset = 0; tsn_s->framenumber = framenumber; tsn_s->length = length-DATA_CHUNK_HEADER_LENGTH; + if (tsn->secs < info->min_secs) + { + info->min_secs = tsn->secs; + info->min_usecs = tsn->usecs; + } + else if (tsn->secs == info->min_secs && tsn->usecs < info->min_usecs) + info->min_usecs = tsn->usecs; + + if (tsn->secs > info->max_secs) + { + info->max_secs = tsn->secs; + info->max_usecs = tsn->usecs; + } + else if (tsn->secs == info->max_secs && tsn->usecs > info->max_usecs) + info->max_usecs = tsn->usecs; g_ptr_array_add(info->sort_tsn1, tsn_s); info->n_array_tsn1++; } @@ -866,13 +881,28 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sackchunk = TRUE; tsn_s = g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; - tsn_s->secs = tsn->secs; - tsn_s->usecs = tsn->usecs; + tsn_s->secs = tsn->secs = (guint32)pinfo->fd->rel_ts.secs; + tsn_s->usecs = tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; 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; + if (tsn->secs < info->min_secs) + { + info->min_secs = tsn->secs; + info->min_usecs = tsn->usecs; + } + else if (tsn->secs == info->min_secs && tsn->usecs < info->min_usecs) + info->min_usecs = tsn->usecs; + + if (tsn->secs > info->max_secs) + { + info->max_secs = tsn->secs; + info->max_usecs = tsn->usecs; + } + else if (tsn->secs == info->max_secs && tsn->usecs > info->max_usecs) + info->max_usecs = tsn->usecs; g_ptr_array_add(info->sort_sack2, tsn_s); info->n_sack_chunks_ep2++; } @@ -1109,11 +1139,27 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->n_data_bytes+=length; tsn_s = g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; - tsn_s->secs = tsn->secs; - tsn_s->usecs = tsn->usecs; + tsn_s->secs = tsn->secs = (guint32)pinfo->fd->rel_ts.secs; + tsn_s->usecs = tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; tsn_s->offset = 0; tsn_s->framenumber = framenumber; tsn_s->length = length; + + if (tsn->secs < info->min_secs) + { + info->min_secs = tsn->secs; + info->min_usecs = tsn->usecs; + } + else if (tsn->secs == info->min_secs && tsn->usecs < info->min_usecs) + info->min_usecs = tsn->usecs; + + if (tsn->secs > info->max_secs) + { + info->max_secs = tsn->secs; + info->max_usecs = tsn->usecs; + } + else if (tsn->secs == info->max_secs && tsn->usecs > info->max_usecs) + info->max_usecs = tsn->usecs; if (info->direction == 1) { @@ -1181,12 +1227,28 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sackchunk = TRUE; tsn_s = g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; - tsn_s->secs = tsn->secs; - tsn_s->usecs = tsn->usecs; + tsn_s->secs = tsn->secs = (guint32)pinfo->fd->rel_ts.secs; + tsn_s->usecs = tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; 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->secs < info->min_secs) + { + info->min_secs = tsn->secs; + info->min_usecs = tsn->usecs; + } + else if (tsn->secs == info->min_secs && tsn->usecs < info->min_usecs) + info->min_usecs = tsn->usecs; + + if (tsn->secs > info->max_secs) + { + info->max_secs = tsn->secs; + info->max_usecs = tsn->usecs; + } + else if (tsn->secs == info->max_secs && tsn->usecs > info->max_usecs) + info->max_usecs = tsn->usecs; + if (info->direction == 2) { |