Ethereal-dev: [Ethereal-dev] [Patch] H.225 Non-Standard-Parameter

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Martin Regner" <martin.regner@xxxxxxxxx>
Date: Fri, 5 Sep 2003 18:00:59 +0200
I have enclosed a patch that I think solves the problem Andreas Sikkema noticed with some IRR messages.
I have tested the patch with the capture he sent and several other captures.

There are some differences between the definitions of NonStandardIdentifier and H221NonStandard in H.225
compared to H.245.

http://www.ethereal.com/lists/ethereal-dev/200308/msg00551.html

http://www.ethereal.com/lists/ethereal-dev/200308/msg00556.html

--- packet-h245.c.martin	2003-09-05 07:57:30.000000000 +0200
+++ packet-h245.c	2003-09-05 08:08:04.000000000 +0200
@@ -7924,7 +7924,7 @@
 }
 
 
-
+/* dissect_h245_h221NonStandard is used for H.245 */
 
 static per_sequence_t h221NonStandard_sequence[] = {
 	{ "t35CountryCode", NO_EXTENSIONS, NOT_OPTIONAL,
@@ -7951,6 +7951,33 @@
 	return offset;
 }
 
+/* dissect_h245_h221NonStandard_with_extension is used for H.225 */
+
+static per_sequence_t h221NonStandard_sequence_with_extension[] = {
+	{ "t35CountryCode", EXTENSION_ROOT, NOT_OPTIONAL,
+		dissect_h245_t35CountryCode },
+	{ "t35Extension", EXTENSION_ROOT, NOT_OPTIONAL, 
+		dissect_h245_t35Extension },
+	{ "manufacturerCode", EXTENSION_ROOT, NOT_OPTIONAL,
+		dissect_h245_manufacturerCode },
+	{ NULL, 0, 0, NULL }
+};
+int
+dissect_h245_h221NonStandard_with_extension(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+{
+	t35CountryCode = 0;
+	t35Extension = 0;
+	manufacturerCode = 0;
+
+	offset=dissect_per_sequence(tvb, offset, pinfo, tree, hf_h245_h221NonStandard, ett_h245_h221NonStandard, h221NonStandard_sequence_with_extension);
+
+	h221NonStandard = ((t35CountryCode * 256) + t35Extension) * 65536 + manufacturerCode;
+
+	proto_tree_add_uint(tree, hf_h245_h221Manufacturer, tvb, (offset-3)>>3,4,h221NonStandard);
+
+     	return offset;
+}
+
 
 
 static int
@@ -12800,6 +12827,8 @@
 
 
 
+/* dissect_h245_NonStandardIdentifier is used for H.245 */
+
 static const value_string NonStandardIdentifier_vals[] = {
 	{ 0,	"object" },
 	{ 1,	"h221NonStandard" },
@@ -12837,6 +12866,40 @@
 }
 
 
+/* dissect_h245_NonStandardIdentifier_with_extension is used for H.225 */
+
+static per_choice_t NonStandardIdentifier_with_extension_choice[] = {
+	{ 0,	"object", EXTENSION_ROOT,
+		dissect_h245_object },
+	{ 1,	"h221NonStandard", EXTENSION_ROOT, 
+		dissect_h245_h221NonStandard_with_extension },
+	{ 0, NULL, 0, NULL }
+};
+static int
+dissect_h245_NonStandardIdentifier_with_extension(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+{
+	guint32 value;
+
+	*object = '\0';
+	h221NonStandard = 0;
+
+	offset=dissect_per_choice(tvb, offset, pinfo, tree, hf_h245_NonStandardIdentifier, ett_h245_NonStandardIdentifier, NonStandardIdentifier_with_extension_choice, "NonStandardIdentifier with extension", &value);
+
+	switch (value) {
+		case 0 :  /* object */
+			nsp_handle = dissector_get_port_handle(nsp_object_dissector_table, adler32_str(object));
+			break;
+		case 1 :  /* h221NonStandard */
+			nsp_handle = dissector_get_port_handle(nsp_h221_dissector_table, h221NonStandard);
+			break;
+		default :
+			nsp_handle = NULL;
+    }
+
+	return offset;
+}
+
+
 static int
 dissect_h245_NonStandardParameterData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
 {
@@ -13470,6 +13533,7 @@
 
 
 
+/* dissect_h245_NonStandardParameter is used for H.245 */
 
 static per_sequence_t NonStandardParameter_sequence[] = {
 	{ "nonStandardIdentifier", NO_EXTENSIONS, NOT_OPTIONAL,
@@ -13488,10 +13552,12 @@
 	return offset;
 }
 
+/* dissect_h245_NonStandardParameter_with_extension_marker is used for H.225 */
+
 static per_sequence_t NonStandardParameter_with_extension_sequence[] = {
-	{ "nonStandardIdentifier", EXTENSION_ROOT, NOT_OPTIONAL,
-		dissect_h245_NonStandardIdentifier },
-	{ "data", EXTENSION_ROOT, NOT_OPTIONAL,
+	{ "nonStandardIdentifier", NO_EXTENSIONS, NOT_OPTIONAL,
+		dissect_h245_NonStandardIdentifier_with_extension },
+	{ "data", NO_EXTENSIONS, NOT_OPTIONAL,
 		dissect_h245_NonStandardParameterData },
 	{ NULL, 0, 0, NULL }
 };