aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-x509af.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-24 22:16:41 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-24 22:16:41 +0000
commit829a19a29bf76c58930ec9e6416494e3b93d103b (patch)
tree071b6fea14b55c0422145c8ae32594f0f9cd5d58 /epan/dissectors/packet-x509af.c
parentd890f4934e01ef1b9cd38efbeda8afabe744cb36 (diff)
add dissection of the structure : Extension
svn path=/trunk/; revision=11507
Diffstat (limited to 'epan/dissectors/packet-x509af.c')
-rw-r--r--epan/dissectors/packet-x509af.c102
1 files changed, 54 insertions, 48 deletions
diff --git a/epan/dissectors/packet-x509af.c b/epan/dissectors/packet-x509af.c
index b42533cefc..80d30b6361 100644
--- a/epan/dissectors/packet-x509af.c
+++ b/epan/dissectors/packet-x509af.c
@@ -52,8 +52,10 @@
#define PFNAME "x509af"
/* Initialize the protocol and registered fields */
-int proto_x509af = -1;
-int hf_x509af_algorithm_id = -1;
+static int proto_x509af = -1;
+static int hf_x509af_algorithm_id = -1;
+static int hf_x509af_extension_id = -1;
+static int hf_x509af_critical = -1; /* BOOLEAN */
/*--- Included file: packet-x509af-hf.c ---*/
@@ -82,8 +84,6 @@ static int hf_x509af_subjectPublicKey = -1; /* BIT_STRING */
static int hf_x509af_utcTime = -1; /* UTCTime */
static int hf_x509af_generalizedTime = -1; /* GeneralizedTime */
static int hf_x509af_Extensions_item = -1; /* Extension */
-static int hf_x509af_critical = -1; /* BOOLEAN */
-static int hf_x509af_extnValue = -1; /* OCTET_STRING */
static int hf_x509af_userCertificate = -1; /* Certificate */
static int hf_x509af_certificationPath = -1; /* ForwardCertificationPath */
static int hf_x509af_ForwardCertificationPath_item = -1; /* CrossCertificates */
@@ -172,6 +172,48 @@ static gint ett_x509af_SET_OF_AttributeType = -1;
+static char extension_id[64]; /*64 chars should be long enough? */
+static int
+dissect_hf_x509af_extension_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+{
+ offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
+ hf_x509af_extension_id, extension_id);
+ return offset;
+}
+/* BOOLEAN from template, remove later if the compiler starts generating it */
+static int
+dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
+ offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index);
+
+ return offset;
+}
+static int dissect_critical(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
+ return dissect_x509af_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_x509af_critical);
+}
+
+static int
+dissect_hf_x509af_extension_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
+{
+ offset=call_ber_oid_callback(extension_id, tvb, offset, pinfo, tree);
+
+ return offset;
+}
+
+static ber_sequence Extension_sequence[] = {
+ { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_x509af_extension_id },
+ { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_critical },
+ { BER_CLASS_ANY, 0, 0, dissect_hf_x509af_extension_type },
+ { 0, 0, 0, NULL }
+};
+
+static int
+dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
+ offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
+ Extension_sequence, hf_index, ett_x509af_Extension);
+
+ return offset;
+}
+
static char algorithm_id[64]; /*64 chars should be long enough? */
static int
dissect_hf_x509af_algorithm_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
@@ -414,42 +456,6 @@ static int dissect_subjectPublicKeyInfo(packet_info *pinfo, proto_tree *tree, tv
return dissect_x509af_SubjectPublicKeyInfo(FALSE, tvb, offset, pinfo, tree, hf_x509af_subjectPublicKeyInfo);
}
-
-static int
-dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index);
-
- return offset;
-}
-static int dissect_critical(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
- return dissect_x509af_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_x509af_critical);
-}
-
-
-static int
-dissect_x509af_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
- NULL);
-
- return offset;
-}
-static int dissect_extnValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
- return dissect_x509af_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_x509af_extnValue);
-}
-
-static ber_sequence Extension_sequence[] = {
- { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_critical },
- { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_extnValue },
- { 0, 0, 0, NULL }
-};
-
-static int
-dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
- offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
- Extension_sequence, hf_index, ett_x509af_Extension);
-
- return offset;
-}
static int dissect_Extensions_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_Extension(FALSE, tvb, offset, pinfo, tree, hf_x509af_Extensions_item);
}
@@ -921,6 +927,14 @@ void proto_register_x509af(void) {
{ "Algorithm Id", "x509af.algorithm.id",
FT_STRING, BASE_NONE, NULL, 0,
"Algorithm Id", HFILL }},
+ { &hf_x509af_extension_id,
+ { "Extension Id", "x509af.extension.id",
+ FT_STRING, BASE_NONE, NULL, 0,
+ "Extension Id", HFILL }},
+ { &hf_x509af_critical,
+ { "critical", "x509af.critical",
+ FT_BOOLEAN, 8, NULL, 0,
+ "Extension/critical", HFILL }},
/*--- Included file: packet-x509af-hfarr.c ---*/
@@ -1009,14 +1023,6 @@ void proto_register_x509af(void) {
{ "Item[##]", "x509af.Extensions_item",
FT_NONE, BASE_NONE, NULL, 0,
"Extensions/_item", HFILL }},
- { &hf_x509af_critical,
- { "critical", "x509af.critical",
- FT_BOOLEAN, 8, NULL, 0,
- "Extension/critical", HFILL }},
- { &hf_x509af_extnValue,
- { "extnValue", "x509af.extnValue",
- FT_BYTES, BASE_HEX, NULL, 0,
- "Extension/extnValue", HFILL }},
{ &hf_x509af_userCertificate,
{ "userCertificate", "x509af.userCertificate",
FT_NONE, BASE_NONE, NULL, 0,