Regenerate all asn2wrs generated dissectors.
[obnox/wireshark/wip.git] / epan / dissectors / packet-ns_cert_exts.c
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 */
5
6 /* Input file: packet-ns_cert_exts-template.c */
7
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
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
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.
23  *
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.
28  *
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.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <glib.h>
39 #include <epan/packet.h>
40
41 #include <stdio.h>
42 #include <string.h>
43
44 #include "packet-ber.h"
45
46 #define PNAME  "NetScape Certificate Extensions"
47 #define PSNAME "NS_CERT_EXTS"
48 #define PFNAME "ns_cert_exts"
49
50 /* Initialize the protocol and registered fields */
51 int proto_ns_cert_exts = -1;
52
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 */
63 /* named bits */
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;
67
68 /*--- End of included file: packet-ns_cert_exts-hf.c ---*/
69 #line 45 "packet-ns_cert_exts-template.c"
70
71 /* Initialize the subtree pointers */
72
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;
76
77 /*--- End of included file: packet-ns_cert_exts-ett.c ---*/
78 #line 48 "packet-ns_cert_exts-template.c"
79
80
81 /*--- Included file: packet-ns_cert_exts-fn.c ---*/
82 #line 1 "packet-ns_cert_exts-fn.c"
83
84
85 static int
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,
89                                             NULL);
90
91   return offset;
92 }
93
94
95
96 static int
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,
100                                             NULL);
101
102   return offset;
103 }
104
105
106
107 static int
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,
111                                             NULL);
112
113   return offset;
114 }
115
116
117
118 static int
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,
122                                             NULL);
123
124   return offset;
125 }
126
127
128
129 static int
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,
133                                             NULL);
134
135   return offset;
136 }
137
138
139
140 static int
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,
144                                             NULL);
145
146   return offset;
147 }
148
149
150
151 static int
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,
155                                             NULL);
156
157   return offset;
158 }
159
160
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 }
166 };
167
168 static int
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,
172                                     NULL);
173
174   return offset;
175 }
176
177 /*--- PDUs ---*/
178
179 static void dissect_BaseUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
180   asn1_ctx_t asn1_ctx;
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);
183 }
184 static void dissect_RevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
185   asn1_ctx_t asn1_ctx;
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);
188 }
189 static void dissect_CaRevocationUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
190   asn1_ctx_t asn1_ctx;
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);
193 }
194 static void dissect_CaPolicyUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
195   asn1_ctx_t asn1_ctx;
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);
198 }
199 static void dissect_Comment_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
200   asn1_ctx_t asn1_ctx;
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);
203 }
204 static void dissect_SslServerName_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
205   asn1_ctx_t asn1_ctx;
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);
208 }
209 static void dissect_CertRenewalUrl_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
210   asn1_ctx_t asn1_ctx;
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);
213 }
214 static void dissect_CertType_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
215   asn1_ctx_t asn1_ctx;
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);
218 }
219
220
221 /*--- End of included file: packet-ns_cert_exts-fn.c ---*/
222 #line 50 "packet-ns_cert_exts-template.c"
223
224
225 /*--- proto_register_ns_cert_exts -------------------------------------------*/
226 void proto_register_ns_cert_exts(void) {
227
228   /* List of fields */
229   static hf_register_info hf[] = {
230
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,
268         "", HFILL }},
269     { &hf_ns_cert_exts_CertType_server,
270       { "server", "ns_cert_exts.server",
271         FT_BOOLEAN, 8, NULL, 0x40,
272         "", HFILL }},
273     { &hf_ns_cert_exts_CertType_ca,
274       { "ca", "ns_cert_exts.ca",
275         FT_BOOLEAN, 8, NULL, 0x04,
276         "", HFILL }},
277
278 /*--- End of included file: packet-ns_cert_exts-hfarr.c ---*/
279 #line 58 "packet-ns_cert_exts-template.c"
280   };
281
282   /* List of subtrees */
283   static gint *ett[] = {
284
285 /*--- Included file: packet-ns_cert_exts-ettarr.c ---*/
286 #line 1 "packet-ns_cert_exts-ettarr.c"
287     &ett_ns_cert_exts_CertType,
288
289 /*--- End of included file: packet-ns_cert_exts-ettarr.c ---*/
290 #line 63 "packet-ns_cert_exts-template.c"
291   };
292
293   /* Register protocol */
294   proto_ns_cert_exts = proto_register_protocol(PNAME, PSNAME, PFNAME);
295
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));
299
300 }
301
302
303 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
304 void proto_reg_handoff_ns_cert_exts(void) {
305
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");
316
317
318 /*--- End of included file: packet-ns_cert_exts-dis-tab.c ---*/
319 #line 78 "packet-ns_cert_exts-template.c"
320 }
321