summaryrefslogtreecommitdiff
path: root/asn1/x509sat
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-23 07:46:12 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2004-07-23 07:46:12 +0000
commit1b0f6edbd974e572d85a5871e69bd5ea491504c4 (patch)
tree1213975e4f5a049d5b15d03b10f7007738e6f70d /asn1/x509sat
parent73f560c866156a061354d75a76f43ce74608449b (diff)
downloadwireshark-1b0f6edbd974e572d85a5871e69bd5ea491504c4.tar.gz
add dissection of DirectoryString, this unfortunately had to be done manually inside the template.
Also implement the attribute organizationName which is of this type. (Add magic comments so emacs-macros will be happy.) svn path=/trunk/; revision=11479
Diffstat (limited to 'asn1/x509sat')
-rw-r--r--asn1/x509sat/SelectedAttributeTypes.asn20
-rw-r--r--asn1/x509sat/packet-x509sat-template.c72
2 files changed, 83 insertions, 9 deletions
diff --git a/asn1/x509sat/SelectedAttributeTypes.asn b/asn1/x509sat/SelectedAttributeTypes.asn
index c9b5bee61d..696bc87a05 100644
--- a/asn1/x509sat/SelectedAttributeTypes.asn
+++ b/asn1/x509sat/SelectedAttributeTypes.asn
@@ -37,14 +37,16 @@ IMPORTS
FROM DirectoryAbstractService directoryAbstractService;
-- Directory string type
--- DirectoryString{INTEGER:maxSize} ::= CHOICE {
+-- XXX DirectoryString is handimplemented inside the template
+-- DirectoryString ::= CHOICE {
+-- XXX not implemented yet
-- teletexString TeletexString(SIZE (1..maxSize)),
--- printableString PrintableString(SIZE (1..maxSize)),
--- universalString UniversalString(SIZE (1..maxSize)),
--- bmpString BMPString(SIZE (1..maxSize)),
--- uTF8String UTF8String(SIZE (1..maxSize))
+-- printableString PrintableString(SIZE (1..maxSize)),
+-- universalString UniversalString(SIZE (1..maxSize)),
+-- bmpString BMPString(SIZE (1..maxSize)),
+-- uTF8String UTF8String(SIZE (1..maxSize))
-- }
---
+--
-- Attribute types
-- knowledgeInformation ATTRIBUTE ::= {
-- WITH SYNTAX DirectoryString {ub-knowledge-information}
@@ -993,9 +995,9 @@ id-at-countryName OBJECT IDENTIFIER ::= {id-at 6}
-- id-at-collectiveStreetAddress OBJECT IDENTIFIER ::= {id-at 9 1}
--
-- id-at-encryptedCollectiveStreetAddress OBJECT IDENTIFIER ::= {id-at 9 1 2}
---
--- id-at-organizationName OBJECT IDENTIFIER ::= {id-at 10}
---
+
+id-at-organizationName OBJECT IDENTIFIER ::= {id-at 10}
+
-- id-at-encryptedOrganizationName OBJECT IDENTIFIER ::= {id-at 10 2}
--
-- id-at-collectiveOrganizationName OBJECT IDENTIFIER ::= {id-at 10 1}
diff --git a/asn1/x509sat/packet-x509sat-template.c b/asn1/x509sat/packet-x509sat-template.c
index 5307af48cb..3001eab1f0 100644
--- a/asn1/x509sat/packet-x509sat-template.c
+++ b/asn1/x509sat/packet-x509sat-template.c
@@ -44,20 +44,84 @@
/* Initialize the protocol and registered fields */
int proto_x509sat = -1;
int hf_x509sat_countryName = -1;
+int hf_x509sat_organizationName = -1;
+/*aaa*/
#include "packet-x509sat-hf.c"
/* Initialize the subtree pointers */
+static gint ett_x509sat_DirectoryString = -1;
#include "packet-x509sat-ett.c"
#include "packet-x509sat-fn.c"
+
+
+static int DirectoryString_hf_index;
+
+static int
+dissect_printableString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
+ return dissect_ber_restricted_string(FALSE, BER_UNI_TAG_PrintableString,
+ pinfo, tree, tvb, offset, DirectoryString_hf_index, NULL);
+}
+static int
+dissect_universalString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
+ return dissect_ber_restricted_string(FALSE, BER_UNI_TAG_UniversalString,
+ pinfo, tree, tvb, offset, DirectoryString_hf_index, NULL);
+}
+static int
+dissect_bmpString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
+ return dissect_ber_restricted_string(FALSE, BER_UNI_TAG_BMPString,
+ pinfo, tree, tvb, offset, DirectoryString_hf_index, NULL);
+}
+static int
+dissect_uTF8String(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
+ return dissect_ber_restricted_string(FALSE, BER_UNI_TAG_UTF8String,
+ pinfo, tree, tvb, offset, DirectoryString_hf_index, NULL);
+}
+
+static const value_string DirectoryString_vals[] = {
+ { 0, "printableString" },
+ { 1, "universalString" },
+ { 2, "bmpString" },
+ { 3, "uTF8String" },
+ { 0, NULL }
+};
+
+static ber_choice DirectoryString_choice[] = {
+/*XXX needs to add TeletexString */
+ { 0, BER_CLASS_UNI, BER_UNI_TAG_PrintableString, BER_FLAGS_NOOWNTAG, dissect_printableString },
+ { 1, BER_CLASS_UNI, BER_UNI_TAG_UniversalString, BER_FLAGS_NOOWNTAG, dissect_universalString },
+ { 2, BER_CLASS_UNI, BER_UNI_TAG_BMPString, BER_FLAGS_NOOWNTAG, dissect_bmpString },
+ { 3, BER_CLASS_UNI, BER_UNI_TAG_UTF8String, BER_FLAGS_NOOWNTAG, dissect_uTF8String },
+ { 0, 0, 0, 0, NULL }
+};
+
+static int
+dissect_x509sat_DirectoryString(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) {
+ DirectoryString_hf_index = hf_index;
+ offset = dissect_ber_choice(pinfo, tree, tvb, offset,
+ DirectoryString_choice, -1, ett_x509sat_DirectoryString);
+
+ return offset;
+}
+
+
+
+
static void
dissect_x509sat_countryName_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_x509sat_CountryName(FALSE, tvb, 0, pinfo, tree, hf_x509sat_countryName);
}
+static void
+dissect_x509sat_organizationName_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_x509sat_DirectoryString(FALSE, tvb, 0, pinfo, tree, hf_x509sat_organizationName);
+}
+/*bbb*/
+
/*--- proto_register_x509sat ----------------------------------------------*/
void proto_register_x509sat(void) {
@@ -67,11 +131,17 @@ void proto_register_x509sat(void) {
{ "countryName", "x509sat.countryName",
FT_STRING, BASE_NONE, NULL, 0,
"Country Name", HFILL }},
+ { &hf_x509sat_organizationName,
+ { "organizationName", "x509sat.organizationName",
+ FT_STRING, BASE_NONE, NULL, 0,
+ "Organization Name", HFILL }},
+/*ccc*/
#include "packet-x509sat-hfarr.c"
};
/* List of subtrees */
static gint *ett[] = {
+ &ett_x509sat_DirectoryString,
#include "packet-x509sat-ettarr.c"
};
@@ -88,5 +158,7 @@ void proto_register_x509sat(void) {
/*--- proto_reg_handoff_x509sat -------------------------------------------*/
void proto_reg_handoff_x509sat(void) {
register_ber_oid_dissector("2.5.4.6", dissect_x509sat_countryName_callback, proto_x509sat, "id-at-countryName");
+ register_ber_oid_dissector("2.5.4.10", dissect_x509sat_organizationName_callback, proto_x509sat, "id-at-organizationName");
+/*ddd*/
}