1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-ns_cert_exts.c */
4 /* ../../tools/asn2wrs.py -b -p ns_cert_exts -c ./ns_cert_exts.cnf -s ./packet-ns_cert_exts-template -D . NETSCAPE-CERT-EXTS.asn */
6 /* Input file: packet-ns_cert_exts-template.c */
8 #line 1 "packet-ns_cert_exts-template.c"
9 /* packet-ns_cert_exts.c
10 * Routines for NetScape Certificate Extensions packet dissection
11 * Ronnie Sahlberg 2004
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 1998 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 #include <epan/packet.h>
43 #include "packet-ber.h"
45 #define PNAME "NetScape Certificate Extensions"
46 #define PSNAME "NS_CERT_EXTS"
47 #define PFNAME "ns_cert_exts"
49 /* Initialize the protocol and registered fields */
50 static int proto_ns_cert_exts = -1;
52 /*--- Included file: packet-ns_cert_exts-hf.c ---*/
53 #line 1 "packet-ns_cert_exts-hf.c"
54 static int hf_ns_cert_exts_BaseUrl_PDU = -1; /* BaseUrl */
55 static int hf_ns_cert_exts_RevocationUrl_PDU = -1; /* RevocationUrl */
56 static int hf_ns_cert_exts_CaRevocationUrl_PDU = -1; /* CaRevocationUrl */
57 static int hf_ns_cert_exts_CaPolicyUrl_PDU = -1; /* CaPolicyUrl */
58 static int hf_ns_cert_exts_Comment_PDU = -1; /* Comment */
59 static int hf_ns_cert_exts_SslServerName_PDU = -1; /* SslServerName */
60 static int hf_ns_cert_exts_CertRenewalUrl_PDU = -1; /* CertRenewalUrl */
61 static int hf_ns_cert_exts_CertType_PDU = -1; /* CertType */
63 static int hf_ns_cert_exts_CertType_ssl_client = -1;
64 static int hf_ns_cert_exts_CertType_ssl_server = -1;
65 static int hf_ns_cert_exts_CertType_smime = -1;
66 static int hf_ns_cert_exts_CertType_object_signing = -1;
67 static int hf_ns_cert_exts_CertType_ssl_ca = -1;
68 static int hf_ns_cert_exts_CertType_smime_ca = -1;
69 static int hf_ns_cert_exts_CertType_object_signing_ca = -1;
71 /*--- End of included file: packet-ns_cert_exts-hf.c ---*/
72 #line 44 "packet-ns_cert_exts-template.c"
74 /* Initialize the subtree pointers */
76 /*--- Included file: packet-ns_cert_exts-ett.c ---*/
77 #line 1 "packet-ns_cert_exts-ett.c"
78 static gint ett_ns_cert_exts_CertType = -1;
80 /*--- End of included file: packet-ns_cert_exts-ett.c ---*/
81 #line 47 "packet-ns_cert_exts-template.c"
84 /*--- Included file: packet-ns_cert_exts-fn.c ---*/
85 #line 1 "packet-ns_cert_exts-fn.c"
89 dissect_ns_cert_exts_BaseUrl(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
90 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
91 actx, tree, tvb, offset, hf_index,
100 dissect_ns_cert_exts_RevocationUrl(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
101 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
102 actx, tree, tvb, offset, hf_index,
111 dissect_ns_cert_exts_CaRevocationUrl(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
112 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
113 actx, tree, tvb, offset, hf_index,
122 dissect_ns_cert_exts_CaPolicyUrl(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
123 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
124 actx, tree, tvb, offset, hf_index,
133 dissect_ns_cert_exts_Comment(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
134 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
135 actx, tree, tvb, offset, hf_index,
144 dissect_ns_cert_exts_SslServerName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
145 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
146 actx, tree, tvb, offset, hf_index,
155 dissect_ns_cert_exts_CertRenewalUrl(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
156 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
157 actx, tree, tvb, offset, hf_index,
164 static const asn_namedbit CertType_bits[] = {
165 { 0, &hf_ns_cert_exts_CertType_ssl_client, -1, -1, "ssl-client", NULL },
166 { 1, &hf_ns_cert_exts_CertType_ssl_server, -1, -1, "ssl-server", NULL },
167 { 2, &hf_ns_cert_exts_CertType_smime, -1, -1, "smime", NULL },
168 { 3, &hf_ns_cert_exts_CertType_object_signing, -1, -1, "object-signing", NULL },
169 { 5, &hf_ns_cert_exts_CertType_ssl_ca, -1, -1, "ssl-ca", NULL },
170 { 6, &hf_ns_cert_exts_CertType_smime_ca, -1, -1, "smime-ca", NULL },
171 { 7, &hf_ns_cert_exts_CertType_object_signing_ca, -1, -1, "object-signing-ca", NULL },
172 { 0, NULL, 0, 0, NULL, NULL }
176 dissect_ns_cert_exts_CertType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
177 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
178 CertType_bits, hf_index, ett_ns_cert_exts_CertType,
186 static void dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
188 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
189 dissect_ns_cert_exts_BaseUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_BaseUrl_PDU);
191 static void dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
193 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
194 dissect_ns_cert_exts_RevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_RevocationUrl_PDU);
196 static void dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
198 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
199 dissect_ns_cert_exts_CaRevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaRevocationUrl_PDU);
201 static void dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
203 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
204 dissect_ns_cert_exts_CaPolicyUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaPolicyUrl_PDU);
206 static void dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
208 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
209 dissect_ns_cert_exts_Comment(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_Comment_PDU);
211 static void dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
213 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
214 dissect_ns_cert_exts_SslServerName(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_SslServerName_PDU);
216 static void dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
218 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
219 dissect_ns_cert_exts_CertRenewalUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertRenewalUrl_PDU);
221 static void dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
223 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
224 dissect_ns_cert_exts_CertType(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertType_PDU);
228 /*--- End of included file: packet-ns_cert_exts-fn.c ---*/
229 #line 49 "packet-ns_cert_exts-template.c"
232 /*--- proto_register_ns_cert_exts -------------------------------------------*/
233 void proto_register_ns_cert_exts(void) {
236 static hf_register_info hf[] = {
238 /*--- Included file: packet-ns_cert_exts-hfarr.c ---*/
239 #line 1 "packet-ns_cert_exts-hfarr.c"
240 { &hf_ns_cert_exts_BaseUrl_PDU,
241 { "BaseUrl", "ns_cert_exts.BaseUrl",
242 FT_STRING, BASE_NONE, NULL, 0,
243 "ns_cert_exts.BaseUrl", HFILL }},
244 { &hf_ns_cert_exts_RevocationUrl_PDU,
245 { "RevocationUrl", "ns_cert_exts.RevocationUrl",
246 FT_STRING, BASE_NONE, NULL, 0,
247 "ns_cert_exts.RevocationUrl", HFILL }},
248 { &hf_ns_cert_exts_CaRevocationUrl_PDU,
249 { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
250 FT_STRING, BASE_NONE, NULL, 0,
251 "ns_cert_exts.CaRevocationUrl", HFILL }},
252 { &hf_ns_cert_exts_CaPolicyUrl_PDU,
253 { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
254 FT_STRING, BASE_NONE, NULL, 0,
255 "ns_cert_exts.CaPolicyUrl", HFILL }},
256 { &hf_ns_cert_exts_Comment_PDU,
257 { "Comment", "ns_cert_exts.Comment",
258 FT_STRING, BASE_NONE, NULL, 0,
259 "ns_cert_exts.Comment", HFILL }},
260 { &hf_ns_cert_exts_SslServerName_PDU,
261 { "SslServerName", "ns_cert_exts.SslServerName",
262 FT_STRING, BASE_NONE, NULL, 0,
263 "ns_cert_exts.SslServerName", HFILL }},
264 { &hf_ns_cert_exts_CertRenewalUrl_PDU,
265 { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
266 FT_STRING, BASE_NONE, NULL, 0,
267 "ns_cert_exts.CertRenewalUrl", HFILL }},
268 { &hf_ns_cert_exts_CertType_PDU,
269 { "CertType", "ns_cert_exts.CertType",
270 FT_BYTES, BASE_NONE, NULL, 0,
271 "ns_cert_exts.CertType", HFILL }},
272 { &hf_ns_cert_exts_CertType_ssl_client,
273 { "ssl-client", "ns_cert_exts.ssl-client",
274 FT_BOOLEAN, 8, NULL, 0x80,
276 { &hf_ns_cert_exts_CertType_ssl_server,
277 { "ssl-server", "ns_cert_exts.ssl-server",
278 FT_BOOLEAN, 8, NULL, 0x40,
280 { &hf_ns_cert_exts_CertType_smime,
281 { "smime", "ns_cert_exts.smime",
282 FT_BOOLEAN, 8, NULL, 0x20,
284 { &hf_ns_cert_exts_CertType_object_signing,
285 { "object-signing", "ns_cert_exts.object-signing",
286 FT_BOOLEAN, 8, NULL, 0x10,
288 { &hf_ns_cert_exts_CertType_ssl_ca,
289 { "ssl-ca", "ns_cert_exts.ssl-ca",
290 FT_BOOLEAN, 8, NULL, 0x04,
292 { &hf_ns_cert_exts_CertType_smime_ca,
293 { "smime-ca", "ns_cert_exts.smime-ca",
294 FT_BOOLEAN, 8, NULL, 0x02,
296 { &hf_ns_cert_exts_CertType_object_signing_ca,
297 { "object-signing-ca", "ns_cert_exts.object-signing-ca",
298 FT_BOOLEAN, 8, NULL, 0x01,
301 /*--- End of included file: packet-ns_cert_exts-hfarr.c ---*/
302 #line 57 "packet-ns_cert_exts-template.c"
305 /* List of subtrees */
306 static gint *ett[] = {
308 /*--- Included file: packet-ns_cert_exts-ettarr.c ---*/
309 #line 1 "packet-ns_cert_exts-ettarr.c"
310 &ett_ns_cert_exts_CertType,
312 /*--- End of included file: packet-ns_cert_exts-ettarr.c ---*/
313 #line 62 "packet-ns_cert_exts-template.c"
316 /* Register protocol */
317 proto_ns_cert_exts = proto_register_protocol(PNAME, PSNAME, PFNAME);
319 /* Register fields and subtrees */
320 proto_register_field_array(proto_ns_cert_exts, hf, array_length(hf));
321 proto_register_subtree_array(ett, array_length(ett));
326 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
327 void proto_reg_handoff_ns_cert_exts(void) {
329 /*--- Included file: packet-ns_cert_exts-dis-tab.c ---*/
330 #line 1 "packet-ns_cert_exts-dis-tab.c"
331 register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU, proto_ns_cert_exts, "ns_cert_exts.cert_type");
332 register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.base_url");
333 register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.revocation-url");
334 register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-revocation-url");
335 register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.cert-renewal-url");
336 register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-policy-url");
337 register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU, proto_ns_cert_exts, "ns_cert_exts.ssl-server-name");
338 register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU, proto_ns_cert_exts, "ns_cert_exts.comment");
341 /*--- End of included file: packet-ns_cert_exts-dis-tab.c ---*/
342 #line 77 "packet-ns_cert_exts-template.c"