diff options
author | Anders Broman <anders.broman@ericsson.com> | 2005-10-06 06:38:17 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2005-10-06 06:38:17 +0000 |
commit | 15aa4d692fe09a10e1cb31addfbd8634ca069d47 (patch) | |
tree | 1a6b08a93996285688cc98b37b75e93be08c1c88 /asn1 | |
parent | e0e6441d5dc74801a47ecfe550f617acdbbae2f2 (diff) |
From Richard van der Hoff:
Extensions to the h.245 dissector to extract H.223 Multiplex Code and Logical
Channel setup messages, and pass this information to the H.223 dissector.
svn path=/trunk/; revision=16139
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/h245/h245.cnf | 268 | ||||
-rw-r--r-- | asn1/h245/packet-h245-template.c | 54 | ||||
-rw-r--r-- | asn1/h245/packet-h245-template.h | 71 |
3 files changed, 390 insertions, 3 deletions
diff --git a/asn1/h245/h245.cnf b/asn1/h245/h245.cnf index 2a88f1206f..07d9db1fdd 100644 --- a/asn1/h245/h245.cnf +++ b/asn1/h245/h245.cnf @@ -12,6 +12,242 @@ OpenLogicalChannel OpenLogicalChannel #---------------------------------------------------------------------------------------- +#.FN_BODY MultiplexEntryDescriptor + /*MultiplexEntryDescriptor*/ + h223_me = NULL; + h223_mc = 0; +%(DEFAULT_BODY)s + if(h223_set_mc_handle) + (*h223_set_mc_handle)(pinfo, h223_mc, h223_me); + /* stuff */ +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS MultiplexTableEntryNumber + VAL_PTR = &value +#.FN_BODY MultiplexTableEntryNumber + guint32 value; +%(DEFAULT_BODY)s + h223_mc = value & 0xf; +#.END +#---------------------------------------------------------------------------------------- +#.FN_BODY MultiplexEntryDescriptor/elementList + /* create a h223_mux_element to hold onto the head of the list, since + * h223_me will track the tail */ + h223_mux_element dummy_me; + h223_me = &dummy_me; +%(DEFAULT_BODY)s + /* set h223_me to the head of the list for MEDescriptor to pick up */ + h223_me = dummy_me.next; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR MultiplexElement + /*MultiplexElement*/ + h223_mux_element* me = se_alloc(sizeof(h223_mux_element)); + h223_me->next = me; + h223_me = me; + h223_me->next = NULL; +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS MultiplexElement/type/logicalChannelNumber + VAL_PTR = &value +#.FN_BODY MultiplexElement/type/logicalChannelNumber + /*MultiplexElement/type/logicalChannelNumber*/ + guint32 value; +%(DEFAULT_BODY)s + h223_me->sublist = NULL; + h223_me->vc = value & 0xffff; +#.END +#---------------------------------------------------------------------------------------- +#.FN_BODY MultiplexElement/type/subElementList + h223_mux_element dummy_me, *parent_me = h223_me; + h223_me = &dummy_me; +%(DEFAULT_BODY)s + parent_me->sublist = dummy_me.next; + h223_me = parent_me; + h223_me->vc = 0; +#.END +#---------------------------------------------------------------------------------------- +#.FN_FTR MultiplexElement/repeatCount/untilClosingFlag + h223_me->repeat_count = 0; +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS MultiplexElement/repeatCount/finite + VAL_PTR = &value +#.FN_BODY MultiplexElement/repeatCount/finite + guint32 value; +%(DEFAULT_BODY)s + h223_me->repeat_count = value & 0xffff; +#.END +#---------------------------------------------------------------------------------------- +# OpenLogicalChannel .FN_FTR is also declared, line 460ish +#.FN_BODY OpenLogicalChannel + gint32 temp; + + h223_fw_lc_num = 0; + h223_lc_params_temp = NULL; + +%(DEFAULT_BODY)s + if(h223_fw_lc_num != 0 && h223_fw_lc_params) { + h223_pending_olc *pending = se_alloc(sizeof(h223_pending_olc)); + pending->fw_channel_params = h223_fw_lc_params; + pending->rev_channel_params = h223_rev_lc_params; + temp = h223_fw_lc_num; + if (pinfo->p2p_dir) + g_hash_table_insert(h223_pending_olc_reqs[pinfo->p2p_dir], GINT_TO_POINTER(temp), pending); + } +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS LogicalChannelNumber + VAL_PTR = &value +#.FN_BODY LogicalChannelNumber + guint32 value; +%(DEFAULT_BODY)s + h245_lc_temp = value & 0xfff; +#.END +#---------------------------------------------------------------------------------------- +#.FN_FTR OpenLogicalChannel/forwardLogicalChannelNumber + h223_fw_lc_num = h245_lc_temp; +#.END +#---------------------------------------------------------------------------------------- +#.FN_BODY OpenLogicalChannel/forwardLogicalChannelParameters + h245_lc_dissector = NULL; +%(DEFAULT_BODY)s + if(h223_lc_params_temp && h245_lc_dissector) + h223_lc_params_temp->subdissector = h245_lc_dissector; + else if(h223_lc_params_temp) + h223_lc_params_temp->subdissector = data_handle; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters + h223_fw_lc_params = se_alloc(sizeof(h223_lc_params)); + h223_fw_lc_params->al_type = al_nonStandard; + h223_fw_lc_params->al_params = NULL; + h223_fw_lc_params->segmentable = 0; + h223_fw_lc_params->subdissector = NULL; + h223_lc_params_temp = h223_fw_lc_params; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters + h223_rev_lc_params = se_alloc(sizeof(h223_lc_params)); + h223_rev_lc_params->al_type = al_nonStandard; + h223_rev_lc_params->al_params = NULL; + h223_rev_lc_params->segmentable = 0; + h223_rev_lc_params->subdissector = NULL; + h223_lc_params_temp = h223_rev_lc_params; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al1Framed + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1Framed; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al1NotFramed + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1NotFramed; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al2WithoutSequenceNumbers + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2WithoutSequenceNumbers; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al2WithSequenceNumbers + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2WithSequenceNumbers; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al3 + if(h223_lc_params_temp) { + h223_lc_params_temp->al_type = al3; + h223_lc_params_temp->al_params = se_alloc(sizeof(h223_al3_params)); + } +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS Al3/controlFieldOctets + VAL_PTR = &value +#.FN_BODY Al3/controlFieldOctets + guint32 value; +%(DEFAULT_BODY)s + if(h223_lc_params_temp && h223_lc_params_temp->al_params) + ((h223_al3_params*)h223_lc_params_temp->al_params)->control_field_octets = value & 3 ; +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS Al3/sendBufferSize + VAL_PTR = &value +#.FN_BODY Al3/sendBufferSize + guint32 value; +%(DEFAULT_BODY)s + if(h223_lc_params_temp && h223_lc_params_temp->al_params) + ((h223_al3_params*)h223_lc_params_temp->al_params)->send_buffer_size = value & 0xfffff; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al1M + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1M; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al2M + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2M; +#.END +#---------------------------------------------------------------------------------------- +#.FN_HDR H223LogicalChannelParameters/adaptationLayerType/al3M + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al3M; +#.END +#---------------------------------------------------------------------------------------- +#.FN_PARS H223LogicalChannelParameters/segmentableFlag + VAL_PTR = &value +#.FN_BODY H223LogicalChannelParameters/segmentableFlag + guint32 value; +%(DEFAULT_BODY)s + if(h223_lc_params_temp) + h223_lc_params_temp->segmentable = value & 1; +#.END +#---------------------------------------------------------------------------------------- +# OpenLogicalChannelAck .FN_FTR is also declared, line 460ish +#.FN_BODY OpenLogicalChannelAck + guint32 temp; + int p2p_dir; + h223_pending_olc *pend; + h223_fw_lc_num = 0; + h223_rev_lc_num = 0; + +%(DEFAULT_BODY)s + temp = h223_fw_lc_num; + p2p_dir = pinfo->p2p_dir; + + if(pinfo->p2p_dir == P2P_DIR_SENT) + pinfo->p2p_dir = P2P_DIR_RECV; + else + pinfo->p2p_dir = P2P_DIR_SENT; + pend = g_hash_table_lookup( h223_pending_olc_reqs[pinfo->p2p_dir], GINT_TO_POINTER(temp) ); + if (pend) { + DISSECTOR_ASSERT( ( h223_rev_lc_num && pend->rev_channel_params) + || (!h223_rev_lc_num && !pend->rev_channel_params) ); + if(h223_add_lc_handle) { + (*h223_add_lc_handle)( pinfo, h223_fw_lc_num, pend->fw_channel_params ); + if(h223_rev_lc_num) + (*h223_add_lc_handle)( pinfo, h223_rev_lc_num, pend->rev_channel_params ); + } + } else { + /* we missed the OpenLogicalChannel packet */ + } + pinfo->p2p_dir = p2p_dir; +#.END +#---------------------------------------------------------------------------------------- +#.FN_FTR OpenLogicalChannelAck/forwardLogicalChannelNumber + h223_fw_lc_num = h245_lc_temp; +#.END +#---------------------------------------------------------------------------------------- +#.FN_FTR OpenLogicalChannelAck/reverseLogicalChannelParamaters/reverseLogicalChannelNumber + h223_rev_lc_num = h245_lc_temp; +#.END +#---------------------------------------------------------------------------------------- +#.FN_FTR H263VideoCapability + h245_lc_dissector = h263_handle; +#.END +#---------------------------------------------------------------------------------------- #.FN_BODY RequestMessage VAL_PTR = &value guint32 value; @@ -231,11 +467,13 @@ OpenLogicalChannel h245_pi->msg_type = H245_TermCapSetRls; #.END #---------------------------------------------------------------------------------------- +# OpenLogicalChannel .FN_BODY is also declared, line 70ish #.FN_FTR OpenLogicalChannel if (h245_pi != NULL) h245_pi->msg_type = H245_OpenLogChn; #.END #---------------------------------------------------------------------------------------- +# OpenLogicalChannelAck .FN_BODY is also declared, line 200ish #.FN_FTR OpenLogicalChannelAck h245_pi->msg_type = H245_OpenLogChnAck; @@ -243,6 +481,9 @@ OpenLogicalChannel #---------------------------------------------------------------------------------------- #.FN_PARS CapabilityIdentifier/standard FN_VARIANT = _str VAL_PTR = &standard_oid_str +#.FN_FTR CapabilityIdentifier/standard + if(!h245_lc_dissector && strcmp(standard_oid_str,"0.0.8.245.1.1.1") == 0) + h245_lc_dissector = amr_handle; #.END #---------------------------------------------------------------------------------------- #.FN_HDR GenericMessage/subMessageIdentifer @@ -501,9 +742,13 @@ MulticastAddress/iPAddress MIPAddress MulticastAddress/iP6Address MIP6Address NonStandardIdentifier/h221NonStandard H221NonStandardID +OpenLogicalChannel/forwardLogicalChannelNumber OLC_fw_lcn +OpenLogicalChannelAck/forwardLogicalChannelNumber OLC_ack_fw_lcn OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters OLC_forw_multiplexParameters OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters OLC_rev_multiplexParameters OpenLogicalChannel/reverseLogicalChannelParameters OLC_reverseLogicalChannelParameters +OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters OLC_fw_h223_params +OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters OLC_rev_h223_params OpenLogicalChannelAck/reverseLogicalChannelParameters OLC_ack_reverseLogicalChannelParameters CloseLogicalChannel/reason Clc_reason VCCapability/availableBitRates/type Avb_type @@ -518,6 +763,7 @@ V76LogicalChannelParameters/mode V76LCP_mode FECData/rfc2733/mode FECdata_mode FECMode/rfc2733Mode/mode FEC_mode IS11172AudioMode/multichannelType IS11172_multichannelType +MultiplexElement/repeatCount/finite ME_finiteRepeatCount MultiplexElement/repeatCount ME_repeatCount FECCapability/rfc2733 FECC_rfc2733 RequestModeAck/response Req_mode_ack_response @@ -685,7 +931,7 @@ H263ModeComboFlags/enhancedReferencePicSelect enhancedReferencePicSelectBool NewATMVCCommand/aal/aal1/errorCorrection/errorCorrectionOnly errorCorrectionOnlyFlag NewATMVCIndication/aal/aal1/errorCorrection/errorCorrectionOnly errorCorrectionOnlyFlag UserInputCapability/extendedAlphanumeric extendedAlphanumericFlag -MultiplexElement/repeatCount/finite finite_1_65535 +MultiplexElement/repeatCount/finite me_repeatCount_finite MiscellaneousCommand/type/videoFastUpdateMB/firstMB firstMB_1_8192 MiscellaneousIndication/type/videoNotDecodedMBs/firstMB firstMB_1_8192 H261VideoCapability/cifMPI cifMPI_1_4 @@ -745,8 +991,10 @@ FECMode/rfc2733Mode/mode fec_mode FECData/rfc2733/mode fec_data_mode V76LogicalChannelParameters/mode v76_mode OpenLogicalChannelAck/reverseLogicalChannelParameters/multiplexParameters olc_ack_multiplexParameters -OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters olc_rev_multiplexParameter +OpenLogicalChannel/forwardLogicalChannelNumber olc_fw_lcn +OpenLogicalChannelAck/forwardLogicalChannelNumber olc_ack_fw_lcn OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters olc_forw_multiplexParameters +OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters olc_rev_multiplexParameter IS11172AudioMode/multichannelType is11172multichannelType IS13818AudioMode/multichannelType is13818MultichannelType CloseLogicalChannel/reason clc_reason @@ -774,6 +1022,20 @@ MulticastAddress/iP6Address/tsapIdentifier multicast_IPv6_tsapIdentifier CommunicationModeTableEntry/mediaChannel cm_mediaChannel CommunicationModeTableEntry/mediaControlChannel cm_mediaControlChannel +OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters olc_rev_h223_params +OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters olc_fw_h223_params + +H223LogicalChannelParameters/adaptationLayerType/al1Framed h223_al_type_al1Framed +H223LogicalChannelParameters/adaptationLayerType/al1NotFramed h223_al_type_al1NotFramed +H223LogicalChannelParameters/adaptationLayerType/al2WithoutSequenceNumbers h223_al_type_al2WithoutSequenceNumbers +H223LogicalChannelParameters/adaptationLayerType/al2WithSequenceNumbers h223_al_type_al2WithSequenceNumbers +H223LogicalChannelParameters/adaptationLayerType/al3 h223_al_type_al3 +Al3/sendBufferSize al3_sendBufferSize +H223LogicalChannelParameters/adaptationLayerType/al1M h223_al_type_al1M +H223LogicalChannelParameters/adaptationLayerType/al2M h223_al_type_al2M +H223LogicalChannelParameters/adaptationLayerType/al3M h223_al_type_al3M +H223LogicalChannelParameters/segmentableFlag h223_lc_segmentableFlag + #---------------------------------------------------------------------------------------- #.TYPE_ATTR UnicastAddress/iPAddress/network TYPE = FT_IPv4 DISPLAY = BASE_NONE STRINGS = NULL @@ -788,4 +1050,6 @@ VendorIdentification/versionNumber TYPE = FT_STRING DISPLAY = BASE_HEX STRINGS = #---------------------------------------------------------------------------------------- #.FIELD_ATTR AlternativeCapabilitySet/_item NAME = "alternativeCapability" + #---------------------------------------------------------------------------------------- +# vim:set ts=4 sts=2 sw=2: diff --git a/asn1/h245/packet-h245-template.c b/asn1/h245/packet-h245-template.c index 2c8588066a..05ebf25608 100644 --- a/asn1/h245/packet-h245-template.c +++ b/asn1/h245/packet-h245-template.c @@ -53,6 +53,7 @@ #include "packet-rtp.h" #include "packet-rtcp.h" #include "packet-ber.h" +#include <epan/emem.h> #define PNAME "MULTIMEDIA-SYSTEM-CONTROL" #define PSNAME "H.245" @@ -66,6 +67,8 @@ static dissector_handle_t nsp_handle; static dissector_handle_t data_handle; static dissector_handle_t h245_handle; static dissector_handle_t MultimediaSystemControlMessage_handle; +static dissector_handle_t h263_handle = NULL; +static dissector_handle_t amr_handle = NULL; static void reset_h245_packet_info(h245_packet_info *pi); static int hf_h245_pdu_type = -1; @@ -221,6 +224,53 @@ static const value_string h245_RFC_number_vals[] = { { 3267, "RFC 3267 - Adaptive Multi-Rate (AMR) and Adaptive Multi-Rate Wideband (AMR-WB)" }, { 0, NULL } }; + +/* h223 multiplex codes */ +static h223_set_mc_handle_t h223_set_mc_handle = NULL; +h223_mux_element *h223_me=NULL; +guint8 h223_mc=0; +void h245_set_h223_set_mc_handle( h223_set_mc_handle_t handle ) +{ + h223_set_mc_handle = handle; +} + +/* h223 logical channels */ +typedef struct { + h223_lc_params *fw_channel_params; + h223_lc_params *rev_channel_params; +} h223_pending_olc; + +static GHashTable* h223_pending_olc_reqs[] = { NULL, NULL }; +static dissector_handle_t h245_lc_dissector; +static guint16 h245_lc_temp; +static guint16 h223_fw_lc_num; +static guint16 h223_rev_lc_num; +static h223_lc_params *h223_lc_params_temp; +static h223_lc_params *h223_fw_lc_params; +static h223_lc_params *h223_rev_lc_params; +static h223_add_lc_handle_t h223_add_lc_handle = NULL; + +static void h223_lc_init_dir( int dir ) +{ + if ( h223_pending_olc_reqs[dir] ) + g_hash_table_destroy( h223_pending_olc_reqs[dir] ); + h223_pending_olc_reqs[dir] = g_hash_table_new( g_direct_hash, g_direct_equal ); +} + +static void h223_lc_init() +{ + h223_lc_init_dir( P2P_DIR_SENT ); + h223_lc_init_dir( P2P_DIR_RECV ); + h223_lc_params_temp = NULL; + h245_lc_dissector = NULL; + h223_fw_lc_num = 0; +} + +void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle ) +{ + h223_add_lc_handle = handle; +} + /* Initialize the protocol and registered fields */ int proto_h245 = -1; #include "packet-h245-hf.c" @@ -348,12 +398,16 @@ void proto_reg_handoff_h245(void) { rtp_handle = find_dissector("rtp"); rtcp_handle = find_dissector("rtcp"); data_handle = find_dissector("data"); + h263_handle = find_dissector("h263data"); + amr_handle = find_dissector("amr_if2"); h245_handle=create_dissector_handle(dissect_h245, proto_h245); dissector_add_handle("tcp.port", h245_handle); MultimediaSystemControlMessage_handle=create_dissector_handle(dissect_h245_h245, proto_h245); dissector_add_handle("udp.port", MultimediaSystemControlMessage_handle); + + h223_lc_init(); } static void reset_h245_packet_info(h245_packet_info *pi) diff --git a/asn1/h245/packet-h245-template.h b/asn1/h245/packet-h245-template.h index 883700ba17..6852cf47f1 100644 --- a/asn1/h245/packet-h245-template.h +++ b/asn1/h245/packet-h245-template.h @@ -49,8 +49,77 @@ typedef struct _h245_packet_info { gchar comment[50]; /* the Frame Comment used by graph_analysis, what is a message desc */ } h245_packet_info; +/* + * h223 LC info + */ + +typedef enum { + al_nonStandard, + al1Framed, + al1NotFramed, + al2WithoutSequenceNumbers, + al2WithSequenceNumbers, + al3, + /*...*/ + // al?M: unimplemented annex C adaptation layers + al1M, + al2M, + al3M +} h223_al_type; + +typedef struct { + guint8 control_field_octets; + guint32 send_buffer_size; +} h223_al3_params; + +typedef struct { + h223_al_type al_type; + gpointer al_params; + gboolean segmentable; + dissector_handle_t subdissector; +} h223_lc_params; + +typedef enum { + nonStandardDataType, + nullData, + videoData, + audioData, + data, + encryptionData, + /*...,*/ + h235Control, + h235Media, + multiplexedStream, + redundancyEncoding, + multiplePayloadStream, + fec +} h245_lc_data_type_enum; + +typedef struct { + h245_lc_data_type_enum data_type; + gpointer params; +} h245_lc_data_type; + +/* + * h223 MUX info + */ + +typedef struct _h223_mux_element h223_mux_element; +struct _h223_mux_element { + h223_mux_element* sublist; /* if NULL, use vc instead */ + guint16 vc; + guint16 repeat_count; /* 0 == untilClosingFlag */ + h223_mux_element* next; +}; + +#include <epan/packet_info.h> +typedef void (*h223_set_mc_handle_t) ( packet_info* pinfo, guint8 mc, h223_mux_element* me ); +extern void h245_set_h223_set_mc_handle( h223_set_mc_handle_t handle ); + +typedef void (*h223_add_lc_handle_t) ( packet_info* pinfo, guint16 lc, h223_lc_params* params ); +extern void h245_set_h223_add_lc_handle( h223_add_lc_handle_t handle ); -#include "packet-h245-exp.h"*/ +#include "packet-h245-exp.h" void dissect_h245_OpenLogicalChannelCodec(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, char *codec_str); |