Update do use the -X and -T asn2wrs flags.
[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 -X -T -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
81
82 static int
83 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_) {
84   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
85                                   NULL);
86
87   return offset;
88 }
89
90
91
92 static int
93 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_) {
94   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
95
96   return offset;
97 }
98
99
100
101 static int
102 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_) {
103   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
104                                        NULL);
105
106   return offset;
107 }
108
109
110 static const ber_sequence_t ProxyPolicy_sequence[] = {
111   { &hf_pkixproxy_policyLanguage, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pkixproxy_OBJECT_IDENTIFIER },
112   { &hf_pkixproxy_policy    , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixproxy_OCTET_STRING },
113   { NULL, 0, 0, 0, NULL }
114 };
115
116 static int
117 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_) {
118   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
119                                    ProxyPolicy_sequence, hf_index, ett_pkixproxy_ProxyPolicy);
120
121   return offset;
122 }
123
124
125 static const ber_sequence_t ProxyCertInfoExtension_sequence[] = {
126   { &hf_pkixproxy_pCPathLenConstraint, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixproxy_ProxyCertPathLengthConstraint },
127   { &hf_pkixproxy_proxyPolicy, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkixproxy_ProxyPolicy },
128   { NULL, 0, 0, 0, NULL }
129 };
130
131 static int
132 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_) {
133   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
134                                    ProxyCertInfoExtension_sequence, hf_index, ett_pkixproxy_ProxyCertInfoExtension);
135
136   return offset;
137 }
138
139 /*--- PDUs ---*/
140
141 static void dissect_ProxyCertInfoExtension_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
142   asn1_ctx_t asn1_ctx;
143   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
144   dissect_pkixproxy_ProxyCertInfoExtension(FALSE, tvb, 0, &asn1_ctx, tree, hf_pkixproxy_ProxyCertInfoExtension_PDU);
145 }
146
147
148 /*--- End of included file: packet-pkixproxy-fn.c ---*/
149 #line 53 "packet-pkixproxy-template.c"
150
151
152 /*--- proto_register_pkixproxy ----------------------------------------------*/
153 void proto_register_pkixproxy(void) {
154
155   /* List of fields */
156   static hf_register_info hf[] = {
157
158 /*--- Included file: packet-pkixproxy-hfarr.c ---*/
159 #line 1 "packet-pkixproxy-hfarr.c"
160     { &hf_pkixproxy_ProxyCertInfoExtension_PDU,
161       { "ProxyCertInfoExtension", "pkixproxy.ProxyCertInfoExtension",
162         FT_NONE, BASE_NONE, NULL, 0,
163         "pkixproxy.ProxyCertInfoExtension", HFILL }},
164     { &hf_pkixproxy_pCPathLenConstraint,
165       { "pCPathLenConstraint", "pkixproxy.pCPathLenConstraint",
166         FT_INT32, BASE_DEC, NULL, 0,
167         "pkixproxy.ProxyCertPathLengthConstraint", HFILL }},
168     { &hf_pkixproxy_proxyPolicy,
169       { "proxyPolicy", "pkixproxy.proxyPolicy",
170         FT_NONE, BASE_NONE, NULL, 0,
171         "pkixproxy.ProxyPolicy", HFILL }},
172     { &hf_pkixproxy_policyLanguage,
173       { "policyLanguage", "pkixproxy.policyLanguage",
174         FT_OID, BASE_NONE, NULL, 0,
175         "pkixproxy.OBJECT_IDENTIFIER", HFILL }},
176     { &hf_pkixproxy_policy,
177       { "policy", "pkixproxy.policy",
178         FT_BYTES, BASE_HEX, NULL, 0,
179         "pkixproxy.OCTET_STRING", HFILL }},
180
181 /*--- End of included file: packet-pkixproxy-hfarr.c ---*/
182 #line 61 "packet-pkixproxy-template.c"
183   };
184
185   /* List of subtrees */
186   static gint *ett[] = {
187
188 /*--- Included file: packet-pkixproxy-ettarr.c ---*/
189 #line 1 "packet-pkixproxy-ettarr.c"
190     &ett_pkixproxy_ProxyCertInfoExtension,
191     &ett_pkixproxy_ProxyPolicy,
192
193 /*--- End of included file: packet-pkixproxy-ettarr.c ---*/
194 #line 66 "packet-pkixproxy-template.c"
195   };
196
197   /* Register protocol */
198   proto_pkixproxy = proto_register_protocol(PNAME, PSNAME, PFNAME);
199
200   /* Register fields and subtrees */
201   proto_register_field_array(proto_pkixproxy, hf, array_length(hf));
202   proto_register_subtree_array(ett, array_length(ett));
203
204 }
205
206
207 /*--- proto_reg_handoff_pkixproxy -------------------------------------------*/
208 void proto_reg_handoff_pkixproxy(void) {
209
210 /*--- Included file: packet-pkixproxy-dis-tab.c ---*/
211 #line 1 "packet-pkixproxy-dis-tab.c"
212   register_ber_oid_dissector("1.3.6.1.5.5.7.1.14", dissect_ProxyCertInfoExtension_PDU, proto_pkixproxy, "id-pe-proxyCertInfo");
213
214
215 /*--- End of included file: packet-pkixproxy-dis-tab.c ---*/
216 #line 81 "packet-pkixproxy-template.c"
217   oid_add_from_string("id-ppl-anyLanguage","1.3.6.1.5.5.7.21.0");
218   oid_add_from_string("id-ppl-inheritAll","1.3.6.1.5.5.7.21.1");
219   oid_add_from_string("id-ppl-independent","1.3.6.1.5.5.7.21.2");
220 }
221