Ethereal-dev: Re: SV: [Ethereal-dev] New dissectors: H.223 and friends
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Richard van der Hoff <richardv@xxxxxxxxxxxxx>
Date: Mon, 03 Oct 2005 17:19:32 +0100
Anders Broman wrote:
Hi, I have checked in the first three patches there are some problems with the h245 patches with MSVC. It does not like declarations inside functions like + h223_pending_olc *pend = g_hash_table_lookup( h223_pending_olc_reqs[pinfo->p2p_dir], GINT_TO_POINTER(temp) );
Indeed, sorry about that. Here's a corrected version of the h.245 patch. Richard -- Richard van der Hoff <richardv@xxxxxxxxxxxxx> Systems Analyst Tel: +44 (0) 845 666 7778 http://www.mxtelecom.com
Index: epan/dissectors/packet-h245.c =================================================================== RCS file: /cvs/ethereal/epan/dissectors/packet-h245.c,v retrieving revision 1.1.1.4 retrieving revision 1.11 diff -u -u -r1.1.1.4 -r1.11 --- epan/dissectors/packet-h245.c 29 Sep 2005 13:18:54 -0000 1.1.1.4 +++ epan/dissectors/packet-h245.c 3 Oct 2005 15:37:45 -0000 1.11 @@ -60,6 +60,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" @@ -73,6 +74,8 @@ 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; @@ -228,6 +231,53 @@ { 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; @@ -913,19 +963,20 @@ static int hf_h245_separateStreamBool = -1; /* T_separateStream */ static int hf_h245_separatePort = -1; /* BOOLEAN */ static int hf_h245_samePortBool = -1; /* BOOLEAN */ -static int hf_h245_forwardLogicalChannelNumber = -1; /* LogicalChannelNumber */ +static int hf_h245_olc_fw_lcn = -1; /* OLC_fw_lcn */ static int hf_h245_forwardLogicalChannelParameters = -1; /* T_forwardLogicalChannelParameters */ static int hf_h245_portNumber = -1; /* INTEGER_0_65535 */ static int hf_h245_dataType = -1; /* DataType */ static int hf_h245_olc_forw_multiplexParameters = -1; /* OLC_forw_multiplexParameters */ static int hf_h245_h222LogicalChannelParameters = -1; /* H222LogicalChannelParameters */ -static int hf_h245_h223LogicalChannelParameters = -1; /* H223LogicalChannelParameters */ +static int hf_h245_olc_fw_h223_params = -1; /* OLC_fw_h223_params */ static int hf_h245_v76LogicalChannelParameters = -1; /* V76LogicalChannelParameters */ static int hf_h245_h2250LogicalChannelParameters = -1; /* H2250LogicalChannelParameters */ static int hf_h245_forwardLogicalChannelDependency = -1; /* LogicalChannelNumber */ static int hf_h245_replacementFor = -1; /* LogicalChannelNumber */ static int hf_h245_reverseLogicalChannelParameters = -1; /* OLC_reverseLogicalChannelParameters */ static int hf_h245_olc_rev_multiplexParameter = -1; /* OLC_rev_multiplexParameters */ +static int hf_h245_olc_rev_h223_params = -1; /* OLC_rev_h223_params */ static int hf_h245_reverseLogicalChannelDependency = -1; /* LogicalChannelNumber */ static int hf_h245_separateStack = -1; /* NetworkAccessParameters */ static int hf_h245_encryptionSync = -1; /* EncryptionSync */ @@ -965,17 +1016,17 @@ static int hf_h245_programDescriptors = -1; /* OCTET_STRING */ static int hf_h245_streamDescriptors = -1; /* OCTET_STRING */ static int hf_h245_adaptationLayerType = -1; /* T_adaptationLayerType */ -static int hf_h245_al1Framed = -1; /* NULL */ -static int hf_h245_al1NotFramed = -1; /* NULL */ -static int hf_h245_al2WithoutSequenceNumbers = -1; /* NULL */ -static int hf_h245_al2WithSequenceNumbers = -1; /* NULL */ -static int hf_h245_al3 = -1; /* Al3 */ -static int hf_h245_al1M = -1; /* H223AL1MParameters */ -static int hf_h245_al2M = -1; /* H223AL2MParameters */ -static int hf_h245_al3M = -1; /* H223AL3MParameters */ -static int hf_h245_segmentableFlag = -1; /* BOOLEAN */ -static int hf_h245_controlFieldOctets = -1; /* INTEGER_0_2 */ -static int hf_h245_sendBufferSize = -1; /* INTEGER_0_16777215 */ +static int hf_h245_h223_al_type_al1Framed = -1; /* T_al1Framed */ +static int hf_h245_h223_al_type_al1NotFramed = -1; /* T_al1NotFramed */ +static int hf_h245_h223_al_type_al2WithoutSequenceNumbers = -1; /* T_al2WithoutSequenceNumbers */ +static int hf_h245_h223_al_type_al2WithSequenceNumbers = -1; /* T_al2WithSequenceNumbers */ +static int hf_h245_h223_al_type_al3 = -1; /* T_al3 */ +static int hf_h245_h223_al_type_al1M = -1; /* T_al1M */ +static int hf_h245_h223_al_type_al2M = -1; /* T_al2M */ +static int hf_h245_h223_al_type_al3M = -1; /* T_al3M */ +static int hf_h245_h223_lc_segmentableFlag = -1; /* T_segmentableFlag */ +static int hf_h245_controlFieldOctets = -1; /* T_controlFieldOctets */ +static int hf_h245_al3_sendBufferSize = -1; /* T_sendBufferSize */ static int hf_h245_transferMode = -1; /* T_transferMode */ static int hf_h245_framed = -1; /* NULL */ static int hf_h245_unframed = -1; /* NULL */ @@ -1005,6 +1056,7 @@ static int hf_h245_numberOfRetransmissions = -1; /* T_numberOfRetransmissions */ static int hf_h245_finite = -1; /* INTEGER_0_16 */ static int hf_h245_infinite = -1; /* NULL */ +static int hf_h245_sendBufferSize = -1; /* INTEGER_0_16777215 */ static int hf_h245_hdlcParameters = -1; /* V76HDLCParameters */ static int hf_h245_suspendResume = -1; /* T_suspendResume */ static int hf_h245_noSuspendResume = -1; /* NULL */ @@ -1088,11 +1140,13 @@ static int hf_h245_escrowentry_item = -1; /* EscrowData */ static int hf_h245_escrowID = -1; /* OBJECT_IDENTIFIER */ static int hf_h245_escrowValue = -1; /* BIT_STRING_SIZE_1_65535 */ +static int hf_h245_olc_ack_fw_lcn = -1; /* OLC_ack_fw_lcn */ static int hf_h245_olc_ack_reverseLogicalChannelParameters = -1; /* OLC_ack_reverseLogicalChannelParameters */ static int hf_h245_reverseLogicalChannelNumber = -1; /* LogicalChannelNumber */ static int hf_h245_olc_ack_multiplexParameters = -1; /* T_multiplexParameters */ static int hf_h245_forwardMultiplexAckParameters = -1; /* T_forwardMultiplexAckParameters */ static int hf_h245_h2250LogicalChannelAckParameters = -1; /* H2250LogicalChannelAckParameters */ +static int hf_h245_forwardLogicalChannelNumber = -1; /* LogicalChannelNumber */ static int hf_h245_olc_rej_cause = -1; /* OpenLogicalChannelRejectCause */ static int hf_h245_unsuitableReverseParameters = -1; /* NULL */ static int hf_h245_dataTypeNotSupported = -1; /* NULL */ @@ -1125,15 +1179,15 @@ static int hf_h245_multiplexEntryDescriptors = -1; /* SET_SIZE_1_15_OF_MultiplexEntryDescriptor */ static int hf_h245_multiplexEntryDescriptors_item = -1; /* MultiplexEntryDescriptor */ static int hf_h245_multiplexTableEntryNumber = -1; /* MultiplexTableEntryNumber */ -static int hf_h245_elementList = -1; /* SEQUENCE_SIZE_1_256_OF_MultiplexElement */ +static int hf_h245_elementList = -1; /* T_elementList */ static int hf_h245_elementList_item = -1; /* MultiplexElement */ static int hf_h245_me_type = -1; /* Me_type */ -static int hf_h245_logicalChannelNum = -1; /* INTEGER_0_65535 */ -static int hf_h245_subElementList = -1; /* SEQUENCE_SIZE_2_255_OF_MultiplexElement */ +static int hf_h245_logicalChannelNum = -1; /* T_logicalChannelNumber */ +static int hf_h245_subElementList = -1; /* T_subElementList */ static int hf_h245_subElementList_item = -1; /* MultiplexElement */ static int hf_h245_me_repeatCount = -1; /* ME_repeatCount */ -static int hf_h245_finite_1_65535 = -1; /* INTEGER_1_65535 */ -static int hf_h245_untilClosingFlag = -1; /* NULL */ +static int hf_h245_me_repeatCount_finite = -1; /* ME_finiteRepeatCount */ +static int hf_h245_untilClosingFlag = -1; /* T_untilClosingFlag */ static int hf_h245_multiplexTableEntryNumbers = -1; /* SET_SIZE_1_15_OF_MultiplexTableEntryNumber */ static int hf_h245_multiplexTableEntryNumber_item = -1; /* MultiplexTableEntryNumber */ static int hf_h245_rejectionDescriptions1 = -1; /* SET_SIZE_1_15_OF_MultiplexEntryRejectionDescriptions */ @@ -1182,6 +1236,15 @@ static int hf_h245_rfc2733Mode = -1; /* T_rfc2733Mode */ static int hf_h245_fec_mode = -1; /* FEC_mode */ static int hf_h245_adaptationLayer = -1; /* AdaptationLayerType */ +static int hf_h245_al1Framed = -1; /* NULL */ +static int hf_h245_al1NotFramed = -1; /* NULL */ +static int hf_h245_al2WithoutSequenceNumbers = -1; /* NULL */ +static int hf_h245_al2WithSequenceNumbers = -1; /* NULL */ +static int hf_h245_al3 = -1; /* Al3 */ +static int hf_h245_al1M = -1; /* H223AL1MParameters */ +static int hf_h245_al2M = -1; /* H223AL2MParameters */ +static int hf_h245_al3M = -1; /* H223AL3MParameters */ +static int hf_h245_segmentableFlag = -1; /* BOOLEAN */ static int hf_h245_redundancyEncodingMode = -1; /* RedundancyEncodingMode */ static int hf_h245_secondaryEncoding = -1; /* T_secondaryEncoding */ static int hf_h245_h261VideoMode = -1; /* H261VideoMode */ @@ -1834,10 +1897,10 @@ static gint ett_h245_MultiplexEntrySend = -1; static gint ett_h245_SET_SIZE_1_15_OF_MultiplexEntryDescriptor = -1; static gint ett_h245_MultiplexEntryDescriptor = -1; -static gint ett_h245_SEQUENCE_SIZE_1_256_OF_MultiplexElement = -1; +static gint ett_h245_T_elementList = -1; static gint ett_h245_MultiplexElement = -1; static gint ett_h245_Me_type = -1; -static gint ett_h245_SEQUENCE_SIZE_2_255_OF_MultiplexElement = -1; +static gint ett_h245_T_subElementList = -1; static gint ett_h245_ME_repeatCount = -1; static gint ett_h245_MultiplexEntrySendAck = -1; static gint ett_h245_SET_SIZE_1_15_OF_MultiplexTableEntryNumber = -1; @@ -3154,9 +3217,6 @@ static int dissect_audioHeaderPresent(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_audioHeaderPresent); } -static int dissect_segmentableFlag(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_segmentableFlag); -} static int dissect_alsduSplitting(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_alsduSplitting); } @@ -3175,6 +3235,9 @@ static int dissect_flowControlToZero(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_flowControlToZero); } +static int dissect_segmentableFlag(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_segmentableFlag); +} static int dissect_multiplexCapabilityBool(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_BOOLEAN(tvb, offset, pinfo, tree, hf_h245_multiplexCapabilityBool); } @@ -3279,9 +3342,6 @@ static int dissect_multicast_IPv6_tsapIdentifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_INTEGER_0_65535(tvb, offset, pinfo, tree, hf_h245_multicast_IPv6_tsapIdentifier); } -static int dissect_logicalChannelNum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_INTEGER_0_65535(tvb, offset, pinfo, tree, hf_h245_logicalChannelNum); -} static int dissect_requestedInterval(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_INTEGER_0_65535(tvb, offset, pinfo, tree, hf_h245_requestedInterval); } @@ -3325,9 +3385,6 @@ static int dissect_higherBitRate(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_INTEGER_1_65535(tvb, offset, pinfo, tree, hf_h245_higherBitRate); } -static int dissect_finite_1_65535(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_INTEGER_1_65535(tvb, offset, pinfo, tree, hf_h245_finite_1_65535); -} static int dissect_maxNumberOfAdditionalConnections(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_INTEGER_1_65535(tvb, offset, pinfo, tree, hf_h245_maxNumberOfAdditionalConnections); } @@ -3779,18 +3836,6 @@ static int dissect_nullData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_nullData); } -static int dissect_al1Framed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al1Framed); -} -static int dissect_al1NotFramed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al1NotFramed); -} -static int dissect_al2WithoutSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al2WithoutSequenceNumbers); -} -static int dissect_al2WithSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al2WithSequenceNumbers); -} static int dissect_framed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_framed); } @@ -3926,9 +3971,6 @@ static int dissect_normal(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_normal); } -static int dissect_untilClosingFlag(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_untilClosingFlag); -} static int dissect_unspecifiedCause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_unspecifiedCause); } @@ -3950,6 +3992,18 @@ static int dissect_requestDenied(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_requestDenied); } +static int dissect_al1Framed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al1Framed); +} +static int dissect_al1NotFramed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al1NotFramed); +} +static int dissect_al2WithoutSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al2WithoutSequenceNumbers); +} +static int dissect_al2WithSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_al2WithSequenceNumbers); +} static int dissect_qcif(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_NULL(tvb, offset, pinfo, tree, hf_h245_qcif); } @@ -5222,6 +5276,8 @@ dissect_h245_T_standard(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { offset = dissect_per_object_identifier_str(tvb, offset, pinfo, tree, hf_index, &standard_oid_str); + if(!h245_lc_dissector && strcmp(standard_oid_str,"0.0.8.245.1.1.1") == 0) + h245_lc_dissector = amr_handle; return offset; } static int dissect_standardOid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { @@ -7358,6 +7414,7 @@ offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_H263VideoCapability, H263VideoCapability_sequence); + h245_lc_dissector = h263_handle; return offset; } static int dissect_h263VideoCapability(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { @@ -8500,14 +8557,14 @@ static int dissect_h245_LogicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, - 1U, 65535U, NULL, NULL, FALSE); + 1U, 65535U, &value, NULL, FALSE); + + h245_lc_temp = value & 0xfff; return offset; } -static int dissect_forwardLogicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_forwardLogicalChannelNumber); -} static int dissect_forwardLogicalChannelDependency(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_forwardLogicalChannelDependency); } @@ -8520,6 +8577,9 @@ static int dissect_reverseLogicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_reverseLogicalChannelNumber); } +static int dissect_forwardLogicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_forwardLogicalChannelNumber); +} static int dissect_logicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { return dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_logicalChannelNumber); } @@ -8543,6 +8603,19 @@ } + +static int +dissect_h245_OLC_fw_lcn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + offset = dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_index); + + h223_fw_lc_num = h245_lc_temp; + return offset; +} +static int dissect_olc_fw_lcn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_OLC_fw_lcn(tvb, offset, pinfo, tree, hf_h245_olc_fw_lcn); +} + + static const value_string h245_EncryptionMode_vals[] = { { 0, "nonStandard" }, { 1, "h233Encryption" }, @@ -8976,20 +9049,97 @@ static int -dissect_h245_INTEGER_0_2(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { +dissect_h245_T_al1Framed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1Framed; + offset = dissect_per_null(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al1Framed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al1Framed(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al1Framed); +} + + + +static int +dissect_h245_T_al1NotFramed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1NotFramed; + offset = dissect_per_null(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al1NotFramed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al1NotFramed(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al1NotFramed); +} + + + +static int +dissect_h245_T_al2WithoutSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2WithoutSequenceNumbers; + offset = dissect_per_null(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al2WithoutSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al2WithoutSequenceNumbers(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al2WithoutSequenceNumbers); +} + + + +static int +dissect_h245_T_al2WithSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2WithSequenceNumbers; + offset = dissect_per_null(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al2WithSequenceNumbers(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al2WithSequenceNumbers(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al2WithSequenceNumbers); +} + + + +static int +dissect_h245_T_controlFieldOctets(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, - 0U, 2U, NULL, NULL, FALSE); + 0U, 2U, &value, NULL, FALSE); + + 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 ; return offset; } static int dissect_controlFieldOctets(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_INTEGER_0_2(tvb, offset, pinfo, tree, hf_h245_controlFieldOctets); + return dissect_h245_T_controlFieldOctets(tvb, offset, pinfo, tree, hf_h245_controlFieldOctets); +} + + + +static int +dissect_h245_T_sendBufferSize(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; + offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, + 0U, 16777215U, &value, NULL, FALSE); + + 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; + + return offset; +} +static int dissect_al3_sendBufferSize(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_sendBufferSize(tvb, offset, pinfo, tree, hf_h245_al3_sendBufferSize); } static const per_sequence_t Al3_sequence[] = { { "controlFieldOctets" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_controlFieldOctets }, - { "sendBufferSize" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_sendBufferSize }, + { "sendBufferSize" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_al3_sendBufferSize }, { NULL, 0, 0, NULL } }; @@ -9005,6 +9155,22 @@ } + +static int +dissect_h245_T_al3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) { + h223_lc_params_temp->al_type = al3; + h223_lc_params_temp->al_params = se_alloc(sizeof(h223_al3_params)); + } + offset = dissect_h245_Al3(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al3(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al3); +} + + static const value_string h245_T_transferMode_vals[] = { { 0, "framed" }, { 1, "unframed" }, @@ -9215,6 +9381,20 @@ } + +static int +dissect_h245_T_al1M(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al1M; + offset = dissect_h245_H223AL1MParameters(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al1M(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al1M(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al1M); +} + + static const value_string h245_AL2HeaderFEC_vals[] = { { 0, "sebch16-5" }, { 1, "golay24-12" }, @@ -9258,6 +9438,20 @@ } + +static int +dissect_h245_T_al2M(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al2M; + offset = dissect_h245_H223AL2MParameters(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al2M(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al2M(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al2M); +} + + static const value_string h245_T_headerFormat_vals[] = { { 0, "sebch16-7" }, { 1, "golay24-12" }, @@ -9342,6 +9536,20 @@ } + +static int +dissect_h245_T_al3M(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + if(h223_lc_params_temp) + h223_lc_params_temp->al_type = al3M; + offset = dissect_h245_H223AL3MParameters(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_h223_al_type_al3M(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_al3M(tvb, offset, pinfo, tree, hf_h245_h223_al_type_al3M); +} + + static const value_string h245_T_adaptationLayerType_vals[] = { { 0, "nonStandard" }, { 1, "al1Framed" }, @@ -9357,14 +9565,14 @@ static const per_choice_t T_adaptationLayerType_choice[] = { { 0, "nonStandard" , ASN1_EXTENSION_ROOT , dissect_nonStandard }, - { 1, "al1Framed" , ASN1_EXTENSION_ROOT , dissect_al1Framed }, - { 2, "al1NotFramed" , ASN1_EXTENSION_ROOT , dissect_al1NotFramed }, - { 3, "al2WithoutSequenceNumbers" , ASN1_EXTENSION_ROOT , dissect_al2WithoutSequenceNumbers }, - { 4, "al2WithSequenceNumbers" , ASN1_EXTENSION_ROOT , dissect_al2WithSequenceNumbers }, - { 5, "al3" , ASN1_EXTENSION_ROOT , dissect_al3 }, - { 6, "al1M" , ASN1_NOT_EXTENSION_ROOT, dissect_al1M }, - { 7, "al2M" , ASN1_NOT_EXTENSION_ROOT, dissect_al2M }, - { 8, "al3M" , ASN1_NOT_EXTENSION_ROOT, dissect_al3M }, + { 1, "al1Framed" , ASN1_EXTENSION_ROOT , dissect_h223_al_type_al1Framed }, + { 2, "al1NotFramed" , ASN1_EXTENSION_ROOT , dissect_h223_al_type_al1NotFramed }, + { 3, "al2WithoutSequenceNumbers" , ASN1_EXTENSION_ROOT , dissect_h223_al_type_al2WithoutSequenceNumbers }, + { 4, "al2WithSequenceNumbers" , ASN1_EXTENSION_ROOT , dissect_h223_al_type_al2WithSequenceNumbers }, + { 5, "al3" , ASN1_EXTENSION_ROOT , dissect_h223_al_type_al3 }, + { 6, "al1M" , ASN1_NOT_EXTENSION_ROOT, dissect_h223_al_type_al1M }, + { 7, "al2M" , ASN1_NOT_EXTENSION_ROOT, dissect_h223_al_type_al2M }, + { 8, "al3M" , ASN1_NOT_EXTENSION_ROOT, dissect_h223_al_type_al3M }, { 0, NULL, 0, NULL } }; @@ -9381,9 +9589,26 @@ } + +static int +dissect_h245_T_segmentableFlag(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; + offset = dissect_per_boolean(tvb, offset, pinfo, tree, hf_index, + &value, NULL); + + if(h223_lc_params_temp) + h223_lc_params_temp->segmentable = value & 1; + + return offset; +} +static int dissect_h223_lc_segmentableFlag(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_segmentableFlag(tvb, offset, pinfo, tree, hf_h245_h223_lc_segmentableFlag); +} + + static const per_sequence_t H223LogicalChannelParameters_sequence[] = { { "adaptationLayerType" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_adaptationLayerType }, - { "segmentableFlag" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_segmentableFlag }, + { "segmentableFlag" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_h223_lc_segmentableFlag }, { NULL, 0, 0, NULL } }; @@ -9394,8 +9619,23 @@ return offset; } -static int dissect_h223LogicalChannelParameters(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_H223LogicalChannelParameters(tvb, offset, pinfo, tree, hf_h245_h223LogicalChannelParameters); + + + +static int +dissect_h245_OLC_fw_h223_params(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + 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; + offset = dissect_h245_H223LogicalChannelParameters(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_olc_fw_h223_params(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_OLC_fw_h223_params(tvb, offset, pinfo, tree, hf_h245_olc_fw_h223_params); } @@ -10102,7 +10342,7 @@ static const per_choice_t OLC_forw_multiplexParameters_choice[] = { { 0, "h222LogicalChannelParameters", ASN1_EXTENSION_ROOT , dissect_h222LogicalChannelParameters }, - { 1, "h223LogicalChannelParameters", ASN1_EXTENSION_ROOT , dissect_h223LogicalChannelParameters }, + { 1, "h223LogicalChannelParameters", ASN1_EXTENSION_ROOT , dissect_olc_fw_h223_params }, { 2, "v76LogicalChannelParameters" , ASN1_EXTENSION_ROOT , dissect_v76LogicalChannelParameters }, { 3, "h2250LogicalChannelParameters", ASN1_NOT_EXTENSION_ROOT, dissect_h2250LogicalChannelParameters }, { 4, "none" , ASN1_NOT_EXTENSION_ROOT, dissect_none }, @@ -10133,9 +10373,15 @@ static int dissect_h245_T_forwardLogicalChannelParameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + h245_lc_dissector = NULL; offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_T_forwardLogicalChannelParameters, T_forwardLogicalChannelParameters_sequence); + 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; + return offset; } static int dissect_forwardLogicalChannelParameters(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { @@ -10143,6 +10389,24 @@ } + +static int +dissect_h245_OLC_rev_h223_params(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + 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; + offset = dissect_h245_H223LogicalChannelParameters(tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_olc_rev_h223_params(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_OLC_rev_h223_params(tvb, offset, pinfo, tree, hf_h245_olc_rev_h223_params); +} + + static const value_string h245_OLC_rev_multiplexParameters_vals[] = { { 0, "h223LogicalChannelParameters" }, { 1, "v76LogicalChannelParameters" }, @@ -10151,7 +10415,7 @@ }; static const per_choice_t OLC_rev_multiplexParameters_choice[] = { - { 0, "h223LogicalChannelParameters", ASN1_EXTENSION_ROOT , dissect_h223LogicalChannelParameters }, + { 0, "h223LogicalChannelParameters", ASN1_EXTENSION_ROOT , dissect_olc_rev_h223_params }, { 1, "v76LogicalChannelParameters" , ASN1_EXTENSION_ROOT , dissect_v76LogicalChannelParameters }, { 2, "h2250LogicalChannelParameters", ASN1_NOT_EXTENSION_ROOT, dissect_h2250LogicalChannelParameters }, { 0, NULL, 0, NULL } @@ -10432,7 +10696,7 @@ static const per_sequence_t OpenLogicalChannel_sequence[] = { - { "forwardLogicalChannelNumber" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_forwardLogicalChannelNumber }, + { "forwardLogicalChannelNumber" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_olc_fw_lcn }, { "forwardLogicalChannelParameters", ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_forwardLogicalChannelParameters }, { "reverseLogicalChannelParameters", ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_reverseLogicalChannelParameters }, { "separateStack" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_separateStack }, @@ -10442,9 +10706,19 @@ int dissect_h245_OpenLogicalChannel(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + h223_fw_lc_num = 0; + h223_lc_params_temp = NULL; offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_OpenLogicalChannel, OpenLogicalChannel_sequence); + 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; + gint32 temp = h223_fw_lc_num; + g_hash_table_insert(h223_pending_olc_reqs[pinfo->p2p_dir], GINT_TO_POINTER(temp), pending); + } + if (h245_pi != NULL) h245_pi->msg_type = H245_OpenLogChn; return offset; @@ -10578,8 +10852,11 @@ static int dissect_h245_MultiplexTableEntryNumber(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, - 1U, 15U, NULL, NULL, FALSE); + 1U, 15U, &value, NULL, FALSE); + + h223_mc = value & 0xf; return offset; } @@ -10594,20 +10871,44 @@ } -static const per_sequence_t SEQUENCE_SIZE_2_255_OF_MultiplexElement_sequence_of[1] = { + +static int +dissect_h245_T_logicalChannelNumber(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + /*MultiplexElement/type/logicalChannelNumber*/ + guint32 value; + offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, + 0U, 65535U, &value, NULL, FALSE); + + h223_me->sublist = NULL; + h223_me->vc = value & 0xffff; + + return offset; +} +static int dissect_logicalChannelNum(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_logicalChannelNumber(tvb, offset, pinfo, tree, hf_h245_logicalChannelNum); +} + + +static const per_sequence_t T_subElementList_sequence_of[1] = { { "" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_subElementList_item }, }; static int -dissect_h245_SEQUENCE_SIZE_2_255_OF_MultiplexElement(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { +dissect_h245_T_subElementList(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + h223_mux_element dummy_me, *parent_me = h223_me; + h223_me = &dummy_me; offset = dissect_per_constrained_sequence_of(tvb, offset, pinfo, tree, hf_index, - ett_h245_SEQUENCE_SIZE_2_255_OF_MultiplexElement, SEQUENCE_SIZE_2_255_OF_MultiplexElement_sequence_of, + ett_h245_T_subElementList, T_subElementList_sequence_of, 2, 255); + parent_me->sublist = dummy_me.next; + h223_me = parent_me; + h223_me->vc = 0; + return offset; } static int dissect_subElementList(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_SEQUENCE_SIZE_2_255_OF_MultiplexElement(tvb, offset, pinfo, tree, hf_h245_subElementList); + return dissect_h245_T_subElementList(tvb, offset, pinfo, tree, hf_h245_subElementList); } @@ -10636,6 +10937,35 @@ } + +static int +dissect_h245_ME_finiteRepeatCount(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + guint32 value; + offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, + 1U, 65535U, &value, NULL, FALSE); + + h223_me->repeat_count = value & 0xffff; + + return offset; +} +static int dissect_me_repeatCount_finite(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_ME_finiteRepeatCount(tvb, offset, pinfo, tree, hf_h245_me_repeatCount_finite); +} + + + +static int +dissect_h245_T_untilClosingFlag(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + offset = dissect_per_null(tvb, offset, pinfo, tree, hf_index); + + h223_me->repeat_count = 0; + return offset; +} +static int dissect_untilClosingFlag(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_T_untilClosingFlag(tvb, offset, pinfo, tree, hf_h245_untilClosingFlag); +} + + static const value_string h245_ME_repeatCount_vals[] = { { 0, "finite" }, { 1, "untilClosingFlag" }, @@ -10643,7 +10973,7 @@ }; static const per_choice_t ME_repeatCount_choice[] = { - { 0, "finite" , ASN1_NO_EXTENSIONS , dissect_finite_1_65535 }, + { 0, "finite" , ASN1_NO_EXTENSIONS , dissect_me_repeatCount_finite }, { 1, "untilClosingFlag" , ASN1_NO_EXTENSIONS , dissect_untilClosingFlag }, { 0, NULL, 0, NULL } }; @@ -10669,6 +10999,11 @@ static int dissect_h245_MultiplexElement(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + /*MultiplexElement*/ + h223_mux_element* me = se_alloc(sizeof(h223_mux_element)); + h223_me->next = me; + h223_me = me; + h223_me->next = NULL; offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_MultiplexElement, MultiplexElement_sequence); @@ -10676,20 +11011,27 @@ } -static const per_sequence_t SEQUENCE_SIZE_1_256_OF_MultiplexElement_sequence_of[1] = { +static const per_sequence_t T_elementList_sequence_of[1] = { { "" , ASN1_NO_EXTENSIONS , ASN1_NOT_OPTIONAL, dissect_elementList_item }, }; static int -dissect_h245_SEQUENCE_SIZE_1_256_OF_MultiplexElement(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { +dissect_h245_T_elementList(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + /* 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; offset = dissect_per_constrained_sequence_of(tvb, offset, pinfo, tree, hf_index, - ett_h245_SEQUENCE_SIZE_1_256_OF_MultiplexElement, SEQUENCE_SIZE_1_256_OF_MultiplexElement_sequence_of, + ett_h245_T_elementList, T_elementList_sequence_of, 1, 256); + /* set h223_me to the head of the list for MEDescriptor to pick up */ + h223_me = dummy_me.next; + return offset; } static int dissect_elementList(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - return dissect_h245_SEQUENCE_SIZE_1_256_OF_MultiplexElement(tvb, offset, pinfo, tree, hf_h245_elementList); + return dissect_h245_T_elementList(tvb, offset, pinfo, tree, hf_h245_elementList); } @@ -10701,9 +11043,16 @@ static int dissect_h245_MultiplexEntryDescriptor(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + /*MultiplexEntryDescriptor*/ + h223_me = NULL; + h223_mc = 0; offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_MultiplexEntryDescriptor, MultiplexEntryDescriptor_sequence); + if(h223_set_mc_handle) + (*h223_set_mc_handle)(pinfo, h223_mc, h223_me); + /* stuff */ + return offset; } static int dissect_multiplexEntryDescriptors_item(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { @@ -12825,6 +13174,19 @@ } + +static int +dissect_h245_OLC_ack_fw_lcn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + offset = dissect_h245_LogicalChannelNumber(tvb, offset, pinfo, tree, hf_index); + + h223_fw_lc_num = h245_lc_temp; + return offset; +} +static int dissect_olc_ack_fw_lcn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { + return dissect_h245_OLC_ack_fw_lcn(tvb, offset, pinfo, tree, hf_h245_olc_ack_fw_lcn); +} + + static const value_string h245_T_multiplexParameters_vals[] = { { 0, "h222LogicalChannelParameters" }, { 1, "h2250LogicalChannelParameters" }, @@ -12978,7 +13340,7 @@ static const per_sequence_t OpenLogicalChannelAck_sequence[] = { - { "forwardLogicalChannelNumber" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_forwardLogicalChannelNumber }, + { "forwardLogicalChannelNumber" , ASN1_EXTENSION_ROOT , ASN1_NOT_OPTIONAL, dissect_olc_ack_fw_lcn }, { "reverseLogicalChannelParameters", ASN1_EXTENSION_ROOT , ASN1_OPTIONAL , dissect_olc_ack_reverseLogicalChannelParameters }, { "separateStack" , ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_separateStack }, { "forwardMultiplexAckParameters", ASN1_NOT_EXTENSION_ROOT, ASN1_OPTIONAL , dissect_forwardMultiplexAckParameters }, @@ -12988,9 +13350,32 @@ static int dissect_h245_OpenLogicalChannelAck(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { + h223_fw_lc_num = 0; + h223_rev_lc_num = 0; offset = dissect_per_sequence(tvb, offset, pinfo, tree, hf_index, ett_h245_OpenLogicalChannelAck, OpenLogicalChannelAck_sequence); + guint32 temp = h223_fw_lc_num; + int p2p_dir = pinfo->p2p_dir; + h223_pending_olc *pend; + 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; + h245_pi->msg_type = H245_OpenLogChnAck; return offset; @@ -19652,10 +20037,10 @@ { "samePort", "h245.samePort", FT_BOOLEAN, 8, NULL, 0, "FECCapability/rfc2733/separateStream/samePort", HFILL }}, - { &hf_h245_forwardLogicalChannelNumber, + { &hf_h245_olc_fw_lcn, { "forwardLogicalChannelNumber", "h245.forwardLogicalChannelNumber", FT_UINT32, BASE_DEC, NULL, 0, - "", HFILL }}, + "OpenLogicalChannel/forwardLogicalChannelNumber", HFILL }}, { &hf_h245_forwardLogicalChannelParameters, { "forwardLogicalChannelParameters", "h245.forwardLogicalChannelParameters", FT_NONE, BASE_NONE, NULL, 0, @@ -19676,10 +20061,10 @@ { "h222LogicalChannelParameters", "h245.h222LogicalChannelParameters", FT_NONE, BASE_NONE, NULL, 0, "", HFILL }}, - { &hf_h245_h223LogicalChannelParameters, + { &hf_h245_olc_fw_h223_params, { "h223LogicalChannelParameters", "h245.h223LogicalChannelParameters", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, + "OpenLogicalChannel/forwardLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters", HFILL }}, { &hf_h245_v76LogicalChannelParameters, { "v76LogicalChannelParameters", "h245.v76LogicalChannelParameters", FT_NONE, BASE_NONE, NULL, 0, @@ -19704,6 +20089,10 @@ { "multiplexParameters", "h245.multiplexParameters", FT_UINT32, BASE_DEC, VALS(h245_OLC_rev_multiplexParameters_vals), 0, "OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters", HFILL }}, + { &hf_h245_olc_rev_h223_params, + { "h223LogicalChannelParameters", "h245.h223LogicalChannelParameters", + FT_NONE, BASE_NONE, NULL, 0, + "OpenLogicalChannel/reverseLogicalChannelParameters/multiplexParameters/h223LogicalChannelParameters", HFILL }}, { &hf_h245_reverseLogicalChannelDependency, { "reverseLogicalChannelDependency", "h245.reverseLogicalChannelDependency", FT_UINT32, BASE_DEC, NULL, 0, @@ -19860,50 +20249,50 @@ { "adaptationLayerType", "h245.adaptationLayerType", FT_UINT32, BASE_DEC, VALS(h245_T_adaptationLayerType_vals), 0, "H223LogicalChannelParameters/adaptationLayerType", HFILL }}, - { &hf_h245_al1Framed, + { &hf_h245_h223_al_type_al1Framed, { "al1Framed", "h245.al1Framed", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al1NotFramed, + "H223LogicalChannelParameters/adaptationLayerType/al1Framed", HFILL }}, + { &hf_h245_h223_al_type_al1NotFramed, { "al1NotFramed", "h245.al1NotFramed", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al2WithoutSequenceNumbers, + "H223LogicalChannelParameters/adaptationLayerType/al1NotFramed", HFILL }}, + { &hf_h245_h223_al_type_al2WithoutSequenceNumbers, { "al2WithoutSequenceNumbers", "h245.al2WithoutSequenceNumbers", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al2WithSequenceNumbers, + "H223LogicalChannelParameters/adaptationLayerType/al2WithoutSequenceNumbers", HFILL }}, + { &hf_h245_h223_al_type_al2WithSequenceNumbers, { "al2WithSequenceNumbers", "h245.al2WithSequenceNumbers", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al3, + "H223LogicalChannelParameters/adaptationLayerType/al2WithSequenceNumbers", HFILL }}, + { &hf_h245_h223_al_type_al3, { "al3", "h245.al3", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al1M, + "H223LogicalChannelParameters/adaptationLayerType/al3", HFILL }}, + { &hf_h245_h223_al_type_al1M, { "al1M", "h245.al1M", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al2M, + "H223LogicalChannelParameters/adaptationLayerType/al1M", HFILL }}, + { &hf_h245_h223_al_type_al2M, { "al2M", "h245.al2M", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_al3M, + "H223LogicalChannelParameters/adaptationLayerType/al2M", HFILL }}, + { &hf_h245_h223_al_type_al3M, { "al3M", "h245.al3M", FT_NONE, BASE_NONE, NULL, 0, - "", HFILL }}, - { &hf_h245_segmentableFlag, + "H223LogicalChannelParameters/adaptationLayerType/al3M", HFILL }}, + { &hf_h245_h223_lc_segmentableFlag, { "segmentableFlag", "h245.segmentableFlag", FT_BOOLEAN, 8, NULL, 0, - "", HFILL }}, + "H223LogicalChannelParameters/segmentableFlag", HFILL }}, { &hf_h245_controlFieldOctets, { "controlFieldOctets", "h245.controlFieldOctets", FT_UINT32, BASE_DEC, NULL, 0, "Al3/controlFieldOctets", HFILL }}, - { &hf_h245_sendBufferSize, + { &hf_h245_al3_sendBufferSize, { "sendBufferSize", "h245.sendBufferSize", FT_UINT32, BASE_DEC, NULL, 0, - "", HFILL }}, + "Al3/sendBufferSize", HFILL }}, { &hf_h245_transferMode, { "transferMode", "h245.transferMode", FT_UINT32, BASE_DEC, VALS(h245_T_transferMode_vals), 0, @@ -20020,6 +20409,10 @@ { "infinite", "h245.infinite", FT_NONE, BASE_NONE, NULL, 0, "H223AnnexCArqParameters/numberOfRetransmissions/infinite", HFILL }}, + { &hf_h245_sendBufferSize, + { "sendBufferSize", "h245.sendBufferSize", + FT_UINT32, BASE_DEC, NULL, 0, + "H223AnnexCArqParameters/sendBufferSize", HFILL }}, { &hf_h245_hdlcParameters, { "hdlcParameters", "h245.hdlcParameters", FT_NONE, BASE_NONE, NULL, 0, @@ -20352,6 +20745,10 @@ { "escrowValue", "h245.escrowValue", FT_BYTES, BASE_HEX, NULL, 0, "EscrowData/escrowValue", HFILL }}, + { &hf_h245_olc_ack_fw_lcn, + { "forwardLogicalChannelNumber", "h245.forwardLogicalChannelNumber", + FT_UINT32, BASE_DEC, NULL, 0, + "OpenLogicalChannelAck/forwardLogicalChannelNumber", HFILL }}, { &hf_h245_olc_ack_reverseLogicalChannelParameters, { "reverseLogicalChannelParameters", "h245.reverseLogicalChannelParameters", FT_NONE, BASE_NONE, NULL, 0, @@ -20372,6 +20769,10 @@ { "h2250LogicalChannelAckParameters", "h245.h2250LogicalChannelAckParameters", FT_NONE, BASE_NONE, NULL, 0, "OpenLogicalChannelAck/forwardMultiplexAckParameters/h2250LogicalChannelAckParameters", HFILL }}, + { &hf_h245_forwardLogicalChannelNumber, + { "forwardLogicalChannelNumber", "h245.forwardLogicalChannelNumber", + FT_UINT32, BASE_DEC, NULL, 0, + "", HFILL }}, { &hf_h245_olc_rej_cause, { "cause", "h245.cause", FT_UINT32, BASE_DEC, VALS(h245_OpenLogicalChannelRejectCause_vals), 0, @@ -20528,7 +20929,7 @@ { "repeatCount", "h245.repeatCount", FT_UINT32, BASE_DEC, VALS(h245_ME_repeatCount_vals), 0, "MultiplexElement/repeatCount", HFILL }}, - { &hf_h245_finite_1_65535, + { &hf_h245_me_repeatCount_finite, { "finite", "h245.finite", FT_UINT32, BASE_DEC, NULL, 0, "MultiplexElement/repeatCount/finite", HFILL }}, @@ -20728,6 +21129,42 @@ { "adaptationLayerType", "h245.adaptationLayerType", FT_UINT32, BASE_DEC, VALS(h245_AdaptationLayerType_vals), 0, "H223ModeParameters/adaptationLayerType", HFILL }}, + { &hf_h245_al1Framed, + { "al1Framed", "h245.al1Framed", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al1Framed", HFILL }}, + { &hf_h245_al1NotFramed, + { "al1NotFramed", "h245.al1NotFramed", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al1NotFramed", HFILL }}, + { &hf_h245_al2WithoutSequenceNumbers, + { "al2WithoutSequenceNumbers", "h245.al2WithoutSequenceNumbers", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al2WithoutSequenceNumbers", HFILL }}, + { &hf_h245_al2WithSequenceNumbers, + { "al2WithSequenceNumbers", "h245.al2WithSequenceNumbers", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al2WithSequenceNumbers", HFILL }}, + { &hf_h245_al3, + { "al3", "h245.al3", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al3", HFILL }}, + { &hf_h245_al1M, + { "al1M", "h245.al1M", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al1M", HFILL }}, + { &hf_h245_al2M, + { "al2M", "h245.al2M", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al2M", HFILL }}, + { &hf_h245_al3M, + { "al3M", "h245.al3M", + FT_NONE, BASE_NONE, NULL, 0, + "H223ModeParameters/adaptationLayerType/al3M", HFILL }}, + { &hf_h245_segmentableFlag, + { "segmentableFlag", "h245.segmentableFlag", + FT_BOOLEAN, 8, NULL, 0, + "H223ModeParameters/segmentableFlag", HFILL }}, { &hf_h245_redundancyEncodingMode, { "redundancyEncodingMode", "h245.redundancyEncodingMode", FT_NONE, BASE_NONE, NULL, 0, @@ -22544,10 +22981,10 @@ &ett_h245_MultiplexEntrySend, &ett_h245_SET_SIZE_1_15_OF_MultiplexEntryDescriptor, &ett_h245_MultiplexEntryDescriptor, - &ett_h245_SEQUENCE_SIZE_1_256_OF_MultiplexElement, + &ett_h245_T_elementList, &ett_h245_MultiplexElement, &ett_h245_Me_type, - &ett_h245_SEQUENCE_SIZE_2_255_OF_MultiplexElement, + &ett_h245_T_subElementList, &ett_h245_ME_repeatCount, &ett_h245_MultiplexEntrySendAck, &ett_h245_SET_SIZE_1_15_OF_MultiplexTableEntryNumber, @@ -22816,12 +23253,16 @@ 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) Index: epan/dissectors/packet-h245.h =================================================================== RCS file: /cvs/ethereal/epan/dissectors/packet-h245.h,v retrieving revision 1.1.1.3 retrieving revision 1.9 diff -u -u -r1.1.1.3 -r1.9 --- epan/dissectors/packet-h245.h 29 Sep 2005 13:18:54 -0000 1.1.1.3 +++ epan/dissectors/packet-h245.h 3 Oct 2005 15:37:45 -0000 1.9 @@ -56,6 +56,75 @@ 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 ); /*--- Included file: packet-h245-exp.h ---*/ Index: asn1/h245/h245.cnf =================================================================== RCS file: /cvs/ethereal/asn1/h245/h245.cnf,v retrieving revision 1.1.1.3 retrieving revision 1.7 diff -u -u -r1.1.1.3 -r1.7 --- asn1/h245/h245.cnf 29 Sep 2005 13:18:51 -0000 1.1.1.3 +++ asn1/h245/h245.cnf 3 Oct 2005 15:23:52 -0000 1.7 @@ -12,6 +12,234 @@ 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 + 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; + gint32 temp = h223_fw_lc_num; + 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 + h223_fw_lc_num = 0; + h223_rev_lc_num = 0; +%(DEFAULT_BODY)s + guint32 temp = h223_fw_lc_num; + int p2p_dir = pinfo->p2p_dir; + h223_pending_olc *pend; + 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 +459,13 @@ 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 +473,9 @@ #---------------------------------------------------------------------------------------- #.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 +734,13 @@ 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 +755,7 @@ 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 +923,7 @@ 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 +983,10 @@ 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 +1014,20 @@ 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 +1042,6 @@ #---------------------------------------------------------------------------------------- #.FIELD_ATTR AlternativeCapabilitySet/_item NAME = "alternativeCapability" + #---------------------------------------------------------------------------------------- +# vim:set ts=4 sts=2 sw=2: Index: asn1/h245/packet-h245-template.c =================================================================== RCS file: /cvs/ethereal/asn1/h245/packet-h245-template.c,v retrieving revision 1.1.1.3 retrieving revision 1.9 diff -u -u -r1.1.1.3 -r1.9 --- asn1/h245/packet-h245-template.c 29 Sep 2005 13:18:51 -0000 1.1.1.3 +++ asn1/h245/packet-h245-template.c 30 Sep 2005 11:04:10 -0000 1.9 @@ -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 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 @@ { 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 @@ 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) Index: asn1/h245/packet-h245-template.h =================================================================== RCS file: /cvs/ethereal/asn1/h245/packet-h245-template.h,v retrieving revision 1.1.1.2 retrieving revision 1.5 diff -u -u -r1.1.1.2 -r1.5 --- asn1/h245/packet-h245-template.h 29 Sep 2005 13:18:51 -0000 1.1.1.2 +++ asn1/h245/packet-h245-template.h 29 Sep 2005 15:51:24 -0000 1.5 @@ -49,8 +49,77 @@ gchar comment[50]; /* the Frame Comment used by graph_analysis, what is a message desc */ } h245_packet_info; +/* + * h223 LC info + */ -#include "packet-h245-exp.h"*/ +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" void dissect_h245_OpenLogicalChannelCodec(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, char *codec_str);
- Follow-Ups:
- SV: SV: [Ethereal-dev] New dissectors: H.223 and friends
- From: Anders Broman
- SV: SV: [Ethereal-dev] New dissectors: H.223 and friends
- References:
- SV: [Ethereal-dev] New dissectors: H.223 and friends
- From: Anders Broman
- SV: [Ethereal-dev] New dissectors: H.223 and friends
- Prev by Date: Re: [Ethereal-dev] Bug fix in packet-iax2.c
- Next by Date: Re: [Ethereal-dev] Optimization: remove the unconditional ip_checksum() in packet-ip?
- Previous by thread: SV: [Ethereal-dev] New dissectors: H.223 and friends
- Next by thread: SV: SV: [Ethereal-dev] New dissectors: H.223 and friends
- Index(es):