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 -e -p ns_cert_exts -c ns_cert_exts.cnf -s packet-ns_cert_exts-template 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>
40 #include <epan/conversation.h>
45 #include "packet-ber.h"
47 #define PNAME "NetScape Certificate Extensions"
48 #define PSNAME "NS_CERT_EXTS"
49 #define PFNAME "ns_cert_exts"
51 /* Initialize the protocol and registered fields */
52 int proto_ns_cert_exts = -1;
54 /*--- Included file: packet-ns_cert_exts-hf.c ---*/
55 #line 1 "packet-ns_cert_exts-hf.c"
56 static int hf_ns_cert_exts_BaseUrl_PDU = -1; /* BaseUrl */
57 static int hf_ns_cert_exts_RevocationUrl_PDU = -1; /* RevocationUrl */
58 static int hf_ns_cert_exts_CaRevocationUrl_PDU = -1; /* CaRevocationUrl */
59 static int hf_ns_cert_exts_CaPolicyUrl_PDU = -1; /* CaPolicyUrl */
60 static int hf_ns_cert_exts_Comment_PDU = -1; /* Comment */
61 static int hf_ns_cert_exts_SslServerName_PDU = -1; /* SslServerName */
62 static int hf_ns_cert_exts_CertRenewalUrl_PDU = -1; /* CertRenewalUrl */
63 static int hf_ns_cert_exts_CertType_PDU = -1; /* CertType */
65 static int hf_ns_cert_exts_CertType_client = -1;
66 static int hf_ns_cert_exts_CertType_server = -1;
67 static int hf_ns_cert_exts_CertType_ca = -1;
69 /*--- End of included file: packet-ns_cert_exts-hf.c ---*/
70 #line 46 "packet-ns_cert_exts-template.c"
72 /* Initialize the subtree pointers */
74 /*--- Included file: packet-ns_cert_exts-ett.c ---*/
75 #line 1 "packet-ns_cert_exts-ett.c"
76 static gint ett_ns_cert_exts_CertType = -1;
78 /*--- End of included file: packet-ns_cert_exts-ett.c ---*/
79 #line 49 "packet-ns_cert_exts-template.c"
82 /*--- Included file: packet-ns_cert_exts-fn.c ---*/
83 #line 1 "packet-ns_cert_exts-fn.c"
84 /*--- Fields for imported types ---*/
90 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_) {
91 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
92 actx, tree, tvb, offset, hf_index,
101 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_) {
102 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
103 actx, tree, tvb, offset, hf_index,
112 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_) {
113 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
114 actx, tree, tvb, offset, hf_index,
123 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_) {
124 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
125 actx, tree, tvb, offset, hf_index,
134 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_) {
135 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
136 actx, tree, tvb, offset, hf_index,
145 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_) {
146 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
147 actx, tree, tvb, offset, hf_index,
156 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_) {
157 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
158 actx, tree, tvb, offset, hf_index,
165 static const asn_namedbit CertType_bits[] = {
166 { 0, &hf_ns_cert_exts_CertType_client, -1, -1, "client", NULL },
167 { 1, &hf_ns_cert_exts_CertType_server, -1, -1, "server", NULL },
168 { 5, &hf_ns_cert_exts_CertType_ca, -1, -1, "ca", NULL },
169 { 0, NULL, 0, 0, NULL, NULL }
173 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_) {
174 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
175 CertType_bits, hf_index, ett_ns_cert_exts_CertType,
183 static void dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
185 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
186 dissect_ns_cert_exts_BaseUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_BaseUrl_PDU);
188 static void dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
190 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
191 dissect_ns_cert_exts_RevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_RevocationUrl_PDU);
193 static void dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
195 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
196 dissect_ns_cert_exts_CaRevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaRevocationUrl_PDU);
198 static void dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
200 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
201 dissect_ns_cert_exts_CaPolicyUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaPolicyUrl_PDU);
203 static void dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
205 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
206 dissect_ns_cert_exts_Comment(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_Comment_PDU);
208 static void dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
210 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
211 dissect_ns_cert_exts_SslServerName(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_SslServerName_PDU);
213 static void dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
215 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
216 dissect_ns_cert_exts_CertRenewalUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertRenewalUrl_PDU);
218 static void dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
220 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
221 dissect_ns_cert_exts_CertType(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertType_PDU);
225 /*--- End of included file: packet-ns_cert_exts-fn.c ---*/
226 #line 51 "packet-ns_cert_exts-template.c"
229 /*--- proto_register_ns_cert_exts -------------------------------------------*/
230 void proto_register_ns_cert_exts(void) {
233 static hf_register_info hf[] = {
235 /*--- Included file: packet-ns_cert_exts-hfarr.c ---*/
236 #line 1 "packet-ns_cert_exts-hfarr.c"
237 { &hf_ns_cert_exts_BaseUrl_PDU,
238 { "BaseUrl", "ns_cert_exts.BaseUrl",
239 FT_STRING, BASE_NONE, NULL, 0,
240 "ns_cert_exts.BaseUrl", HFILL }},
241 { &hf_ns_cert_exts_RevocationUrl_PDU,
242 { "RevocationUrl", "ns_cert_exts.RevocationUrl",
243 FT_STRING, BASE_NONE, NULL, 0,
244 "ns_cert_exts.RevocationUrl", HFILL }},
245 { &hf_ns_cert_exts_CaRevocationUrl_PDU,
246 { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
247 FT_STRING, BASE_NONE, NULL, 0,
248 "ns_cert_exts.CaRevocationUrl", HFILL }},
249 { &hf_ns_cert_exts_CaPolicyUrl_PDU,
250 { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
251 FT_STRING, BASE_NONE, NULL, 0,
252 "ns_cert_exts.CaPolicyUrl", HFILL }},
253 { &hf_ns_cert_exts_Comment_PDU,
254 { "Comment", "ns_cert_exts.Comment",
255 FT_STRING, BASE_NONE, NULL, 0,
256 "ns_cert_exts.Comment", HFILL }},
257 { &hf_ns_cert_exts_SslServerName_PDU,
258 { "SslServerName", "ns_cert_exts.SslServerName",
259 FT_STRING, BASE_NONE, NULL, 0,
260 "ns_cert_exts.SslServerName", HFILL }},
261 { &hf_ns_cert_exts_CertRenewalUrl_PDU,
262 { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
263 FT_STRING, BASE_NONE, NULL, 0,
264 "ns_cert_exts.CertRenewalUrl", HFILL }},
265 { &hf_ns_cert_exts_CertType_PDU,
266 { "CertType", "ns_cert_exts.CertType",
267 FT_BYTES, BASE_HEX, NULL, 0,
268 "ns_cert_exts.CertType", HFILL }},
269 { &hf_ns_cert_exts_CertType_client,
270 { "client", "ns_cert_exts.client",
271 FT_BOOLEAN, 8, NULL, 0x80,
273 { &hf_ns_cert_exts_CertType_server,
274 { "server", "ns_cert_exts.server",
275 FT_BOOLEAN, 8, NULL, 0x40,
277 { &hf_ns_cert_exts_CertType_ca,
278 { "ca", "ns_cert_exts.ca",
279 FT_BOOLEAN, 8, NULL, 0x04,
282 /*--- End of included file: packet-ns_cert_exts-hfarr.c ---*/
283 #line 59 "packet-ns_cert_exts-template.c"
286 /* List of subtrees */
287 static gint *ett[] = {
289 /*--- Included file: packet-ns_cert_exts-ettarr.c ---*/
290 #line 1 "packet-ns_cert_exts-ettarr.c"
291 &ett_ns_cert_exts_CertType,
293 /*--- End of included file: packet-ns_cert_exts-ettarr.c ---*/
294 #line 64 "packet-ns_cert_exts-template.c"
297 /* Register protocol */
298 proto_ns_cert_exts = proto_register_protocol(PNAME, PSNAME, PFNAME);
300 /* Register fields and subtrees */
301 proto_register_field_array(proto_ns_cert_exts, hf, array_length(hf));
302 proto_register_subtree_array(ett, array_length(ett));
307 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
308 void proto_reg_handoff_ns_cert_exts(void) {
310 /*--- Included file: packet-ns_cert_exts-dis-tab.c ---*/
311 #line 1 "packet-ns_cert_exts-dis-tab.c"
312 register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU, proto_ns_cert_exts, "ns-cert-exts.cert_type");
313 register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.base_url");
314 register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.revocation-url");
315 register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.ca-revocation-url");
316 register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.cert-renewal-url");
317 register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.ca-policy-url");
318 register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU, proto_ns_cert_exts, "ns-cert-exts.ssl-server-name");
319 register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU, proto_ns_cert_exts, "ns-cert-exts.comment");
322 /*--- End of included file: packet-ns_cert_exts-dis-tab.c ---*/
323 #line 79 "packet-ns_cert_exts-template.c"