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