2007-12-17 20:43:38 +00:00
|
|
|
/* packet-rtmpt.c
|
|
|
|
* Routines for Real Time Messaging Protocol packet dissection
|
|
|
|
* metatech <metatech@flashmail.com>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-12-17 20:43:38 +00:00
|
|
|
*/
|
|
|
|
|
2010-05-13 18:28:34 +00:00
|
|
|
/* This dissector is called RTMPT to avoid a conflict with
|
2007-12-17 20:43:38 +00:00
|
|
|
* the other RTMP protocol (Routing Table Maintenance Protocol) implemented in packet-atalk.c
|
|
|
|
* (RTMPT normally stands for RTMP-Tunnel via http)
|
|
|
|
*
|
|
|
|
* RTMP in a nutshell
|
|
|
|
*
|
2009-07-12 15:03:05 +00:00
|
|
|
* The protocol has very few "magic words" to facilitate detection,
|
2007-12-17 20:43:38 +00:00
|
|
|
* but rather has "magic lengths".
|
|
|
|
* This protocol has plenty of special cases and few general rules,
|
|
|
|
* especially regarding the lengths and the structures.
|
|
|
|
*
|
|
|
|
* Documentation:
|
2012-04-12 22:13:59 +00:00
|
|
|
* RTMP protocol description on Wiki of Red5 Open Source Flash Server at
|
|
|
|
*
|
|
|
|
* http://trac.red5.org/wiki/Codecs/RTMPSpecification
|
|
|
|
*
|
|
|
|
* and the pages to which it links:
|
|
|
|
*
|
|
|
|
* http://osflash.org/documentation/rtmp
|
|
|
|
* http://wiki.gnashdev.org/RTMP
|
|
|
|
* http://wiki.gnashdev.org/RTMP_Messages_Decoded
|
|
|
|
* http://www.acmewebworks.com/Downloads/openCS/TheAMF.pdf
|
|
|
|
* http://www.gnashdev.org/files/rtmp-decoded.pdf
|
2012-11-16 21:59:58 +00:00
|
|
|
*
|
|
|
|
* It's also available from Adobe at
|
|
|
|
*
|
|
|
|
* http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf
|
|
|
|
*
|
|
|
|
* For AMF, see:
|
|
|
|
*
|
|
|
|
* http://download.macromedia.com/pub/labs/amf/amf0_spec_121207.pdf
|
|
|
|
*
|
|
|
|
* for AMF0 and
|
|
|
|
*
|
|
|
|
* http://amf3cplusplus.googlecode.com/svn-history/r4/trunk/doc/amf3_spec_05_05_08.pdf
|
|
|
|
*
|
|
|
|
* for AMF3.
|
2013-07-15 20:42:57 +00:00
|
|
|
*
|
2014-02-06 19:47:02 +00:00
|
|
|
* For FLV, see:
|
|
|
|
*
|
|
|
|
* http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
|
|
|
|
*
|
2007-12-17 20:43:38 +00:00
|
|
|
* Default TCP port is 1935
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2007-12-17 20:43:38 +00:00
|
|
|
#include <epan/packet.h>
|
2013-11-09 15:44:29 +00:00
|
|
|
#include <wsutil/pint.h>
|
2011-05-20 15:44:25 +00:00
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
#include <epan/wmem/wmem.h>
|
2007-12-17 20:43:38 +00:00
|
|
|
#include <epan/conversation.h>
|
2010-10-30 16:40:46 +00:00
|
|
|
#include <epan/strutil.h>
|
2007-12-17 20:43:38 +00:00
|
|
|
#include <epan/prefs.h>
|
2013-12-21 17:23:17 +00:00
|
|
|
#include <epan/to_str.h>
|
2007-12-17 20:43:38 +00:00
|
|
|
#include "packet-tcp.h"
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* #define DEBUG_RTMPT 1 */
|
|
|
|
|
2013-12-12 06:11:05 +00:00
|
|
|
void proto_register_rtmpt(void);
|
|
|
|
void proto_reg_handoff_rtmpt(void);
|
|
|
|
|
|
|
|
void proto_register_amf(void);
|
|
|
|
|
2007-12-17 20:43:38 +00:00
|
|
|
static int proto_rtmpt = -1;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
static int hf_rtmpt_handshake_c0 = -1;
|
|
|
|
static int hf_rtmpt_handshake_s0 = -1;
|
|
|
|
static int hf_rtmpt_handshake_c1 = -1;
|
|
|
|
static int hf_rtmpt_handshake_s1 = -1;
|
|
|
|
static int hf_rtmpt_handshake_c2 = -1;
|
|
|
|
static int hf_rtmpt_handshake_s2 = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_header_format = -1;
|
|
|
|
static int hf_rtmpt_header_csid = -1;
|
2007-12-17 20:43:38 +00:00
|
|
|
static int hf_rtmpt_header_timestamp = -1;
|
2010-10-30 16:40:46 +00:00
|
|
|
static int hf_rtmpt_header_timestamp_delta = -1;
|
2007-12-17 20:43:38 +00:00
|
|
|
static int hf_rtmpt_header_body_size = -1;
|
2010-10-30 16:40:46 +00:00
|
|
|
static int hf_rtmpt_header_typeid = -1;
|
|
|
|
static int hf_rtmpt_header_streamid = -1;
|
|
|
|
static int hf_rtmpt_header_ets = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_scm_chunksize = -1;
|
|
|
|
static int hf_rtmpt_scm_csid = -1;
|
|
|
|
static int hf_rtmpt_scm_seq = -1;
|
|
|
|
static int hf_rtmpt_scm_was = -1;
|
|
|
|
static int hf_rtmpt_scm_limittype = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_ucm_eventtype = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_function_call = -1;
|
|
|
|
static int hf_rtmpt_function_response = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_audio_control = -1;
|
|
|
|
static int hf_rtmpt_audio_format = -1;
|
|
|
|
static int hf_rtmpt_audio_rate = -1;
|
|
|
|
static int hf_rtmpt_audio_size = -1;
|
|
|
|
static int hf_rtmpt_audio_type = -1;
|
|
|
|
static int hf_rtmpt_audio_data = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_video_control = -1;
|
|
|
|
static int hf_rtmpt_video_type = -1;
|
|
|
|
static int hf_rtmpt_video_format = -1;
|
|
|
|
static int hf_rtmpt_video_data = -1;
|
|
|
|
|
|
|
|
static int hf_rtmpt_tag_type = -1;
|
|
|
|
static int hf_rtmpt_tag_datasize = -1;
|
|
|
|
static int hf_rtmpt_tag_timestamp = -1;
|
|
|
|
static int hf_rtmpt_tag_ets = -1;
|
|
|
|
static int hf_rtmpt_tag_streamid = -1;
|
|
|
|
static int hf_rtmpt_tag_tagsize = -1;
|
2007-12-17 20:43:38 +00:00
|
|
|
|
|
|
|
static gint ett_rtmpt = -1;
|
2010-10-30 16:40:46 +00:00
|
|
|
static gint ett_rtmpt_handshake = -1;
|
2007-12-17 20:43:38 +00:00
|
|
|
static gint ett_rtmpt_header = -1;
|
|
|
|
static gint ett_rtmpt_body = -1;
|
2010-10-30 16:40:46 +00:00
|
|
|
static gint ett_rtmpt_ucm = -1;
|
|
|
|
static gint ett_rtmpt_audio_control = -1;
|
|
|
|
static gint ett_rtmpt_video_control = -1;
|
|
|
|
static gint ett_rtmpt_tag = -1;
|
|
|
|
static gint ett_rtmpt_tag_data = -1;
|
2007-12-17 20:43:38 +00:00
|
|
|
|
|
|
|
static dissector_handle_t rtmpt_tcp_handle;
|
2010-10-30 16:40:46 +00:00
|
|
|
static dissector_handle_t rtmpt_http_handle;
|
2007-12-17 20:43:38 +00:00
|
|
|
|
|
|
|
static gboolean rtmpt_desegment = TRUE;
|
|
|
|
|
2013-05-16 01:56:48 +00:00
|
|
|
/* Native Bandwidth Detection (using the checkBandwidth(), onBWCheck(),
|
|
|
|
* onBWDone() calls) transmits a series of increasing size packets over
|
|
|
|
* the course of 2 seconds. On a fast link the largest packet can just
|
|
|
|
* exceed 256KB, but setting the limit there can cause massive memory
|
|
|
|
* usage in some scenarios. For now make it a preference, but a better fix
|
|
|
|
* is really needed.
|
|
|
|
* See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6898
|
|
|
|
*/
|
2013-09-21 16:27:55 +00:00
|
|
|
static guint rtmpt_max_packet_size = 32768;
|
2013-05-16 01:56:48 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
#define RTMP_PORT 1935
|
|
|
|
|
|
|
|
#define RTMPT_MAGIC 0x03
|
2011-12-15 18:47:57 +00:00
|
|
|
#define RTMPT_HANDSHAKE_OFFSET_1 1
|
2010-10-30 16:40:46 +00:00
|
|
|
#define RTMPT_HANDSHAKE_OFFSET_2 1538
|
|
|
|
#define RTMPT_HANDSHAKE_OFFSET_3 3074
|
|
|
|
#define RTMPT_HANDSHAKE_LENGTH_1 1537
|
|
|
|
#define RTMPT_HANDSHAKE_LENGTH_2 3073
|
|
|
|
#define RTMPT_HANDSHAKE_LENGTH_3 1536
|
2011-12-15 18:47:57 +00:00
|
|
|
#define RTMPT_DEFAULT_CHUNK_SIZE 128
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
#define RTMPT_ID_MAX 65599
|
2010-10-30 16:40:46 +00:00
|
|
|
#define RTMPT_TYPE_HANDSHAKE_1 0x100001
|
|
|
|
#define RTMPT_TYPE_HANDSHAKE_2 0x100002
|
|
|
|
#define RTMPT_TYPE_HANDSHAKE_3 0x100003
|
2007-12-17 20:43:38 +00:00
|
|
|
|
|
|
|
#define RTMPT_TYPE_CHUNK_SIZE 0x01
|
2010-10-30 16:40:46 +00:00
|
|
|
#define RTMPT_TYPE_ABORT_MESSAGE 0x02
|
|
|
|
#define RTMPT_TYPE_ACKNOWLEDGEMENT 0x03
|
|
|
|
#define RTMPT_TYPE_UCM 0x04
|
|
|
|
#define RTMPT_TYPE_WINDOW 0x05
|
|
|
|
#define RTMPT_TYPE_PEER_BANDWIDTH 0x06
|
2007-12-17 20:43:38 +00:00
|
|
|
#define RTMPT_TYPE_AUDIO_DATA 0x08
|
|
|
|
#define RTMPT_TYPE_VIDEO_DATA 0x09
|
2010-10-30 16:40:46 +00:00
|
|
|
#define RTMPT_TYPE_DATA_AMF3 0x0F
|
|
|
|
#define RTMPT_TYPE_SHARED_AMF3 0x10
|
|
|
|
#define RTMPT_TYPE_COMMAND_AMF3 0x11
|
|
|
|
#define RTMPT_TYPE_DATA_AMF0 0x12
|
|
|
|
#define RTMPT_TYPE_SHARED_AMF0 0x13
|
|
|
|
#define RTMPT_TYPE_COMMAND_AMF0 0x14
|
|
|
|
#define RTMPT_TYPE_AGGREGATE 0x16
|
|
|
|
|
|
|
|
#define RTMPT_UCM_STREAM_BEGIN 0x00
|
|
|
|
#define RTMPT_UCM_STREAM_EOF 0x01
|
|
|
|
#define RTMPT_UCM_STREAM_DRY 0x02
|
|
|
|
#define RTMPT_UCM_SET_BUFFER 0x03
|
|
|
|
#define RTMPT_UCM_STREAM_ISRECORDED 0x04
|
|
|
|
#define RTMPT_UCM_PING_REQUEST 0x06
|
|
|
|
#define RTMPT_UCM_PING_RESPONSE 0x07
|
|
|
|
|
|
|
|
#define RTMPT_TEXT_RTMP_HEADER "RTMP Header"
|
|
|
|
#define RTMPT_TEXT_RTMP_BODY "RTMP Body"
|
|
|
|
|
|
|
|
static const value_string rtmpt_handshake_vals[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ RTMPT_TYPE_HANDSHAKE_1, "Handshake C0+C1" },
|
|
|
|
{ RTMPT_TYPE_HANDSHAKE_2, "Handshake S0+S1+S2" },
|
|
|
|
{ RTMPT_TYPE_HANDSHAKE_3, "Handshake C2" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
2007-12-17 20:43:38 +00:00
|
|
|
|
|
|
|
static const value_string rtmpt_opcode_vals[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ RTMPT_TYPE_CHUNK_SIZE, "Set Chunk Size" },
|
|
|
|
{ RTMPT_TYPE_ABORT_MESSAGE, "Abort Message" },
|
|
|
|
{ RTMPT_TYPE_ACKNOWLEDGEMENT, "Acknowledgement" },
|
|
|
|
{ RTMPT_TYPE_UCM, "User Control Message" },
|
|
|
|
{ RTMPT_TYPE_WINDOW, "Window Acknowledgement Size" },
|
|
|
|
{ RTMPT_TYPE_PEER_BANDWIDTH, "Set Peer Bandwidth" },
|
|
|
|
{ RTMPT_TYPE_AUDIO_DATA, "Audio Data" },
|
|
|
|
{ RTMPT_TYPE_VIDEO_DATA, "Video Data" },
|
|
|
|
{ RTMPT_TYPE_DATA_AMF3, "AMF3 Data" },
|
|
|
|
{ RTMPT_TYPE_SHARED_AMF3, "AMF3 Shared Object" },
|
|
|
|
{ RTMPT_TYPE_COMMAND_AMF3, "AMF3 Command" },
|
|
|
|
{ RTMPT_TYPE_DATA_AMF0, "AMF0 Data" },
|
|
|
|
{ RTMPT_TYPE_SHARED_AMF0, "AMF0 Shared Object" },
|
|
|
|
{ RTMPT_TYPE_COMMAND_AMF0, "AMF0 Command" },
|
|
|
|
{ RTMPT_TYPE_AGGREGATE, "Aggregate" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rtmpt_limit_vals[] = {
|
|
|
|
/* These are a complete guess, from the order of the documented
|
|
|
|
* options - the values aren't actually specified */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, "Hard" },
|
|
|
|
{ 1, "Soft" },
|
|
|
|
{ 2, "Dynamic" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rtmpt_ucm_vals[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ RTMPT_UCM_STREAM_BEGIN, "Stream Begin" },
|
|
|
|
{ RTMPT_UCM_STREAM_EOF, "Stream EOF" },
|
|
|
|
{ RTMPT_UCM_STREAM_DRY, "Stream Dry" },
|
|
|
|
{ RTMPT_UCM_SET_BUFFER, "Set Buffer Length" },
|
|
|
|
{ RTMPT_UCM_STREAM_ISRECORDED, "Stream Is Recorded" },
|
|
|
|
{ RTMPT_UCM_PING_REQUEST, "Ping Request" },
|
|
|
|
{ RTMPT_UCM_PING_RESPONSE, "Ping Response" },
|
|
|
|
{ 0, NULL }
|
2007-12-17 20:43:38 +00:00
|
|
|
};
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static const value_string rtmpt_tag_vals[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ RTMPT_TYPE_AUDIO_DATA, "Audio Tag" },
|
|
|
|
{ RTMPT_TYPE_VIDEO_DATA, "Video Tag" },
|
|
|
|
{ RTMPT_TYPE_DATA_AMF0, "Script Tag" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
2011-02-25 19:17:17 +00:00
|
|
|
/* [Spec] http://www.adobe.com/content/dam/Adobe/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf */
|
2012-10-29 14:13:12 +00:00
|
|
|
/* [DevG] http://help.adobe.com/en_US/flashmediaserver/devguide/index.html "working with Live Video" => Adding metadata to a live stream */
|
|
|
|
/* [SWF] http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf */
|
2010-10-30 16:40:46 +00:00
|
|
|
static const value_string rtmpt_audio_codecs[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, "Uncompressed" }, /* [DevG] */
|
|
|
|
{ 1, "ADPCM" }, /* [DevG] */
|
|
|
|
{ 2, "MP3" }, /* [DevG] */
|
2012-10-29 14:13:12 +00:00
|
|
|
{ 3, "Uncompressed, little-endian"}, /* [SWF] */
|
|
|
|
{ 4, "Nellymoser 16kHz" }, /* [SWF] */
|
|
|
|
{ 5, "Nellymoser 8kHz" }, /* [DevG] [SWF]*/
|
|
|
|
{ 6, "Nellymoser" }, /* [DevG] [SWF]*/
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 7, "G711A" }, /* [Spec] */
|
|
|
|
{ 8, "G711U" }, /* [Spec] */
|
|
|
|
{ 9, "Nellymoser 16kHz" }, /* [Spec] */
|
|
|
|
{ 10, "HE-AAC" }, /* [DevG] */
|
|
|
|
{ 11, "SPEEX" }, /* [DevG] */
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rtmpt_audio_rates[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, "5.5 kHz" },
|
|
|
|
{ 1, "11 kHz" },
|
|
|
|
{ 2, "22 kHz" },
|
|
|
|
{ 3, "44 kHz" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rtmpt_audio_sizes[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, "8 bit" },
|
|
|
|
{ 1, "16 bit" },
|
|
|
|
{ 0, NULL }
|
2007-12-17 20:43:38 +00:00
|
|
|
};
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static const value_string rtmpt_audio_types[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, "mono" },
|
|
|
|
{ 1, "stereo" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
2014-02-06 19:47:02 +00:00
|
|
|
/* from FLV v10.1 section E.4.3.1 */
|
2010-10-30 16:40:46 +00:00
|
|
|
static const value_string rtmpt_video_types[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 1, "keyframe" },
|
|
|
|
{ 2, "inter-frame" },
|
|
|
|
{ 3, "disposable inter-frame" },
|
2014-02-06 19:47:02 +00:00
|
|
|
{ 4, "generated key frame" },
|
|
|
|
{ 5, "video info/command frame" },
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
2014-02-06 19:47:02 +00:00
|
|
|
/* from FLV v10.1 section E.4.3.1 */
|
2010-10-30 16:40:46 +00:00
|
|
|
static const value_string rtmpt_video_codecs[] = {
|
2011-12-15 18:47:57 +00:00
|
|
|
{ 2, "Sorensen H.263" },
|
|
|
|
{ 3, "Screen video" },
|
|
|
|
{ 4, "On2 VP6" },
|
|
|
|
{ 5, "On2 VP6+alpha" },
|
|
|
|
{ 6, "Screen video version 2" },
|
|
|
|
{ 7, "H.264" },
|
|
|
|
{ 0, NULL }
|
2010-10-30 16:40:46 +00:00
|
|
|
};
|
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
static int proto_amf = -1;
|
|
|
|
|
|
|
|
static int hf_amf_version = -1;
|
|
|
|
static int hf_amf_header_count = -1;
|
|
|
|
static int hf_amf_header_name = -1;
|
|
|
|
static int hf_amf_header_must_understand = -1;
|
|
|
|
static int hf_amf_header_length = -1;
|
2013-01-26 18:54:53 +00:00
|
|
|
/* static int hf_amf_header_value_type = -1; */
|
2012-11-18 08:03:05 +00:00
|
|
|
static int hf_amf_message_count = -1;
|
|
|
|
static int hf_amf_message_target_uri = -1;
|
|
|
|
static int hf_amf_message_response_uri = -1;
|
|
|
|
static int hf_amf_message_length = -1;
|
|
|
|
|
|
|
|
static int hf_amf_amf0_type = -1;
|
|
|
|
static int hf_amf_amf3_type = -1;
|
|
|
|
static int hf_amf_number = -1;
|
|
|
|
static int hf_amf_integer = -1;
|
|
|
|
static int hf_amf_boolean = -1;
|
|
|
|
static int hf_amf_stringlength = -1;
|
|
|
|
static int hf_amf_string = -1;
|
|
|
|
static int hf_amf_string_reference = -1;
|
|
|
|
static int hf_amf_object_reference = -1;
|
|
|
|
static int hf_amf_date = -1;
|
2013-01-26 18:54:53 +00:00
|
|
|
/* static int hf_amf_longstringlength = -1; */
|
2012-11-18 08:03:05 +00:00
|
|
|
static int hf_amf_longstring = -1;
|
|
|
|
static int hf_amf_xml_doc = -1;
|
|
|
|
static int hf_amf_xmllength = -1;
|
|
|
|
static int hf_amf_xml = -1;
|
|
|
|
static int hf_amf_int64 = -1;
|
|
|
|
static int hf_amf_bytearraylength = -1;
|
|
|
|
static int hf_amf_bytearray = -1;
|
|
|
|
|
|
|
|
static int hf_amf_object = -1;
|
|
|
|
static int hf_amf_traitcount = -1;
|
|
|
|
static int hf_amf_classnamelength = -1;
|
|
|
|
static int hf_amf_classname = -1;
|
|
|
|
static int hf_amf_membernamelength = -1;
|
|
|
|
static int hf_amf_membername = -1;
|
|
|
|
static int hf_amf_trait_reference = -1;
|
|
|
|
static int hf_amf_ecmaarray = -1;
|
|
|
|
static int hf_amf_strictarray = -1;
|
|
|
|
static int hf_amf_array = -1;
|
|
|
|
static int hf_amf_arraylength = -1;
|
|
|
|
static int hf_amf_arraydenselength = -1;
|
|
|
|
|
|
|
|
static gint ett_amf = -1;
|
|
|
|
static gint ett_amf_headers = -1;
|
|
|
|
static gint ett_amf_messages = -1;
|
|
|
|
static gint ett_amf_value = -1;
|
|
|
|
static gint ett_amf_property = -1;
|
|
|
|
static gint ett_amf_string = -1;
|
|
|
|
static gint ett_amf_array_element = -1;
|
|
|
|
static gint ett_amf_traits = -1;
|
|
|
|
static gint ett_amf_trait_member = -1;
|
|
|
|
|
|
|
|
/* AMF0 type markers */
|
|
|
|
#define AMF0_NUMBER 0x00
|
|
|
|
#define AMF0_BOOLEAN 0x01
|
|
|
|
#define AMF0_STRING 0x02
|
|
|
|
#define AMF0_OBJECT 0x03
|
|
|
|
#define AMF0_MOVIECLIP 0x04
|
|
|
|
#define AMF0_NULL 0x05
|
|
|
|
#define AMF0_UNDEFINED 0x06
|
|
|
|
#define AMF0_REFERENCE 0x07
|
|
|
|
#define AMF0_ECMA_ARRAY 0x08
|
|
|
|
#define AMF0_END_OF_OBJECT 0x09
|
|
|
|
#define AMF0_STRICT_ARRAY 0x0A
|
|
|
|
#define AMF0_DATE 0x0B
|
|
|
|
#define AMF0_LONG_STRING 0x0C
|
|
|
|
#define AMF0_UNSUPPORTED 0x0D
|
|
|
|
#define AMF0_RECORDSET 0x0E
|
|
|
|
#define AMF0_XML 0x0F
|
|
|
|
#define AMF0_TYPED_OBJECT 0x10
|
|
|
|
#define AMF0_AMF3_MARKER 0x11
|
|
|
|
#define AMF0_INT64 0x22
|
|
|
|
|
|
|
|
/* AMF3 type markers */
|
|
|
|
#define AMF3_UNDEFINED 0x00
|
|
|
|
#define AMF3_NULL 0x01
|
|
|
|
#define AMF3_FALSE 0x02
|
|
|
|
#define AMF3_TRUE 0x03
|
|
|
|
#define AMF3_INTEGER 0x04
|
|
|
|
#define AMF3_DOUBLE 0x05
|
|
|
|
#define AMF3_STRING 0x06
|
|
|
|
#define AMF3_XML_DOC 0x07
|
|
|
|
#define AMF3_DATE 0x08
|
|
|
|
#define AMF3_ARRAY 0x09
|
|
|
|
#define AMF3_OBJECT 0x0A
|
|
|
|
#define AMF3_XML 0x0B
|
|
|
|
#define AMF3_BYTEARRAY 0x0C
|
|
|
|
|
|
|
|
static const value_string amf0_type_vals[] = {
|
|
|
|
{ AMF0_NUMBER, "Number" },
|
|
|
|
{ AMF0_BOOLEAN, "Boolean" },
|
|
|
|
{ AMF0_STRING, "String" },
|
|
|
|
{ AMF0_OBJECT, "Object" },
|
|
|
|
{ AMF0_MOVIECLIP, "Movie clip" },
|
|
|
|
{ AMF0_NULL, "Null" },
|
|
|
|
{ AMF0_UNDEFINED, "Undefined" },
|
|
|
|
{ AMF0_REFERENCE, "Reference" },
|
|
|
|
{ AMF0_ECMA_ARRAY, "ECMA array" },
|
|
|
|
{ AMF0_END_OF_OBJECT, "End of object" },
|
|
|
|
{ AMF0_STRICT_ARRAY, "Strict array" },
|
|
|
|
{ AMF0_DATE, "Date" },
|
|
|
|
{ AMF0_LONG_STRING, "Long string" },
|
|
|
|
{ AMF0_UNSUPPORTED, "Unsupported" },
|
|
|
|
{ AMF0_RECORDSET, "Record set" },
|
|
|
|
{ AMF0_XML, "XML" },
|
|
|
|
{ AMF0_TYPED_OBJECT, "Typed object" },
|
|
|
|
{ AMF0_AMF3_MARKER, "Switch to AMF3" },
|
|
|
|
{ AMF0_INT64, "Int64" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string amf3_type_vals[] = {
|
|
|
|
{ AMF3_UNDEFINED, "Undefined" },
|
|
|
|
{ AMF3_NULL, "Null" },
|
|
|
|
{ AMF3_FALSE, "False" },
|
|
|
|
{ AMF3_TRUE, "True" },
|
|
|
|
{ AMF3_INTEGER, "Integer" },
|
|
|
|
{ AMF3_DOUBLE, "Double" },
|
|
|
|
{ AMF3_STRING, "String" },
|
|
|
|
{ AMF3_XML_DOC, "XML document" },
|
|
|
|
{ AMF3_DATE, "Date" },
|
|
|
|
{ AMF3_ARRAY, "Array" },
|
|
|
|
{ AMF3_OBJECT, "Object" },
|
|
|
|
{ AMF3_XML, "XML" },
|
|
|
|
{ AMF3_BYTEARRAY, "ByteArray" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Holds the reassembled data for a packet during un-chunking
|
|
|
|
*/
|
|
|
|
typedef struct rtmpt_packet {
|
2011-12-15 18:47:57 +00:00
|
|
|
guint32 seq;
|
|
|
|
guint32 lastseq;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
int resident;
|
2010-10-30 16:40:46 +00:00
|
|
|
union {
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 *p;
|
|
|
|
guint32 offset;
|
2010-10-30 16:40:46 +00:00
|
|
|
} data;
|
|
|
|
|
|
|
|
/* used during unchunking */
|
2011-12-15 18:47:57 +00:00
|
|
|
int want;
|
|
|
|
int have;
|
|
|
|
int chunkwant;
|
|
|
|
int chunkhave;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 bhlen;
|
|
|
|
guint8 mhlen;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/* Chunk Basic Header */
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 fmt; /* byte 0 */
|
|
|
|
guint32 id; /* byte 0 */
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
/* Chunk Message Header (offsets assume bhlen == 1) */
|
2011-12-15 18:47:57 +00:00
|
|
|
guint32 ts; /* bytes 1-3, or from ETS @ mhlen-4 if -1 */
|
|
|
|
guint32 len; /* bytes 4-6 */
|
|
|
|
guint8 cmd; /* byte 7 */
|
|
|
|
guint32 src; /* bytes 8-11 */
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
guint32 txid;
|
|
|
|
gint isresponse;
|
|
|
|
gint otherframe;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
} rtmpt_packet_t;
|
|
|
|
|
|
|
|
/* Represents a header or a chunk that is split over two TCP
|
|
|
|
* segments
|
|
|
|
*/
|
|
|
|
typedef struct rtmpt_frag {
|
2011-12-15 18:47:57 +00:00
|
|
|
int ishdr;
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 seq;
|
|
|
|
guint32 lastseq;
|
2011-12-15 18:47:57 +00:00
|
|
|
int have;
|
|
|
|
int len;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
guint8 d[18]; /* enough for a complete header (3 + 11 + 4) */
|
|
|
|
guint32 id;
|
|
|
|
} saved;
|
|
|
|
} rtmpt_frag_t;
|
|
|
|
|
|
|
|
/* The full message header information for the last packet on a particular
|
|
|
|
* ID - used for defaulting short headers
|
|
|
|
*/
|
|
|
|
typedef struct rtmpt_id {
|
2012-03-16 02:00:29 +00:00
|
|
|
guint32 ts; /* bytes 1-3 */
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 tsd;
|
2012-03-16 02:00:29 +00:00
|
|
|
guint32 len; /* bytes 4-6 */
|
|
|
|
guint32 src; /* bytes 8-11 */
|
|
|
|
guint8 cmd; /* byte 7 */
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_t *packets;
|
2010-10-30 16:40:46 +00:00
|
|
|
} rtmpt_id_t;
|
|
|
|
|
|
|
|
/* Historical view of a whole TCP connection
|
|
|
|
*/
|
|
|
|
typedef struct rtmpt_conv {
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_t *seqs[2];
|
|
|
|
wmem_tree_t *frags[2];
|
|
|
|
wmem_tree_t *ids[2];
|
|
|
|
wmem_tree_t *packets[2];
|
|
|
|
wmem_tree_t *chunksize[2];
|
|
|
|
wmem_tree_t *txids[2];
|
2010-10-30 16:40:46 +00:00
|
|
|
} rtmpt_conv_t;
|
|
|
|
|
|
|
|
#ifdef DEBUG_RTMPT
|
|
|
|
static void rtmpt_debug(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintf(fmt, args);
|
|
|
|
}
|
|
|
|
#define RTMPT_DEBUG rtmpt_debug
|
|
|
|
#else
|
|
|
|
static void rtmpt_debug(const char *fmt, ...){ (void)fmt; }
|
|
|
|
#define RTMPT_DEBUG 1 ? (void)0 : rtmpt_debug
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Header length helpers */
|
|
|
|
|
|
|
|
static gint rtmpt_basic_header_length(gint id)
|
2007-12-17 20:43:38 +00:00
|
|
|
{
|
2010-10-30 16:40:46 +00:00
|
|
|
switch (id & 0x3f) {
|
|
|
|
case 0: return 2;
|
|
|
|
case 1: return 3;
|
|
|
|
default: return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint rtmpt_message_header_length(gint id)
|
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
switch ((id>>6) & 3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
case 0: return 11;
|
|
|
|
case 1: return 7;
|
|
|
|
case 2: return 3;
|
|
|
|
default: return 0;
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
2010-05-13 18:28:34 +00:00
|
|
|
}
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Lightweight access to AMF0 blobs - more complete dissection is done
|
|
|
|
* in dissect_rtmpt_body_command */
|
|
|
|
|
|
|
|
static gint
|
|
|
|
rtmpt_get_amf_length(tvbuff_t *tvb, gint offset)
|
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 iObjType;
|
2014-06-19 17:18:16 +00:00
|
|
|
gint remain = tvb_length_remaining(tvb, offset);
|
2011-12-15 18:47:57 +00:00
|
|
|
guint32 depth = 0;
|
|
|
|
gint itemlen = 0;
|
|
|
|
gint rv = 0;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
while (rv == 0 || depth > 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (depth > 0) {
|
|
|
|
if (remain-rv < 2)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = tvb_get_ntohs(tvb, offset+rv) + 2;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain-rv<itemlen+1)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
rv += itemlen;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain-rv < 1)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
iObjType = tvb_get_guint8(tvb, offset+rv);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (depth > 0 && itemlen == 2 && iObjType == AMF0_END_OF_OBJECT) {
|
2010-10-30 16:40:46 +00:00
|
|
|
rv++;
|
|
|
|
depth--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (iObjType) {
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_NUMBER:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 9;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_BOOLEAN:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 2;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_STRING:
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain-rv < 3)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = tvb_get_ntohs(tvb, offset+rv+1) + 3;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_NULL:
|
|
|
|
case AMF0_UNDEFINED:
|
|
|
|
case AMF0_UNSUPPORTED:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen= 1;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_DATE:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 11;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_LONG_STRING:
|
|
|
|
case AMF0_XML:
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain-rv < 5)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = tvb_get_ntohl(tvb, offset+rv+1) + 5;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_INT64:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 9;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_OBJECT:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 1;
|
|
|
|
depth++;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_ECMA_ARRAY:
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = 5;
|
|
|
|
depth++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return remain;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain-rv < itemlen)
|
|
|
|
return remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
rv += itemlen;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
static gchar *
|
2010-10-30 16:40:46 +00:00
|
|
|
rtmpt_get_amf_param(tvbuff_t *tvb, gint offset, gint param, const gchar *prop)
|
|
|
|
{
|
2014-06-19 17:18:16 +00:00
|
|
|
guint32 remain = tvb_length_remaining(tvb, offset);
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 itemlen;
|
|
|
|
guint32 iStringLength;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
while (remain > 0 && param > 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
itemlen = rtmpt_get_amf_length(tvb, offset);
|
|
|
|
offset += itemlen;
|
|
|
|
remain -= itemlen;
|
|
|
|
param--;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain > 0 && param == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint8 iObjType = tvb_get_guint8(tvb, offset);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (!prop && iObjType == AMF0_STRING && remain >= 3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
iStringLength = tvb_get_ntohs(tvb, offset+1);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain >= iStringLength+3) {
|
2014-06-17 15:30:58 +00:00
|
|
|
return tvb_get_string_enc(wmem_packet_scope(), tvb, offset+3, iStringLength, ENC_ASCII);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (prop && iObjType == AMF0_OBJECT) {
|
2010-10-30 16:40:46 +00:00
|
|
|
offset++;
|
|
|
|
remain--;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
while (remain > 2) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 iPropLength = tvb_get_ntohs(tvb, offset);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain < 2+iPropLength+3)
|
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tvb_strneql(tvb, offset+2, prop, strlen(prop)) == 0) {
|
|
|
|
if (tvb_get_guint8(tvb, offset+2+iPropLength) != AMF0_STRING)
|
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
iStringLength = tvb_get_ntohs(tvb, offset+2+iPropLength+1);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain < 2+iPropLength+3+iStringLength)
|
|
|
|
break;
|
2011-05-20 15:44:25 +00:00
|
|
|
|
2014-06-17 15:30:58 +00:00
|
|
|
return tvb_get_string_enc(wmem_packet_scope(), tvb, offset+2+iPropLength+3, iStringLength, ENC_ASCII);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
itemlen = rtmpt_get_amf_length(tvb, offset+2+iPropLength);
|
|
|
|
offset += 2+iPropLength+itemlen;
|
|
|
|
remain -= 2+iPropLength+itemlen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint32
|
|
|
|
rtmpt_get_amf_txid(tvbuff_t *tvb, gint offset)
|
|
|
|
{
|
2014-06-19 17:18:16 +00:00
|
|
|
guint32 remain = tvb_length_remaining(tvb, offset);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain > 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 itemlen = rtmpt_get_amf_length(tvb, offset);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain<itemlen)
|
|
|
|
return 0;
|
2010-10-30 16:40:46 +00:00
|
|
|
offset += itemlen;
|
|
|
|
remain -= itemlen;
|
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain >= 9) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint8 iObjType = tvb_get_guint8(tvb, offset);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (iObjType == AMF0_NUMBER) {
|
2010-10-30 16:40:46 +00:00
|
|
|
return (guint32)tvb_get_ntohieee_double(tvb, offset+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Generate a useful description for various packet types */
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
static gchar *
|
2010-10-30 16:40:46 +00:00
|
|
|
rtmpt_get_packet_desc(tvbuff_t *tvb, guint32 offset, guint32 remain, rtmpt_conv_t *rconv, int cdir, rtmpt_packet_t *tp, gint *deschasopcode)
|
|
|
|
{
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->cmd == RTMPT_TYPE_CHUNK_SIZE || tp->cmd == RTMPT_TYPE_ABORT_MESSAGE ||
|
|
|
|
tp->cmd == RTMPT_TYPE_ACKNOWLEDGEMENT || tp->cmd == RTMPT_TYPE_WINDOW) {
|
|
|
|
if (tp->len >= 4 && remain >= 4) {
|
2010-10-30 16:40:46 +00:00
|
|
|
*deschasopcode = TRUE;
|
2013-08-25 14:23:13 +00:00
|
|
|
return wmem_strdup_printf(wmem_packet_scope(), "%s %d",
|
2010-10-30 16:40:46 +00:00
|
|
|
val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"),
|
|
|
|
tvb_get_ntohl(tvb, offset));
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (tp->cmd == RTMPT_TYPE_PEER_BANDWIDTH) {
|
|
|
|
if (tp->len >= 5 && remain >= 5) {
|
2010-10-30 16:40:46 +00:00
|
|
|
*deschasopcode = TRUE;
|
2013-08-25 14:23:13 +00:00
|
|
|
return wmem_strdup_printf(wmem_packet_scope(), "%s %d,%s",
|
2011-05-20 15:44:25 +00:00
|
|
|
val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"),
|
2010-10-30 16:40:46 +00:00
|
|
|
tvb_get_ntohl(tvb, offset),
|
|
|
|
val_to_str(tvb_get_guint8(tvb, offset+4), rtmpt_limit_vals, "Unknown (%d)"));
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (tp->cmd == RTMPT_TYPE_UCM) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint16 iUCM = -1;
|
|
|
|
const gchar *sFunc = NULL;
|
|
|
|
const gchar *sParam = "";
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->len < 2 || remain < 2)
|
|
|
|
return NULL;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
iUCM = tvb_get_ntohs(tvb, offset);
|
2013-03-29 00:26:23 +00:00
|
|
|
sFunc = try_val_to_str(iUCM, rtmpt_ucm_vals);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (sFunc == NULL) {
|
2010-10-30 16:40:46 +00:00
|
|
|
*deschasopcode = TRUE;
|
2013-08-25 14:23:13 +00:00
|
|
|
sFunc = wmem_strdup_printf(wmem_packet_scope(), "User Control Message 0x%01x", iUCM);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (iUCM == RTMPT_UCM_STREAM_BEGIN || iUCM == RTMPT_UCM_STREAM_EOF ||
|
|
|
|
iUCM == RTMPT_UCM_STREAM_DRY || iUCM == RTMPT_UCM_STREAM_ISRECORDED) {
|
|
|
|
if (tp->len >= 6 && remain >= 6) {
|
2013-08-25 14:23:13 +00:00
|
|
|
sParam = wmem_strdup_printf(wmem_packet_scope(), " %d", tvb_get_ntohl(tvb, offset+2));
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (iUCM == RTMPT_UCM_SET_BUFFER) {
|
|
|
|
if (tp->len >= 10 && remain >= 10) {
|
2013-08-25 14:23:13 +00:00
|
|
|
sParam = wmem_strdup_printf(wmem_packet_scope(), " %d,%dms",
|
2010-10-30 16:40:46 +00:00
|
|
|
tvb_get_ntohl(tvb, offset+2),
|
|
|
|
tvb_get_ntohl(tvb, offset+6));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
return wmem_strdup_printf(wmem_packet_scope(), "%s%s", sFunc, sParam);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (tp->cmd == RTMPT_TYPE_COMMAND_AMF0 || tp->cmd == RTMPT_TYPE_COMMAND_AMF3 ||
|
|
|
|
tp->cmd == RTMPT_TYPE_DATA_AMF0 || tp->cmd == RTMPT_TYPE_DATA_AMF3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 slen = 0;
|
|
|
|
guint32 soff = 0;
|
|
|
|
gchar *sFunc = NULL;
|
|
|
|
gchar *sParam = NULL;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->cmd == RTMPT_TYPE_COMMAND_AMF3 || tp->cmd == RTMPT_TYPE_DATA_AMF3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
soff = 1;
|
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->len >= 3+soff && remain >= 3+soff) {
|
2010-10-30 16:40:46 +00:00
|
|
|
slen = tvb_get_ntohs(tvb, offset+1+soff);
|
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
if (slen > 0) {
|
2014-06-17 15:30:58 +00:00
|
|
|
sFunc = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+3+soff, slen, ENC_ASCII);
|
2010-10-30 16:40:46 +00:00
|
|
|
RTMPT_DEBUG("got function call '%s'\n", sFunc);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (strcmp(sFunc, "connect") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 2, "app");
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "play") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, NULL);
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "play2") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, "streamName");
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "releaseStream") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, NULL);
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "FCPublish") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, NULL);
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "publish") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, NULL);
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "onStatus") == 0) {
|
|
|
|
if (tp->cmd == RTMPT_TYPE_COMMAND_AMF0 || tp->cmd == RTMPT_TYPE_COMMAND_AMF3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, "code");
|
|
|
|
} else {
|
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 1, "code");
|
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "onPlayStatus") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 1, "code");
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "_result") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, "code");
|
|
|
|
tp->isresponse = TRUE;
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (strcmp(sFunc, "_error") == 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
sParam = rtmpt_get_amf_param(tvb, offset+soff, 3, "code");
|
|
|
|
tp->isresponse = TRUE;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->txid != 0 && tp->otherframe == 0) {
|
2013-08-25 14:23:13 +00:00
|
|
|
tp->otherframe = GPOINTER_TO_INT(wmem_tree_lookup32(rconv->txids[cdir^1], tp->txid));
|
2010-10-30 16:40:46 +00:00
|
|
|
if (tp->otherframe) {
|
|
|
|
RTMPT_DEBUG("got otherframe=%d\n", tp->otherframe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sFunc) {
|
|
|
|
if (sParam) {
|
2013-08-25 14:23:13 +00:00
|
|
|
return wmem_strdup_printf(wmem_packet_scope(), "%s('%s')", sFunc, sParam);
|
2010-10-30 16:40:46 +00:00
|
|
|
} else {
|
2013-08-25 14:23:13 +00:00
|
|
|
return wmem_strdup_printf(wmem_packet_scope(), "%s()", sFunc);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Tree dissection helpers for various packet body forms */
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2009-07-12 15:03:05 +00:00
|
|
|
static void
|
2010-10-30 16:40:46 +00:00
|
|
|
dissect_rtmpt_body_scm(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree, guint scm)
|
2009-07-12 15:03:05 +00:00
|
|
|
{
|
2010-10-30 16:40:46 +00:00
|
|
|
switch (scm) {
|
|
|
|
case RTMPT_TYPE_CHUNK_SIZE:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_chunksize, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_ABORT_MESSAGE:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_csid, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_ACKNOWLEDGEMENT:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_seq, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_UCM:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_ucm_eventtype, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_WINDOW:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_was, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_PEER_BANDWIDTH:
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_was, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_scm_limittype, tvb, offset+4, 1, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
static gint
|
|
|
|
dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A "property list" is a sequence of name/value pairs, terminated by
|
|
|
|
* and "end of object" indicator. AMF0 "object"s and "ECMA array"s
|
|
|
|
* are encoded as property lists.
|
|
|
|
*/
|
|
|
|
static gint
|
|
|
|
dissect_amf0_property_list(tvbuff_t *tvb, gint offset, proto_tree *tree, guint *countp, gboolean *amf3_encoding)
|
2010-10-30 16:40:46 +00:00
|
|
|
{
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item *prop_ti;
|
|
|
|
proto_tree *prop_tree;
|
|
|
|
proto_tree *name_tree;
|
|
|
|
guint iStringLength;
|
|
|
|
gchar *iStringValue;
|
|
|
|
guint count = 0;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* XXX - at least as I read "3.1 AVM+ Type Marker" in the AMF0
|
|
|
|
* specification, the AVM+ Type Marker only affects "the following
|
|
|
|
* Object". For now, we have a single "AMF3 encoding" flag, and
|
|
|
|
* set it when we see the type marker, and never clear it.
|
|
|
|
*/
|
|
|
|
for (;;) {
|
|
|
|
/* UTF-8: property name */
|
|
|
|
iStringLength = tvb_get_ntohs(tvb, offset);
|
|
|
|
if (iStringLength == 0 &&
|
2012-11-18 08:03:05 +00:00
|
|
|
tvb_get_guint8(tvb, offset + 2) == AMF0_END_OF_OBJECT)
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
|
|
|
count++;
|
2014-06-17 15:30:58 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, iStringLength, ENC_ASCII);
|
2014-07-06 13:49:27 +00:00
|
|
|
prop_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
|
|
|
|
ett_amf_property, &prop_ti, "Property '%s'",
|
2012-11-16 21:59:58 +00:00
|
|
|
iStringValue);
|
|
|
|
|
2014-07-06 13:49:27 +00:00
|
|
|
name_tree = proto_tree_add_subtree_format(prop_tree, tvb,
|
2012-11-16 21:59:58 +00:00
|
|
|
offset, 2+iStringLength,
|
2014-07-06 13:49:27 +00:00
|
|
|
ett_amf_string, NULL, "Name: %s", iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(name_tree, hf_amf_stringlength, tvb, offset, 2, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
offset += 2;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_item(name_tree, hf_amf_string, tvb, offset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
offset += iStringLength;
|
|
|
|
|
|
|
|
/* value-type: property value */
|
|
|
|
offset = dissect_amf0_value_type(tvb, offset, prop_tree, amf3_encoding, prop_ti);
|
|
|
|
proto_item_set_end(prop_ti, tvb, offset);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset, 3, "End Of Object Marker");
|
|
|
|
offset += 3;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
*countp = count;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
static gint
|
|
|
|
dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti)
|
|
|
|
{
|
|
|
|
guint8 iObjType;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *val_tree;
|
|
|
|
gint iValueOffset = offset;
|
|
|
|
guint32 iIntegerValue;
|
|
|
|
double iDoubleValue;
|
|
|
|
gboolean iBooleanValue;
|
|
|
|
guint iStringLength;
|
|
|
|
gchar *iStringValue;
|
|
|
|
guint iArrayLength;
|
|
|
|
guint i;
|
|
|
|
nstime_t t;
|
|
|
|
gint64 iInteger64Value;
|
|
|
|
guint count;
|
|
|
|
|
|
|
|
iObjType = tvb_get_guint8(tvb, offset);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " %s",
|
2012-11-18 08:03:05 +00:00
|
|
|
val_to_str_const(iObjType, amf0_type_vals, "Unknown"));
|
2012-11-16 21:59:58 +00:00
|
|
|
switch (iObjType) {
|
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* For object types, make the top-level protocol tree
|
|
|
|
* item a field for that type.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_amf_object, tvb, offset, -1, ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_ECMA_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* For ECMA array types, make the top-level protocol tree
|
|
|
|
* item a field for that type.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_amf_ecmaarray, tvb, offset, -1, ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_STRICT_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* For strict array types, make the top-level protocol tree
|
|
|
|
* item a field for that type.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_amf_strictarray, tvb, offset, -1, ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* For all other types, make it just a text item; the
|
|
|
|
* field for that type will be used for the value.
|
|
|
|
*/
|
|
|
|
ti = proto_tree_add_text(tree, tvb, offset, -1, "%s",
|
2012-11-18 08:03:05 +00:00
|
|
|
val_to_str_const(iObjType, amf0_type_vals, "Unknown"));
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-18 04:30:10 +00:00
|
|
|
val_tree = proto_item_add_subtree(ti, ett_amf_value);
|
|
|
|
proto_tree_add_uint(val_tree, hf_amf_amf0_type, tvb, iValueOffset, 1, iObjType);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset++;
|
|
|
|
|
|
|
|
switch (iObjType) {
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_NUMBER:
|
2012-11-16 21:59:58 +00:00
|
|
|
iDoubleValue = tvb_get_ntohieee_double(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_double(val_tree, hf_amf_number, tvb, iValueOffset, 8, iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 8;
|
2013-11-09 14:37:13 +00:00
|
|
|
proto_item_append_text(ti, " %." G_STRINGIFY(DBL_DIG) "g", iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
if (parent_ti != NULL)
|
2013-11-09 14:37:13 +00:00
|
|
|
proto_item_append_text(parent_ti, " %." G_STRINGIFY(DBL_DIG) "g", iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_BOOLEAN:
|
2012-11-16 21:59:58 +00:00
|
|
|
iBooleanValue = tvb_get_guint8(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_boolean(val_tree, hf_amf_boolean, tvb, iValueOffset, 1, iBooleanValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 1;
|
|
|
|
proto_item_append_text(ti, iBooleanValue ? " true" : " false");
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, iBooleanValue ? " true" : " false");
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_STRING:
|
2012-11-16 21:59:58 +00:00
|
|
|
iStringLength = tvb_get_ntohs(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_stringlength, tvb, iValueOffset, 2, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 2;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
if (iStringLength != 0)
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(val_tree, hf_amf_string, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
proto_item_append_text(ti, " '%s'", iStringValue);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " '%s'", iStringValue);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
|
|
|
|
proto_item_append_text(ti, " (%u items)", count);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_NULL:
|
|
|
|
case AMF0_UNDEFINED:
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_REFERENCE:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = tvb_get_ntohs(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, 2, iIntegerValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 2;
|
|
|
|
proto_item_append_text(ti, " %d", iIntegerValue);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_ECMA_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* Counted list type, with end marker. The count appears to be
|
|
|
|
* more of a hint than a rule, and is sometimes sent as 0 or
|
|
|
|
* invalid.
|
|
|
|
*
|
|
|
|
* Basically the same as OBJECT but with the extra count field.
|
|
|
|
* There being many strange encoders/metadata injectors out
|
|
|
|
* there, sometimes you see a valid count and no end marker.
|
|
|
|
* Figuring out which you've got for a deeply nested structure
|
|
|
|
* is non-trivial.
|
|
|
|
*/
|
|
|
|
iArrayLength = tvb_get_ntohl(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_arraylength, tvb, iValueOffset, 4, iArrayLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 4;
|
|
|
|
iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
|
|
|
|
proto_item_append_text(ti, " (%u items)", count);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_END_OF_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_tree_add_text(tree, tvb, iValueOffset, 3, "End Of Object Marker");
|
|
|
|
iValueOffset += 3;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_STRICT_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* Counted list type, without end marker. Number of values
|
|
|
|
* is determined by count, values are assumed to form a
|
|
|
|
* [0..N-1] numbered array and are presented as plain AMF
|
|
|
|
* types, not OBJECT or ECMA_ARRAY style named properties.
|
|
|
|
*/
|
|
|
|
iArrayLength = tvb_get_ntohl(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_arraylength, tvb, iValueOffset, 4, iArrayLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 4;
|
|
|
|
for (i = 0; i < iArrayLength; i++)
|
|
|
|
iValueOffset = dissect_amf0_value_type(tvb, iValueOffset, val_tree, amf3_encoding, NULL);
|
|
|
|
proto_item_append_text(ti, " (%u items)", iArrayLength);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_DATE:
|
2012-11-16 21:59:58 +00:00
|
|
|
iDoubleValue = tvb_get_ntohieee_double(tvb, iValueOffset);
|
2012-11-16 22:21:22 +00:00
|
|
|
t.secs = (time_t)(iDoubleValue/1000);
|
|
|
|
t.nsecs = (int)((iDoubleValue - 1000*(double)t.secs) * 1000000);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_time(val_tree, hf_amf_date, tvb, iValueOffset, 8, &t);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 8;
|
2014-06-16 06:42:14 +00:00
|
|
|
proto_item_append_text(ti, " %s", abs_time_to_str(wmem_packet_scope(), &t, ABSOLUTE_TIME_LOCAL, TRUE));
|
2012-11-16 21:59:58 +00:00
|
|
|
if (parent_ti != NULL)
|
2014-06-16 06:42:14 +00:00
|
|
|
proto_item_append_text(parent_ti, " %s", abs_time_to_str(wmem_packet_scope(), &t, ABSOLUTE_TIME_LOCAL, TRUE));
|
2012-11-16 21:59:58 +00:00
|
|
|
/* time-zone */
|
|
|
|
iValueOffset += 2;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_LONG_STRING:
|
|
|
|
case AMF0_XML: /* same representation */
|
2012-11-16 21:59:58 +00:00
|
|
|
iStringLength = tvb_get_ntohl(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_stringlength, tvb, iValueOffset, 2, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 4;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
if (iStringLength != 0)
|
2013-12-12 19:59:23 +00:00
|
|
|
proto_tree_add_string(val_tree, (iObjType == AMF0_XML) ? hf_amf_xml_doc : hf_amf_longstring, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
proto_item_append_text(ti, " '%s'", iStringValue);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " '%s'", iStringValue);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_UNSUPPORTED:
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_TYPED_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
/* class-name */
|
|
|
|
iStringLength = tvb_get_ntohs(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_stringlength, tvb, iValueOffset, 2, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 2;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(val_tree, hf_amf_string, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_AMF3_MARKER:
|
2012-11-16 21:59:58 +00:00
|
|
|
*amf3_encoding = TRUE;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF0_INT64:
|
2012-11-16 21:59:58 +00:00
|
|
|
iInteger64Value = tvb_get_ntoh64(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_int64(val_tree, hf_amf_int64, tvb, iValueOffset, 8, iInteger64Value);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 8;
|
|
|
|
proto_item_append_text(ti," %" G_GINT64_MODIFIER "d", iInteger64Value);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti," %" G_GINT64_MODIFIER "d", iInteger64Value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* If we can't determine the length, don't carry on;
|
|
|
|
* just skip to the end of the tvbuff.
|
|
|
|
*/
|
2014-06-19 17:18:16 +00:00
|
|
|
iValueOffset = tvb_length(tvb);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
proto_item_set_end(ti, tvb, iValueOffset);
|
|
|
|
return iValueOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint32
|
|
|
|
amf_get_u29(tvbuff_t *tvb, int offset, guint *lenp)
|
|
|
|
{
|
2013-12-12 19:59:23 +00:00
|
|
|
guint len = 0;
|
|
|
|
guint8 iByte;
|
|
|
|
guint32 iValue;
|
2012-11-16 21:59:58 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
iByte = tvb_get_guint8(tvb, offset);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValue = (iByte & 0x7F);
|
|
|
|
offset++;
|
|
|
|
len++;
|
|
|
|
if (!(iByte & 0x80)) {
|
|
|
|
/* 1 byte value */
|
|
|
|
*lenp = len;
|
|
|
|
return iValue;
|
|
|
|
}
|
|
|
|
iByte = tvb_get_guint8(tvb, offset);
|
|
|
|
iValue = (iValue << 7) | (iByte & 0x7F);
|
|
|
|
offset++;
|
|
|
|
len++;
|
|
|
|
if (!(iByte & 0x80)) {
|
|
|
|
/* 2 byte value */
|
|
|
|
*lenp = len;
|
|
|
|
return iValue;
|
|
|
|
}
|
|
|
|
iByte = tvb_get_guint8(tvb, offset);
|
|
|
|
iValue = (iValue << 7) | (iByte & 0x7F);
|
|
|
|
offset++;
|
|
|
|
len++;
|
|
|
|
if (!(iByte & 0x80)) {
|
|
|
|
/* 3 byte value */
|
|
|
|
*lenp = len;
|
|
|
|
return iValue;
|
|
|
|
}
|
|
|
|
iByte = tvb_get_guint8(tvb, offset);
|
|
|
|
iValue = (iValue << 8) | iByte;
|
|
|
|
len++;
|
|
|
|
*lenp = len;
|
|
|
|
return iValue;
|
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
static gint
|
|
|
|
dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item *parent_ti)
|
|
|
|
{
|
|
|
|
guint8 iObjType;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *val_tree;
|
|
|
|
gint iValueOffset = offset;
|
|
|
|
guint iValueLength;
|
|
|
|
guint32 iIntegerValue;
|
|
|
|
double iDoubleValue;
|
|
|
|
guint iStringLength;
|
|
|
|
gchar *iStringValue;
|
|
|
|
guint iArrayLength;
|
|
|
|
proto_item *subval_ti;
|
|
|
|
proto_tree *subval_tree;
|
|
|
|
guint i;
|
|
|
|
gboolean iTypeIsDynamic;
|
|
|
|
guint iTraitCount;
|
|
|
|
proto_item *traits_ti;
|
|
|
|
proto_tree *traits_tree;
|
|
|
|
proto_tree *name_tree;
|
|
|
|
proto_tree *member_tree;
|
|
|
|
guint8 *iByteArrayValue;
|
|
|
|
|
|
|
|
iObjType = tvb_get_guint8(tvb, offset);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " %s",
|
2012-11-18 08:03:05 +00:00
|
|
|
val_to_str_const(iObjType, amf3_type_vals, "Unknown"));
|
2012-11-16 21:59:58 +00:00
|
|
|
switch (iObjType) {
|
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* For array types, make the top-level protocol tree
|
|
|
|
* item a field for that type.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_amf_array, tvb, offset, -1, ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* For object types, make the top-level protocol tree
|
|
|
|
* item a field for that type.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_amf_object, tvb, offset, -1, ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* For all other types, make it just a text item; the
|
|
|
|
* field for that type will be used for the value.
|
|
|
|
*/
|
|
|
|
ti = proto_tree_add_text(tree, tvb, offset, -1, "%s",
|
2012-11-18 08:03:05 +00:00
|
|
|
val_to_str_const(iObjType, amf3_type_vals, "Unknown"));
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-18 04:30:10 +00:00
|
|
|
val_tree = proto_item_add_subtree(ti, ett_amf_value);
|
|
|
|
proto_tree_add_uint(val_tree, hf_amf_amf3_type, tvb, iValueOffset, 1, iObjType);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset++;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
switch (iObjType) {
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_UNDEFINED:
|
|
|
|
case AMF3_NULL:
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_FALSE:
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_boolean(val_tree, hf_amf_boolean, tvb, 0, 0, FALSE);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " false");
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_TRUE:
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_boolean(val_tree, hf_amf_boolean, tvb, 0, 0, TRUE);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " true");
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_INTEGER:
|
2012-11-16 21:59:58 +00:00
|
|
|
/* XXX - signed or unsigned? */
|
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_integer, tvb, iValueOffset, iValueLength, iIntegerValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " %u", iIntegerValue);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " %u", iIntegerValue);
|
|
|
|
iValueOffset += iValueLength;
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_DOUBLE:
|
2012-11-16 21:59:58 +00:00
|
|
|
iDoubleValue = tvb_get_ntohieee_double(tvb, iValueOffset);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_double(val_tree, hf_amf_number, tvb, iValueOffset, 8, iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 8;
|
2013-11-09 14:37:13 +00:00
|
|
|
proto_item_append_text(ti, " %." G_STRINGIFY(DBL_DIG) "g", iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
if (parent_ti != NULL)
|
2013-11-09 14:37:13 +00:00
|
|
|
proto_item_append_text(parent_ti, " %." G_STRINGIFY(DBL_DIG) "g", iDoubleValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_STRING:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/* the upper 28 bits of the integer value is a string length */
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_stringlength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
if (iStringLength != 0)
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(val_tree, hf_amf_string, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
proto_item_append_text(ti, " '%s'", iStringValue);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " '%s'", iStringValue);
|
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_string_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
proto_item_append_text(ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " reference %u", iIntegerValue >> 1);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_DATE:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/*
|
|
|
|
* The upper 28 bits of the integer value are
|
|
|
|
* ignored; what follows is a double
|
|
|
|
* containing milliseconds since the Epoch.
|
|
|
|
*/
|
|
|
|
nstime_t t;
|
|
|
|
|
|
|
|
iValueOffset += iValueLength;
|
|
|
|
iDoubleValue = tvb_get_ntohieee_double(tvb, iValueOffset);
|
2012-11-16 22:21:22 +00:00
|
|
|
t.secs = (time_t)(iDoubleValue/1000);
|
|
|
|
t.nsecs = (int)((iDoubleValue - 1000*(double)t.secs) * 1000000);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_time(val_tree, hf_amf_date, tvb, iValueOffset, 8, &t);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += 8;
|
2014-06-16 06:42:14 +00:00
|
|
|
proto_item_append_text(ti, "%s", abs_time_to_str(wmem_packet_scope(), &t, ABSOLUTE_TIME_LOCAL, TRUE));
|
2012-11-16 21:59:58 +00:00
|
|
|
if (parent_ti != NULL)
|
2014-06-16 06:42:14 +00:00
|
|
|
proto_item_append_text(parent_ti, "%s", abs_time_to_str(wmem_packet_scope(), &t, ABSOLUTE_TIME_LOCAL, TRUE));
|
2012-11-16 21:59:58 +00:00
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are an object reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
proto_item_append_text(ti, " object reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " object reference %u", iIntegerValue >> 1);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_ARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/*
|
|
|
|
* The upper 28 bits of the integer value are
|
|
|
|
* a count of the number of elements in
|
|
|
|
* the dense portion of the array.
|
|
|
|
*/
|
|
|
|
iArrayLength = iIntegerValue >> 1;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_arraydenselength, tvb, iValueOffset, iValueLength, iArrayLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The AMF3 spec bit on the Array type is slightly
|
|
|
|
* confusingly written, but seems to be saying that
|
|
|
|
* the associative portion of the array follows the
|
|
|
|
* size of the dense portion of the array, and the
|
|
|
|
* dense portion of the array follows the associative
|
|
|
|
* portion.
|
|
|
|
*
|
|
|
|
* Dissect the associative portion.
|
|
|
|
*/
|
|
|
|
for (;;) {
|
|
|
|
/* Fetch the name */
|
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/* the upper 28 bits of the integer value is a string length */
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
|
|
|
if (iStringLength == 0) {
|
|
|
|
/* null name marks the end of the associative part */
|
|
|
|
proto_tree_add_text(val_tree, tvb, iValueOffset, iValueLength, "End of associative part");
|
|
|
|
iValueOffset += iValueLength;
|
|
|
|
break;
|
|
|
|
}
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset+iValueLength, iStringLength, ENC_UTF_8|ENC_NA);
|
2014-07-06 13:49:27 +00:00
|
|
|
subval_tree = proto_tree_add_subtree(val_tree, tvb, iValueOffset, iStringLength,
|
|
|
|
ett_amf_array_element, &subval_ti, iStringValue);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(subval_tree, hf_amf_stringlength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(subval_tree, hf_amf_string, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2014-07-06 13:49:27 +00:00
|
|
|
subval_tree = proto_tree_add_subtree_format(val_tree, tvb, iValueOffset, iValueLength,
|
|
|
|
ett_amf_array_element, &subval_ti, "Reference %u:", iIntegerValue >> 1);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(subval_tree, hf_amf_string_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
/* Fetch the value */
|
|
|
|
iObjType = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_item_append_text(subval_ti, "%s",
|
2012-11-18 08:03:05 +00:00
|
|
|
val_to_str_const(iObjType, amf3_type_vals, "Unknown"));
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, subval_tree, subval_ti);
|
|
|
|
}
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
/*
|
|
|
|
* Dissect the dense portion.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < iArrayLength; i++)
|
|
|
|
iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, val_tree, NULL);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_set_end(ti, tvb, iValueOffset);
|
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are an object reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " reference %u", iIntegerValue >> 1);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_OBJECT:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
if (iIntegerValue & 0x00000002) {
|
|
|
|
if (iIntegerValue & 0x00000004) {
|
|
|
|
/*
|
|
|
|
* U29O-traits-ext; the rest of
|
|
|
|
* iIntegerValue is not significant,
|
|
|
|
* and, worse, we have idea what
|
|
|
|
* follows the class name, or even
|
|
|
|
* how many bytes follow the class
|
|
|
|
* name - that's by convention between
|
|
|
|
* the client and server.
|
|
|
|
*/
|
|
|
|
iValueOffset += iValueLength;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* U29O-traits; the 0x00000008 bit
|
|
|
|
* specifies whether the type is
|
|
|
|
* dynamic.
|
|
|
|
*/
|
|
|
|
iTypeIsDynamic = (iIntegerValue & 0x00000008) ? TRUE : FALSE;
|
|
|
|
iTraitCount = iIntegerValue >> 4;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_traitcount, tvb, iValueOffset, iValueLength, iTraitCount);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/* the upper 28 bits of the integer value is a string length */
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset+iValueLength, iStringLength, ENC_UTF_8|ENC_NA);
|
2014-07-06 13:49:27 +00:00
|
|
|
traits_tree = proto_tree_add_subtree_format(val_tree, tvb, iValueOffset, -1,
|
|
|
|
ett_amf_traits, &traits_ti, "Traits for class %s (%u member names)", iStringValue, iTraitCount);
|
|
|
|
name_tree = proto_tree_add_subtree_format(traits_tree, tvb,
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset,
|
|
|
|
iValueLength+iStringLength,
|
2014-07-06 13:49:27 +00:00
|
|
|
ett_amf_string, NULL, "Class name: %s",
|
2012-11-16 21:59:58 +00:00
|
|
|
iStringValue);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(name_tree, hf_amf_classnamelength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(name_tree, hf_amf_classname, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2014-07-06 13:49:27 +00:00
|
|
|
traits_tree = proto_tree_add_subtree_format(val_tree, tvb, iValueOffset, iValueLength,
|
|
|
|
ett_amf_traits, &traits_ti, "Traits for class (reference %u for name)", iIntegerValue >> 1);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(traits_tree, hf_amf_string_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
}
|
|
|
|
for (i = 0; i < iTraitCount; i++) {
|
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/* the upper 28 bits of the integer value is a string length */
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset+iValueLength, iStringLength, ENC_UTF_8|ENC_NA);
|
2014-07-06 13:49:27 +00:00
|
|
|
member_tree = proto_tree_add_subtree_format(traits_tree, tvb, iValueOffset, iValueLength+iStringLength,
|
|
|
|
ett_amf_trait_member, NULL, "Member '%s'", iStringValue);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(member_tree, hf_amf_membernamelength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(member_tree, hf_amf_membername, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(traits_tree, hf_amf_string_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < iTraitCount; i++)
|
|
|
|
iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, traits_tree, NULL);
|
|
|
|
if (iTypeIsDynamic) {
|
2013-12-12 19:59:23 +00:00
|
|
|
for (;;) {
|
2012-11-16 21:59:58 +00:00
|
|
|
/* Fetch the name */
|
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/* the upper 28 bits of the integer value is a string length */
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
|
|
|
if (iStringLength == 0) {
|
|
|
|
/* null name marks the end of the associative part */
|
|
|
|
proto_tree_add_text(traits_tree, tvb, iValueOffset, iValueLength, "End of dynamic members");
|
|
|
|
iValueOffset += iValueLength;
|
|
|
|
break;
|
|
|
|
}
|
2013-09-22 15:50:55 +00:00
|
|
|
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset+iValueLength, iStringLength, ENC_UTF_8|ENC_NA);
|
2014-07-06 13:49:27 +00:00
|
|
|
subval_tree = proto_tree_add_subtree_format(traits_tree, tvb, iValueOffset, -1,
|
|
|
|
ett_amf_array_element, &subval_ti, "%s:", iStringValue);
|
|
|
|
name_tree = proto_tree_add_subtree_format(subval_tree, tvb,
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset,
|
|
|
|
iValueLength+iStringLength,
|
2014-07-06 13:49:27 +00:00
|
|
|
ett_amf_string, NULL, "Member name: %s",
|
2012-11-16 21:59:58 +00:00
|
|
|
iStringValue);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(name_tree, hf_amf_membernamelength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_string(name_tree, hf_amf_membername, tvb, iValueOffset, iStringLength, iStringValue);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iStringLength;
|
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2014-07-06 13:49:27 +00:00
|
|
|
subval_tree = proto_tree_add_subtree_format(traits_tree, tvb, iValueOffset, iValueLength,
|
|
|
|
ett_amf_array_element, &subval_ti, "Reference %u:", iIntegerValue >> 1);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(subval_tree, hf_amf_string_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2013-12-12 19:59:23 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
|
|
|
|
/* Fetch the value */
|
|
|
|
iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, subval_tree, subval_ti);
|
|
|
|
proto_item_set_end(subval_ti, tvb, iValueOffset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
proto_item_set_end(traits_ti, tvb, iValueOffset);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* U29O-traits-ref; the upper 27 bits of
|
|
|
|
* the integer value are a traits reference
|
|
|
|
* index.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_trait_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 2);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* U29O-ref; the upper 28 bits of the integer value
|
|
|
|
* are an object reference index.
|
|
|
|
*/
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
}
|
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_XML:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/*
|
|
|
|
* The upper 28 bits of the integer value are
|
|
|
|
* a count of the number of bytes in the
|
|
|
|
* XML string.
|
|
|
|
*/
|
|
|
|
iStringLength = iIntegerValue >> 1;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_xmllength, tvb, iValueOffset, iValueLength, iStringLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_item(val_tree, hf_amf_xml, tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
|
2012-11-16 21:59:58 +00:00
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a string reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " reference %u", iIntegerValue >> 1);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2012-11-18 08:03:05 +00:00
|
|
|
case AMF3_BYTEARRAY:
|
2012-11-16 21:59:58 +00:00
|
|
|
iIntegerValue = amf_get_u29(tvb, iValueOffset, &iValueLength);
|
|
|
|
if (iIntegerValue & 0x00000001) {
|
|
|
|
/*
|
|
|
|
* The upper 28 bits of the integer value are
|
|
|
|
* a count of the number of bytes in the
|
|
|
|
* byte array.
|
|
|
|
*/
|
|
|
|
iArrayLength = iIntegerValue >> 1;
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_bytearraylength, tvb, iValueOffset, iValueLength, iArrayLength);
|
2012-11-16 21:59:58 +00:00
|
|
|
iValueOffset += iValueLength;
|
2013-09-22 15:50:55 +00:00
|
|
|
iByteArrayValue = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, iValueOffset, iArrayLength);
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_bytes(val_tree, hf_amf_bytearray, tvb, iValueOffset, iArrayLength, iByteArrayValue);
|
2013-12-19 15:49:09 +00:00
|
|
|
proto_item_append_text(ti, " %s", bytes_to_ep_str(iByteArrayValue, iArrayLength));
|
2012-11-16 21:59:58 +00:00
|
|
|
if (parent_ti != NULL)
|
2013-12-19 15:49:09 +00:00
|
|
|
proto_item_append_text(parent_ti, " %s", bytes_to_ep_str(iByteArrayValue, iArrayLength));
|
2012-11-16 21:59:58 +00:00
|
|
|
} else {
|
|
|
|
/* the upper 28 bits of the integer value are a object reference index */
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_tree_add_uint(val_tree, hf_amf_object_reference, tvb, iValueOffset, iValueLength, iIntegerValue >> 1);
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_append_text(ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
if (parent_ti != NULL)
|
|
|
|
proto_item_append_text(parent_ti, " reference %u", iIntegerValue >> 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* If we can't determine the length, don't carry on;
|
|
|
|
* just skip to the end of the tvbuff.
|
|
|
|
*/
|
2014-06-19 17:18:16 +00:00
|
|
|
iValueOffset = tvb_length(tvb);
|
2012-11-16 21:59:58 +00:00
|
|
|
break;
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_item_set_end(ti, tvb, iValueOffset);
|
|
|
|
return iValueOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
dissect_rtmpt_body_command(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree, gboolean amf3)
|
|
|
|
{
|
|
|
|
gboolean amf3_encoding = FALSE;
|
|
|
|
|
|
|
|
if (amf3) {
|
|
|
|
/* Looks like for the AMF3 variants we get a 0 byte here,
|
|
|
|
* followed by AMF0 encoding - I've never seen actual AMF3
|
|
|
|
* encoding used, which is completely different. I speculate
|
2012-11-18 08:03:05 +00:00
|
|
|
* that if the byte is AMF0_AMF3_MARKER then the rest
|
2012-11-16 21:59:58 +00:00
|
|
|
* will be in AMF3. For now, assume AMF0 only. */
|
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0)
|
|
|
|
{
|
|
|
|
if (amf3_encoding)
|
|
|
|
offset = dissect_amf3_value_type(tvb, offset, rtmpt_tree, NULL);
|
|
|
|
else
|
|
|
|
offset = dissect_amf0_value_type(tvb, offset, rtmpt_tree, &amf3_encoding, NULL);
|
|
|
|
}
|
|
|
|
return offset;
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static void
|
|
|
|
dissect_rtmpt_body_audio(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
|
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 iCtl;
|
2010-10-30 16:40:46 +00:00
|
|
|
proto_item *ai;
|
|
|
|
proto_tree *at;
|
|
|
|
|
|
|
|
iCtl = tvb_get_guint8(tvb, offset);
|
|
|
|
ai = proto_tree_add_uint_format(rtmpt_tree, hf_rtmpt_audio_control, tvb, offset, 1, iCtl,
|
|
|
|
"Control: 0x%02x (%s %s %s %s)", iCtl,
|
2012-03-16 02:00:29 +00:00
|
|
|
val_to_str_const((iCtl & 0xf0)>>4, rtmpt_audio_codecs, "Unknown codec"),
|
|
|
|
val_to_str_const((iCtl & 0x0c)>>2, rtmpt_audio_rates, "Unknown rate"),
|
|
|
|
val_to_str_const((iCtl & 0x02)>>1, rtmpt_audio_sizes, "Unknown sample size"),
|
|
|
|
val_to_str_const(iCtl & 0x01, rtmpt_audio_types, "Unknown channel count"));
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
at = proto_item_add_subtree(ai, ett_rtmpt_audio_control);
|
|
|
|
proto_tree_add_uint(at, hf_rtmpt_audio_format, tvb, offset, 1, iCtl);
|
|
|
|
proto_tree_add_uint(at, hf_rtmpt_audio_rate, tvb, offset, 1, iCtl);
|
|
|
|
proto_tree_add_uint(at, hf_rtmpt_audio_size, tvb, offset, 1, iCtl);
|
|
|
|
proto_tree_add_uint(at, hf_rtmpt_audio_type, tvb, offset, 1, iCtl);
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_audio_data, tvb, offset+1, -1, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static void
|
|
|
|
dissect_rtmpt_body_video(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
|
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
guint8 iCtl;
|
2010-10-30 16:40:46 +00:00
|
|
|
proto_item *vi;
|
|
|
|
proto_tree *vt;
|
|
|
|
|
|
|
|
iCtl = tvb_get_guint8(tvb, offset);
|
|
|
|
vi = proto_tree_add_uint_format(rtmpt_tree, hf_rtmpt_video_control, tvb, offset, 1, iCtl,
|
|
|
|
"Control: 0x%02x (%s %s)", iCtl,
|
2012-03-16 02:00:29 +00:00
|
|
|
val_to_str_const((iCtl & 0xf0)>>4, rtmpt_video_types, "Unknown frame type"),
|
|
|
|
val_to_str_const(iCtl & 0x0f, rtmpt_video_codecs, "Unknown codec"));
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
vt = proto_item_add_subtree(vi, ett_rtmpt_video_control);
|
|
|
|
proto_tree_add_uint(vt, hf_rtmpt_video_type, tvb, offset, 1, iCtl);
|
|
|
|
proto_tree_add_uint(vt, hf_rtmpt_video_format, tvb, offset, 1, iCtl);
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_video_data, tvb, offset+1, -1, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static void
|
|
|
|
dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
|
|
|
|
{
|
2014-07-06 13:49:27 +00:00
|
|
|
proto_tree *tag_tree;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2014-07-06 13:49:27 +00:00
|
|
|
proto_tree *data_tree;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
while (tvb_length_remaining(tvb, offset) > 0) {
|
2012-11-17 13:58:02 +00:00
|
|
|
guint8 iTagType;
|
2013-12-12 19:59:23 +00:00
|
|
|
guint iDataSize;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
iTagType = tvb_get_guint8(tvb, offset + 0);
|
2010-10-30 16:40:46 +00:00
|
|
|
iDataSize = tvb_get_ntoh24(tvb, offset + 1);
|
|
|
|
|
2014-07-06 13:49:27 +00:00
|
|
|
tag_tree = proto_tree_add_subtree(rtmpt_tree, tvb, offset, 11+iDataSize+4, ett_rtmpt_tag, NULL,
|
2012-03-16 02:00:29 +00:00
|
|
|
val_to_str_const(iTagType, rtmpt_tag_vals, "Unknown Tag"));
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_type, tvb, offset+0, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_datasize, tvb, offset+1, 3, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_timestamp, tvb, offset+4, 3, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_ets, tvb, offset+7, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_streamid, tvb, offset+8, 3, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2014-07-06 13:49:27 +00:00
|
|
|
data_tree = proto_tree_add_subtree(tag_tree, tvb, offset+11, iDataSize, ett_rtmpt_tag_data, NULL, "Data");
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
switch (iTagType) {
|
|
|
|
case 8:
|
|
|
|
dissect_rtmpt_body_audio(tvb, offset + 11, data_tree);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
dissect_rtmpt_body_video(tvb, offset + 11, data_tree);
|
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
dissect_rtmpt_body_command(tvb, offset + 11, data_tree, FALSE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(tag_tree, hf_rtmpt_tag_tagsize, tvb, offset+11+iDataSize, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
offset += 11 + iDataSize + 4;
|
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
}
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* The main dissector for unchunked packets */
|
|
|
|
|
2007-12-17 20:43:38 +00:00
|
|
|
static void
|
2010-10-30 16:40:46 +00:00
|
|
|
dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t *rconv, int cdir, rtmpt_packet_t *tp)
|
2007-12-17 20:43:38 +00:00
|
|
|
{
|
2013-12-12 19:59:23 +00:00
|
|
|
proto_tree *rtmpt_tree = NULL;
|
|
|
|
proto_tree *rtmptroot_tree = NULL;
|
|
|
|
proto_item *ti = NULL;
|
|
|
|
gint offset = 0;
|
2012-03-16 02:00:29 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
gchar *sDesc = NULL;
|
|
|
|
gint deschasopcode = FALSE;
|
|
|
|
gboolean haveETS = FALSE;
|
|
|
|
guint32 iBodyOffset = 0;
|
|
|
|
guint32 iBodyRemain = 0;
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP");
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2013-06-14 01:56:28 +00:00
|
|
|
RTMPT_DEBUG("Dissect: frame=%u visited=%d len=%d tree=%p\n",
|
2013-05-21 02:08:40 +00:00
|
|
|
pinfo->fd->num, pinfo->fd->flags.visited,
|
2014-06-19 17:18:16 +00:00
|
|
|
tvb_length_remaining(tvb, offset), tree);
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2013-05-21 02:08:40 +00:00
|
|
|
/* Clear any previous data in Info column (RTMP packets are protected by a "fence") */
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
if (tvb_length_remaining(tvb, offset) < 1) return;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->id <= RTMPT_ID_MAX) {
|
|
|
|
if (tp->fmt < 3
|
2014-06-19 17:18:16 +00:00
|
|
|
&& tvb_length_remaining(tvb, offset) >= tp->bhlen+3
|
2013-12-12 19:59:23 +00:00
|
|
|
&& tvb_get_ntoh24(tvb, offset+tp->bhlen) == 0xffffff) {
|
2010-10-30 16:40:46 +00:00
|
|
|
haveETS = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
iBodyOffset = offset + tp->bhlen + tp->mhlen;
|
2014-06-19 17:18:16 +00:00
|
|
|
iBodyRemain = tvb_length_remaining(tvb, iBodyOffset);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->cmd == RTMPT_TYPE_CHUNK_SIZE && tp->len >= 4 && iBodyRemain >= 4) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 newchunksize = tvb_get_ntohl(tvb, iBodyOffset);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (newchunksize < rtmpt_max_packet_size) {
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->chunksize[cdir], tp->lastseq, GINT_TO_POINTER(newchunksize));
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!PINFO_FD_VISITED(pinfo)) {
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->cmd == RTMPT_TYPE_COMMAND_AMF0 || tp->cmd == RTMPT_TYPE_COMMAND_AMF3 ||
|
|
|
|
tp->cmd == RTMPT_TYPE_DATA_AMF0 || tp->cmd == RTMPT_TYPE_DATA_AMF3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
guint32 soff = 0;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->cmd == RTMPT_TYPE_COMMAND_AMF3 || tp->cmd == RTMPT_TYPE_DATA_AMF3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
soff = 1;
|
|
|
|
}
|
|
|
|
tp->txid = rtmpt_get_amf_txid(tvb, iBodyOffset+soff);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->txid != 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
RTMPT_DEBUG("got txid=%d\n", tp->txid);
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->txids[cdir], tp->txid, GINT_TO_POINTER(pinfo->fd->num));
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tree && tp->id <= RTMPT_ID_MAX)
|
2010-10-30 16:40:46 +00:00
|
|
|
{
|
|
|
|
sDesc = rtmpt_get_packet_desc(tvb, iBodyOffset, iBodyRemain, rconv, cdir, tp, &deschasopcode);
|
|
|
|
}
|
|
|
|
|
2013-06-14 01:56:28 +00:00
|
|
|
if (tp->id>RTMPT_ID_MAX) {
|
|
|
|
col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s",
|
|
|
|
val_to_str(tp->id, rtmpt_handshake_vals, "Unknown (0x%01x)"));
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
|
|
|
} else if (sDesc) {
|
|
|
|
col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s", sDesc);
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
|
|
|
} else {
|
|
|
|
col_append_sep_fstr(pinfo->cinfo, COL_INFO, "|", "%s",
|
|
|
|
val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"));
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree)
|
|
|
|
{
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_rtmpt, tvb, offset, -1, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->id > RTMPT_ID_MAX) {
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Dissect handshake */
|
2011-12-15 18:47:57 +00:00
|
|
|
proto_item_append_text(ti, " (%s)",
|
|
|
|
val_to_str(tp->id, rtmpt_handshake_vals, "Unknown (0x%01x)"));
|
2010-10-30 16:40:46 +00:00
|
|
|
rtmptroot_tree = proto_item_add_subtree(ti, ett_rtmpt);
|
2014-07-06 13:49:27 +00:00
|
|
|
rtmpt_tree = proto_tree_add_subtree(rtmptroot_tree, tvb, offset, -1, ett_rtmpt_handshake, NULL,
|
2011-12-15 18:47:57 +00:00
|
|
|
val_to_str(tp->id, rtmpt_handshake_vals, "Unknown (0x%01x)"));
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
if (tp->id == RTMPT_TYPE_HANDSHAKE_1)
|
|
|
|
{
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_c0, tvb, 0, 1, ENC_NA);
|
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_c1, tvb, 1, 1536, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
else if (tp->id == RTMPT_TYPE_HANDSHAKE_2)
|
|
|
|
{
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_s0, tvb, 0, 1, ENC_NA);
|
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_s1, tvb, 1, 1536, ENC_NA);
|
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_s2, tvb, 1537, 1536, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
else if (tp->id == RTMPT_TYPE_HANDSHAKE_3)
|
|
|
|
{
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_handshake_c2, tvb, 0, 1536, ENC_NA);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sDesc && deschasopcode) {
|
|
|
|
proto_item_append_text(ti, " (%s)", sDesc);
|
|
|
|
} else if (sDesc) {
|
2011-12-15 18:47:57 +00:00
|
|
|
proto_item_append_text(ti, " (%s %s)",
|
|
|
|
val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"), sDesc);
|
2010-10-30 16:40:46 +00:00
|
|
|
} else {
|
2011-12-15 18:47:57 +00:00
|
|
|
proto_item_append_text(ti, " (%s)",
|
|
|
|
val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)"));
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
rtmptroot_tree = proto_item_add_subtree(ti, ett_rtmpt);
|
|
|
|
|
|
|
|
/* Function call/response matching */
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->otherframe != 0) {
|
2010-10-30 16:40:46 +00:00
|
|
|
proto_tree_add_uint(rtmptroot_tree,
|
|
|
|
tp->isresponse ? hf_rtmpt_function_response : hf_rtmpt_function_call,
|
|
|
|
tvb, offset, tp->bhlen+tp->mhlen+tp->len,
|
|
|
|
tp->otherframe);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dissect header fields */
|
2014-07-06 13:49:27 +00:00
|
|
|
rtmpt_tree = proto_tree_add_subtree(rtmptroot_tree, tvb, offset, tp->bhlen+tp->mhlen, ett_rtmpt_header, NULL, RTMPT_TEXT_RTMP_HEADER);
|
2010-10-30 16:40:46 +00:00
|
|
|
/* proto_item_append_text(ti, " (%s)", val_to_str(tp->cmd, rtmpt_opcode_vals, "Unknown (0x%01x)")); */
|
|
|
|
|
2011-10-06 03:35:44 +00:00
|
|
|
if (tp->fmt <= 3) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_format, tvb, offset + 0, 1, ENC_BIG_ENDIAN);
|
|
|
|
if (tp->fmt <= 3) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_csid, tvb, offset + 0, tp->bhlen, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
if (tp->fmt <= 2) {
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->fmt > 0) {
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_timestamp_delta, tvb, offset + tp->bhlen, 3, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
} else {
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_timestamp, tvb, offset + tp->bhlen, 3, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
if (haveETS) {
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_ets, tvb, offset + tp->bhlen + tp->mhlen - 4, 4, ENC_BIG_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
}
|
2013-12-12 19:59:23 +00:00
|
|
|
if ((tp->fmt>0 && !haveETS) || tp->fmt == 3) {
|
2010-10-30 16:40:46 +00:00
|
|
|
proto_tree_add_text(rtmpt_tree, tvb, offset + tp->bhlen, 0, "Timestamp: %d (calculated)", tp->ts);
|
|
|
|
}
|
2011-10-06 03:35:44 +00:00
|
|
|
if (tp->fmt <= 1) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_body_size, tvb, offset + tp->bhlen + 3, 3, ENC_BIG_ENDIAN);
|
|
|
|
if (tp->fmt <= 1) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_typeid, tvb, offset + tp->bhlen + 6, 1, ENC_BIG_ENDIAN);
|
|
|
|
if (tp->fmt <= 0) proto_tree_add_item(rtmpt_tree, hf_rtmpt_header_streamid, tvb, offset + tp->bhlen + 7, 4, ENC_LITTLE_ENDIAN);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/* Dissect body */
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->len == 0) return;
|
2010-10-30 16:40:46 +00:00
|
|
|
offset = iBodyOffset;
|
|
|
|
|
2014-07-06 13:49:27 +00:00
|
|
|
rtmpt_tree = proto_tree_add_subtree(rtmptroot_tree, tvb, offset, -1, ett_rtmpt_body, NULL, RTMPT_TEXT_RTMP_BODY);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
switch (tp->cmd) {
|
|
|
|
case RTMPT_TYPE_CHUNK_SIZE:
|
|
|
|
case RTMPT_TYPE_ABORT_MESSAGE:
|
|
|
|
case RTMPT_TYPE_ACKNOWLEDGEMENT:
|
|
|
|
case RTMPT_TYPE_UCM:
|
|
|
|
case RTMPT_TYPE_WINDOW:
|
|
|
|
case RTMPT_TYPE_PEER_BANDWIDTH:
|
|
|
|
dissect_rtmpt_body_scm(tvb, offset, rtmpt_tree, tp->cmd);
|
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_COMMAND_AMF0:
|
|
|
|
case RTMPT_TYPE_DATA_AMF0:
|
|
|
|
dissect_rtmpt_body_command(tvb, offset, rtmpt_tree, FALSE);
|
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_COMMAND_AMF3:
|
|
|
|
case RTMPT_TYPE_DATA_AMF3:
|
|
|
|
dissect_rtmpt_body_command(tvb, offset, rtmpt_tree, TRUE);
|
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_AUDIO_DATA:
|
|
|
|
dissect_rtmpt_body_audio(tvb, offset, rtmpt_tree);
|
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_VIDEO_DATA:
|
|
|
|
dissect_rtmpt_body_video(tvb, offset, rtmpt_tree);
|
|
|
|
break;
|
|
|
|
case RTMPT_TYPE_AGGREGATE:
|
|
|
|
dissect_rtmpt_body_aggregate(tvb, offset, rtmpt_tree);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Unchunk a data stream into individual RTMP packets */
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static void
|
|
|
|
dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t *rconv, int cdir, guint32 seq, guint32 lastackseq)
|
|
|
|
{
|
2013-12-12 19:59:23 +00:00
|
|
|
int offset = 0;
|
|
|
|
int remain;
|
|
|
|
int want;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
guint8 header_type;
|
|
|
|
int basic_hlen;
|
|
|
|
int message_hlen;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
guint32 id;
|
2013-12-12 19:59:23 +00:00
|
|
|
guint32 ts = 0;
|
|
|
|
guint32 tsd = 0;
|
|
|
|
int body_len;
|
|
|
|
guint8 cmd;
|
2011-12-15 18:47:57 +00:00
|
|
|
guint32 src;
|
2013-12-12 19:59:23 +00:00
|
|
|
int chunk_size;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
rtmpt_frag_t *tf;
|
|
|
|
rtmpt_id_t *ti;
|
2011-12-15 18:47:57 +00:00
|
|
|
rtmpt_packet_t *tp;
|
2013-12-12 19:59:23 +00:00
|
|
|
tvbuff_t *pktbuf;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2014-06-19 17:18:16 +00:00
|
|
|
remain = tvb_length(tvb);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (!remain)
|
|
|
|
return;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
RTMPT_DEBUG("Segment: cdir=%d seq=%d-%d\n", cdir, seq, seq+remain-1);
|
|
|
|
|
|
|
|
if (pinfo->fd->flags.visited) {
|
|
|
|
/* Already done the work, so just dump the existing state */
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_stack_t *packets;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
/* List all RTMP packets terminating in this TCP segment, from end to beginning */
|
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
packets = wmem_stack_new(wmem_packet_scope());
|
|
|
|
wmem_stack_push(packets, 0);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(rconv->packets[cdir], seq+remain-1);
|
2013-12-12 19:59:23 +00:00
|
|
|
while (tp && tp->lastseq >= seq) {
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_stack_push(packets, tp);
|
|
|
|
tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(rconv->packets[cdir], tp->lastseq-1);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Dissect the generated list in reverse order (beginning to end) */
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
while ((tp=(rtmpt_packet_t *)wmem_stack_pop(packets)) != NULL) {
|
2011-12-15 18:47:57 +00:00
|
|
|
if (tp->resident) {
|
|
|
|
pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
|
|
|
|
add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
|
|
|
|
} else {
|
2014-06-06 14:35:50 +00:00
|
|
|
pktbuf = tvb_new_subset_length(tvb, tp->data.offset, tp->have);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (remain>0) {
|
|
|
|
tf = NULL;
|
|
|
|
ti = NULL;
|
|
|
|
tp = NULL;
|
|
|
|
|
|
|
|
/* Check for outstanding fragmented headers/chunks first */
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (offset == 0) {
|
2013-08-25 14:23:13 +00:00
|
|
|
tf = (rtmpt_frag_t *)wmem_tree_lookup32_le(rconv->frags[cdir], seq+offset-1);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
if (tf) {
|
|
|
|
/* May need to reassemble cross-TCP-segment fragments */
|
|
|
|
RTMPT_DEBUG(" tf seq=%d lseq=%d h=%d l=%d\n", tf->seq, tf->lastseq, tf->have, tf->len);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tf->have >= tf->len || seq+offset < tf->seq || seq+offset > tf->lastseq+tf->len-tf->have) {
|
2011-12-15 18:47:57 +00:00
|
|
|
tf = NULL;
|
|
|
|
} else if (!tf->ishdr) {
|
2013-08-25 14:23:13 +00:00
|
|
|
ti = (rtmpt_id_t *)wmem_tree_lookup32(rconv->ids[cdir], tf->saved.id);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (ti) {
|
|
|
|
tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(ti->packets, seq+offset-1);
|
|
|
|
}
|
2011-12-15 18:47:57 +00:00
|
|
|
if (tp && tp->chunkwant) {
|
|
|
|
goto unchunk;
|
|
|
|
}
|
|
|
|
tf = NULL;
|
|
|
|
ti = NULL;
|
|
|
|
tp = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tf) {
|
|
|
|
/* The preceding segment contained an incomplete chunk header */
|
|
|
|
|
|
|
|
want = tf->len - tf->have;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain<want)
|
|
|
|
want = remain;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
tvb_memcpy(tvb, tf->saved.d+tf->have, offset, want);
|
|
|
|
|
|
|
|
id = tf->saved.d[0];
|
|
|
|
header_type = (id>>6) & 3;
|
|
|
|
basic_hlen = rtmpt_basic_header_length(id);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if ((header_type < 3) && (tf->have < (basic_hlen+3)) && (tf->have+want >= (basic_hlen+3))) {
|
|
|
|
if (pntoh24(tf->saved.d+basic_hlen) == 0xffffff) {
|
2011-12-15 18:47:57 +00:00
|
|
|
tf->len += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tf->have += want;
|
|
|
|
tf->lastseq = seq+want-1;
|
|
|
|
remain -= want;
|
|
|
|
offset += want;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tf->have < tf->len) {
|
2011-12-15 18:47:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!tf) {
|
|
|
|
/* No preceeding data, get header data starting at current position */
|
|
|
|
id = tvb_get_guint8(tvb, offset);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (id == RTMPT_MAGIC && seq+offset == RTMPT_HANDSHAKE_OFFSET_1) {
|
2011-12-15 18:47:57 +00:00
|
|
|
header_type = 4;
|
|
|
|
basic_hlen = 1;
|
|
|
|
message_hlen = 0;
|
2013-12-12 19:59:23 +00:00
|
|
|
id = lastackseq == 1 ? RTMPT_TYPE_HANDSHAKE_1 : RTMPT_TYPE_HANDSHAKE_2;
|
|
|
|
} else if (seq+offset == RTMPT_HANDSHAKE_OFFSET_2) {
|
2011-12-15 18:47:57 +00:00
|
|
|
header_type = 4;
|
|
|
|
basic_hlen = 0;
|
|
|
|
message_hlen = 0;
|
|
|
|
id = RTMPT_TYPE_HANDSHAKE_3;
|
|
|
|
} else {
|
2010-10-30 16:40:46 +00:00
|
|
|
header_type = (id>>6) & 3;
|
|
|
|
basic_hlen = rtmpt_basic_header_length(id);
|
|
|
|
message_hlen = rtmpt_message_header_length(id);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if ((header_type < 3) && (remain >= (basic_hlen+3))) {
|
|
|
|
if (tvb_get_ntoh24(tvb, offset+basic_hlen) == 0xffffff) {
|
2010-10-30 16:40:46 +00:00
|
|
|
message_hlen += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain < (basic_hlen+message_hlen)) {
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Ran out of packet mid-header, save and try again next time */
|
2013-08-25 14:23:13 +00:00
|
|
|
tf = wmem_new(wmem_file_scope(), rtmpt_frag_t);
|
2010-10-30 16:40:46 +00:00
|
|
|
tf->ishdr = 1;
|
|
|
|
tf->seq = seq + offset;
|
|
|
|
tf->lastseq = tf->seq + remain - 1;
|
|
|
|
tf->len = basic_hlen + message_hlen;
|
|
|
|
tvb_memcpy(tvb, tf->saved.d, offset, remain);
|
|
|
|
tf->have = remain;
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->frags[cdir], seq+offset, tf);
|
2010-10-30 16:40:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
id = id & 0x3f;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (id == 0)
|
|
|
|
id = tvb_get_guint8(tvb, offset+1) + 64;
|
|
|
|
else if (id == 1)
|
|
|
|
id = tvb_get_letohs(tvb, offset+1) + 64;
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
} else {
|
|
|
|
/* Use reassembled header data */
|
2010-10-30 16:40:46 +00:00
|
|
|
id = tf->saved.d[0];
|
|
|
|
header_type = (id>>6) & 3;
|
|
|
|
basic_hlen = rtmpt_basic_header_length(id);
|
|
|
|
message_hlen = tf->len - basic_hlen;
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
id = id & 0x3f;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (id == 0)
|
|
|
|
id = tf->saved.d[1] + 64;
|
|
|
|
else if (id == 1)
|
|
|
|
id = pletoh16(tf->saved.d+1) + 64;
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate header values, defaulting from previous packets with same id */
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (id <= RTMPT_ID_MAX)
|
|
|
|
ti = (rtmpt_id_t *)wmem_tree_lookup32(rconv->ids[cdir], id);
|
|
|
|
if (ti)
|
|
|
|
tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(ti->packets, seq+offset-1);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (header_type == 0)
|
|
|
|
src = tf ? pntoh32(tf->saved.d+basic_hlen+7) : tvb_get_ntohl(tvb, offset+basic_hlen+7);
|
|
|
|
else if (ti)
|
|
|
|
src = ti->src;
|
2011-12-15 18:47:57 +00:00
|
|
|
else src = 0;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (header_type < 2)
|
|
|
|
cmd = tf ? tf->saved.d[basic_hlen+6] : tvb_get_guint8(tvb, offset+basic_hlen+6);
|
|
|
|
else if (ti)
|
|
|
|
cmd = ti->cmd;
|
|
|
|
else
|
|
|
|
cmd = 0;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
/* Calculate chunk_size now as a last-resort default payload length */
|
2013-12-12 19:59:23 +00:00
|
|
|
if (id > RTMPT_ID_MAX) {
|
|
|
|
if (id == RTMPT_TYPE_HANDSHAKE_1)
|
|
|
|
chunk_size = body_len = 1536;
|
|
|
|
else if (id == RTMPT_TYPE_HANDSHAKE_2)
|
|
|
|
chunk_size = body_len = 3072;
|
|
|
|
else /* if (id == RTMPT_TYPE_HANDSHAKE_3) */
|
|
|
|
chunk_size = body_len = 1536;
|
2011-12-15 18:47:57 +00:00
|
|
|
} else {
|
2013-08-25 14:23:13 +00:00
|
|
|
chunk_size = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->chunksize[cdir], seq+offset-1));
|
2013-12-12 19:59:23 +00:00
|
|
|
if (!chunk_size)
|
|
|
|
chunk_size = RTMPT_DEFAULT_CHUNK_SIZE;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (header_type < 2)
|
|
|
|
body_len = tf ? pntoh24(tf->saved.d+basic_hlen+3) : tvb_get_ntoh24(tvb, offset+basic_hlen+3);
|
|
|
|
else if (ti)
|
|
|
|
body_len = ti->len;
|
|
|
|
else
|
|
|
|
body_len = chunk_size;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (body_len > (gint)rtmpt_max_packet_size) {
|
2011-12-15 18:47:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (!ti || !tp || header_type<3 || tp->have == tp->want || tp->chunkhave != tp->chunkwant) {
|
2011-12-15 18:47:57 +00:00
|
|
|
/* Start a new packet if:
|
|
|
|
* no previous packet with same id
|
|
|
|
* not a short 1-byte header
|
|
|
|
* previous packet with same id was complete
|
|
|
|
* previous incomplete chunk not handled by fragment handler
|
|
|
|
*/
|
|
|
|
RTMPT_DEBUG("New packet cdir=%d seq=%d ti=%p tp=%p header_type=%d header_len=%d id=%d tph=%d tpw=%d len=%d cs=%d\n",
|
|
|
|
cdir, seq+offset,
|
|
|
|
ti, tp, header_type, basic_hlen+message_hlen, id, tp?tp->have:0, tp?tp->want:0, body_len, chunk_size);
|
|
|
|
|
|
|
|
if (!ti) {
|
2013-08-25 14:23:13 +00:00
|
|
|
ti = wmem_new(wmem_file_scope(), rtmpt_id_t);
|
|
|
|
ti->packets = wmem_tree_new(wmem_file_scope());
|
2013-12-12 19:59:23 +00:00
|
|
|
ti->ts = 0;
|
2011-12-15 18:47:57 +00:00
|
|
|
ti->tsd = 0;
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->ids[cdir], id, ti);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (header_type == 0) {
|
2011-12-15 18:47:57 +00:00
|
|
|
ts = tf ? pntoh24(tf->saved.d+basic_hlen) : tvb_get_ntoh24(tvb, offset+basic_hlen);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (ts == 0xffffff) {
|
2013-11-29 18:59:06 +00:00
|
|
|
ts = tf ? pntoh32(tf->saved.d+basic_hlen+11) : tvb_get_ntohl(tvb, offset+basic_hlen+11);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
tsd = ts - ti->ts;
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (header_type < 3) {
|
2011-12-15 18:47:57 +00:00
|
|
|
tsd = tf ? pntoh24(tf->saved.d+basic_hlen) : tvb_get_ntoh24(tvb, offset+basic_hlen);
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tsd == 0xffffff) {
|
|
|
|
ts = tf ? pntoh32(tf->saved.d+basic_hlen+message_hlen-4) : tvb_get_ntohl(tvb, offset+basic_hlen+message_hlen-4);
|
2011-12-15 18:47:57 +00:00
|
|
|
tsd = ti->tsd; /* questionable */
|
|
|
|
} else {
|
2013-12-12 19:59:23 +00:00
|
|
|
ts = ti->ts + tsd;
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
2013-12-12 19:59:23 +00:00
|
|
|
ts = ti->ts + ti->tsd;
|
2011-12-15 18:47:57 +00:00
|
|
|
tsd = ti->tsd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create a new packet structure */
|
2013-12-12 19:59:23 +00:00
|
|
|
tp = wmem_new(wmem_file_scope(), rtmpt_packet_t);
|
|
|
|
tp->seq = tp->lastseq = tf ? tf->seq : seq+offset;
|
|
|
|
tp->have = 0;
|
|
|
|
tp->want = basic_hlen + message_hlen + body_len;
|
|
|
|
tp->chunkwant = 0;
|
|
|
|
tp->chunkhave = 0;
|
|
|
|
tp->bhlen = basic_hlen;
|
|
|
|
tp->mhlen = message_hlen;
|
|
|
|
tp->fmt = header_type;
|
|
|
|
tp->id = id;
|
|
|
|
tp->ts = ts;
|
|
|
|
tp->len = body_len;
|
|
|
|
if (id > RTMPT_ID_MAX)
|
|
|
|
tp->cmd = id;
|
|
|
|
else
|
|
|
|
tp->cmd = cmd & 0x7f;
|
|
|
|
tp->src = src;
|
|
|
|
tp->txid = 0;
|
2011-12-15 18:47:57 +00:00
|
|
|
tp->isresponse = FALSE;
|
|
|
|
tp->otherframe = 0;
|
|
|
|
|
|
|
|
/* Save the header information for future defaulting needs */
|
2013-12-12 19:59:23 +00:00
|
|
|
ti->ts = ts;
|
2011-12-15 18:47:57 +00:00
|
|
|
ti->tsd = tsd;
|
|
|
|
ti->len = body_len;
|
|
|
|
ti->cmd = cmd;
|
|
|
|
ti->src = src;
|
|
|
|
|
|
|
|
/* store against the id only until unchunking is complete */
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(ti->packets, tp->seq, tp);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (!tf && body_len <= chunk_size && tp->want <= remain) {
|
2011-12-15 18:47:57 +00:00
|
|
|
/* The easy case - a whole packet contiguous and fully within this segment */
|
2013-12-12 19:59:23 +00:00
|
|
|
tp->resident = FALSE;
|
2011-12-15 18:47:57 +00:00
|
|
|
tp->data.offset = offset;
|
2013-12-12 19:59:23 +00:00
|
|
|
tp->lastseq = seq+offset+tp->want-1;
|
|
|
|
tp->have = tp->want;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
2014-06-06 14:35:50 +00:00
|
|
|
pktbuf = tvb_new_subset_length(tvb, tp->data.offset, tp->have);
|
2011-12-15 18:47:57 +00:00
|
|
|
dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
|
|
|
|
|
|
|
|
offset += tp->want;
|
|
|
|
remain -= tp->want;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Some more reassembly required */
|
|
|
|
tp->resident = TRUE;
|
2013-08-25 14:23:13 +00:00
|
|
|
tp->data.p = (guint8 *)wmem_alloc(wmem_file_scope(), tp->bhlen+tp->mhlen+tp->len);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
if (tf && tf->ishdr) {
|
|
|
|
memcpy(tp->data.p, tf->saved.d, tf->len);
|
|
|
|
} else {
|
|
|
|
tvb_memcpy(tvb, tp->data.p, offset, basic_hlen+message_hlen);
|
|
|
|
offset += basic_hlen + message_hlen;
|
|
|
|
remain -= basic_hlen + message_hlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
tp->lastseq = seq+offset-1;
|
|
|
|
tp->have = basic_hlen + message_hlen;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->have == tp->want) {
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
|
|
|
|
add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
|
|
|
|
dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
tp->chunkwant = chunk_size;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->chunkwant > tp->want-tp->have)
|
|
|
|
tp->chunkwant = tp->want - tp->have;
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
RTMPT_DEBUG("Old packet cdir=%d seq=%d ti=%p tp=%p header_len=%d id=%d tph=%d tpw=%d len=%d cs=%d\n",
|
|
|
|
cdir, seq+offset,
|
|
|
|
ti, tp, basic_hlen+message_hlen, id, tp?tp->have:0, tp?tp->want:0, body_len, chunk_size);
|
|
|
|
|
|
|
|
tp->chunkwant = chunk_size;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->chunkwant > tp->want-tp->have)
|
|
|
|
tp->chunkwant = tp->want - tp->have;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
offset += basic_hlen + message_hlen;
|
|
|
|
remain -= basic_hlen + message_hlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
tf = NULL;
|
|
|
|
|
|
|
|
/* Last case to deal with is unchunking the packet body */
|
|
|
|
unchunk:
|
|
|
|
want = tp->chunkwant - tp->chunkhave;
|
2013-12-12 19:59:23 +00:00
|
|
|
if (want > remain)
|
|
|
|
want = remain;
|
2011-12-15 18:47:57 +00:00
|
|
|
RTMPT_DEBUG(" cw=%d ch=%d r=%d w=%d\n", tp->chunkwant, tp->chunkhave, remain, want);
|
|
|
|
|
|
|
|
tvb_memcpy(tvb, tp->data.p+tp->have, offset, want);
|
|
|
|
|
|
|
|
if (tf) {
|
|
|
|
tf->have += want;
|
|
|
|
tf->lastseq = seq+offset+want-1;
|
|
|
|
}
|
|
|
|
tp->lastseq = seq+offset+want-1;
|
|
|
|
tp->have += want;
|
|
|
|
tp->chunkhave += want;
|
|
|
|
|
|
|
|
offset += want;
|
|
|
|
remain -= want;
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->chunkhave == tp->chunkwant) {
|
2011-12-15 18:47:57 +00:00
|
|
|
/* Chunk is complete - wait for next header */
|
|
|
|
tp->chunkhave = 0;
|
|
|
|
tp->chunkwant = 0;
|
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (tp->have == tp->want) {
|
2011-12-15 18:47:57 +00:00
|
|
|
/* Whole packet is complete */
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->packets[cdir], tp->lastseq, tp);
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
pktbuf = tvb_new_child_real_data(tvb, tp->data.p, tp->have, tp->have);
|
|
|
|
add_new_data_source(pinfo, pktbuf, "Unchunked RTMP");
|
|
|
|
dissect_rtmpt(pktbuf, pinfo, tree, rconv, cdir, tp);
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (tp->chunkhave < tp->chunkwant) {
|
2011-12-15 18:47:57 +00:00
|
|
|
/* Chunk is split across segment boundary */
|
2013-08-25 14:23:13 +00:00
|
|
|
rtmpt_frag_t *tf2 = wmem_new(wmem_file_scope(), rtmpt_frag_t);
|
2013-12-12 19:59:23 +00:00
|
|
|
tf2->ishdr = 0;
|
|
|
|
tf2->seq = seq + offset - want;
|
|
|
|
tf2->lastseq = tf2->seq + remain - 1 + want;
|
|
|
|
tf2->have = tp->chunkhave;
|
|
|
|
tf2->len = tp->chunkwant;
|
2011-12-15 18:47:57 +00:00
|
|
|
tf2->saved.id = tp->id;
|
|
|
|
RTMPT_DEBUG(" inserting tf @ %d\n", seq+offset-want-1);
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->frags[cdir], seq+offset-want-1, tf2);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-17 20:43:38 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
static rtmpt_conv_t *
|
2010-10-30 16:40:46 +00:00
|
|
|
rtmpt_init_rconv(conversation_t *conv)
|
|
|
|
{
|
2013-08-25 14:23:13 +00:00
|
|
|
rtmpt_conv_t *rconv = wmem_new(wmem_file_scope(), rtmpt_conv_t);
|
2010-10-30 16:40:46 +00:00
|
|
|
conversation_add_proto_data(conv, proto_rtmpt, rconv);
|
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
rconv->seqs[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->seqs[1] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->frags[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->frags[1] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->ids[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->ids[1] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->packets[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->packets[1] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->chunksize[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->chunksize[1] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->txids[0] = wmem_tree_new(wmem_file_scope());
|
|
|
|
rconv->txids[1] = wmem_tree_new(wmem_file_scope());
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
return rconv;
|
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2013-11-02 00:36:30 +00:00
|
|
|
static int
|
|
|
|
dissect_rtmpt_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
2007-12-17 20:43:38 +00:00
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
conversation_t *conv;
|
|
|
|
rtmpt_conv_t *rconv;
|
|
|
|
int cdir;
|
2013-12-11 21:06:09 +00:00
|
|
|
struct tcpinfo *tcpinfo;
|
|
|
|
|
|
|
|
/* Reject the packet if data is NULL */
|
|
|
|
if (data == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
tcpinfo = (struct tcpinfo*)data;
|
2011-12-15 18:47:57 +00:00
|
|
|
|
|
|
|
conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
|
|
|
if (!conv) {
|
|
|
|
conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
rconv = (rtmpt_conv_t*)conversation_get_proto_data(conv, proto_rtmpt);
|
|
|
|
if (!rconv) {
|
2010-10-30 16:40:46 +00:00
|
|
|
rconv = rtmpt_init_rconv(conv);
|
2011-12-15 18:47:57 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
cdir = (ADDRESSES_EQUAL(&conv->key_ptr->addr1, &pinfo->src) &&
|
2010-10-30 16:40:46 +00:00
|
|
|
ADDRESSES_EQUAL(&conv->key_ptr->addr2, &pinfo->dst) &&
|
2013-12-12 19:59:23 +00:00
|
|
|
conv->key_ptr->port1 == pinfo->srcport &&
|
|
|
|
conv->key_ptr->port2 == pinfo->destport) ? 0 : 1;
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
dissect_rtmpt_common(tvb, pinfo, tree, rconv, cdir, tcpinfo->seq, tcpinfo->lastackseq);
|
2014-06-19 17:18:16 +00:00
|
|
|
return tvb_length(tvb);
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
static void
|
|
|
|
dissect_rtmpt_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
conversation_t *conv;
|
2011-12-15 18:47:57 +00:00
|
|
|
rtmpt_conv_t *rconv;
|
|
|
|
int cdir;
|
|
|
|
guint32 seq;
|
|
|
|
guint32 lastackseq;
|
|
|
|
guint32 offset;
|
|
|
|
gint remain;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
offset = 0;
|
2014-06-19 17:18:16 +00:00
|
|
|
remain = tvb_length_remaining(tvb, 0);
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Request flow:
|
|
|
|
*
|
|
|
|
* POST /open/1
|
|
|
|
* request body is a single non-RTMP byte
|
|
|
|
* response contains a client ID <cid> followed by NL
|
|
|
|
* POST /send/<cid>/<seq>
|
|
|
|
* <seq> starts at 0 after open and increments on each
|
|
|
|
* subsequent post
|
|
|
|
* request body is pure RTMP data
|
|
|
|
* response is a single non-RTMP byte followed by RTMP data
|
|
|
|
* POST /idle/<cid>/<seq>
|
|
|
|
* request contains a single non-RTMP byte
|
|
|
|
* response is a single non-RTMP byte followed by RTMP data
|
|
|
|
* POST /close/<cid>/<seq>
|
|
|
|
* request and response contain a single non-RTMP byte
|
|
|
|
*
|
|
|
|
* Ideally here we'd know:
|
|
|
|
*
|
|
|
|
* 1) Whether this is was a HTTP request or response
|
|
|
|
* (this gives us cdir directly)
|
|
|
|
* 2) The requested URL (for both cases)
|
|
|
|
* (this tells us the type of framing bytes present,
|
|
|
|
* so whether there are any real bytes present). We
|
|
|
|
* could also use the client ID to identify the
|
|
|
|
* conversation, since each POST is likely to be on
|
|
|
|
* a different TCP connection, and there could be
|
|
|
|
* multiple simultaneous sessions from a single
|
|
|
|
* client (which we don't deal with here.)
|
|
|
|
*
|
|
|
|
* As it is, we currently have to just guess, and are
|
|
|
|
* likely easily confused.
|
|
|
|
*/
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
cdir = pinfo->srcport == pinfo->match_uint;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
if (cdir) {
|
|
|
|
conv = find_conversation(pinfo->fd->num, &pinfo->dst, &pinfo->src, pinfo->ptype, 0, pinfo->srcport, 0);
|
|
|
|
if (!conv) {
|
|
|
|
RTMPT_DEBUG("RTMPT new conversation\n");
|
|
|
|
conv = conversation_new(pinfo->fd->num, &pinfo->dst, &pinfo->src, pinfo->ptype, 0, pinfo->srcport, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, 0, pinfo->destport, 0);
|
|
|
|
if (!conv) {
|
|
|
|
RTMPT_DEBUG("RTMPT new conversation\n");
|
|
|
|
conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, 0, pinfo->destport, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rconv = (rtmpt_conv_t*)conversation_get_proto_data(conv, proto_rtmpt);
|
|
|
|
if (!rconv) {
|
|
|
|
rconv = rtmpt_init_rconv(conv);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Work out a TCP-like sequence numbers for the tunneled data stream.
|
|
|
|
* If we've seen the packet before we'll have stored the seq of our
|
|
|
|
* last byte against the frame number - since we know how big we are
|
|
|
|
* we can work out the seq of our first byte. If this is the first
|
|
|
|
* time, we use the stored seq of the last byte of the previous frame
|
|
|
|
* plus one. If there is no previous frame then we must be at seq=1!
|
|
|
|
* (This is per-conversation and per-direction, of course.) */
|
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
lastackseq = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->seqs[cdir ^ 1], pinfo->fd->num))+1;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (cdir == 1 && lastackseq < 2 && remain == 17) {
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Session startup: the client makes an /open/ request and
|
|
|
|
* the server responds with a 16 bytes client
|
|
|
|
* identifier followed by a newline */
|
|
|
|
offset += 17;
|
|
|
|
remain -= 17;
|
2013-12-12 19:59:23 +00:00
|
|
|
} else if (cdir || remain == 1) {
|
2010-10-30 16:40:46 +00:00
|
|
|
/* All other server responses start with one byte which
|
|
|
|
* is not part of the RTMP stream. Client /idle/ requests
|
|
|
|
* contain a single byte also not part of the stream. We
|
|
|
|
* must discard these */
|
|
|
|
offset++;
|
|
|
|
remain--;
|
|
|
|
}
|
|
|
|
|
2013-08-25 14:23:13 +00:00
|
|
|
seq = GPOINTER_TO_INT(wmem_tree_lookup32(rconv->seqs[cdir], pinfo->fd->num));
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (seq == 0) {
|
2013-08-25 14:23:13 +00:00
|
|
|
seq = GPOINTER_TO_INT(wmem_tree_lookup32_le(rconv->seqs[cdir], pinfo->fd->num));
|
2010-10-30 16:40:46 +00:00
|
|
|
seq += remain;
|
2013-08-25 14:23:13 +00:00
|
|
|
wmem_tree_insert32(rconv->seqs[cdir], pinfo->fd->num, GINT_TO_POINTER(seq));
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
seq -= remain-1;
|
|
|
|
|
|
|
|
RTMPT_DEBUG("RTMPT f=%d cdir=%d seq=%d lastackseq=%d len=%d\n", pinfo->fd->num, cdir, seq, lastackseq, remain);
|
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (remain < 1)
|
|
|
|
return;
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
if (offset > 0) {
|
2014-06-06 14:35:50 +00:00
|
|
|
tvbuff_t *tvbrtmp = tvb_new_subset_length(tvb, offset, remain);
|
2010-10-30 16:40:46 +00:00
|
|
|
dissect_rtmpt_common(tvbrtmp, pinfo, tree, rconv, cdir, seq, lastackseq);
|
|
|
|
} else {
|
|
|
|
dissect_rtmpt_common(tvb, pinfo, tree, rconv, cdir, seq, lastackseq);
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
#if 0
|
|
|
|
static gboolean
|
2013-11-02 00:36:30 +00:00
|
|
|
dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
2010-10-30 16:40:46 +00:00
|
|
|
{
|
2013-12-12 19:59:23 +00:00
|
|
|
conversation_t *conversation;
|
2014-06-19 17:18:16 +00:00
|
|
|
if (tvb_length(tvb) >= 12)
|
2011-12-15 18:47:57 +00:00
|
|
|
{
|
|
|
|
/* 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.
|
|
|
|
Therefore it is necessary to a "Decode as" to properly decode the first packets */
|
2013-11-02 00:36:30 +00:00
|
|
|
struct tcpinfo *tcpinfo = (struct tcpinfo *)data;
|
2011-12-15 18:47:57 +00:00
|
|
|
if (tcpinfo->lastackseq == RTMPT_HANDSHAKE_OFFSET_2
|
|
|
|
&& tcpinfo->seq == RTMPT_HANDSHAKE_OFFSET_1
|
|
|
|
&& tvb_get_guint8(tvb, 0) == RTMPT_MAGIC)
|
|
|
|
{
|
|
|
|
/* Register this dissector for this conversation */
|
|
|
|
conversation = NULL;
|
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
|
|
|
if (conversation == NULL)
|
|
|
|
{
|
|
|
|
conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
|
|
|
}
|
|
|
|
conversation_set_dissector(conversation, rtmpt_tcp_handle);
|
|
|
|
|
|
|
|
/* Dissect the packet */
|
|
|
|
dissect_rtmpt_tcp(tvb, pinfo, tree);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
2010-10-30 16:40:46 +00:00
|
|
|
}
|
|
|
|
#endif
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
static void
|
|
|
|
dissect_amf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *amf_tree, *headers_tree, *messages_tree;
|
2013-12-12 19:59:23 +00:00
|
|
|
int offset;
|
|
|
|
guint header_count, message_count, i;
|
|
|
|
guint string_length;
|
|
|
|
guint header_length, message_length;
|
|
|
|
gboolean amf3_encoding = FALSE;
|
2012-11-16 21:59:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX - is "application/x-amf" just AMF3?
|
|
|
|
*/
|
|
|
|
ti = proto_tree_add_item(tree, proto_amf, tvb, 0, -1, ENC_NA);
|
|
|
|
amf_tree = proto_item_add_subtree(ti, ett_amf);
|
|
|
|
offset = 0;
|
|
|
|
proto_tree_add_item(amf_tree, hf_amf_version, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
header_count = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_uint(amf_tree, hf_amf_header_count, tvb, offset, 2, header_count);
|
|
|
|
offset += 2;
|
|
|
|
if (header_count != 0) {
|
2014-07-06 13:49:27 +00:00
|
|
|
headers_tree = proto_tree_add_subtree(amf_tree, tvb, offset, -1, ett_amf_headers, NULL, "Headers");
|
2012-11-16 21:59:58 +00:00
|
|
|
for (i = 0; i < header_count; i++) {
|
|
|
|
string_length = tvb_get_ntohs(tvb, offset);
|
2014-09-19 01:18:34 +00:00
|
|
|
proto_tree_add_item(headers_tree, hf_amf_header_name, tvb, offset, 2, ENC_UTF_8|ENC_BIG_ENDIAN);
|
2012-11-16 21:59:58 +00:00
|
|
|
offset += 2 + string_length;
|
|
|
|
proto_tree_add_item(headers_tree, hf_amf_header_must_understand, tvb, offset, 1, ENC_NA);
|
|
|
|
offset += 1;
|
|
|
|
header_length = tvb_get_ntohl(tvb, offset);
|
|
|
|
if (header_length == 0xFFFFFFFF)
|
|
|
|
proto_tree_add_uint_format_value(headers_tree, hf_amf_header_length, tvb, offset, 4, header_length, "Unknown");
|
|
|
|
else
|
|
|
|
proto_tree_add_uint(headers_tree, hf_amf_header_length, tvb, offset, 4, header_length);
|
|
|
|
offset += 4;
|
|
|
|
if (amf3_encoding)
|
|
|
|
offset = dissect_amf3_value_type(tvb, offset, headers_tree, NULL);
|
|
|
|
else
|
|
|
|
offset = dissect_amf0_value_type(tvb, offset, headers_tree, &amf3_encoding, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
message_count = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_uint(amf_tree, hf_amf_message_count, tvb, offset, 2, message_count);
|
|
|
|
offset += 2;
|
|
|
|
if (message_count != 0) {
|
2014-07-06 13:49:27 +00:00
|
|
|
messages_tree = proto_tree_add_subtree(amf_tree, tvb, offset, -1, ett_amf_messages, NULL, "Messages");
|
2012-11-16 21:59:58 +00:00
|
|
|
for (i = 0; i < message_count; i++) {
|
|
|
|
string_length = tvb_get_ntohs(tvb, offset);
|
2014-09-19 01:18:34 +00:00
|
|
|
proto_tree_add_item(messages_tree, hf_amf_message_target_uri, tvb, offset, 2, ENC_UTF_8|ENC_BIG_ENDIAN);
|
2012-11-16 21:59:58 +00:00
|
|
|
offset += 2 + string_length;
|
|
|
|
string_length = tvb_get_ntohs(tvb, offset);
|
2014-09-19 01:18:34 +00:00
|
|
|
proto_tree_add_item(messages_tree, hf_amf_message_response_uri, tvb, offset, 2, ENC_UTF_8|ENC_BIG_ENDIAN);
|
2012-11-16 21:59:58 +00:00
|
|
|
offset += 2 + string_length;
|
|
|
|
message_length = tvb_get_ntohl(tvb, offset);
|
|
|
|
if (message_length == 0xFFFFFFFF)
|
|
|
|
proto_tree_add_uint_format_value(messages_tree, hf_amf_message_length, tvb, offset, 4, message_length, "Unknown");
|
|
|
|
else
|
|
|
|
proto_tree_add_uint(messages_tree, hf_amf_message_length, tvb, offset, 4, message_length);
|
|
|
|
offset += 4;
|
|
|
|
offset = dissect_rtmpt_body_command(tvb, offset, messages_tree, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
void
|
|
|
|
proto_register_rtmpt(void)
|
|
|
|
{
|
2011-12-15 18:47:57 +00:00
|
|
|
static hf_register_info hf[] = {
|
2010-10-30 16:40:46 +00:00
|
|
|
/* RTMP Handshake data */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_c0,
|
|
|
|
{ "Protocol version", "rtmpt.handshake.c0", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake C0", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_s0,
|
|
|
|
{ "Protocol version", "rtmpt.handshake.s0", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake S0", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_c1,
|
|
|
|
{ "Handshake data", "rtmpt.handshake.c1", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake C1", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_s1,
|
|
|
|
{ "Handshake data", "rtmpt.handshake.s1", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake S1", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_c2,
|
|
|
|
{ "Handshake data", "rtmpt.handshake.c2", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake C2", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_handshake_s2,
|
|
|
|
{ "Handshake data", "rtmpt.handshake.s2", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Handshake S2", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* RTMP chunk/packet header */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_format,
|
|
|
|
{ "Format", "rtmpt.header.format", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0xC0, "RTMPT Basic Header format", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_csid,
|
|
|
|
{ "Chunk Stream ID", "rtmpt.header.csid", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x3F, "RTMPT Basic Header chunk stream ID", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_timestamp,
|
|
|
|
{ "Timestamp", "rtmpt.header.timestamp", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Message Header timestamp", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_timestamp_delta,
|
|
|
|
{ "Timestamp delta", "rtmpt.header.timestampdelta", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Message Header timestamp delta", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_body_size,
|
|
|
|
{ "Body size", "rtmpt.header.bodysize", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Message Header body size", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_typeid,
|
|
|
|
{ "Type ID", "rtmpt.header.typeid", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(rtmpt_opcode_vals), 0x0, "RTMPT Message Header type ID", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_streamid,
|
|
|
|
{ "Stream ID", "rtmpt.header.streamid", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Header stream ID", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_header_ets,
|
|
|
|
{ "Extended timestamp", "rtmpt.header.ets", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Message Header extended timestamp", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Stream Control Messages */
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_scm_chunksize,
|
|
|
|
{ "Chunk size", "rtmpt.scm.chunksize", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT SCM chunk size", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_scm_csid,
|
|
|
|
{ "Chunk stream ID", "rtmpt.scm.csid", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT SCM chunk stream ID", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_scm_seq,
|
|
|
|
{ "Sequence number", "rtmpt.scm.seq", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT SCM acknowledgement sequence number", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_scm_was,
|
2012-01-23 20:14:37 +00:00
|
|
|
{ "Window acknowledgement size", "rtmpt.scm.was", FT_UINT32, BASE_DEC,
|
2011-12-15 18:47:57 +00:00
|
|
|
NULL, 0x0, "RTMPT SCM window acknowledgement size", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_scm_limittype,
|
|
|
|
{ "Limit type", "rtmpt.scm.limittype", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_limit_vals), 0x0, "RTMPT SCM window acknowledgement size", HFILL }},
|
2009-07-12 15:03:05 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* User Control Messages */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_ucm_eventtype,
|
|
|
|
{ "Event type", "rtmpt.ucm.eventtype", FT_UINT16, BASE_DEC,
|
|
|
|
VALS(rtmpt_ucm_vals), 0x0, "RTMPT UCM event type", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/* Frame links */
|
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_function_call,
|
|
|
|
{ "Response to this call in frame", "rtmpt.function.call", FT_FRAMENUM, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT function call", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_function_response,
|
|
|
|
{ "Call for this response in frame", "rtmpt.function.response", FT_FRAMENUM, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT function response", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/* Audio packets */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_control,
|
|
|
|
{ "Audio control", "rtmpt.audio.control", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0x0, "RTMPT Audio control", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_format,
|
|
|
|
{ "Format", "rtmpt.audio.format", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_audio_codecs), 0xf0, "RTMPT Audio format", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_rate,
|
|
|
|
{ "Sample rate", "rtmpt.audio.rate", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_audio_rates), 0x0c, "RTMPT Audio sample rate", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_size,
|
|
|
|
{ "Sample size", "rtmpt.audio.size", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_audio_sizes), 0x02, "RTMPT Audio sample size", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_type,
|
|
|
|
{ "Channels", "rtmpt.audio.type", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_audio_types), 0x01, "RTMPT Audio channel count", HFILL }},
|
2007-12-17 20:43:38 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_audio_data,
|
|
|
|
{ "Audio data", "rtmpt.audio.data", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Audio data", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/* Video packets */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_video_control,
|
|
|
|
{ "Video control", "rtmpt.video.control", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0x0, "RTMPT Video control", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_video_type,
|
|
|
|
{ "Type", "rtmpt.video.type", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_video_types), 0xf0, "RTMPT Video type", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_video_format,
|
|
|
|
{ "Format", "rtmpt.video.format", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_video_codecs), 0x0f, "RTMPT Video format", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_video_data,
|
|
|
|
{ "Video data", "rtmpt.video.data", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT Video data", HFILL }},
|
2010-10-30 16:40:46 +00:00
|
|
|
|
|
|
|
/* Aggregate packets */
|
2011-12-15 18:47:57 +00:00
|
|
|
{ &hf_rtmpt_tag_type,
|
|
|
|
{ "Type", "rtmpt.tag.type", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(rtmpt_tag_vals), 0x0, "RTMPT Aggregate tag type", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_rtmpt_tag_datasize,
|
|
|
|
{ "Data size", "rtmpt.tag.datasize", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Aggregate tag data size", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_rtmpt_tag_timestamp,
|
|
|
|
{ "Timestamp", "rtmpt.tag.timestamp", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Aggregate tag timestamp", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_rtmpt_tag_ets,
|
|
|
|
{ "Timestamp Extended", "rtmpt.tag.ets", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Aggregate tag timestamp extended", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_rtmpt_tag_streamid,
|
|
|
|
{ "Stream ID", "rtmpt.tag.streamid", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Aggregate tag stream ID", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_rtmpt_tag_tagsize,
|
|
|
|
{ "Previous tag size", "rtmpt.tag.tagsize", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT Aggregate previous tag size", HFILL }}
|
|
|
|
|
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rtmpt,
|
|
|
|
&ett_rtmpt_handshake,
|
|
|
|
&ett_rtmpt_header,
|
|
|
|
&ett_rtmpt_body,
|
|
|
|
&ett_rtmpt_ucm,
|
|
|
|
&ett_rtmpt_audio_control,
|
|
|
|
&ett_rtmpt_video_control,
|
|
|
|
&ett_rtmpt_tag,
|
|
|
|
&ett_rtmpt_tag_data
|
|
|
|
};
|
|
|
|
|
|
|
|
module_t *rtmpt_module;
|
|
|
|
|
|
|
|
proto_rtmpt = proto_register_protocol("Real Time Messaging Protocol", "RTMPT", "rtmpt");
|
|
|
|
proto_register_field_array(proto_rtmpt, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
rtmpt_module = prefs_register_protocol(proto_rtmpt, NULL);
|
|
|
|
prefs_register_bool_preference(rtmpt_module, "desegment",
|
|
|
|
"Reassemble RTMPT messages spanning multiple TCP segments",
|
|
|
|
"Whether the RTMPT dissector should reassemble messages spanning multiple TCP segments."
|
|
|
|
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\""
|
|
|
|
" in the TCP protocol settings.",
|
|
|
|
&rtmpt_desegment);
|
2012-11-16 21:59:58 +00:00
|
|
|
|
2013-05-16 01:56:48 +00:00
|
|
|
prefs_register_uint_preference(rtmpt_module, "max_packet_size",
|
|
|
|
"Maximum packet size",
|
|
|
|
"The largest acceptable packet size for reassembly",
|
|
|
|
10, &rtmpt_max_packet_size);
|
|
|
|
|
2007-12-17 20:43:38 +00:00
|
|
|
}
|
|
|
|
|
2012-11-16 21:59:58 +00:00
|
|
|
void
|
|
|
|
proto_register_amf(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_amf_version,
|
|
|
|
{ "AMF version", "amf.version", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_header_count,
|
|
|
|
{ "Header count", "amf.header_count", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_header_name,
|
|
|
|
{ "Name", "amf.header.name", FT_UINT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_header_must_understand,
|
|
|
|
{ "Must understand", "amf.header.must_understand", FT_BOOLEAN, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_header_length,
|
|
|
|
{ "Length", "amf.header.length", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
2013-01-31 18:31:28 +00:00
|
|
|
#if 0
|
2012-11-16 21:59:58 +00:00
|
|
|
{ &hf_amf_header_value_type,
|
|
|
|
{ "Value type", "amf.header.value_type", FT_UINT32, BASE_HEX,
|
2013-01-26 18:54:53 +00:00
|
|
|
VALS(rtmpt_type_vals), 0x0, NULL, HFILL }},
|
2013-01-31 18:31:28 +00:00
|
|
|
#endif
|
2012-11-16 21:59:58 +00:00
|
|
|
|
|
|
|
{ &hf_amf_message_count,
|
|
|
|
{ "Message count", "amf.message_count", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_message_target_uri,
|
|
|
|
{ "Target URI", "amf.message.target_uri", FT_UINT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_message_response_uri,
|
|
|
|
{ "Response URI", "amf.message.response_uri", FT_UINT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_message_length,
|
|
|
|
{ "Length", "amf.message.length", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, NULL, HFILL }},
|
2012-11-18 04:30:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* AMF basic types */
|
|
|
|
{ &hf_amf_amf0_type,
|
2012-11-18 08:03:05 +00:00
|
|
|
{ "AMF0 type", "amf.amf0_type", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(amf0_type_vals), 0x0, NULL, HFILL }},
|
2012-11-18 04:30:10 +00:00
|
|
|
|
|
|
|
{ &hf_amf_amf3_type,
|
2012-11-18 08:03:05 +00:00
|
|
|
{ "AMF3 type", "amf.amf3_type", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(amf3_type_vals), 0x0, NULL, HFILL }},
|
2012-11-18 04:30:10 +00:00
|
|
|
|
|
|
|
{ &hf_amf_number,
|
|
|
|
{ "Number", "amf.number", FT_DOUBLE, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF number", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_integer,
|
|
|
|
{ "Integer", "amf.integer", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT AMF3 integer", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_boolean,
|
|
|
|
{ "Boolean", "amf.boolean", FT_BOOLEAN, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF boolean", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_stringlength,
|
|
|
|
{ "String length", "amf.stringlength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF string length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_string,
|
|
|
|
{ "String", "amf.string", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF string", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_string_reference,
|
|
|
|
{ "String reference", "amf.string_reference", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT AMF3 string reference", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_object_reference,
|
|
|
|
{ "Object reference", "amf.object_reference", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF object reference", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_date,
|
|
|
|
{ "Date", "amf.date", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
|
|
|
|
NULL, 0x0, "AMF date", HFILL }},
|
|
|
|
|
2013-01-31 18:31:28 +00:00
|
|
|
#if 0
|
2012-11-18 04:30:10 +00:00
|
|
|
{ &hf_amf_longstringlength,
|
|
|
|
{ "String length", "amf.longstringlength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF long string length", HFILL }},
|
2013-01-31 18:31:28 +00:00
|
|
|
#endif
|
2012-11-18 04:30:10 +00:00
|
|
|
|
|
|
|
{ &hf_amf_longstring,
|
|
|
|
{ "Long string", "amf.longstring", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF long string", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_xml_doc,
|
|
|
|
{ "XML document", "amf.xml_doc", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF XML document", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_xmllength,
|
|
|
|
{ "XML text length", "amf.xmllength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF E4X XML length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_xml,
|
|
|
|
{ "XML", "amf.xml", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF E4X XML", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_int64,
|
|
|
|
{ "Int64", "amf.int64", FT_INT64, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF int64", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_bytearraylength,
|
|
|
|
{ "ByteArray length", "amf.bytearraylength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "RTMPT AMF3 ByteArray length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_bytearray,
|
|
|
|
{ "ByteArray", "amf.bytearray", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT AMF3 ByteArray", HFILL }},
|
|
|
|
|
|
|
|
/* AMF object types and subfields of the object types */
|
|
|
|
{ &hf_amf_object,
|
|
|
|
{ "Object", "amf.object", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF object", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_traitcount,
|
|
|
|
{ "Trait count", "amf.traitcount", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF count of traits for an object", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_classnamelength,
|
|
|
|
{ "Class name length", "amf.classnamelength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF class name length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_classname,
|
|
|
|
{ "Class name", "amf.classname", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF class name", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_membernamelength,
|
|
|
|
{ "Member name length", "amf.membernamelength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF member name length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_membername,
|
|
|
|
{ "Member name", "amf.membername", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF member name", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_trait_reference,
|
|
|
|
{ "Trait reference", "amf.trait_reference", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF trait reference", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_ecmaarray,
|
|
|
|
{ "ECMA array", "amf.ecmaarray", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF ECMA array", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_strictarray,
|
|
|
|
{ "Strict array", "amf.strictarray", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0x0, "AMF strict array", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_array,
|
|
|
|
{ "Array", "amf.array", FT_NONE, BASE_NONE,
|
|
|
|
NULL, 0x0, "RTMPT AMF3 array", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_arraylength,
|
|
|
|
{ "Array length", "amf.arraylength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF array length", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_amf_arraydenselength,
|
|
|
|
{ "Length of dense portion", "amf.arraydenselength", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0x0, "AMF length of dense portion of array", HFILL }},
|
2012-11-16 21:59:58 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_amf,
|
|
|
|
&ett_amf_headers,
|
2012-11-18 04:30:10 +00:00
|
|
|
&ett_amf_messages,
|
|
|
|
&ett_amf_value,
|
|
|
|
&ett_amf_property,
|
|
|
|
&ett_amf_string,
|
|
|
|
&ett_amf_array_element,
|
|
|
|
&ett_amf_traits,
|
|
|
|
&ett_amf_trait_member,
|
2012-11-16 21:59:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
proto_amf = proto_register_protocol("Action Message Format", "AMF", "amf");
|
2012-11-18 04:30:10 +00:00
|
|
|
proto_register_field_array(proto_amf, hf, array_length(hf));
|
2012-11-16 21:59:58 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2013-07-15 20:42:57 +00:00
|
|
|
}
|
2012-11-16 21:59:58 +00:00
|
|
|
|
2013-12-12 19:59:23 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_rtmpt(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t amf_handle;
|
|
|
|
|
|
|
|
/* heur_dissector_add("tcp", dissect_rtmpt_heur, proto_rtmpt); */
|
|
|
|
rtmpt_tcp_handle = new_create_dissector_handle(dissect_rtmpt_tcp, proto_rtmpt);
|
2014-06-20 16:43:28 +00:00
|
|
|
/* dissector_add_for_decode_as("tcp.port", rtmpt_tcp_handle); */
|
2013-12-12 19:59:23 +00:00
|
|
|
dissector_add_uint("tcp.port", RTMP_PORT, rtmpt_tcp_handle);
|
|
|
|
|
|
|
|
rtmpt_http_handle = create_dissector_handle(dissect_rtmpt_http, proto_rtmpt);
|
|
|
|
dissector_add_string("media_type", "application/x-fcs", rtmpt_http_handle);
|
|
|
|
|
|
|
|
amf_handle = create_dissector_handle(dissect_amf, proto_amf);
|
|
|
|
dissector_add_string("media_type", "application/x-amf", amf_handle);
|
|
|
|
}
|
|
|
|
|
2010-10-30 16:40:46 +00:00
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
2011-09-21 16:28:53 +00:00
|
|
|
* vi: set shiftwidth=8 tabstop=8 expandtab:
|
2010-10-30 16:40:46 +00:00
|
|
|
* :indentSize=8:tabSize=8:noTabs=true:
|
|
|
|
*/
|