get users of oid_resolv to use the new oids, rollout packet-snmp.c
[obnox/wireshark/wip.git] / epan / dissectors / packet-pkixtsp.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* ./packet-pkixtsp.c                                                         */
4 /* ../../tools/asn2wrs.py -b -e -p pkixtsp -c pkixtsp.cnf -s packet-pkixtsp-template PKIXTSP.asn */
5
6 /* Input file: packet-pkixtsp-template.c */
7
8 #line 1 "packet-pkixtsp-template.c"
9 /* packet-pkixtsp.c
10  * Routines for RFC2634 Extended Security Services 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 <epan/asn1.h>
45 #include "packet-ber.h"
46 #include "packet-pkixtsp.h"
47 #include "packet-pkix1explicit.h"
48 #include "packet-pkix1implicit.h"
49 #include "packet-cms.h"
50
51 #define PNAME  "PKIX Time Stamp Protocol"
52 #define PSNAME "PKIXTSP"
53 #define PFNAME "pkixtsp"
54
55 /* Initialize the protocol and registered fields */
56 static int proto_pkixtsp = -1;
57
58 /*--- Included file: packet-pkixtsp-hf.c ---*/
59 #line 1 "packet-pkixtsp-hf.c"
60 static int hf_pkixtsp_version = -1;               /* T_version */
61 static int hf_pkixtsp_messageImprint = -1;        /* MessageImprint */
62 static int hf_pkixtsp_reqPolicy = -1;             /* TSAPolicyId */
63 static int hf_pkixtsp_nonce = -1;                 /* INTEGER */
64 static int hf_pkixtsp_certReq = -1;               /* BOOLEAN */
65 static int hf_pkixtsp_extensions = -1;            /* Extensions */
66 static int hf_pkixtsp_hashAlgorithm = -1;         /* AlgorithmIdentifier */
67 static int hf_pkixtsp_hashedMessage = -1;         /* OCTET_STRING */
68 static int hf_pkixtsp_status = -1;                /* PKIStatusInfo */
69 static int hf_pkixtsp_timeStampToken = -1;        /* TimeStampToken */
70 static int hf_pkixtsp_pki_status = -1;            /* PKIStatus */
71 static int hf_pkixtsp_failInfo = -1;              /* PKIFailureInfo */
72 static int hf_pkixtsp_tst_version = -1;           /* tst_version */
73 static int hf_pkixtsp_policy = -1;                /* TSAPolicyId */
74 static int hf_pkixtsp_serialNumber = -1;          /* INTEGER */
75 static int hf_pkixtsp_genTime = -1;               /* GeneralizedTime */
76 static int hf_pkixtsp_accuracy = -1;              /* Accuracy */
77 static int hf_pkixtsp_ordering = -1;              /* BOOLEAN */
78 static int hf_pkixtsp_tsa = -1;                   /* GeneralName */
79 static int hf_pkixtsp_seconds = -1;               /* INTEGER */
80 static int hf_pkixtsp_millis = -1;                /* INTEGER_1_999 */
81 static int hf_pkixtsp_micros = -1;                /* INTEGER_1_999 */
82 /* named bits */
83 static int hf_pkixtsp_PKIFailureInfo_badAlg = -1;
84 static int hf_pkixtsp_PKIFailureInfo_badRequest = -1;
85 static int hf_pkixtsp_PKIFailureInfo_badDataFormat = -1;
86 static int hf_pkixtsp_PKIFailureInfo_timeNotAvailable = -1;
87 static int hf_pkixtsp_PKIFailureInfo_unacceptedPolicy = -1;
88 static int hf_pkixtsp_PKIFailureInfo_unacceptedExtension = -1;
89 static int hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable = -1;
90 static int hf_pkixtsp_PKIFailureInfo_systemFailure = -1;
91
92 /*--- End of included file: packet-pkixtsp-hf.c ---*/
93 #line 50 "packet-pkixtsp-template.c"
94
95 /* Initialize the subtree pointers */
96 static gint ett_pkixtsp = -1;
97
98 /*--- Included file: packet-pkixtsp-ett.c ---*/
99 #line 1 "packet-pkixtsp-ett.c"
100 static gint ett_pkixtsp_TimeStampReq = -1;
101 static gint ett_pkixtsp_MessageImprint = -1;
102 static gint ett_pkixtsp_TimeStampResp = -1;
103 static gint ett_pkixtsp_PKIStatusInfo = -1;
104 static gint ett_pkixtsp_PKIFailureInfo = -1;
105 static gint ett_pkixtsp_TSTInfo = -1;
106 static gint ett_pkixtsp_Accuracy = -1;
107
108 /*--- End of included file: packet-pkixtsp-ett.c ---*/
109 #line 54 "packet-pkixtsp-template.c"
110
111
112
113 /*--- Included file: packet-pkixtsp-fn.c ---*/
114 #line 1 "packet-pkixtsp-fn.c"
115 /*--- Fields for imported types ---*/
116
117 static int dissect_extensions_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
118   return dissect_pkix1explicit_Extensions(TRUE, tvb, offset, actx, tree, hf_pkixtsp_extensions);
119 }
120 static int dissect_hashAlgorithm(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
121   return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, actx, tree, hf_pkixtsp_hashAlgorithm);
122 }
123 static int dissect_tsa_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
124   return dissect_pkix1implicit_GeneralName(TRUE, tvb, offset, actx, tree, hf_pkixtsp_tsa);
125 }
126
127
128 static const value_string pkixtsp_T_version_vals[] = {
129   {   1, "v1" },
130   { 0, NULL }
131 };
132
133
134 static int
135 dissect_pkixtsp_T_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
136   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
137                                   NULL);
138
139   return offset;
140 }
141 static int dissect_version(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
142   return dissect_pkixtsp_T_version(FALSE, tvb, offset, actx, tree, hf_pkixtsp_version);
143 }
144
145
146
147 static int
148 dissect_pkixtsp_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_) {
149   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
150                                        NULL);
151
152   return offset;
153 }
154 static int dissect_hashedMessage(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
155   return dissect_pkixtsp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_pkixtsp_hashedMessage);
156 }
157
158
159 static const ber_old_sequence_t MessageImprint_sequence[] = {
160   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_hashAlgorithm },
161   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_hashedMessage },
162   { 0, 0, 0, NULL }
163 };
164
165 static int
166 dissect_pkixtsp_MessageImprint(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
167   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
168                                        MessageImprint_sequence, hf_index, ett_pkixtsp_MessageImprint);
169
170   return offset;
171 }
172 static int dissect_messageImprint(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
173   return dissect_pkixtsp_MessageImprint(FALSE, tvb, offset, actx, tree, hf_pkixtsp_messageImprint);
174 }
175
176
177
178 static int
179 dissect_pkixtsp_TSAPolicyId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
180   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
181
182   return offset;
183 }
184 static int dissect_reqPolicy(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
185   return dissect_pkixtsp_TSAPolicyId(FALSE, tvb, offset, actx, tree, hf_pkixtsp_reqPolicy);
186 }
187 static int dissect_policy(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
188   return dissect_pkixtsp_TSAPolicyId(FALSE, tvb, offset, actx, tree, hf_pkixtsp_policy);
189 }
190
191
192
193 static int
194 dissect_pkixtsp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
195   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
196                                   NULL);
197
198   return offset;
199 }
200 static int dissect_nonce(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
201   return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, actx, tree, hf_pkixtsp_nonce);
202 }
203 static int dissect_serialNumber(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
204   return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, actx, tree, hf_pkixtsp_serialNumber);
205 }
206 static int dissect_seconds(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
207   return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, actx, tree, hf_pkixtsp_seconds);
208 }
209
210
211
212 static int
213 dissect_pkixtsp_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
214   offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index);
215
216   return offset;
217 }
218 static int dissect_certReq(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
219   return dissect_pkixtsp_BOOLEAN(FALSE, tvb, offset, actx, tree, hf_pkixtsp_certReq);
220 }
221 static int dissect_ordering(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
222   return dissect_pkixtsp_BOOLEAN(FALSE, tvb, offset, actx, tree, hf_pkixtsp_ordering);
223 }
224
225
226 static const ber_old_sequence_t TimeStampReq_sequence[] = {
227   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
228   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_messageImprint },
229   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_reqPolicy },
230   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_nonce },
231   { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_certReq },
232   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_extensions_impl },
233   { 0, 0, 0, NULL }
234 };
235
236 static int
237 dissect_pkixtsp_TimeStampReq(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
238   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
239                                        TimeStampReq_sequence, hf_index, ett_pkixtsp_TimeStampReq);
240
241   return offset;
242 }
243
244
245 static const value_string pkixtsp_PKIStatus_vals[] = {
246   {   0, "granted" },
247   {   1, "grantedWithMods" },
248   {   2, "rejection" },
249   {   3, "waiting" },
250   {   4, "revocationWarning" },
251   {   5, "revocationNotification" },
252   { 0, NULL }
253 };
254
255
256 static int
257 dissect_pkixtsp_PKIStatus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
258   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
259                                   NULL);
260
261   return offset;
262 }
263 static int dissect_pki_status(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
264   return dissect_pkixtsp_PKIStatus(FALSE, tvb, offset, actx, tree, hf_pkixtsp_pki_status);
265 }
266
267
268 static const asn_namedbit PKIFailureInfo_bits[] = {
269   {  0, &hf_pkixtsp_PKIFailureInfo_badAlg, -1, -1, "badAlg", NULL },
270   {  2, &hf_pkixtsp_PKIFailureInfo_badRequest, -1, -1, "badRequest", NULL },
271   {  5, &hf_pkixtsp_PKIFailureInfo_badDataFormat, -1, -1, "badDataFormat", NULL },
272   { 14, &hf_pkixtsp_PKIFailureInfo_timeNotAvailable, -1, -1, "timeNotAvailable", NULL },
273   { 15, &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy, -1, -1, "unacceptedPolicy", NULL },
274   { 16, &hf_pkixtsp_PKIFailureInfo_unacceptedExtension, -1, -1, "unacceptedExtension", NULL },
275   { 17, &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable, -1, -1, "addInfoNotAvailable", NULL },
276   { 25, &hf_pkixtsp_PKIFailureInfo_systemFailure, -1, -1, "systemFailure", NULL },
277   { 0, NULL, 0, 0, NULL, NULL }
278 };
279
280 static int
281 dissect_pkixtsp_PKIFailureInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
282   offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
283                                     PKIFailureInfo_bits, hf_index, ett_pkixtsp_PKIFailureInfo,
284                                     NULL);
285
286   return offset;
287 }
288 static int dissect_failInfo(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
289   return dissect_pkixtsp_PKIFailureInfo(FALSE, tvb, offset, actx, tree, hf_pkixtsp_failInfo);
290 }
291
292
293 static const ber_old_sequence_t PKIStatusInfo_sequence[] = {
294   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pki_status },
295   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_failInfo },
296   { 0, 0, 0, NULL }
297 };
298
299 static int
300 dissect_pkixtsp_PKIStatusInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
301   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
302                                        PKIStatusInfo_sequence, hf_index, ett_pkixtsp_PKIStatusInfo);
303
304   return offset;
305 }
306 static int dissect_status(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
307   return dissect_pkixtsp_PKIStatusInfo(FALSE, tvb, offset, actx, tree, hf_pkixtsp_status);
308 }
309
310
311
312 static int
313 dissect_pkixtsp_TimeStampToken(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
314   offset = dissect_cms_ContentInfo(implicit_tag, tvb, offset, actx, tree, hf_index);
315
316   return offset;
317 }
318 static int dissect_timeStampToken(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
319   return dissect_pkixtsp_TimeStampToken(FALSE, tvb, offset, actx, tree, hf_pkixtsp_timeStampToken);
320 }
321
322
323 static const ber_old_sequence_t TimeStampResp_sequence[] = {
324   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status },
325   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_timeStampToken },
326   { 0, 0, 0, NULL }
327 };
328
329 static int
330 dissect_pkixtsp_TimeStampResp(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
331   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
332                                        TimeStampResp_sequence, hf_index, ett_pkixtsp_TimeStampResp);
333
334   return offset;
335 }
336
337
338 static const value_string pkixtsp_tst_version_vals[] = {
339   {   1, "v1" },
340   { 0, NULL }
341 };
342
343
344 static int
345 dissect_pkixtsp_tst_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
346   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
347                                   NULL);
348
349   return offset;
350 }
351 static int dissect_tst_version(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
352   return dissect_pkixtsp_tst_version(FALSE, tvb, offset, actx, tree, hf_pkixtsp_tst_version);
353 }
354
355
356
357 static int
358 dissect_pkixtsp_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
359   offset = dissect_ber_GeneralizedTime(implicit_tag, actx, tree, tvb, offset, hf_index);
360
361   return offset;
362 }
363 static int dissect_genTime(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
364   return dissect_pkixtsp_GeneralizedTime(FALSE, tvb, offset, actx, tree, hf_pkixtsp_genTime);
365 }
366
367
368
369 static int
370 dissect_pkixtsp_INTEGER_1_999(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
371   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
372                                   NULL);
373
374   return offset;
375 }
376 static int dissect_millis_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
377   return dissect_pkixtsp_INTEGER_1_999(TRUE, tvb, offset, actx, tree, hf_pkixtsp_millis);
378 }
379 static int dissect_micros_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
380   return dissect_pkixtsp_INTEGER_1_999(TRUE, tvb, offset, actx, tree, hf_pkixtsp_micros);
381 }
382
383
384 static const ber_old_sequence_t Accuracy_sequence[] = {
385   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_seconds },
386   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_millis_impl },
387   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_micros_impl },
388   { 0, 0, 0, NULL }
389 };
390
391 static int
392 dissect_pkixtsp_Accuracy(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
393   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
394                                        Accuracy_sequence, hf_index, ett_pkixtsp_Accuracy);
395
396   return offset;
397 }
398 static int dissect_accuracy(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
399   return dissect_pkixtsp_Accuracy(FALSE, tvb, offset, actx, tree, hf_pkixtsp_accuracy);
400 }
401
402
403 static const ber_old_sequence_t TSTInfo_sequence[] = {
404   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tst_version },
405   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_policy },
406   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_messageImprint },
407   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
408   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_genTime },
409   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_accuracy },
410   { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ordering },
411   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_nonce },
412   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tsa_impl },
413   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_extensions_impl },
414   { 0, 0, 0, NULL }
415 };
416
417 static int
418 dissect_pkixtsp_TSTInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
419   offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
420                                        TSTInfo_sequence, hf_index, ett_pkixtsp_TSTInfo);
421
422   return offset;
423 }
424
425
426 /*--- End of included file: packet-pkixtsp-fn.c ---*/
427 #line 57 "packet-pkixtsp-template.c"
428
429
430 static int
431 dissect_timestamp_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
432 {
433         proto_item *item=NULL;
434         proto_tree *tree=NULL;
435         asn1_ctx_t asn1_ctx;
436         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
437
438         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
439                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
440
441         if (check_col(pinfo->cinfo, COL_INFO)) {
442                 col_clear(pinfo->cinfo, COL_INFO);
443                 
444                 col_add_fstr(pinfo->cinfo, COL_INFO, "Reply");
445         }
446
447
448         if(parent_tree){
449                 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
450                 tree = proto_item_add_subtree(item, ett_pkixtsp);
451         }
452
453         return dissect_pkixtsp_TimeStampResp(FALSE, tvb, 0, &asn1_ctx, tree, -1);
454 }
455
456 static int
457 dissect_timestamp_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
458 {
459         proto_item *item=NULL;
460         proto_tree *tree=NULL;
461         asn1_ctx_t asn1_ctx;
462         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
463
464         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
465                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
466
467         if (check_col(pinfo->cinfo, COL_INFO)) {
468                 col_clear(pinfo->cinfo, COL_INFO);
469                 
470                 col_add_fstr(pinfo->cinfo, COL_INFO, "Query");
471         }
472
473
474         if(parent_tree){
475                 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
476                 tree = proto_item_add_subtree(item, ett_pkixtsp);
477         }
478
479         return dissect_pkixtsp_TimeStampReq(FALSE, tvb, 0, &asn1_ctx, tree, -1);
480 }
481
482
483 /*--- proto_register_pkixtsp ----------------------------------------------*/
484 void proto_register_pkixtsp(void) {
485
486   /* List of fields */
487   static hf_register_info hf[] = {
488
489 /*--- Included file: packet-pkixtsp-hfarr.c ---*/
490 #line 1 "packet-pkixtsp-hfarr.c"
491     { &hf_pkixtsp_version,
492       { "version", "pkixtsp.version",
493         FT_INT32, BASE_DEC, VALS(pkixtsp_T_version_vals), 0,
494         "pkixtsp.T_version", HFILL }},
495     { &hf_pkixtsp_messageImprint,
496       { "messageImprint", "pkixtsp.messageImprint",
497         FT_NONE, BASE_NONE, NULL, 0,
498         "pkixtsp.MessageImprint", HFILL }},
499     { &hf_pkixtsp_reqPolicy,
500       { "reqPolicy", "pkixtsp.reqPolicy",
501         FT_OID, BASE_NONE, NULL, 0,
502         "pkixtsp.TSAPolicyId", HFILL }},
503     { &hf_pkixtsp_nonce,
504       { "nonce", "pkixtsp.nonce",
505         FT_INT32, BASE_DEC, NULL, 0,
506         "pkixtsp.INTEGER", HFILL }},
507     { &hf_pkixtsp_certReq,
508       { "certReq", "pkixtsp.certReq",
509         FT_BOOLEAN, 8, NULL, 0,
510         "pkixtsp.BOOLEAN", HFILL }},
511     { &hf_pkixtsp_extensions,
512       { "extensions", "pkixtsp.extensions",
513         FT_UINT32, BASE_DEC, NULL, 0,
514         "pkix1explicit.Extensions", HFILL }},
515     { &hf_pkixtsp_hashAlgorithm,
516       { "hashAlgorithm", "pkixtsp.hashAlgorithm",
517         FT_NONE, BASE_NONE, NULL, 0,
518         "pkix1explicit.AlgorithmIdentifier", HFILL }},
519     { &hf_pkixtsp_hashedMessage,
520       { "hashedMessage", "pkixtsp.hashedMessage",
521         FT_BYTES, BASE_HEX, NULL, 0,
522         "pkixtsp.OCTET_STRING", HFILL }},
523     { &hf_pkixtsp_status,
524       { "status", "pkixtsp.status",
525         FT_NONE, BASE_NONE, NULL, 0,
526         "pkixtsp.PKIStatusInfo", HFILL }},
527     { &hf_pkixtsp_timeStampToken,
528       { "timeStampToken", "pkixtsp.timeStampToken",
529         FT_NONE, BASE_NONE, NULL, 0,
530         "pkixtsp.TimeStampToken", HFILL }},
531     { &hf_pkixtsp_pki_status,
532       { "status", "pkixtsp.status",
533         FT_INT32, BASE_DEC, VALS(pkixtsp_PKIStatus_vals), 0,
534         "pkixtsp.PKIStatus", HFILL }},
535     { &hf_pkixtsp_failInfo,
536       { "failInfo", "pkixtsp.failInfo",
537         FT_BYTES, BASE_HEX, NULL, 0,
538         "pkixtsp.PKIFailureInfo", HFILL }},
539     { &hf_pkixtsp_tst_version,
540       { "version", "pkixtsp.version",
541         FT_INT32, BASE_DEC, VALS(pkixtsp_tst_version_vals), 0,
542         "pkixtsp.tst_version", HFILL }},
543     { &hf_pkixtsp_policy,
544       { "policy", "pkixtsp.policy",
545         FT_OID, BASE_NONE, NULL, 0,
546         "pkixtsp.TSAPolicyId", HFILL }},
547     { &hf_pkixtsp_serialNumber,
548       { "serialNumber", "pkixtsp.serialNumber",
549         FT_INT32, BASE_DEC, NULL, 0,
550         "pkixtsp.INTEGER", HFILL }},
551     { &hf_pkixtsp_genTime,
552       { "genTime", "pkixtsp.genTime",
553         FT_STRING, BASE_NONE, NULL, 0,
554         "pkixtsp.GeneralizedTime", HFILL }},
555     { &hf_pkixtsp_accuracy,
556       { "accuracy", "pkixtsp.accuracy",
557         FT_NONE, BASE_NONE, NULL, 0,
558         "pkixtsp.Accuracy", HFILL }},
559     { &hf_pkixtsp_ordering,
560       { "ordering", "pkixtsp.ordering",
561         FT_BOOLEAN, 8, NULL, 0,
562         "pkixtsp.BOOLEAN", HFILL }},
563     { &hf_pkixtsp_tsa,
564       { "tsa", "pkixtsp.tsa",
565         FT_UINT32, BASE_DEC, NULL, 0,
566         "pkix1implicit.GeneralName", HFILL }},
567     { &hf_pkixtsp_seconds,
568       { "seconds", "pkixtsp.seconds",
569         FT_INT32, BASE_DEC, NULL, 0,
570         "pkixtsp.INTEGER", HFILL }},
571     { &hf_pkixtsp_millis,
572       { "millis", "pkixtsp.millis",
573         FT_UINT32, BASE_DEC, NULL, 0,
574         "pkixtsp.INTEGER_1_999", HFILL }},
575     { &hf_pkixtsp_micros,
576       { "micros", "pkixtsp.micros",
577         FT_UINT32, BASE_DEC, NULL, 0,
578         "pkixtsp.INTEGER_1_999", HFILL }},
579     { &hf_pkixtsp_PKIFailureInfo_badAlg,
580       { "badAlg", "pkixtsp.badAlg",
581         FT_BOOLEAN, 8, NULL, 0x80,
582         "", HFILL }},
583     { &hf_pkixtsp_PKIFailureInfo_badRequest,
584       { "badRequest", "pkixtsp.badRequest",
585         FT_BOOLEAN, 8, NULL, 0x20,
586         "", HFILL }},
587     { &hf_pkixtsp_PKIFailureInfo_badDataFormat,
588       { "badDataFormat", "pkixtsp.badDataFormat",
589         FT_BOOLEAN, 8, NULL, 0x04,
590         "", HFILL }},
591     { &hf_pkixtsp_PKIFailureInfo_timeNotAvailable,
592       { "timeNotAvailable", "pkixtsp.timeNotAvailable",
593         FT_BOOLEAN, 8, NULL, 0x02,
594         "", HFILL }},
595     { &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy,
596       { "unacceptedPolicy", "pkixtsp.unacceptedPolicy",
597         FT_BOOLEAN, 8, NULL, 0x01,
598         "", HFILL }},
599     { &hf_pkixtsp_PKIFailureInfo_unacceptedExtension,
600       { "unacceptedExtension", "pkixtsp.unacceptedExtension",
601         FT_BOOLEAN, 8, NULL, 0x80,
602         "", HFILL }},
603     { &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable,
604       { "addInfoNotAvailable", "pkixtsp.addInfoNotAvailable",
605         FT_BOOLEAN, 8, NULL, 0x40,
606         "", HFILL }},
607     { &hf_pkixtsp_PKIFailureInfo_systemFailure,
608       { "systemFailure", "pkixtsp.systemFailure",
609         FT_BOOLEAN, 8, NULL, 0x40,
610         "", HFILL }},
611
612 /*--- End of included file: packet-pkixtsp-hfarr.c ---*/
613 #line 118 "packet-pkixtsp-template.c"
614   };
615
616   /* List of subtrees */
617   static gint *ett[] = {
618         &ett_pkixtsp,
619
620 /*--- Included file: packet-pkixtsp-ettarr.c ---*/
621 #line 1 "packet-pkixtsp-ettarr.c"
622     &ett_pkixtsp_TimeStampReq,
623     &ett_pkixtsp_MessageImprint,
624     &ett_pkixtsp_TimeStampResp,
625     &ett_pkixtsp_PKIStatusInfo,
626     &ett_pkixtsp_PKIFailureInfo,
627     &ett_pkixtsp_TSTInfo,
628     &ett_pkixtsp_Accuracy,
629
630 /*--- End of included file: packet-pkixtsp-ettarr.c ---*/
631 #line 124 "packet-pkixtsp-template.c"
632   };
633
634   /* Register protocol */
635   proto_pkixtsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
636
637   /* Register fields and subtrees */
638   proto_register_field_array(proto_pkixtsp, hf, array_length(hf));
639   proto_register_subtree_array(ett, array_length(ett));
640
641 }
642
643
644 /*--- proto_reg_handoff_pkixtsp -------------------------------------------*/
645 void proto_reg_handoff_pkixtsp(void) {
646         dissector_handle_t timestamp_reply_handle;
647         dissector_handle_t timestamp_query_handle;
648
649         timestamp_reply_handle = new_create_dissector_handle(dissect_timestamp_reply, proto_pkixtsp);
650         dissector_add_string("media_type", "application/timestamp-reply", timestamp_reply_handle);
651
652         timestamp_query_handle = new_create_dissector_handle(dissect_timestamp_query, proto_pkixtsp);
653         dissector_add_string("media_type", "application/timestamp-query", timestamp_query_handle);
654
655 /*#include "packet-pkixtsp-dis-tab.c"*/
656 }
657