forked from osmocom/wireshark
Cleanup:
Including: tvb_length...() ==> tvb_reported_length...() Remove some dead initializers; Localize some variables; Whitespace. Change-Id: Ide9490f248d558bb7e3af96a1fc17d8f911de4ef Reviewed-on: https://code.wireshark.org/review/6862 Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
parent
7b929e2ff7
commit
eda485ea53
|
@ -116,6 +116,7 @@ static const char applemidi_unknown_command[] = "unknown command: 0x%04x";
|
|||
static void
|
||||
dissect_applemidi_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 command ) {
|
||||
|
||||
proto_item *ti;
|
||||
guint16 seq_num;
|
||||
guint8 count;
|
||||
guint8 *name;
|
||||
|
@ -130,103 +131,100 @@ dissect_applemidi_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
|
|||
|
||||
col_add_fstr( pinfo->cinfo, COL_INFO, "%s", val_to_str( command, applemidi_commands, applemidi_unknown_command ) );
|
||||
|
||||
/* if ( tree ) */ {
|
||||
proto_item *ti;
|
||||
ti = proto_tree_add_item( tree, proto_applemidi, tvb, 0, -1, ENC_NA );
|
||||
applemidi_tree = proto_item_add_subtree( ti, ett_applemidi );
|
||||
ti = proto_tree_add_item( tree, proto_applemidi, tvb, 0, -1, ENC_NA );
|
||||
applemidi_tree = proto_item_add_subtree( ti, ett_applemidi );
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_signature, tvb, offset, 2, ENC_BIG_ENDIAN );
|
||||
offset += 2;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_signature, tvb, offset, 2, ENC_BIG_ENDIAN );
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_command, tvb, offset, 2, ENC_BIG_ENDIAN );
|
||||
offset += 2;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_command, tvb, offset, 2, ENC_BIG_ENDIAN );
|
||||
offset += 2;
|
||||
|
||||
/* the format of packets for "IN", "NO", "OK" and "BY" is identical and contains
|
||||
* the protocol version, a random number generated by the initiator of the session,
|
||||
* the SSRC that is used by the respective sides RTP-entity and optionally the
|
||||
* name of the participant */
|
||||
if ( ( APPLEMIDI_COMMAND_INVITATION == command ) ||
|
||||
( APPLEMIDI_COMMAND_INVITATION_REJECTED == command ) ||
|
||||
( APLLEMIDI_COMMAND_INVITATION_ACCEPTED == command ) ||
|
||||
( APPLEMIDI_COMMAND_ENDSESSION == command ) ) {
|
||||
/* the format of packets for "IN", "NO", "OK" and "BY" is identical and contains
|
||||
* the protocol version, a random number generated by the initiator of the session,
|
||||
* the SSRC that is used by the respective sides RTP-entity and optionally the
|
||||
* name of the participant */
|
||||
if ( ( APPLEMIDI_COMMAND_INVITATION == command ) ||
|
||||
( APPLEMIDI_COMMAND_INVITATION_REJECTED == command ) ||
|
||||
( APLLEMIDI_COMMAND_INVITATION_ACCEPTED == command ) ||
|
||||
( APPLEMIDI_COMMAND_ENDSESSION == command ) ) {
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_protocol_version, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_protocol_version, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_token, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_token, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
len = tvb_reported_length(tvb) - offset;
|
||||
len = tvb_reported_length(tvb) - offset;
|
||||
|
||||
/* Name is optional */
|
||||
if ( len > 0 ) {
|
||||
name = tvb_get_string_enc( wmem_packet_scope(), tvb, offset, len, ENC_UTF_8|ENC_NA );
|
||||
string_size = (gint)( strlen( name ) + 1 );
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_name, tvb, offset, string_size, ENC_UTF_8|ENC_NA );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": peer = \"%s\"", name );
|
||||
offset += string_size;
|
||||
}
|
||||
/* Name is optional */
|
||||
if ( len > 0 ) {
|
||||
name = tvb_get_string_enc( wmem_packet_scope(), tvb, offset, len, ENC_UTF_8|ENC_NA );
|
||||
string_size = (gint)( strlen( name ) + 1 );
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_name, tvb, offset, string_size, ENC_UTF_8|ENC_NA );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": peer = \"%s\"", name );
|
||||
offset += string_size;
|
||||
}
|
||||
|
||||
/* the synchronization packet contains three 64bit timestamps, and a value to define how
|
||||
* many of the timestamps transmitted are valid */
|
||||
} else if ( APPLEMIDI_COMMAND_SYNCHRONIZATION == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
} else if ( APPLEMIDI_COMMAND_SYNCHRONIZATION == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
count = tvb_get_guint8( tvb, offset );
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_count, tvb, offset, 1, ENC_BIG_ENDIAN );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": count = %u", count );
|
||||
offset += 1;
|
||||
count = tvb_get_guint8( tvb, offset );
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_count, tvb, offset, 1, ENC_BIG_ENDIAN );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": count = %u", count );
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_padding, tvb, offset, 3, ENC_BIG_ENDIAN );
|
||||
offset += 3;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_padding, tvb, offset, 3, ENC_BIG_ENDIAN );
|
||||
offset += 3;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp1, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp1, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp2, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp2, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp3, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_timestamp3, tvb, offset, 8, ENC_BIG_ENDIAN );
|
||||
offset += 8;
|
||||
/* With the receiver feedback packet, the recipient can tell the sender up to what sequence
|
||||
* number in the RTP-stream the packets have been received; this can be used to shorten the
|
||||
* recovery-journal-section in the RTP-session */
|
||||
} else if ( APPLEMIDI_COMMAND_RECEIVER_FEEDBACK == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
} else if ( APPLEMIDI_COMMAND_RECEIVER_FEEDBACK == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
ti = proto_tree_add_item( applemidi_tree, hf_applemidi_sequence_num, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
/* Apple includes a 32bit sequence-number, but the RTP-packet only specifies 16bit.
|
||||
* this subtree and subitem are added to be able to associate the sequence-number
|
||||
* here easier with the one specified in the corresponding RTP-packet */
|
||||
applemidi_tree_seq_num = proto_item_add_subtree( ti, ett_applemidi_seq_num );
|
||||
seq_num = tvb_get_ntohs( tvb, offset );
|
||||
proto_tree_add_uint( applemidi_tree_seq_num, hf_applemidi_rtp_sequence_num, tvb, offset, 2, seq_num );
|
||||
offset += 4;
|
||||
ti = proto_tree_add_item( applemidi_tree, hf_applemidi_sequence_num, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
/* Apple includes a 32bit sequence-number, but the RTP-packet only specifies 16bit.
|
||||
* this subtree and subitem are added to be able to associate the sequence-number
|
||||
* here easier with the one specified in the corresponding RTP-packet */
|
||||
applemidi_tree_seq_num = proto_item_add_subtree( ti, ett_applemidi_seq_num );
|
||||
seq_num = tvb_get_ntohs( tvb, offset );
|
||||
proto_tree_add_uint( applemidi_tree_seq_num, hf_applemidi_rtp_sequence_num, tvb, offset, 2, seq_num );
|
||||
offset += 4;
|
||||
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": seq = %u", seq_num );
|
||||
col_append_fstr( pinfo->cinfo, COL_INFO, ": seq = %u", seq_num );
|
||||
/* With the bitrate receive limit packet, the recipient can tell the sender to limit
|
||||
the transmission to a certain bitrate. This is important if the peer is a gateway
|
||||
to a hardware-device that only supports a certain speed. Like the MIDI 1.0 DIN-cable
|
||||
MIDI-implementation which is limited to 31250. */
|
||||
} else if ( APPLEMIDI_COMMAND_BITRATE_RECEIVE_LIMIT == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
} else if ( APPLEMIDI_COMMAND_BITRATE_RECEIVE_LIMIT == command ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_ssrc, tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_rtp_bitrate_limit,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
}
|
||||
/* If there is any remaining data (possibly because an unknown command was encountered),
|
||||
* we just dump it here */
|
||||
len = tvb_length_remaining( tvb, offset );
|
||||
if ( len > 0 ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_unknown_data, tvb, offset, len, ENC_NA );
|
||||
}
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_rtp_bitrate_limit,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN );
|
||||
offset += 4;
|
||||
}
|
||||
/* If there is any remaining data (possibly because an unknown command was encountered),
|
||||
* we just dump it here */
|
||||
len = tvb_reported_length_remaining( tvb, offset );
|
||||
if ( len > 0 ) {
|
||||
proto_tree_add_item( applemidi_tree, hf_applemidi_unknown_data, tvb, offset, len, ENC_NA );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,10 +280,9 @@ dissect_applemidi_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
|
|||
|
||||
guint16 command;
|
||||
conversation_t *p_conv;
|
||||
/*struct _rtp_conversation_info *p_conv_data = NULL;*/
|
||||
rtp_dyn_payload_t *rtp_dyn_payload = NULL;
|
||||
rtp_dyn_payload_t *rtp_dyn_payload;
|
||||
|
||||
if ( tvb_length( tvb ) < 4)
|
||||
if ( tvb_captured_length( tvb ) < 4)
|
||||
return FALSE; /* not enough bytes to check */
|
||||
|
||||
if ( !test_applemidi( tvb, &command, FALSE ) ) {
|
||||
|
|
|
@ -1817,55 +1817,54 @@ dissect_abis_oml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
|
|||
{
|
||||
proto_item *ti;
|
||||
proto_tree *oml_tree;
|
||||
|
||||
int offset = 0;
|
||||
|
||||
guint8 msg_disc = tvb_get_guint8(tvb, offset);
|
||||
guint8 len = tvb_get_guint8(tvb, offset+3);
|
||||
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OML");
|
||||
|
||||
top_tree = tree;
|
||||
/* if (tree) */ {
|
||||
guint8 msg_disc = tvb_get_guint8(tvb, offset);
|
||||
guint8 len = tvb_get_guint8(tvb, offset+3);
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_abis_oml, tvb, 0, -1, ENC_NA);
|
||||
oml_tree = proto_item_add_subtree(ti, ett_oml);
|
||||
ti = proto_tree_add_item(tree, proto_abis_oml, tvb, 0, -1, ENC_NA);
|
||||
oml_tree = proto_item_add_subtree(ti, ett_oml);
|
||||
|
||||
proto_tree_add_item(oml_tree, hf_oml_msg_disc, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_placement, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_sequence, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_length, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_msg_disc, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_placement, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_sequence, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(oml_tree, hf_oml_length, tvb, offset++,
|
||||
1, ENC_LITTLE_ENDIAN);
|
||||
|
||||
if (global_oml_dialect == OML_DIALECT_ERICSSON) {
|
||||
/* Ericsson OM2000 only sharese the common header above
|
||||
* and has completely custom/proprietary message format
|
||||
* after that header. Thus, it makes more sense of
|
||||
* putting all of that into an external dissector and
|
||||
* call out to that dissector */
|
||||
tvbuff_t *subtvb;
|
||||
subtvb = tvb_new_subset_length(tvb, offset, len);
|
||||
if (global_oml_dialect == OML_DIALECT_ERICSSON) {
|
||||
/* Ericsson OM2000 only sharese the common header above
|
||||
* and has completely custom/proprietary message format
|
||||
* after that header. Thus, it makes more sense of
|
||||
* putting all of that into an external dissector and
|
||||
* call out to that dissector */
|
||||
tvbuff_t *subtvb;
|
||||
subtvb = tvb_new_subset_length(tvb, offset, len);
|
||||
|
||||
if (sub_om2000)
|
||||
call_dissector(sub_om2000, subtvb, pinfo, tree);
|
||||
} else {
|
||||
if (sub_om2000)
|
||||
call_dissector(sub_om2000, subtvb, pinfo, tree);
|
||||
} else {
|
||||
|
||||
switch (msg_disc) {
|
||||
case ABIS_OM_MDISC_FOM:
|
||||
offset = dissect_oml_fom(tvb, pinfo, oml_tree,
|
||||
offset, ti);
|
||||
break;
|
||||
case ABIS_OM_MDISC_MANUF:
|
||||
offset = dissect_oml_manuf(tvb, pinfo, oml_tree,
|
||||
offset, ti);
|
||||
break;
|
||||
case ABIS_OM_MDISC_MMI:
|
||||
case ABIS_OM_MDISC_TRAU:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (msg_disc) {
|
||||
case ABIS_OM_MDISC_FOM:
|
||||
offset = dissect_oml_fom(tvb, pinfo, oml_tree,
|
||||
offset, ti);
|
||||
break;
|
||||
case ABIS_OM_MDISC_MANUF:
|
||||
offset = dissect_oml_manuf(tvb, pinfo, oml_tree,
|
||||
offset, ti);
|
||||
break;
|
||||
case ABIS_OM_MDISC_MMI:
|
||||
case ABIS_OM_MDISC_TRAU:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ void proto_reg_handoff_netrom(void);
|
|||
|
||||
#define NETROM_PROTO_IP 0x0C
|
||||
|
||||
/* Dissector handles - all the possibles are listed */
|
||||
/* Dissector handles */
|
||||
static dissector_handle_t ip_handle;
|
||||
static dissector_handle_t default_handle;
|
||||
static dissector_handle_t data_handle;
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
static int proto_netrom = -1;
|
||||
|
@ -198,7 +198,7 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
guint8 op_code;
|
||||
guint8 cct_index;
|
||||
guint8 cct_id;
|
||||
tvbuff_t *next_tvb = NULL;
|
||||
tvbuff_t *next_tvb;
|
||||
|
||||
col_set_str( pinfo->cinfo, COL_PROTOCOL, "NET/ROM" );
|
||||
col_clear( pinfo->cinfo, COL_INFO );
|
||||
|
@ -439,12 +439,12 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
if ( cct_index == NETROM_PROTO_IP && cct_id == NETROM_PROTO_IP )
|
||||
call_dissector( ip_handle , next_tvb, pinfo, tree );
|
||||
else
|
||||
call_dissector( default_handle , next_tvb, pinfo, tree );
|
||||
call_dissector( data_handle , next_tvb, pinfo, tree );
|
||||
|
||||
break;
|
||||
case NETROM_INFO :
|
||||
default :
|
||||
call_dissector( default_handle , next_tvb, pinfo, tree );
|
||||
call_dissector( data_handle , next_tvb, pinfo, tree );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ dissect_netrom_routing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
next_tvb = tvb_new_subset_remaining(tvb, 7);
|
||||
|
||||
call_dissector( default_handle , next_tvb, pinfo, tree );
|
||||
call_dissector( data_handle , next_tvb, pinfo, tree );
|
||||
}
|
||||
|
||||
/* Code to actually dissect the packets */
|
||||
|
@ -626,8 +626,8 @@ proto_reg_handoff_netrom(void)
|
|||
{
|
||||
dissector_add_uint( "ax25.pid", AX25_P_NETROM, create_dissector_handle( dissect_netrom, proto_netrom ) );
|
||||
|
||||
ip_handle = find_dissector( "ip" );
|
||||
default_handle = find_dissector( "data" );
|
||||
ip_handle = find_dissector( "ip" );
|
||||
data_handle = find_dissector( "data" );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -461,9 +461,8 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
|
|||
tvb, offset, avp_data_length,
|
||||
ett_pana_avp, NULL, "AVP Value (EAP packet)");
|
||||
eap_tvb = tvb_new_subset_length(tvb, offset, avp_data_length);
|
||||
if (eap_handle != NULL) {
|
||||
call_dissector(eap_handle, eap_tvb, pinfo, avp_eap_tree);
|
||||
}
|
||||
DISSECTOR_ASSERT_HINT(eap_handle, "EAP Dissector not available");
|
||||
call_dissector(eap_handle, eap_tvb, pinfo, avp_eap_tree);
|
||||
break;
|
||||
}
|
||||
case PANA_ENCAPSULATED: {
|
||||
|
@ -652,7 +651,7 @@ dissect_pana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
guint32 avp_length;
|
||||
|
||||
/* Get actual buffer length */
|
||||
buffer_length = tvb_length(tvb);
|
||||
buffer_length = tvb_captured_length(tvb);
|
||||
|
||||
/* Check minimum buffer length */
|
||||
if(buffer_length < 12) {
|
||||
|
@ -925,7 +924,6 @@ proto_reg_handoff_pana(void)
|
|||
dissector_add_for_decode_as("udp.port", pana_handle);
|
||||
|
||||
eap_handle = find_dissector("eap");
|
||||
/** if(!eap_handle) fprintf(stderr,"PANA warning: EAP dissector not found\n"); **/
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -561,7 +561,7 @@ static gint
|
|||
rtmpt_get_amf_length(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
guint8 iObjType;
|
||||
gint remain = tvb_length_remaining(tvb, offset);
|
||||
gint remain = tvb_reported_length_remaining(tvb, offset);
|
||||
guint32 depth = 0;
|
||||
gint itemlen = 0;
|
||||
gint rv = 0;
|
||||
|
@ -640,7 +640,7 @@ rtmpt_get_amf_length(tvbuff_t *tvb, gint offset)
|
|||
static gchar *
|
||||
rtmpt_get_amf_param(tvbuff_t *tvb, gint offset, gint param, const gchar *prop)
|
||||
{
|
||||
guint32 remain = tvb_length_remaining(tvb, offset);
|
||||
guint32 remain = tvb_reported_length_remaining(tvb, offset);
|
||||
guint32 itemlen;
|
||||
guint32 iStringLength;
|
||||
|
||||
|
@ -694,7 +694,7 @@ rtmpt_get_amf_param(tvbuff_t *tvb, gint offset, gint param, const gchar *prop)
|
|||
static guint32
|
||||
rtmpt_get_amf_txid(tvbuff_t *tvb, gint offset)
|
||||
{
|
||||
guint32 remain = tvb_length_remaining(tvb, offset);
|
||||
guint32 remain = tvb_reported_length_remaining(tvb, offset);
|
||||
|
||||
if (remain > 0) {
|
||||
guint32 itemlen = rtmpt_get_amf_length(tvb, offset);
|
||||
|
@ -739,7 +739,7 @@ rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_
|
|||
|
||||
} else if (tp->cmd == RTMPT_TYPE_UCM) {
|
||||
guint16 iUCM = -1;
|
||||
const gchar *sFunc = NULL;
|
||||
const gchar *sFunc;
|
||||
const gchar *sParam = "";
|
||||
|
||||
if (tp->len < 2 || remain < 2)
|
||||
|
@ -1111,7 +1111,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
|
|||
* If we can't determine the length, don't carry on;
|
||||
* just skip to the end of the tvbuff.
|
||||
*/
|
||||
iValueOffset = tvb_length(tvb);
|
||||
iValueOffset = tvb_reported_length(tvb);
|
||||
break;
|
||||
}
|
||||
proto_item_set_end(ti, tvb, iValueOffset);
|
||||
|
@ -1546,7 +1546,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
|
|||
* If we can't determine the length, don't carry on;
|
||||
* just skip to the end of the tvbuff.
|
||||
*/
|
||||
iValueOffset = tvb_length(tvb);
|
||||
iValueOffset = tvb_reported_length(tvb);
|
||||
break;
|
||||
}
|
||||
proto_item_set_end(ti, tvb, iValueOffset);
|
||||
|
@ -1626,7 +1626,7 @@ dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
|
|||
|
||||
proto_tree *data_tree;
|
||||
|
||||
while (tvb_length_remaining(tvb, offset) > 0) {
|
||||
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
||||
guint8 iTagType;
|
||||
guint iDataSize;
|
||||
|
||||
|
@ -1667,9 +1667,6 @@ dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
|
|||
static void
|
||||
dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t *rconv, int cdir, rtmpt_packet_t *tp)
|
||||
{
|
||||
proto_tree *rtmpt_tree = NULL;
|
||||
proto_tree *rtmptroot_tree = NULL;
|
||||
proto_item *ti = NULL;
|
||||
gint offset = 0;
|
||||
|
||||
gchar *sDesc = NULL;
|
||||
|
@ -1682,22 +1679,22 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
|
|||
|
||||
RTMPT_DEBUG("Dissect: frame=%u visited=%d len=%d tree=%p\n",
|
||||
pinfo->fd->num, pinfo->fd->flags.visited,
|
||||
tvb_length_remaining(tvb, offset), tree);
|
||||
tvb_reported_length_remaining(tvb, offset), tree);
|
||||
|
||||
/* Clear any previous data in Info column (RTMP packets are protected by a "fence") */
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
if (tvb_length_remaining(tvb, offset) < 1) return;
|
||||
if (tvb_reported_length_remaining(tvb, offset) < 1) return;
|
||||
|
||||
if (tp->id <= RTMPT_ID_MAX) {
|
||||
if (tp->fmt < 3
|
||||
&& tvb_length_remaining(tvb, offset) >= tp->bhlen+3
|
||||
&& tvb_reported_length_remaining(tvb, offset) >= tp->bhlen+3
|
||||
&& tvb_get_ntoh24(tvb, offset+tp->bhlen) == 0xffffff) {
|
||||
haveETS = TRUE;
|
||||
}
|
||||
|
||||
iBodyOffset = offset + tp->bhlen + tp->mhlen;
|
||||
iBodyRemain = tvb_length_remaining(tvb, iBodyOffset);
|
||||
iBodyRemain = tvb_reported_length_remaining(tvb, iBodyOffset);
|
||||
|
||||
if (tp->cmd == RTMPT_TYPE_CHUNK_SIZE && tp->len >= 4 && iBodyRemain >= 4) {
|
||||
guint32 newchunksize = tvb_get_ntohl(tvb, iBodyOffset);
|
||||
|
@ -1742,6 +1739,9 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
|
|||
|
||||
if (tree)
|
||||
{
|
||||
proto_tree *rtmpt_tree = NULL;
|
||||
proto_tree *rtmptroot_tree = NULL;
|
||||
proto_item *ti;
|
||||
ti = proto_tree_add_item(tree, proto_rtmpt, tvb, offset, -1, ENC_NA);
|
||||
|
||||
if (tp->id > RTMPT_ID_MAX) {
|
||||
|
@ -1875,7 +1875,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
|
|||
rtmpt_packet_t *tp;
|
||||
tvbuff_t *pktbuf;
|
||||
|
||||
remain = tvb_length(tvb);
|
||||
remain = tvb_reported_length(tvb);
|
||||
if (!remain)
|
||||
return;
|
||||
|
||||
|
@ -2304,7 +2304,7 @@ dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
|
|||
conv->key_ptr->port2 == pinfo->destport) ? 0 : 1;
|
||||
|
||||
dissect_rtmpt_common(tvb, pinfo, tree, rconv, cdir, tcpinfo->seq, tcpinfo->lastackseq);
|
||||
return tvb_length(tvb);
|
||||
return tvb_reported_length(tvb);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2319,7 +2319,7 @@ dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
gint remain;
|
||||
|
||||
offset = 0;
|
||||
remain = tvb_length_remaining(tvb, 0);
|
||||
remain = tvb_reported_length_remaining(tvb, 0);
|
||||
|
||||
/*
|
||||
* Request flow:
|
||||
|
@ -2429,7 +2429,7 @@ static gboolean
|
|||
dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
conversation_t *conversation;
|
||||
if (tvb_length(tvb) >= 12)
|
||||
if (tvb_reported_length(tvb) >= 12)
|
||||
{
|
||||
/* To avoid a too high rate of false positive, this heuristics only matches the protocol
|
||||
from the first server response packet and not from the client request packets before.
|
||||
|
|
Loading…
Reference in New Issue