1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler */
3 /* ./packet-pkix1implicit.c */
4 /* ../../tools/asn2eth.py -e -X -b -p pkix1implicit -c pkix1implicit.cnf -s packet-pkix1implicit-template PKIX1IMPLICIT93.asn */
6 /* Input file: packet-pkix1implicit-template.c */
8 /* packet-pkix1implicit.c
9 * Routines for PKIX1Implitic packet dissection
11 * $Id: packet-pkix1implicit-template.c 12827 2004-12-24 12:22:52Z sahlberg $
13 * Ethereal - Network traffic analyzer
14 * By Gerald Combs <gerald@ethereal.com>
15 * Copyright 1998 Gerald Combs
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #include <epan/packet.h>
38 #include <epan/conversation.h>
43 #include "packet-ber.h"
44 #include "packet-pkix1implicit.h"
45 #include "packet-pkix1explicit.h"
46 #include "packet-x509ce.h"
48 #define PNAME "PKIX1Implitit"
49 #define PSNAME "PKIX1IMPLICIT"
50 #define PFNAME "pkix1implicit"
52 /* Initialize the protocol and registered fields */
53 static int proto_pkix1implicit = -1;
55 /*--- Included file: packet-pkix1implicit-hf.c ---*/
57 static int hf_pkix1implicit_Dummy_PDU = -1; /* Dummy */
58 static int hf_pkix1implicit_AuthorityInfoAccessSyntax_PDU = -1; /* AuthorityInfoAccessSyntax */
59 static int hf_pkix1implicit_nameAssigner = -1; /* DirectoryString */
60 static int hf_pkix1implicit_partyName = -1; /* DirectoryString */
61 static int hf_pkix1implicit_AuthorityInfoAccessSyntax_item = -1; /* AccessDescription */
62 static int hf_pkix1implicit_accessMethod = -1; /* OBJECT_IDENTIFIER */
63 static int hf_pkix1implicit_accessLocation = -1; /* GeneralName */
64 static int hf_pkix1implicit_noticeRef = -1; /* NoticeReference */
65 static int hf_pkix1implicit_explicitText = -1; /* DisplayText */
66 static int hf_pkix1implicit_organization = -1; /* DisplayText */
67 static int hf_pkix1implicit_noticeNumbers = -1; /* T_noticeNumbers */
68 static int hf_pkix1implicit_noticeNumbers_item = -1; /* INTEGER */
69 static int hf_pkix1implicit_visibleString = -1; /* VisibleString */
70 static int hf_pkix1implicit_bmpString = -1; /* BMPString */
71 static int hf_pkix1implicit_utf8String = -1; /* UTF8String */
73 /*--- End of included file: packet-pkix1implicit-hf.c ---*/
76 /* Initialize the subtree pointers */
78 /*--- Included file: packet-pkix1implicit-ett.c ---*/
80 static gint ett_pkix1implicit_EDIPartyName = -1;
81 static gint ett_pkix1implicit_AuthorityInfoAccessSyntax = -1;
82 static gint ett_pkix1implicit_AccessDescription = -1;
83 static gint ett_pkix1implicit_UserNotice = -1;
84 static gint ett_pkix1implicit_NoticeReference = -1;
85 static gint ett_pkix1implicit_T_noticeNumbers = -1;
86 static gint ett_pkix1implicit_DisplayText = -1;
88 /*--- End of included file: packet-pkix1implicit-ett.c ---*/
93 dissect_pkix1implicit_ReasonFlags(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
94 offset = dissect_x509ce_ReasonFlags(implicit_tag, tvb, offset, pinfo, tree, hf_index);
99 dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
100 offset = dissect_x509ce_GeneralName(implicit_tag, tvb, offset, pinfo, tree, hf_index);
106 /*--- Included file: packet-pkix1implicit-fn.c ---*/
108 /*--- Fields for imported types ---*/
110 static int dissect_nameAssigner_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
111 return dissect_pkix1explicit_DirectoryString(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_nameAssigner);
113 static int dissect_partyName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
114 return dissect_pkix1explicit_DirectoryString(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_partyName);
116 static int dissect_accessLocation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
117 return dissect_x509ce_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_accessLocation);
123 dissect_pkix1implicit_Dummy(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
124 offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
129 static const ber_sequence_t EDIPartyName_sequence[] = {
130 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_nameAssigner_impl },
131 { BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_partyName_impl },
136 dissect_pkix1implicit_EDIPartyName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
137 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
138 EDIPartyName_sequence, hf_index, ett_pkix1implicit_EDIPartyName);
146 dissect_pkix1implicit_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
147 offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index,
152 static int dissect_accessMethod(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
153 return dissect_pkix1implicit_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_accessMethod);
156 static const ber_sequence_t AccessDescription_sequence[] = {
157 { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_accessMethod },
158 { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_accessLocation },
163 dissect_pkix1implicit_AccessDescription(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
164 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
165 AccessDescription_sequence, hf_index, ett_pkix1implicit_AccessDescription);
169 static int dissect_AuthorityInfoAccessSyntax_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
170 return dissect_pkix1implicit_AccessDescription(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_AuthorityInfoAccessSyntax_item);
173 static const ber_sequence_t AuthorityInfoAccessSyntax_sequence_of[1] = {
174 { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_AuthorityInfoAccessSyntax_item },
178 dissect_pkix1implicit_AuthorityInfoAccessSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
179 offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
180 AuthorityInfoAccessSyntax_sequence_of, hf_index, ett_pkix1implicit_AuthorityInfoAccessSyntax);
187 dissect_pkix1implicit_VisibleString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
188 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_VisibleString,
189 pinfo, tree, tvb, offset, hf_index,
194 static int dissect_visibleString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
195 return dissect_pkix1implicit_VisibleString(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_visibleString);
200 dissect_pkix1implicit_BMPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
201 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_BMPString,
202 pinfo, tree, tvb, offset, hf_index,
207 static int dissect_bmpString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
208 return dissect_pkix1implicit_BMPString(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_bmpString);
213 dissect_pkix1implicit_UTF8String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
214 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
215 pinfo, tree, tvb, offset, hf_index,
220 static int dissect_utf8String(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
221 return dissect_pkix1implicit_UTF8String(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_utf8String);
225 static const value_string pkix1implicit_DisplayText_vals[] = {
226 { 0, "visibleString" },
232 static const ber_choice_t DisplayText_choice[] = {
233 { 0, BER_CLASS_UNI, BER_UNI_TAG_VisibleString, BER_FLAGS_NOOWNTAG, dissect_visibleString },
234 { 1, BER_CLASS_UNI, BER_UNI_TAG_BMPString, BER_FLAGS_NOOWNTAG, dissect_bmpString },
235 { 2, BER_CLASS_UNI, BER_UNI_TAG_UTF8String, BER_FLAGS_NOOWNTAG, dissect_utf8String },
240 dissect_pkix1implicit_DisplayText(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
241 offset = dissect_ber_CHOICE(pinfo, tree, tvb, offset,
242 DisplayText_choice, hf_index, ett_pkix1implicit_DisplayText, NULL);
246 static int dissect_explicitText(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
247 return dissect_pkix1implicit_DisplayText(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_explicitText);
249 static int dissect_organization(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
250 return dissect_pkix1implicit_DisplayText(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_organization);
256 dissect_pkix1implicit_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
257 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
262 static int dissect_noticeNumbers_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
263 return dissect_pkix1implicit_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeNumbers_item);
266 static const ber_sequence_t T_noticeNumbers_sequence_of[1] = {
267 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_noticeNumbers_item },
271 dissect_pkix1implicit_T_noticeNumbers(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
272 offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
273 T_noticeNumbers_sequence_of, hf_index, ett_pkix1implicit_T_noticeNumbers);
277 static int dissect_noticeNumbers(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
278 return dissect_pkix1implicit_T_noticeNumbers(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeNumbers);
281 static const ber_sequence_t NoticeReference_sequence[] = {
282 { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_organization },
283 { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_noticeNumbers },
288 dissect_pkix1implicit_NoticeReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
289 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
290 NoticeReference_sequence, hf_index, ett_pkix1implicit_NoticeReference);
294 static int dissect_noticeRef(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
295 return dissect_pkix1implicit_NoticeReference(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_noticeRef);
298 static const ber_sequence_t UserNotice_sequence[] = {
299 { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_noticeRef },
300 { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_explicitText },
305 dissect_pkix1implicit_UserNotice(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
306 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
307 UserNotice_sequence, hf_index, ett_pkix1implicit_UserNotice);
314 static void dissect_Dummy_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
315 dissect_pkix1implicit_Dummy(FALSE, tvb, 0, pinfo, tree, hf_pkix1implicit_Dummy_PDU);
317 static void dissect_AuthorityInfoAccessSyntax_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
318 dissect_pkix1implicit_AuthorityInfoAccessSyntax(FALSE, tvb, 0, pinfo, tree, hf_pkix1implicit_AuthorityInfoAccessSyntax_PDU);
322 /*--- End of included file: packet-pkix1implicit-fn.c ---*/
326 /*--- proto_register_pkix1implicit ----------------------------------------------*/
327 void proto_register_pkix1implicit(void) {
330 static hf_register_info hf[] = {
332 /*--- Included file: packet-pkix1implicit-hfarr.c ---*/
334 { &hf_pkix1implicit_Dummy_PDU,
335 { "Dummy", "pkix1implicit.Dummy",
336 FT_NONE, BASE_NONE, NULL, 0,
338 { &hf_pkix1implicit_AuthorityInfoAccessSyntax_PDU,
339 { "AuthorityInfoAccessSyntax", "pkix1implicit.AuthorityInfoAccessSyntax",
340 FT_NONE, BASE_NONE, NULL, 0,
341 "AuthorityInfoAccessSyntax", HFILL }},
342 { &hf_pkix1implicit_nameAssigner,
343 { "nameAssigner", "pkix1implicit.nameAssigner",
344 FT_STRING, BASE_NONE, NULL, 0,
345 "EDIPartyName/nameAssigner", HFILL }},
346 { &hf_pkix1implicit_partyName,
347 { "partyName", "pkix1implicit.partyName",
348 FT_STRING, BASE_NONE, NULL, 0,
349 "EDIPartyName/partyName", HFILL }},
350 { &hf_pkix1implicit_AuthorityInfoAccessSyntax_item,
351 { "Item", "pkix1implicit.AuthorityInfoAccessSyntax_item",
352 FT_NONE, BASE_NONE, NULL, 0,
353 "AuthorityInfoAccessSyntax/_item", HFILL }},
354 { &hf_pkix1implicit_accessMethod,
355 { "accessMethod", "pkix1implicit.accessMethod",
356 FT_STRING, BASE_NONE, NULL, 0,
357 "AccessDescription/accessMethod", HFILL }},
358 { &hf_pkix1implicit_accessLocation,
359 { "accessLocation", "pkix1implicit.accessLocation",
360 FT_UINT32, BASE_DEC, NULL, 0,
361 "AccessDescription/accessLocation", HFILL }},
362 { &hf_pkix1implicit_noticeRef,
363 { "noticeRef", "pkix1implicit.noticeRef",
364 FT_NONE, BASE_NONE, NULL, 0,
365 "UserNotice/noticeRef", HFILL }},
366 { &hf_pkix1implicit_explicitText,
367 { "explicitText", "pkix1implicit.explicitText",
368 FT_UINT32, BASE_DEC, VALS(pkix1implicit_DisplayText_vals), 0,
369 "UserNotice/explicitText", HFILL }},
370 { &hf_pkix1implicit_organization,
371 { "organization", "pkix1implicit.organization",
372 FT_UINT32, BASE_DEC, VALS(pkix1implicit_DisplayText_vals), 0,
373 "NoticeReference/organization", HFILL }},
374 { &hf_pkix1implicit_noticeNumbers,
375 { "noticeNumbers", "pkix1implicit.noticeNumbers",
376 FT_NONE, BASE_NONE, NULL, 0,
377 "NoticeReference/noticeNumbers", HFILL }},
378 { &hf_pkix1implicit_noticeNumbers_item,
379 { "Item", "pkix1implicit.noticeNumbers_item",
380 FT_INT32, BASE_DEC, NULL, 0,
381 "NoticeReference/noticeNumbers/_item", HFILL }},
382 { &hf_pkix1implicit_visibleString,
383 { "visibleString", "pkix1implicit.visibleString",
384 FT_STRING, BASE_NONE, NULL, 0,
385 "DisplayText/visibleString", HFILL }},
386 { &hf_pkix1implicit_bmpString,
387 { "bmpString", "pkix1implicit.bmpString",
388 FT_STRING, BASE_NONE, NULL, 0,
389 "DisplayText/bmpString", HFILL }},
390 { &hf_pkix1implicit_utf8String,
391 { "utf8String", "pkix1implicit.utf8String",
392 FT_STRING, BASE_NONE, NULL, 0,
393 "DisplayText/utf8String", HFILL }},
395 /*--- End of included file: packet-pkix1implicit-hfarr.c ---*/
399 /* List of subtrees */
400 static gint *ett[] = {
402 /*--- Included file: packet-pkix1implicit-ettarr.c ---*/
404 &ett_pkix1implicit_EDIPartyName,
405 &ett_pkix1implicit_AuthorityInfoAccessSyntax,
406 &ett_pkix1implicit_AccessDescription,
407 &ett_pkix1implicit_UserNotice,
408 &ett_pkix1implicit_NoticeReference,
409 &ett_pkix1implicit_T_noticeNumbers,
410 &ett_pkix1implicit_DisplayText,
412 /*--- End of included file: packet-pkix1implicit-ettarr.c ---*/
416 /* Register protocol */
417 proto_pkix1implicit = proto_register_protocol(PNAME, PSNAME, PFNAME);
419 /* Register fields and subtrees */
420 proto_register_field_array(proto_pkix1implicit, hf, array_length(hf));
421 proto_register_subtree_array(ett, array_length(ett));
426 /*--- proto_reg_handoff_pkix1implicit -------------------------------------------*/
427 void proto_reg_handoff_pkix1implicit(void) {
429 /*--- Included file: packet-pkix1implicit-dis-tab.c ---*/
431 register_ber_oid_dissector("1.3.6.1.5.5.7.1.1", dissect_AuthorityInfoAccessSyntax_PDU, proto_pkix1implicit, "id-pe-authorityInfoAccessSyntax");
432 register_ber_oid_dissector("1.3.6.1.5.5.7.3.1", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-serverAuth");
433 register_ber_oid_dissector("1.3.6.1.5.5.7.3.2", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-clientAuth");
434 register_ber_oid_dissector("1.3.6.1.5.5.7.3.3", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-codeSigning");
435 register_ber_oid_dissector("1.3.6.1.5.5.7.3.4", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-emailProtection");
436 register_ber_oid_dissector("1.3.6.1.5.5.7.3.5", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ip-kp-ipsecEndSystem");
437 register_ber_oid_dissector("1.3.6.1.5.5.7.3.6", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ipsecTunnel");
438 register_ber_oid_dissector("1.3.6.1.5.5.7.3.7", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-ipsecUser");
439 register_ber_oid_dissector("1.3.6.1.5.5.7.3.8", dissect_Dummy_PDU, proto_pkix1implicit, "id-kp-timeStamping");
440 register_ber_oid_dissector("1.3.6.1.5.5.7.3.9", dissect_Dummy_PDU, proto_pkix1implicit, "OCSPSigning");
443 /*--- End of included file: packet-pkix1implicit-dis-tab.c ---*/