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>
44 #include "packet-ber.h"
46 #define PNAME "NetScape Certificate Extensions"
47 #define PSNAME "NS_CERT_EXTS"
48 #define PFNAME "ns_cert_exts"
50 /* Initialize the protocol and registered fields */
51 int proto_ns_cert_exts = -1;
53 /*--- Included file: packet-ns_cert_exts-hf.c ---*/
54 #line 1 "packet-ns_cert_exts-hf.c"
55 static int hf_ns_cert_exts_BaseUrl_PDU = -1; /* BaseUrl */
56 static int hf_ns_cert_exts_RevocationUrl_PDU = -1; /* RevocationUrl */
57 static int hf_ns_cert_exts_CaRevocationUrl_PDU = -1; /* CaRevocationUrl */
58 static int hf_ns_cert_exts_CaPolicyUrl_PDU = -1; /* CaPolicyUrl */
59 static int hf_ns_cert_exts_Comment_PDU = -1; /* Comment */
60 static int hf_ns_cert_exts_SslServerName_PDU = -1; /* SslServerName */
61 static int hf_ns_cert_exts_CertRenewalUrl_PDU = -1; /* CertRenewalUrl */
62 static int hf_ns_cert_exts_CertType_PDU = -1; /* CertType */
64 static int hf_ns_cert_exts_CertType_client = -1;
65 static int hf_ns_cert_exts_CertType_server = -1;
66 static int hf_ns_cert_exts_CertType_ca = -1;
68 /*--- End of included file: packet-ns_cert_exts-hf.c ---*/
69 #line 45 "packet-ns_cert_exts-template.c"
71 /* Initialize the subtree pointers */
73 /*--- Included file: packet-ns_cert_exts-ett.c ---*/
74 #line 1 "packet-ns_cert_exts-ett.c"
75 static gint ett_ns_cert_exts_CertType = -1;
77 /*--- End of included file: packet-ns_cert_exts-ett.c ---*/
78 #line 48 "packet-ns_cert_exts-template.c"
81 /*--- Included file: packet-ns_cert_exts-fn.c ---*/
82 #line 1 "packet-ns_cert_exts-fn.c"
86 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_) {
87 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
88 actx, tree, tvb, offset, hf_index,
97 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_) {
98 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
99 actx, tree, tvb, offset, hf_index,
108 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_) {
109 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
110 actx, tree, tvb, offset, hf_index,
119 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_) {
120 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
121 actx, tree, tvb, offset, hf_index,
130 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_) {
131 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
132 actx, tree, tvb, offset, hf_index,
141 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_) {
142 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
143 actx, tree, tvb, offset, hf_index,
152 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_) {
153 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
154 actx, tree, tvb, offset, hf_index,
161 static const asn_namedbit CertType_bits[] = {
162 { 0, &hf_ns_cert_exts_CertType_client, -1, -1, "client", NULL },
163 { 1, &hf_ns_cert_exts_CertType_server, -1, -1, "server", NULL },
164 { 5, &hf_ns_cert_exts_CertType_ca, -1, -1, "ca", NULL },
165 { 0, NULL, 0, 0, NULL, NULL }
169 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_) {
170 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
171 CertType_bits, hf_index, ett_ns_cert_exts_CertType,
179 static void dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
181 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
182 dissect_ns_cert_exts_BaseUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_BaseUrl_PDU);
184 static void dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
186 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
187 dissect_ns_cert_exts_RevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_RevocationUrl_PDU);
189 static void dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
191 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
192 dissect_ns_cert_exts_CaRevocationUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaRevocationUrl_PDU);
194 static void dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
196 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
197 dissect_ns_cert_exts_CaPolicyUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CaPolicyUrl_PDU);
199 static void dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
201 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
202 dissect_ns_cert_exts_Comment(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_Comment_PDU);
204 static void dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
206 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
207 dissect_ns_cert_exts_SslServerName(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_SslServerName_PDU);
209 static void dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
211 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
212 dissect_ns_cert_exts_CertRenewalUrl(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertRenewalUrl_PDU);
214 static void dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
216 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
217 dissect_ns_cert_exts_CertType(FALSE, tvb, 0, &asn1_ctx, tree, hf_ns_cert_exts_CertType_PDU);
221 /*--- End of included file: packet-ns_cert_exts-fn.c ---*/
222 #line 50 "packet-ns_cert_exts-template.c"
225 /*--- proto_register_ns_cert_exts -------------------------------------------*/
226 void proto_register_ns_cert_exts(void) {
229 static hf_register_info hf[] = {
231 /*--- Included file: packet-ns_cert_exts-hfarr.c ---*/
232 #line 1 "packet-ns_cert_exts-hfarr.c"
233 { &hf_ns_cert_exts_BaseUrl_PDU,
234 { "BaseUrl", "ns_cert_exts.BaseUrl",
235 FT_STRING, BASE_NONE, NULL, 0,
236 "ns_cert_exts.BaseUrl", HFILL }},
237 { &hf_ns_cert_exts_RevocationUrl_PDU,
238 { "RevocationUrl", "ns_cert_exts.RevocationUrl",
239 FT_STRING, BASE_NONE, NULL, 0,
240 "ns_cert_exts.RevocationUrl", HFILL }},
241 { &hf_ns_cert_exts_CaRevocationUrl_PDU,
242 { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
243 FT_STRING, BASE_NONE, NULL, 0,
244 "ns_cert_exts.CaRevocationUrl", HFILL }},
245 { &hf_ns_cert_exts_CaPolicyUrl_PDU,
246 { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
247 FT_STRING, BASE_NONE, NULL, 0,
248 "ns_cert_exts.CaPolicyUrl", HFILL }},
249 { &hf_ns_cert_exts_Comment_PDU,
250 { "Comment", "ns_cert_exts.Comment",
251 FT_STRING, BASE_NONE, NULL, 0,
252 "ns_cert_exts.Comment", HFILL }},
253 { &hf_ns_cert_exts_SslServerName_PDU,
254 { "SslServerName", "ns_cert_exts.SslServerName",
255 FT_STRING, BASE_NONE, NULL, 0,
256 "ns_cert_exts.SslServerName", HFILL }},
257 { &hf_ns_cert_exts_CertRenewalUrl_PDU,
258 { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
259 FT_STRING, BASE_NONE, NULL, 0,
260 "ns_cert_exts.CertRenewalUrl", HFILL }},
261 { &hf_ns_cert_exts_CertType_PDU,
262 { "CertType", "ns_cert_exts.CertType",
263 FT_BYTES, BASE_HEX, NULL, 0,
264 "ns_cert_exts.CertType", HFILL }},
265 { &hf_ns_cert_exts_CertType_client,
266 { "client", "ns_cert_exts.client",
267 FT_BOOLEAN, 8, NULL, 0x80,
269 { &hf_ns_cert_exts_CertType_server,
270 { "server", "ns_cert_exts.server",
271 FT_BOOLEAN, 8, NULL, 0x40,
273 { &hf_ns_cert_exts_CertType_ca,
274 { "ca", "ns_cert_exts.ca",
275 FT_BOOLEAN, 8, NULL, 0x04,
278 /*--- End of included file: packet-ns_cert_exts-hfarr.c ---*/
279 #line 58 "packet-ns_cert_exts-template.c"
282 /* List of subtrees */
283 static gint *ett[] = {
285 /*--- Included file: packet-ns_cert_exts-ettarr.c ---*/
286 #line 1 "packet-ns_cert_exts-ettarr.c"
287 &ett_ns_cert_exts_CertType,
289 /*--- End of included file: packet-ns_cert_exts-ettarr.c ---*/
290 #line 63 "packet-ns_cert_exts-template.c"
293 /* Register protocol */
294 proto_ns_cert_exts = proto_register_protocol(PNAME, PSNAME, PFNAME);
296 /* Register fields and subtrees */
297 proto_register_field_array(proto_ns_cert_exts, hf, array_length(hf));
298 proto_register_subtree_array(ett, array_length(ett));
303 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
304 void proto_reg_handoff_ns_cert_exts(void) {
306 /*--- Included file: packet-ns_cert_exts-dis-tab.c ---*/
307 #line 1 "packet-ns_cert_exts-dis-tab.c"
308 register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU, proto_ns_cert_exts, "ns-cert-exts.cert_type");
309 register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.base_url");
310 register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.revocation-url");
311 register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.ca-revocation-url");
312 register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.cert-renewal-url");
313 register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU, proto_ns_cert_exts, "ns-cert-exts.ca-policy-url");
314 register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU, proto_ns_cert_exts, "ns-cert-exts.ssl-server-name");
315 register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU, proto_ns_cert_exts, "ns-cert-exts.comment");
318 /*--- End of included file: packet-ns_cert_exts-dis-tab.c ---*/
319 #line 78 "packet-ns_cert_exts-template.c"