Get rid of get_ber_last_reated_item() and fix dissection of wIN-TriggerList.
[obnox/wireshark/wip.git] / epan / dissectors / packet-pkixproxy.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* ./packet-pkixproxy.c                                                       */
4 /* ../../tools/asn2wrs.py -b -e -p pkixproxy -c pkixproxy.cnf -s packet-pkixproxy-template PKIXProxy.asn */
5
6 /* Input file: packet-pkixproxy-template.c */
7
8 #line 1 "packet-pkixproxy-template.c"
9 /* packet-pkixproxy.c
10  * Routines for RFC3820 PKIXProxy 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 #include <epan/oids.h>
41 #include <epan/asn1.h>
42
43 #include <stdio.h>
44 #include <string.h>
45
46 #include "packet-ber.h"
47 #include "packet-pkixproxy.h"
48
49 #define PNAME  "PKIXProxy (RFC3820)"
50 #define PSNAME "PKIXPROXY"
51 #define PFNAME "pkixproxy"
52
53 /* Initialize the protocol and registered fields */
54 static int proto_pkixproxy = -1;
55
56 /*--- Included file: packet-pkixproxy-hf.c ---*/
57 #line 1 "packet-pkixproxy-hf.c"
58 static int hf_pkixproxy_ProxyCertInfoExtension_PDU = -1;  /* ProxyCertInfoExtension */
59 static int hf_pkixproxy_pCPathLenConstraint = -1;  /* ProxyCertPathLengthConstraint */
60 static int hf_pkixproxy_proxyPolicy = -1;         /* ProxyPolicy */
61 static int hf_pkixproxy_policyLanguage = -1;      /* OBJECT_IDENTIFIER */
62 static int hf_pkixproxy_policy = -1;              /* OCTET_STRING */
63
64 /*--- End of included file: packet-pkixproxy-hf.c ---*/
65 #line 48 "packet-pkixproxy-template.c"
66
67 /* Initialize the subtree pointers */
68
69 /*--- Included file: packet-pkixproxy-ett.c ---*/
70 #line 1 "packet-pkixproxy-ett.c"
71 static gint ett_pkixproxy_ProxyCertInfoExtension = -1;
72 static gint ett_pkixproxy_ProxyPolicy = -1;
73
74 /*--- End of included file: packet-pkixproxy-ett.c ---*/
75 #line 51 "packet-pkixproxy-template.c"
76
77
78 /*--- Included file: packet-pkixproxy-fn.c ---*/
79 #line 1 "packet-pkixproxy-fn.c"
80 /*--- Fields for imported types ---*/
81
82
83
84
85 static int
86 dissect_pkixproxy_ProxyCertPathLengthConstraint(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_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
88                                   NULL);
89
90   return offset;
91 }
92 static int dissect_pCPathLenConstraint(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
93   return dissect_pkixproxy_ProxyCertPathLengthConstraint(FALSE, tvb, offset, actx, tree, hf_pkixproxy_pCPathLenConstraint);
94 }
95
96
97
98 static int
99 dissect_pkixproxy_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
100   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
101
102   return offset;
103 }
104 static int dissect_policyLanguage(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
105   return dissect_pkixproxy_OBJECT_IDENTIFIER(FALSE, tvb, offset, actx, tree, hf_pkixproxy_policyLanguage);
106 }
107
108
109
110 static int
111 dissect_pkixproxy_OCTET_STRING(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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
113                                        NULL);
114
115   return offset;
116 }
117 static int dissect_policy(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
118   return dissect_pkixproxy_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_pkixproxy_policy);
119 }
120
121
122 static const ber_old_sequence_t ProxyPolicy_sequence[] = {
123   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_policyLanguage },
124   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_policy },
125   { 0, 0, 0, NULL }
126 };
127
128 static int
129 dissect_pkixproxy_ProxyPolicy(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
130   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
131                                        ProxyPolicy_sequence, hf_index, ett_pkixproxy_ProxyPolicy);
132
133   return offset;
134 }
135 static int dissect_proxyPolicy(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
136   return dissect_pkixproxy_ProxyPolicy(FALSE, tvb, offset, actx, tree, hf_pkixproxy_proxyPolicy);
137 }
138
139
140 static const ber_old_sequence_t ProxyCertInfoExtension_sequence[] = {
141   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pCPathLenConstraint },
142   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_proxyPolicy },
143   { 0, 0, 0, NULL }
144 };
145
146 static int
147 dissect_pkixproxy_ProxyCertInfoExtension(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
148   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
149                                        ProxyCertInfoExtension_sequence, hf_index, ett_pkixproxy_ProxyCertInfoExtension);
150
151   return offset;
152 }
153
154 /*--- PDUs ---*/
155
156 static void dissect_ProxyCertInfoExtension_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
157   asn1_ctx_t asn1_ctx;
158   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
159   dissect_pkixproxy_ProxyCertInfoExtension(FALSE, tvb, 0, &asn1_ctx, tree, hf_pkixproxy_ProxyCertInfoExtension_PDU);
160 }
161
162
163 /*--- End of included file: packet-pkixproxy-fn.c ---*/
164 #line 53 "packet-pkixproxy-template.c"
165
166
167 /*--- proto_register_pkixproxy ----------------------------------------------*/
168 void proto_register_pkixproxy(void) {
169
170   /* List of fields */
171   static hf_register_info hf[] = {
172
173 /*--- Included file: packet-pkixproxy-hfarr.c ---*/
174 #line 1 "packet-pkixproxy-hfarr.c"
175     { &hf_pkixproxy_ProxyCertInfoExtension_PDU,
176       { "ProxyCertInfoExtension", "pkixproxy.ProxyCertInfoExtension",
177         FT_NONE, BASE_NONE, NULL, 0,
178         "pkixproxy.ProxyCertInfoExtension", HFILL }},
179     { &hf_pkixproxy_pCPathLenConstraint,
180       { "pCPathLenConstraint", "pkixproxy.pCPathLenConstraint",
181         FT_INT32, BASE_DEC, NULL, 0,
182         "pkixproxy.ProxyCertPathLengthConstraint", HFILL }},
183     { &hf_pkixproxy_proxyPolicy,
184       { "proxyPolicy", "pkixproxy.proxyPolicy",
185         FT_NONE, BASE_NONE, NULL, 0,
186         "pkixproxy.ProxyPolicy", HFILL }},
187     { &hf_pkixproxy_policyLanguage,
188       { "policyLanguage", "pkixproxy.policyLanguage",
189         FT_OID, BASE_NONE, NULL, 0,
190         "pkixproxy.OBJECT_IDENTIFIER", HFILL }},
191     { &hf_pkixproxy_policy,
192       { "policy", "pkixproxy.policy",
193         FT_BYTES, BASE_HEX, NULL, 0,
194         "pkixproxy.OCTET_STRING", HFILL }},
195
196 /*--- End of included file: packet-pkixproxy-hfarr.c ---*/
197 #line 61 "packet-pkixproxy-template.c"
198   };
199
200   /* List of subtrees */
201   static gint *ett[] = {
202
203 /*--- Included file: packet-pkixproxy-ettarr.c ---*/
204 #line 1 "packet-pkixproxy-ettarr.c"
205     &ett_pkixproxy_ProxyCertInfoExtension,
206     &ett_pkixproxy_ProxyPolicy,
207
208 /*--- End of included file: packet-pkixproxy-ettarr.c ---*/
209 #line 66 "packet-pkixproxy-template.c"
210   };
211
212   /* Register protocol */
213   proto_pkixproxy = proto_register_protocol(PNAME, PSNAME, PFNAME);
214
215   /* Register fields and subtrees */
216   proto_register_field_array(proto_pkixproxy, hf, array_length(hf));
217   proto_register_subtree_array(ett, array_length(ett));
218
219 }
220
221
222 /*--- proto_reg_handoff_pkixproxy -------------------------------------------*/
223 void proto_reg_handoff_pkixproxy(void) {
224
225 /*--- Included file: packet-pkixproxy-dis-tab.c ---*/
226 #line 1 "packet-pkixproxy-dis-tab.c"
227   register_ber_oid_dissector("1.3.6.1.5.5.7.1.14", dissect_ProxyCertInfoExtension_PDU, proto_pkixproxy, "id-pe-proxyCertInfo");
228
229
230 /*--- End of included file: packet-pkixproxy-dis-tab.c ---*/
231 #line 81 "packet-pkixproxy-template.c"
232   add_oid_str_name("1.3.6.1.5.5.7.21.0", "id-ppl-anyLanguage");
233   add_oid_str_name("1.3.6.1.5.5.7.21.1", "id-ppl-inheritAll");
234   add_oid_str_name("1.3.6.1.5.5.7.21.2", "id-ppl-independent");
235 }
236