Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ns_cert_exts.c
blob87e3e2ad18a614455e881f14500cdf3709c6cfc1
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-ns_cert_exts.c */
4 /* asn2wrs.py -b -q -L -p ns_cert_exts -c ./ns_cert_exts.cnf -s ./packet-ns_cert_exts-template -D . -O ../.. NETSCAPE-CERT-EXTS.asn */
6 /* packet-ns_cert_exts.c
7 * Routines for NetScape Certificate Extensions packet dissection
8 * Ronnie Sahlberg 2004
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <wsutil/array.h>
22 #include "packet-ber.h"
24 #define PNAME "NetScape Certificate Extensions"
25 #define PSNAME "NS_CERT_EXTS"
26 #define PFNAME "ns_cert_exts"
28 void proto_register_ns_cert_exts(void);
29 void proto_reg_handoff_ns_cert_exts(void);
31 /* Initialize the protocol and registered fields */
32 static int proto_ns_cert_exts;
33 static int hf_ns_cert_exts_BaseUrl_PDU; /* BaseUrl */
34 static int hf_ns_cert_exts_RevocationUrl_PDU; /* RevocationUrl */
35 static int hf_ns_cert_exts_CaRevocationUrl_PDU; /* CaRevocationUrl */
36 static int hf_ns_cert_exts_CaPolicyUrl_PDU; /* CaPolicyUrl */
37 static int hf_ns_cert_exts_Comment_PDU; /* Comment */
38 static int hf_ns_cert_exts_SslServerName_PDU; /* SslServerName */
39 static int hf_ns_cert_exts_CertRenewalUrl_PDU; /* CertRenewalUrl */
40 static int hf_ns_cert_exts_CertType_PDU; /* CertType */
41 /* named bits */
42 static int hf_ns_cert_exts_CertType_ssl_client;
43 static int hf_ns_cert_exts_CertType_ssl_server;
44 static int hf_ns_cert_exts_CertType_smime;
45 static int hf_ns_cert_exts_CertType_object_signing;
46 static int hf_ns_cert_exts_CertType_reserved_for_future_use;
47 static int hf_ns_cert_exts_CertType_ssl_ca;
48 static int hf_ns_cert_exts_CertType_smime_ca;
49 static int hf_ns_cert_exts_CertType_object_signing_ca;
51 /* Initialize the subtree pointers */
52 static int ett_ns_cert_exts_CertType;
56 static int
57 dissect_ns_cert_exts_BaseUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
58 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
59 actx, tree, tvb, offset, hf_index,
60 NULL);
62 return offset;
67 static int
68 dissect_ns_cert_exts_RevocationUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
69 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
70 actx, tree, tvb, offset, hf_index,
71 NULL);
73 return offset;
78 static int
79 dissect_ns_cert_exts_CaRevocationUrl(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
80 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_IA5String,
81 actx, tree, tvb, offset, hf_index,
82 NULL);
84 return offset;
89 static int
90 dissect_ns_cert_exts_CaPolicyUrl(bool 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,
93 NULL);
95 return offset;
100 static int
101 dissect_ns_cert_exts_Comment(bool 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,
104 NULL);
106 return offset;
111 static int
112 dissect_ns_cert_exts_SslServerName(bool 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,
115 NULL);
117 return offset;
122 static int
123 dissect_ns_cert_exts_CertRenewalUrl(bool 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,
126 NULL);
128 return offset;
132 static int * const CertType_bits[] = {
133 &hf_ns_cert_exts_CertType_ssl_client,
134 &hf_ns_cert_exts_CertType_ssl_server,
135 &hf_ns_cert_exts_CertType_smime,
136 &hf_ns_cert_exts_CertType_object_signing,
137 &hf_ns_cert_exts_CertType_reserved_for_future_use,
138 &hf_ns_cert_exts_CertType_ssl_ca,
139 &hf_ns_cert_exts_CertType_smime_ca,
140 &hf_ns_cert_exts_CertType_object_signing_ca,
141 NULL
144 static int
145 dissect_ns_cert_exts_CertType(bool 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_bitstring(implicit_tag, actx, tree, tvb, offset,
147 CertType_bits, 8, hf_index, ett_ns_cert_exts_CertType,
148 NULL);
150 return offset;
153 /*--- PDUs ---*/
155 static int dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
156 int offset = 0;
157 asn1_ctx_t asn1_ctx;
158 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
159 offset = dissect_ns_cert_exts_BaseUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_BaseUrl_PDU);
160 return offset;
162 static int dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
163 int offset = 0;
164 asn1_ctx_t asn1_ctx;
165 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
166 offset = dissect_ns_cert_exts_RevocationUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_RevocationUrl_PDU);
167 return offset;
169 static int dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
170 int offset = 0;
171 asn1_ctx_t asn1_ctx;
172 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
173 offset = dissect_ns_cert_exts_CaRevocationUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CaRevocationUrl_PDU);
174 return offset;
176 static int dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
177 int offset = 0;
178 asn1_ctx_t asn1_ctx;
179 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
180 offset = dissect_ns_cert_exts_CaPolicyUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CaPolicyUrl_PDU);
181 return offset;
183 static int dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
184 int offset = 0;
185 asn1_ctx_t asn1_ctx;
186 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
187 offset = dissect_ns_cert_exts_Comment(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_Comment_PDU);
188 return offset;
190 static int dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
191 int offset = 0;
192 asn1_ctx_t asn1_ctx;
193 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
194 offset = dissect_ns_cert_exts_SslServerName(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_SslServerName_PDU);
195 return offset;
197 static int dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
198 int offset = 0;
199 asn1_ctx_t asn1_ctx;
200 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
201 offset = dissect_ns_cert_exts_CertRenewalUrl(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CertRenewalUrl_PDU);
202 return offset;
204 static int dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
205 int offset = 0;
206 asn1_ctx_t asn1_ctx;
207 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
208 offset = dissect_ns_cert_exts_CertType(false, tvb, offset, &asn1_ctx, tree, hf_ns_cert_exts_CertType_PDU);
209 return offset;
214 /*--- proto_register_ns_cert_exts -------------------------------------------*/
215 void proto_register_ns_cert_exts(void) {
217 /* List of fields */
218 static hf_register_info hf[] = {
219 { &hf_ns_cert_exts_BaseUrl_PDU,
220 { "BaseUrl", "ns_cert_exts.BaseUrl",
221 FT_STRING, BASE_NONE, NULL, 0,
222 NULL, HFILL }},
223 { &hf_ns_cert_exts_RevocationUrl_PDU,
224 { "RevocationUrl", "ns_cert_exts.RevocationUrl",
225 FT_STRING, BASE_NONE, NULL, 0,
226 NULL, HFILL }},
227 { &hf_ns_cert_exts_CaRevocationUrl_PDU,
228 { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
229 FT_STRING, BASE_NONE, NULL, 0,
230 NULL, HFILL }},
231 { &hf_ns_cert_exts_CaPolicyUrl_PDU,
232 { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
233 FT_STRING, BASE_NONE, NULL, 0,
234 NULL, HFILL }},
235 { &hf_ns_cert_exts_Comment_PDU,
236 { "Comment", "ns_cert_exts.Comment",
237 FT_STRING, BASE_NONE, NULL, 0,
238 NULL, HFILL }},
239 { &hf_ns_cert_exts_SslServerName_PDU,
240 { "SslServerName", "ns_cert_exts.SslServerName",
241 FT_STRING, BASE_NONE, NULL, 0,
242 NULL, HFILL }},
243 { &hf_ns_cert_exts_CertRenewalUrl_PDU,
244 { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
245 FT_STRING, BASE_NONE, NULL, 0,
246 NULL, HFILL }},
247 { &hf_ns_cert_exts_CertType_PDU,
248 { "CertType", "ns_cert_exts.CertType",
249 FT_BYTES, BASE_NONE, NULL, 0,
250 NULL, HFILL }},
251 { &hf_ns_cert_exts_CertType_ssl_client,
252 { "ssl-client", "ns.cert.exts.CertType.ssl.client",
253 FT_BOOLEAN, 8, NULL, 0x80,
254 NULL, HFILL }},
255 { &hf_ns_cert_exts_CertType_ssl_server,
256 { "ssl-server", "ns.cert.exts.CertType.ssl.server",
257 FT_BOOLEAN, 8, NULL, 0x40,
258 NULL, HFILL }},
259 { &hf_ns_cert_exts_CertType_smime,
260 { "smime", "ns.cert.exts.CertType.smime",
261 FT_BOOLEAN, 8, NULL, 0x20,
262 NULL, HFILL }},
263 { &hf_ns_cert_exts_CertType_object_signing,
264 { "object-signing", "ns.cert.exts.CertType.object.signing",
265 FT_BOOLEAN, 8, NULL, 0x10,
266 NULL, HFILL }},
267 { &hf_ns_cert_exts_CertType_reserved_for_future_use,
268 { "reserved-for-future-use", "ns.cert.exts.CertType.reserved.for.future.use",
269 FT_BOOLEAN, 8, NULL, 0x08,
270 NULL, HFILL }},
271 { &hf_ns_cert_exts_CertType_ssl_ca,
272 { "ssl-ca", "ns.cert.exts.CertType.ssl.ca",
273 FT_BOOLEAN, 8, NULL, 0x04,
274 NULL, HFILL }},
275 { &hf_ns_cert_exts_CertType_smime_ca,
276 { "smime-ca", "ns.cert.exts.CertType.smime.ca",
277 FT_BOOLEAN, 8, NULL, 0x02,
278 NULL, HFILL }},
279 { &hf_ns_cert_exts_CertType_object_signing_ca,
280 { "object-signing-ca", "ns.cert.exts.CertType.object.signing.ca",
281 FT_BOOLEAN, 8, NULL, 0x01,
282 NULL, HFILL }},
285 /* List of subtrees */
286 static int *ett[] = {
287 &ett_ns_cert_exts_CertType,
290 /* Register protocol */
291 proto_ns_cert_exts = proto_register_protocol(PNAME, PSNAME, PFNAME);
293 /* Register fields and subtrees */
294 proto_register_field_array(proto_ns_cert_exts, hf, array_length(hf));
295 proto_register_subtree_array(ett, array_length(ett));
300 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
301 void proto_reg_handoff_ns_cert_exts(void) {
302 register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU, proto_ns_cert_exts, "ns_cert_exts.cert_type");
303 register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.base_url");
304 register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.revocation-url");
305 register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-revocation-url");
306 register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.cert-renewal-url");
307 register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU, proto_ns_cert_exts, "ns_cert_exts.ca-policy-url");
308 register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU, proto_ns_cert_exts, "ns_cert_exts.ssl-server-name");
309 register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU, proto_ns_cert_exts, "ns_cert_exts.comment");