Exemple #1
0
static void
dissect_applemidi( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {
	guint16		command;

	if ( test_applemidi( tvb, &command, TRUE ) )
		dissect_applemidi_common( tvb, pinfo, tree, command );
	else
		call_dissector( rtp_handle, tvb, pinfo, tree );
}
Exemple #2
0
static gboolean
dissect_applemidi_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) {

	guint16		 command;
	conversation_t	*p_conv;
	/*struct _rtp_conversation_info *p_conv_data = NULL;*/
	encoding_name_and_rate_t *encoding_name_and_rate = NULL;
	GHashTable *rtp_dyn_payload = NULL;
	gint *key;

	if ( tvb_length( tvb ) < 4)
		return FALSE;  /* not enough bytes to check */

	if ( !test_applemidi( tvb, &command, FALSE ) ) {
		return FALSE;
	}

	/* set dynamic payload-type 97 which is used by Apple for their RTP-MIDI implementation for this
	   address/port-tuple to cause RTP-dissector to call the RTP-MIDI-dissector for payload-decoding */

	encoding_name_and_rate = se_alloc( sizeof( encoding_name_and_rate_t ) );
	rtp_dyn_payload = g_hash_table_new( g_int_hash, g_int_equal );
	encoding_name_and_rate->encoding_name = se_strdup( "rtp-midi" );
	encoding_name_and_rate->sample_rate = 10000;
	key = se_alloc( sizeof( gint ) );
	*key = 97;
	g_hash_table_insert( rtp_dyn_payload, key, encoding_name_and_rate );
        rtp_add_address( pinfo, &pinfo->src, pinfo->srcport, 0, APPLEMIDI_DISSECTOR_SHORTNAME,
			 pinfo->fd->num, FALSE, rtp_dyn_payload);

	/* call dissect_applemidi() from now on for UDP packets on this "connection"
	   it is important to do this step after calling rtp_add_address, otherwise
	   all further packets will go directly to the RTP-dissector!                */

	p_conv = find_or_create_conversation(pinfo);
	conversation_set_dissector( p_conv, applemidi_handle );

	/* punt to actual decoding */

	dissect_applemidi_common( tvb, pinfo, tree, command );
	return TRUE;

}