diff options
author | Irene RĂ¼ngeler <I.Ruengeler@fh-muenster.de> | 2013-04-19 11:34:46 +0000 |
---|---|---|
committer | Irene RĂ¼ngeler <I.Ruengeler@fh-muenster.de> | 2013-04-19 11:34:46 +0000 |
commit | 319e5be393c2f7a5e772e066bc32b4e6e5161952 (patch) | |
tree | 65a603bb79456a00f502f71c5e0671d658d63ad0 /ui | |
parent | 72c5985ec6a12ea7a85e3f1dc2f77d05d1f7459b (diff) | |
download | wireshark-319e5be393c2f7a5e772e066bc32b4e6e5161952.tar.gz |
Show Forward_Tsn chunks in the graph
svn path=/trunk/; revision=48925
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/sctp_graph_dlg.c | 8 | ||||
-rw-r--r-- | ui/gtk/sctp_stat.c | 167 | ||||
-rw-r--r-- | ui/gtk/sctp_stat.h | 3 |
3 files changed, 133 insertions, 45 deletions
diff --git a/ui/gtk/sctp_graph_dlg.c b/ui/gtk/sctp_graph_dlg.c index e61aae5968..c3597067bf 100644 --- a/ui/gtk/sctp_graph_dlg.c +++ b/ui/gtk/sctp_graph_dlg.c @@ -534,6 +534,8 @@ draw_tsn_graph(struct sctp_udata *u_data) guint32 min_secs=0, diff; gint xvalue, yvalue; cairo_t *cr = NULL; + GdkRGBA black_color = {0.0, 0.0, 0.0, 1.0}; + GdkRGBA pink_color = {1.0, 0.6, 0.8, 1.0}; if (u_data->dir == 1) { @@ -571,7 +573,7 @@ draw_tsn_graph(struct sctp_udata *u_data) while (tlist) { type = ((struct chunk_header *)tlist->data)->type; - if (type == SCTP_DATA_CHUNK_ID) + if (type == SCTP_DATA_CHUNK_ID || type == SCTP_FORWARD_TSN_CHUNK_ID) tsnumber = g_ntohl(((struct data_chunk_header *)tlist->data)->tsn); if (tsnumber >= min_tsn && tsnumber <= max_tsn && tsn->secs >= min_secs) { @@ -591,6 +593,10 @@ draw_tsn_graph(struct sctp_udata *u_data) #else cr = gdk_cairo_create (u_data->io->pixmap); #endif + if (type == SCTP_DATA_CHUNK_ID) + gdk_cairo_set_source_rgba (cr, &black_color); + else + gdk_cairo_set_source_rgba (cr, &pink_color); cairo_arc(cr, xvalue, yvalue, diff --git a/ui/gtk/sctp_stat.c b/ui/gtk/sctp_stat.c index 20eec2a8a6..9f525c8c7d 100644 --- a/ui/gtk/sctp_stat.c +++ b/ui/gtk/sctp_stat.c @@ -534,6 +534,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v guint8 *t_s_n = NULL; gboolean sackchunk = FALSE; gboolean datachunk = FALSE; + gboolean forwardchunk = FALSE; struct tsn_sort *tsn_s; guint8* addr = NULL; int i; @@ -663,6 +664,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->n_sack_chunks_ep2 = 0; info->n_array_tsn1 = 0; info->n_array_tsn2 = 0; + info->n_forward_chunks = 0; info->max_window1 = 0; info->max_window2 = 0; info->min_max = NULL; @@ -682,7 +684,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) || - ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) || + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID)) { tsn = (tsn_t *)g_malloc(sizeof(tsn_t)); sack = (tsn_t *)g_malloc(sizeof(tsn_t)); @@ -710,7 +713,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sack->usecs=tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) || - ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) || + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID)) { if (tsn->secs < info->min_secs) { @@ -784,7 +788,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_INIT_ACK_CHUNK_ID) && ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_DATA_CHUNK_ID) && ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_SACK_CHUNK_ID) && - ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID) && + ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_FORWARD_TSN_CHUNK_ID)) { tsn = (tsn_t *)g_malloc(sizeof(tsn_t)); sack = (tsn_t *)g_malloc(sizeof(tsn_t)); @@ -803,35 +808,60 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->ep1_chunk_count[idx]++; info = add_chunk_count(&tmp_info.src, info, 1, idx); - if (tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID) + if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_DATA_CHUNK_ID)) { + datachunk = TRUE; length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; info->n_data_chunks++; info->n_data_bytes+=length; info->outstream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; + } + if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0) == SCTP_FORWARD_TSN_CHUNK_ID)) + { + forwardchunk = TRUE; + length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET); + info->n_forward_chunks++; + } + if (datachunk || forwardchunk) + { + tsnumber = tvb_get_ntohl((sctp_info->tvb)[chunk_number], DATA_CHUNK_TSN_OFFSET); if (tsnumber < info->min_tsn1) info->min_tsn1 = tsnumber; if (tsnumber > info->max_tsn1) { - length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks_ep1++; - info->n_data_bytes_ep1+=length; + if (datachunk) + { + info->n_data_chunks_ep1++; + info->n_data_bytes_ep1+=length; + } + else + info->n_forward_chunks_ep1++; info->max_tsn1 = tsnumber; } if (tsn->first_tsn == 0) tsn->first_tsn = tsnumber; - t_s_n = (guint8 *)g_malloc(16); - tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16); + if (datachunk) + { + t_s_n = (guint8 *)g_malloc(16); + tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16); + } + else + { + t_s_n = (guint8 *)g_malloc(length); + tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, length); + } tsn->tsns = g_list_append(tsn->tsns, t_s_n); - datachunk = TRUE; tsn_s = (struct tsn_sort *)g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; 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 (datachunk) + tsn_s->length = length-DATA_CHUNK_HEADER_LENGTH; + else + tsn_s->length = length; if (tsn->secs < info->min_secs) { info->min_secs = tsn->secs; @@ -911,7 +941,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v store->data = addr; info = add_address(store, info, 2); info->frame_numbers=g_list_prepend(info->frame_numbers,&(pinfo->fd->num)); - if (datachunk == TRUE) + if (datachunk || forwardchunk) info->tsn1 = g_list_prepend(info->tsn1, tsn); if (sackchunk == TRUE) info->sack2 = g_list_prepend(info->sack2, sack); @@ -938,7 +968,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) || ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) || - ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) || + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID)) { tsn = (tsn_t *)g_malloc(sizeof(tsn_t)); @@ -966,8 +997,9 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v sack->secs=tsn->secs = (guint32)pinfo->fd->rel_ts.secs; sack->usecs=tsn->usecs = (guint32)pinfo->fd->rel_ts.nsecs/1000; if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) || - ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) || - ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_SACK_CHUNK_ID) || + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_NR_SACK_CHUNK_ID) || + ((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_FORWARD_TSN_CHUNK_ID)) { if (tsn->secs < info->min_secs) { @@ -1088,7 +1120,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v if (((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_INIT_ACK_CHUNK_ID) && ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_DATA_CHUNK_ID) && ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_SACK_CHUNK_ID) && - ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID)) + ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_NR_SACK_CHUNK_ID) && + ((tvb_get_guint8(sctp_info->tvb[0],0)) != SCTP_FORWARD_TSN_CHUNK_ID)) { sack = (tsn_t *)g_malloc(sizeof(tsn_t)); sack->tsns = NULL; @@ -1110,18 +1143,32 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->ep2_chunk_count[idx]++; info = add_chunk_count(&tmp_info.src, info,info->direction, idx); - if ((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_DATA_CHUNK_ID) + if (((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_DATA_CHUNK_ID)) + datachunk = TRUE; + if (((tvb_get_guint8(sctp_info->tvb[chunk_number],0)) == SCTP_FORWARD_TSN_CHUNK_ID)) + forwardchunk = TRUE; + if (datachunk || forwardchunk) { 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 = (guint8 *)g_malloc(16); - tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16); + if (datachunk) + { + t_s_n = (guint8 *)g_malloc(16); + tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, 16); + length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; + info->n_data_chunks++; + info->n_data_bytes+=length; + } + else + { + length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET); + t_s_n = (guint8 *)g_malloc(length); + tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(t_s_n),0, length); + info->n_forward_chunks++; + } tsn->tsns = g_list_append(tsn->tsns, t_s_n); - datachunk = TRUE; - length=tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks++; - info->n_data_bytes+=length; + tsn_s = (struct tsn_sort *)g_malloc(sizeof(struct tsn_sort)); tsn_s->tsnumber = tsnumber; tsn_s->secs = tsn->secs = (guint32)pinfo->fd->rel_ts.secs; @@ -1152,21 +1199,36 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v info->min_tsn1 = tsnumber; if ((info->init == TRUE || (info->initack == TRUE && info->initack_dir == 1))&& tsnumber >= info->min_tsn1 && tsnumber <= info->max_tsn1) { - length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks_ep1++; - info->n_data_bytes_ep1 += length; + if (datachunk) + { + info->n_data_chunks_ep1++; + info->n_data_bytes_ep1 += length; + } + else if (forwardchunk) + { + info->n_forward_chunks_ep1++; + } } if(tsnumber > info->max_tsn1) { info->max_tsn1 = tsnumber; - length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks_ep1++; - info->n_data_bytes_ep1 += length; + if (datachunk) + { + info->n_data_chunks_ep1++; + info->n_data_bytes_ep1 += length; + } + else if (forwardchunk) + { + info->n_forward_chunks_ep1++; + } + } + if (datachunk) + { + if (info->init == FALSE) + info->outstream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; + if (info->initack == FALSE) + info->instream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; } - if (info->init == FALSE) - info->outstream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; - if (info->initack == FALSE) - info->instream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; g_ptr_array_add(info->sort_tsn1, tsn_s); info->n_array_tsn1++; @@ -1179,21 +1241,38 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v if ((info->initack == TRUE && info->initack_dir == 2)&& tsnumber >= info->min_tsn2 && tsnumber <= info->max_tsn2) { - length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks_ep2++; - info->n_data_bytes_ep2+=length; + if (datachunk) + { + length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; + info->n_data_chunks_ep2++; + info->n_data_bytes_ep2+=length; + } + else if (forwardchunk) + { + info->n_forward_chunks_ep2++; + } } if(tsnumber > info->max_tsn2) { info->max_tsn2 = tsnumber; - length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; - info->n_data_chunks_ep2++; - info->n_data_bytes_ep2+=length; + if (datachunk) + { + length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH; + info->n_data_chunks_ep2++; + info->n_data_bytes_ep2+=length; + } + else if (forwardchunk) + { + info->n_forward_chunks_ep2++; + } + } + if (datachunk) + { + if (info->init == FALSE) + info->instream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; + if (info->initack == FALSE) + info->outstream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; } - if (info->init == FALSE) - info->instream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; - if (info->initack == FALSE) - info->outstream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1; g_ptr_array_add(info->sort_tsn2, tsn_s); info->n_array_tsn2++; @@ -1263,7 +1342,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v } } - if (datachunk == TRUE) + if (datachunk || forwardchunk) { if (info->direction == 1) info->tsn1 = g_list_prepend(info->tsn1, tsn); diff --git a/ui/gtk/sctp_stat.h b/ui/gtk/sctp_stat.h index 225009ac1e..d91e76ce50 100644 --- a/ui/gtk/sctp_stat.h +++ b/ui/gtk/sctp_stat.h @@ -196,6 +196,9 @@ typedef struct _sctp_assoc_info { guint32 n_length_errors; guint32 n_value_errors; guint32 n_data_chunks; + guint32 n_forward_chunks; + guint32 n_forward_chunks_ep1; + guint32 n_forward_chunks_ep2; guint32 n_data_bytes; guint32 n_packets; guint32 n_data_chunks_ep1; |