diff options
author | Anders Broman <anders.broman@ericsson.com> | 2005-09-01 05:34:52 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2005-09-01 05:34:52 +0000 |
commit | 85c29a030d7a51ddb92e74447120d14c14ec4b29 (patch) | |
tree | 3152983e8c76097a757331f34ff7365c91ff35fc /epan | |
parent | 6fec98fa525ffec9e1ae98e7bc9239f02d8812db (diff) |
From Martin Mathieson
These small patches:
- add RTSP header 'RDTFeatureLevel as a proper field
- show feature level in RDT stream setup info
- tidy up RDT info column text
svn path=/trunk/; revision=15647
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-rdt.c | 70 | ||||
-rw-r--r-- | epan/dissectors/packet-rdt.h | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-rtsp.c | 82 |
3 files changed, 105 insertions, 51 deletions
diff --git a/epan/dissectors/packet-rdt.c b/epan/dissectors/packet-rdt.c index 6fed8d2aca..807017d142 100644 --- a/epan/dissectors/packet-rdt.c +++ b/epan/dissectors/packet-rdt.c @@ -147,6 +147,7 @@ static gint hf_rdt_unk_flags1 = -1; static gint hf_rdt_setup = -1; static gint hf_rdt_setup_frame = -1; static gint hf_rdt_setup_method = -1; +static gint hf_rdt_feature_level = -1; /* RDT fields defining a sub tree */ static gint ett_rdt = -1; @@ -239,7 +240,8 @@ static const value_string packet_type_vals[] = void rdt_add_address(packet_info *pinfo, address *addr, int port, int other_port, - const gchar *setup_method, guint32 setup_frame_number) + const gchar *setup_method, + gint rdt_feature_level) { address null_addr; conversation_t* p_conv; @@ -257,13 +259,13 @@ void rdt_add_address(packet_info *pinfo, /* Check if the ip address and port combination is not already registered as a conversation. */ - p_conv = find_conversation(setup_frame_number, addr, &null_addr, PT_UDP, port, other_port, + p_conv = find_conversation(pinfo->fd->num, addr, &null_addr, PT_UDP, port, other_port, NO_ADDR_B | (!other_port ? NO_PORT_B : 0)); /* If not, create a new conversation. */ - if ( !p_conv || p_conv->setup_frame != setup_frame_number) + if ( !p_conv || p_conv->setup_frame != pinfo->fd->num) { - p_conv = conversation_new(setup_frame_number, addr, &null_addr, PT_UDP, + p_conv = conversation_new(pinfo->fd->num, addr, &null_addr, PT_UDP, (guint32)port, (guint32)other_port, NO_ADDR2 | (!other_port ? NO_PORT2 : 0)); } @@ -285,7 +287,8 @@ void rdt_add_address(packet_info *pinfo, /* Update the conversation data. */ strncpy(p_conv_data->method, setup_method, MAX_RDT_SETUP_METHOD_SIZE); p_conv_data->method[MAX_RDT_SETUP_METHOD_SIZE] = '\0'; - p_conv_data->frame_number = setup_frame_number; + p_conv_data->frame_number = pinfo->fd->num; + p_conv_data->feature_level = rdt_feature_level; } @@ -302,14 +305,14 @@ static void dissect_rdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *rdt_packet_tree = NULL; guint16 packet_type; - /* Set columns */ + /* Set/clear columns */ if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "RDT"); } if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, "RDT:"); + col_clear(pinfo->cinfo, COL_INFO); } /* Create RDT protocol tree */ @@ -534,7 +537,7 @@ guint dissect_rdt_data_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_append_fstr(pinfo->cinfo, COL_INFO, - " DATA: stream-id=%02u asm-rule=%02u seq=%05u ts=%u", + "DATA: stream-id=%02u asm-rule=%02u seq=%05u ts=%05u ", stream_id, asm_rule_number, sequence_number, timestamp); } @@ -619,7 +622,7 @@ guint dissect_rdt_asm_action_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (check_col(pinfo->cinfo, COL_PROTOCOL)) { col_append_fstr(pinfo->cinfo, COL_INFO, - " ASM-ACTION: stream-id=%02u rel-seqno=%05u", + "ASM-ACTION: stream-id=%02u rel-seqno=%05u ", stream_id, rel_seqno); } @@ -691,7 +694,7 @@ guint dissect_rdt_bandwidth_report_packet(tvbuff_t *tvb, packet_info *pinfo, pro if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_add_str(pinfo->cinfo, COL_INFO, " BANDWIDTH-REPORT: "); + col_append_str(pinfo->cinfo, COL_INFO, "BANDWIDTH-REPORT: "); } if (packet_length < (offset - start_offset) || @@ -759,7 +762,7 @@ guint dissect_rdt_ack_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " ACK: lh=%u", lost_high_flag); + col_append_fstr(pinfo->cinfo, COL_INFO, "ACK: lh=%u ", lost_high_flag); } if (packet_length < (offset - start_offset) || @@ -787,7 +790,7 @@ guint dissect_rdt_rtt_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tr if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_add_str(pinfo->cinfo, COL_INFO, " RTT-REQUEST: "); + col_append_str(pinfo->cinfo, COL_INFO, "RTT-REQUEST: "); } return offset; @@ -813,7 +816,7 @@ guint dissect_rdt_rtt_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_t if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " RTT-RESPONSE: "); + col_append_str(pinfo->cinfo, COL_INFO, "RTT-RESPONSE: "); } return offset; @@ -839,7 +842,7 @@ guint dissect_rdt_congestion_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " CONGESTION: "); + col_append_str(pinfo->cinfo, COL_INFO, "CONGESTION: "); } return offset; @@ -920,7 +923,7 @@ guint dissect_rdt_stream_end_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_fstr(pinfo->cinfo, COL_INFO, " STREAM-END: stream-id=%02u", stream_id); + col_append_fstr(pinfo->cinfo, COL_INFO, "STREAM-END: stream-id=%02u ", stream_id); } return offset; @@ -974,7 +977,7 @@ guint dissect_rdt_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " REPORT: "); + col_append_str(pinfo->cinfo, COL_INFO, "REPORT: "); } /* The remaining data is unparsed. */ @@ -1043,9 +1046,7 @@ guint dissect_rdt_latency_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_fstr(pinfo->cinfo, COL_INFO, - " LATENCY-REPORT: t=%u", - server_out_time); + col_append_fstr(pinfo->cinfo, COL_INFO, "LATENCY-REPORT: t=%u ", server_out_time); } if (packet_length < (offset - start_offset) || @@ -1101,7 +1102,7 @@ guint dissect_rdt_transport_info_request_packet(tvbuff_t *tvb, packet_info *pinf if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " TRANSPORT-INFO-REQUEST: "); + col_append_str(pinfo->cinfo, COL_INFO, "TRANSPORT-INFO-REQUEST: "); } return offset; @@ -1200,7 +1201,7 @@ guint dissect_rdt_transport_info_response_packet(tvbuff_t *tvb, packet_info *pin if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " RESPONSE: "); + col_append_str(pinfo->cinfo, COL_INFO, "RESPONSE: "); } return offset; @@ -1259,7 +1260,7 @@ guint dissect_rdt_bw_probing_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tre if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " BW-PROBING: "); + col_append_str(pinfo->cinfo, COL_INFO, "BW-PROBING: "); } if (packet_length < (offset - start_offset) || @@ -1292,7 +1293,7 @@ guint dissect_rdt_unknown_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (check_col(pinfo->cinfo, COL_PROTOCOL)) { - col_append_str(pinfo->cinfo, COL_INFO, " UNKNOWN-CTL: "); + col_append_str(pinfo->cinfo, COL_INFO, "UNKNOWN-CTL: "); } return offset; @@ -1326,6 +1327,7 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) p_conv_packet_data = se_alloc(sizeof(struct _rdt_conversation_info)); strcpy(p_conv_packet_data->method, p_conv_data->method); p_conv_packet_data->frame_number = p_conv_data->frame_number; + p_conv_packet_data->feature_level = p_conv_data->feature_level; p_add_proto_data(pinfo->fd, proto_rdt, p_conv_packet_data); } } @@ -1337,9 +1339,10 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *rdt_setup_tree; proto_item *ti = proto_tree_add_string_format(tree, hf_rdt_setup, tvb, 0, 0, "", - "Stream setup by %s (frame %u)", + "Stream setup by %s (frame %u), feature level %d", p_conv_data->method, - p_conv_data->frame_number); + p_conv_data->frame_number, + p_conv_data->feature_level); PROTO_ITEM_SET_GENERATED(ti); rdt_setup_tree = proto_item_add_subtree(ti, ett_rdt_setup); if (rdt_setup_tree) @@ -1351,6 +1354,9 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) item = proto_tree_add_string(rdt_setup_tree, hf_rdt_setup_method, tvb, 0, 0, p_conv_data->method); PROTO_ITEM_SET_GENERATED(item); + item = proto_tree_add_int(rdt_setup_tree, hf_rdt_feature_level, + tvb, 0, 0, p_conv_data->feature_level); + PROTO_ITEM_SET_GENERATED(item); } } } @@ -2176,7 +2182,19 @@ void proto_register_rdt(void) 0x0, "Method used to set up this stream", HFILL } - } + }, + { + &hf_rdt_feature_level, + { + "RDT feature level", + "rdt.feature-level", + FT_INT32, + BASE_DEC, + NULL, + 0x0, + "", HFILL + } + }, }; static gint *ett[] = diff --git a/epan/dissectors/packet-rdt.h b/epan/dissectors/packet-rdt.h index 20754f5c4e..6c40fd2b68 100644 --- a/epan/dissectors/packet-rdt.h +++ b/epan/dissectors/packet-rdt.h @@ -32,11 +32,13 @@ struct _rdt_conversation_info { gchar method[MAX_RDT_SETUP_METHOD_SIZE + 1]; guint32 frame_number; + gint feature_level; }; /* Add an RDT conversation with the given details */ void rdt_add_address(packet_info *pinfo, address *addr, int port, int other_port, - const gchar *setup_method, guint32 setup_frame_number); + const gchar *setup_method, + gint rdt_feature_level); diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 6879d9a1a1..46cd8921fd 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -63,6 +63,7 @@ static int hf_rtsp_url = -1; static int hf_rtsp_status = -1; static int hf_rtsp_session = -1; static int hf_rtsp_transport = -1; +static int hf_rtsp_rdtfeaturelevel = -1; static int hf_rtsp_X_Vig_Msisdn = -1; static dissector_handle_t sdp_handle; @@ -351,13 +352,14 @@ static const char rtsp_transport[] = "Transport:"; static const char rtsp_sps[] = "server_port="; static const char rtsp_cps[] = "client_port="; static const char rtsp_rtp[] = "rtp/"; +static const char rtsp_rdt_feature_level[] = "RDTFeatureLevel"; static const char rtsp_real_rdt[] = "x-real-rdt/"; static const char rtsp_real_tng[] = "x-pn-tng/"; /* synonym for x-real-rdt */ static const char rtsp_inter[] = "interleaved="; static void rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, - size_t line_len) + size_t line_len, gint rdt_feature_level) { conversation_t *conv; guchar buf[256]; @@ -367,10 +369,10 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, guint c_data_port, c_mon_port; guint s_data_port, s_mon_port; - if (line_len > sizeof(buf) - 1) { - /* - * Don't overflow the buffer. - */ + /* Copy line into buf */ + if (line_len > sizeof(buf) - 1) + { + /* Don't overflow the buffer. */ line_len = sizeof(buf) - 1; } memcpy(buf, line_begin, line_len); @@ -390,6 +392,7 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, rdt_transport = TRUE; else { + /* Give up on unknown transport types */ return; } @@ -414,14 +417,15 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, return; } } + + + /* Deal with RTSP TCP-interleaved conversations. */ if (!c_data_port) { rtsp_conversation_data_t *data; guint s_data_chan, s_mon_chan; int i; - /* - * Deal with RTSP TCP-interleaved conversations. - */ + /* Search tranport line for interleaved string */ if ((tmp = strstr(buf, rtsp_inter)) == NULL) { /* * No interleaved or server_port - probably a @@ -429,26 +433,41 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, */ return; } + + /* Move tmp to beyone interleaved string */ tmp += strlen(rtsp_inter); + /* Look for channel number(s) */ i = sscanf(tmp, "%u-%u", &s_data_chan, &s_mon_chan); - if (i < 1) { - g_warning("Frame %u: rtsp: bad interleaved", - pinfo->fd->num); + if (i < 1) + { + g_warning("Frame %u: rtsp: bad interleaved", pinfo->fd->num); return; } + + /* At least data channel present, look for conversation (presumably TCP) */ conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, - pinfo->srcport, pinfo->destport, 0); - if (!conv) { + pinfo->srcport, pinfo->destport, 0); + + /* Create new conversation if necessary */ + if (!conv) + { conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, - pinfo->ptype, pinfo->srcport, pinfo->destport, - 0); + pinfo->ptype, pinfo->srcport, pinfo->destport, + 0); } + + /* Look for previous data */ data = conversation_get_proto_data(conv, proto_rtsp); - if (!data) { + + /* Create new data if necessary */ + if (!data) + { data = se_alloc(sizeof(rtsp_conversation_data_t)); conversation_add_proto_data(conv, proto_rtsp, data); } + /* Now set the dissector handle of the interleaved channel + according to the transport protocol used */ if (rtp_transport) { if (s_data_chan < RTSP_MAX_INTERLEAVED) { @@ -479,20 +498,23 @@ rtsp_create_conversation(packet_info *pinfo, const guchar *line_begin, */ if (rtp_transport) { + /* There is always data for RTP */ rtp_add_address(pinfo, &pinfo->dst, c_data_port, s_data_port, - "RTSP", pinfo->fd->num, NULL); + "RTSP", pinfo->fd->num, NULL); - if (!c_mon_port) - return; - - rtcp_add_address(pinfo, &pinfo->dst, c_mon_port, s_mon_port, - "RTSP", pinfo->fd->num); + /* RTCP only if indicated */ + if (c_mon_port) + { + rtcp_add_address(pinfo, &pinfo->dst, c_mon_port, s_mon_port, + "RTSP", pinfo->fd->num); + } } else if (rdt_transport) { + /* Real Data Transport */ rdt_add_address(pinfo, &pinfo->dst, c_data_port, s_data_port, - "RTSP", pinfo->fd->num); + "RTSP", rdt_feature_level); } } @@ -556,6 +578,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, int value_offset; int value_len; e164_info_t e164_info; + gint rdt_feature_level = 0; /* * Is this a request or response? @@ -875,7 +898,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, * a conversation that will be dissected * with the appropriate dissector. */ - rtsp_create_conversation(pinfo, line, linelen); + rtsp_create_conversation(pinfo, line, linelen, rdt_feature_level); } else if (HDR_MATCHES(rtsp_content_type)) { proto_tree_add_string(rtsp_tree, hf_rtsp_content_type, @@ -944,6 +967,14 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, dissect_e164_number(tvb, sub_tree, value_offset, value_len, e164_info); } + } else if (HDR_MATCHES(rtsp_rdt_feature_level)) + { + rdt_feature_level = atoi(tvb_format_text(tvb, value_offset, + value_len)); + proto_tree_add_uint(rtsp_tree, hf_rtsp_rdtfeaturelevel, + tvb, offset, linelen, + atoi(tvb_format_text(tvb, value_offset, + value_len))); } else { @@ -1233,6 +1264,9 @@ proto_register_rtsp(void) { &hf_rtsp_transport, { "Transport", "rtsp.transport", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }}, + { &hf_rtsp_rdtfeaturelevel, + { "RDTFeatureLevel", "rtsp.rdt-feature-level", FT_UINT32, BASE_DEC, NULL, 0, + "", HFILL }}, { &hf_rtsp_X_Vig_Msisdn, { "X-Vig-Msisdn", "X_Vig_Msisdn", FT_STRING, BASE_NONE, NULL, 0, "", HFILL }}, |