aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-10-02 15:45:54 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-10-02 15:45:54 +0000
commit55cc2f5adc7f7fa9b2f235df125f969deb59fac2 (patch)
tree9a51f914af31af68fddc77c2403e6d28b58d0f5d
parent9be273b75b4618b6287172b602694150482b0de3 (diff)
Decode content according to given content type.
svn path=/trunk/; revision=26338
-rw-r--r--asn1/cdt/cdt.cnf27
-rw-r--r--asn1/cdt/packet-cdt-template.c12
-rw-r--r--epan/dissectors/packet-cdt.c66
-rw-r--r--epan/dissectors/packet-cdt.h2
4 files changed, 83 insertions, 24 deletions
diff --git a/asn1/cdt/cdt.cnf b/asn1/cdt/cdt.cnf
index 49afdb2ab9..194c292869 100644
--- a/asn1/cdt/cdt.cnf
+++ b/asn1/cdt/cdt.cnf
@@ -9,6 +9,11 @@ CompressedData
#.REGISTER
CompressedData B "1.3.26.0.4406.0.4.2" "cdt"
+#.FN_BODY CompressedData
+ content_type = 0;
+
+ %(DEFAULT_BODY)s
+
#.FN_PARS AlgorithmID-ShortForm
VAL_PTR = &value
@@ -26,19 +31,18 @@ CompressedData B "1.3.26.0.4406.0.4.2" "cdt"
"unknown"));
#.FN_PARS ContentType-ShortForm
- VAL_PTR = &value
+ VAL_PTR = &content_type
#.FN_BODY ContentType-ShortForm
- guint32 value;
%(DEFAULT_BODY)s
proto_item_append_text (cdt_item, ", %%s",
- val_to_str (value, cdt_ContentType_ShortForm_vals,
+ val_to_str (content_type, cdt_ContentType_ShortForm_vals,
"unknown"));
if (check_col (actx->pinfo->cinfo, COL_INFO))
col_append_fstr (actx->pinfo->cinfo, COL_INFO, "%%s ",
- val_to_str (value, cdt_ContentType_ShortForm_vals,
+ val_to_str (content_type, cdt_ContentType_ShortForm_vals,
"unknown"));
#.FN_PARS CompressedContentInfo/contentType/contentType-OID
@@ -97,6 +101,19 @@ CompressedData B "1.3.26.0.4406.0.4.2" "cdt"
tvb_set_child_real_data_tvbuff (tvb, next_tvb);
add_new_data_source (actx->pinfo, next_tvb, "Uncompressed Content");
- dissect_x411_mts_apdu (next_tvb, actx->pinfo, top_tree);
+ switch (content_type) {
+ case CDT_UNDEFINED:
+ call_dissector (data_handle, next_tvb, actx->pinfo, top_tree);
+ break;
+ case CDT_EXTERNAL:
+ dissect_unknown_ber (actx->pinfo, next_tvb, 0, top_tree);
+ break;
+ case CDT_P1:
+ dissect_x411_mts_apdu (next_tvb, actx->pinfo, top_tree);
+ break;
+ default:
+ call_dissector (data_handle, next_tvb, actx->pinfo, top_tree);
+ break;
+ }
#.END
diff --git a/asn1/cdt/packet-cdt-template.c b/asn1/cdt/packet-cdt-template.c
index 0edfeeccbd..7b08333715 100644
--- a/asn1/cdt/packet-cdt-template.c
+++ b/asn1/cdt/packet-cdt-template.c
@@ -41,6 +41,12 @@
#include "packet-cdt.h"
+#define CDT_UNDEFINED 0
+#define CDT_EXTERNAL 1
+#define CDT_P1 2
+#define CDT_P3 3
+#define CDT_P7 4
+
#define PNAME "Compressed Data Type"
#define PSNAME "CDT"
#define PFNAME "cdt"
@@ -48,10 +54,14 @@
static proto_tree *top_tree = NULL;
static proto_item *cdt_item = NULL;
+static guint32 content_type = 0;
+
/* Initialize the protocol and registered fields */
int proto_cdt = -1;
#include "packet-cdt-hf.c"
+static dissector_handle_t data_handle = NULL;
+
/* Initialize the subtree pointers */
#include "packet-cdt-ett.c"
@@ -108,4 +118,6 @@ void proto_register_cdt (void) {
/*--- proto_reg_handoff_cdt ---------------------------------------*/
void proto_reg_handoff_cdt (void) {
#include "packet-cdt-dis-tab.c"
+
+ data_handle = find_dissector ("data");
}
diff --git a/epan/dissectors/packet-cdt.c b/epan/dissectors/packet-cdt.c
index fa6f6048b6..c8b8ce4288 100644
--- a/epan/dissectors/packet-cdt.c
+++ b/epan/dissectors/packet-cdt.c
@@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-cdt.c */
-/* ../../tools/asn2wrs.py -b -p cdt -c cdt.cnf -s packet-cdt-template cdt.asn */
+/* ../../tools/asn2wrs.py -b -p cdt -c ./cdt.cnf -s ./packet-cdt-template -D . cdt.asn */
/* Input file: packet-cdt-template.c */
@@ -49,6 +49,12 @@
#include "packet-cdt.h"
+#define CDT_UNDEFINED 0
+#define CDT_EXTERNAL 1
+#define CDT_P1 2
+#define CDT_P3 3
+#define CDT_P7 4
+
#define PNAME "Compressed Data Type"
#define PSNAME "CDT"
#define PFNAME "cdt"
@@ -56,6 +62,8 @@
static proto_tree *top_tree = NULL;
static proto_item *cdt_item = NULL;
+static guint32 content_type = 0;
+
/* Initialize the protocol and registered fields */
int proto_cdt = -1;
@@ -72,7 +80,9 @@ static int hf_cdt_contentType_OID = -1; /* T_contentType_OID */
static int hf_cdt_compressedContent = -1; /* CompressedContent */
/*--- End of included file: packet-cdt-hf.c ---*/
-#line 54 "packet-cdt-template.c"
+#line 62 "packet-cdt-template.c"
+
+static dissector_handle_t data_handle = NULL;
/* Initialize the subtree pointers */
@@ -84,7 +94,7 @@ static gint ett_cdt_CompressedContentInfo = -1;
static gint ett_cdt_T_contentType = -1;
/*--- End of included file: packet-cdt-ett.c ---*/
-#line 57 "packet-cdt-template.c"
+#line 67 "packet-cdt-template.c"
/*--- Included file: packet-cdt-fn.c ---*/
@@ -98,11 +108,11 @@ static const value_string cdt_AlgorithmID_ShortForm_vals[] = {
static int
dissect_cdt_AlgorithmID_ShortForm(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 16 "cdt.cnf"
+#line 21 "cdt.cnf"
guint32 value;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
- &value);
+ &value);
proto_item_append_text (cdt_item, ", %s",
val_to_str (value, cdt_AlgorithmID_ShortForm_vals,
@@ -162,19 +172,18 @@ static const value_string cdt_ContentType_ShortForm_vals[] = {
static int
dissect_cdt_ContentType_ShortForm(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 32 "cdt.cnf"
- guint32 value;
+#line 37 "cdt.cnf"
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
- &value);
+ &content_type);
proto_item_append_text (cdt_item, ", %s",
- val_to_str (value, cdt_ContentType_ShortForm_vals,
+ val_to_str (content_type, cdt_ContentType_ShortForm_vals,
"unknown"));
if (check_col (actx->pinfo->cinfo, COL_INFO))
col_append_fstr (actx->pinfo->cinfo, COL_INFO, "%s ",
- val_to_str (value, cdt_ContentType_ShortForm_vals,
+ val_to_str (content_type, cdt_ContentType_ShortForm_vals,
"unknown"));
@@ -186,7 +195,7 @@ dissect_cdt_ContentType_ShortForm(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
dissect_cdt_T_contentType_OID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 48 "cdt.cnf"
+#line 52 "cdt.cnf"
const char *obj_id = NULL;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &obj_id);
@@ -235,7 +244,7 @@ dissect_cdt_T_contentType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_cdt_CompressedContent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 68 "cdt.cnf"
+#line 72 "cdt.cnf"
tvbuff_t *next_tvb = NULL, *compr_tvb = NULL;
proto_item *tf = NULL;
int save_offset = offset;
@@ -270,7 +279,20 @@ dissect_cdt_CompressedContent(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
tvb_set_child_real_data_tvbuff (tvb, next_tvb);
add_new_data_source (actx->pinfo, next_tvb, "Uncompressed Content");
- dissect_x411_mts_apdu (next_tvb, actx->pinfo, top_tree);
+ switch (content_type) {
+ case CDT_UNDEFINED:
+ call_dissector (data_handle, next_tvb, actx->pinfo, top_tree);
+ break;
+ case CDT_EXTERNAL:
+ dissect_unknown_ber (actx->pinfo, next_tvb, 0, top_tree);
+ break;
+ case CDT_P1:
+ dissect_x411_mts_apdu (next_tvb, actx->pinfo, top_tree);
+ break;
+ default:
+ call_dissector (data_handle, next_tvb, actx->pinfo, top_tree);
+ break;
+ }
@@ -301,9 +323,15 @@ static const ber_sequence_t CompressedData_sequence[] = {
int
dissect_cdt_CompressedData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
+#line 13 "cdt.cnf"
+ content_type = 0;
+
+ offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
CompressedData_sequence, hf_index, ett_cdt_CompressedData);
+
+
+
return offset;
}
@@ -317,7 +345,7 @@ static void dissect_CompressedData_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_
/*--- End of included file: packet-cdt-fn.c ---*/
-#line 59 "packet-cdt-template.c"
+#line 69 "packet-cdt-template.c"
/*--- proto_register_cdt -------------------------------------------*/
@@ -390,7 +418,7 @@ void proto_register_cdt (void) {
"cdt.CompressedContent", HFILL }},
/*--- End of included file: packet-cdt-hfarr.c ---*/
-#line 91 "packet-cdt-template.c"
+#line 101 "packet-cdt-template.c"
};
/* List of subtrees */
@@ -404,7 +432,7 @@ void proto_register_cdt (void) {
&ett_cdt_T_contentType,
/*--- End of included file: packet-cdt-ettarr.c ---*/
-#line 96 "packet-cdt-template.c"
+#line 106 "packet-cdt-template.c"
};
/* Register protocol */
@@ -426,5 +454,7 @@ void proto_reg_handoff_cdt (void) {
/*--- End of included file: packet-cdt-dis-tab.c ---*/
-#line 111 "packet-cdt-template.c"
+#line 121 "packet-cdt-template.c"
+
+ data_handle = find_dissector ("data");
}
diff --git a/epan/dissectors/packet-cdt.h b/epan/dissectors/packet-cdt.h
index 1ce5f3f0d4..a70caba953 100644
--- a/epan/dissectors/packet-cdt.h
+++ b/epan/dissectors/packet-cdt.h
@@ -1,7 +1,7 @@
/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-cdt.h */
-/* ../../tools/asn2wrs.py -b -p cdt -c cdt.cnf -s packet-cdt-template cdt.asn */
+/* ../../tools/asn2wrs.py -b -p cdt -c ./cdt.cnf -s ./packet-cdt-template -D . cdt.asn */
/* Input file: packet-cdt-template.h */