Get rid of dissect_ber_boolean_value() and change the signature of
[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 -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
116 static const value_string pkixtsp_T_version_vals[] = {
117   {   1, "v1" },
118   { 0, NULL }
119 };
120
121
122 static int
123 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_) {
124   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
125                                   NULL);
126
127   return offset;
128 }
129
130
131
132 static int
133 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_) {
134   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
135                                        NULL);
136
137   return offset;
138 }
139
140
141 static const ber_sequence_t MessageImprint_sequence[] = {
142   { &hf_pkixtsp_hashAlgorithm, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
143   { &hf_pkixtsp_hashedMessage, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_OCTET_STRING },
144   { NULL, 0, 0, 0, NULL }
145 };
146
147 static int
148 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_) {
149   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
150                                    MessageImprint_sequence, hf_index, ett_pkixtsp_MessageImprint);
151
152   return offset;
153 }
154
155
156
157 static int
158 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_) {
159   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
160
161   return offset;
162 }
163
164
165
166 static int
167 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_) {
168   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
169                                   NULL);
170
171   return offset;
172 }
173
174
175
176 static int
177 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_) {
178   offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
179
180   return offset;
181 }
182
183
184 static const ber_sequence_t TimeStampReq_sequence[] = {
185   { &hf_pkixtsp_version     , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_T_version },
186   { &hf_pkixtsp_messageImprint, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_MessageImprint },
187   { &hf_pkixtsp_reqPolicy   , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_TSAPolicyId },
188   { &hf_pkixtsp_nonce       , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_INTEGER },
189   { &hf_pkixtsp_certReq     , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_BOOLEAN },
190   { &hf_pkixtsp_extensions  , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Extensions },
191   { NULL, 0, 0, 0, NULL }
192 };
193
194 static int
195 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_) {
196   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
197                                    TimeStampReq_sequence, hf_index, ett_pkixtsp_TimeStampReq);
198
199   return offset;
200 }
201
202
203 static const value_string pkixtsp_PKIStatus_vals[] = {
204   {   0, "granted" },
205   {   1, "grantedWithMods" },
206   {   2, "rejection" },
207   {   3, "waiting" },
208   {   4, "revocationWarning" },
209   {   5, "revocationNotification" },
210   { 0, NULL }
211 };
212
213
214 static int
215 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_) {
216   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
217                                   NULL);
218
219   return offset;
220 }
221
222
223 static const asn_namedbit PKIFailureInfo_bits[] = {
224   {  0, &hf_pkixtsp_PKIFailureInfo_badAlg, -1, -1, "badAlg", NULL },
225   {  2, &hf_pkixtsp_PKIFailureInfo_badRequest, -1, -1, "badRequest", NULL },
226   {  5, &hf_pkixtsp_PKIFailureInfo_badDataFormat, -1, -1, "badDataFormat", NULL },
227   { 14, &hf_pkixtsp_PKIFailureInfo_timeNotAvailable, -1, -1, "timeNotAvailable", NULL },
228   { 15, &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy, -1, -1, "unacceptedPolicy", NULL },
229   { 16, &hf_pkixtsp_PKIFailureInfo_unacceptedExtension, -1, -1, "unacceptedExtension", NULL },
230   { 17, &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable, -1, -1, "addInfoNotAvailable", NULL },
231   { 25, &hf_pkixtsp_PKIFailureInfo_systemFailure, -1, -1, "systemFailure", NULL },
232   { 0, NULL, 0, 0, NULL, NULL }
233 };
234
235 static int
236 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_) {
237   offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
238                                     PKIFailureInfo_bits, hf_index, ett_pkixtsp_PKIFailureInfo,
239                                     NULL);
240
241   return offset;
242 }
243
244
245 static const ber_sequence_t PKIStatusInfo_sequence[] = {
246   { &hf_pkixtsp_pki_status  , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_PKIStatus },
247   { &hf_pkixtsp_failInfo    , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_PKIFailureInfo },
248   { NULL, 0, 0, 0, NULL }
249 };
250
251 static int
252 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_) {
253   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
254                                    PKIStatusInfo_sequence, hf_index, ett_pkixtsp_PKIStatusInfo);
255
256   return offset;
257 }
258
259
260
261 static int
262 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_) {
263   offset = dissect_cms_ContentInfo(implicit_tag, tvb, offset, actx, tree, hf_index);
264
265   return offset;
266 }
267
268
269 static const ber_sequence_t TimeStampResp_sequence[] = {
270   { &hf_pkixtsp_status      , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_PKIStatusInfo },
271   { &hf_pkixtsp_timeStampToken, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_TimeStampToken },
272   { NULL, 0, 0, 0, NULL }
273 };
274
275 static int
276 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_) {
277   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
278                                    TimeStampResp_sequence, hf_index, ett_pkixtsp_TimeStampResp);
279
280   return offset;
281 }
282
283
284 static const value_string pkixtsp_Tst_version_vals[] = {
285   {   1, "v1" },
286   { 0, NULL }
287 };
288
289
290 static int
291 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_) {
292   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
293                                   NULL);
294
295   return offset;
296 }
297
298
299
300 static int
301 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_) {
302   offset = dissect_ber_GeneralizedTime(implicit_tag, actx, tree, tvb, offset, hf_index);
303
304   return offset;
305 }
306
307
308
309 static int
310 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_) {
311   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
312                                   NULL);
313
314   return offset;
315 }
316
317
318 static const ber_sequence_t Accuracy_sequence[] = {
319   { &hf_pkixtsp_seconds     , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_INTEGER },
320   { &hf_pkixtsp_millis      , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkixtsp_INTEGER_1_999 },
321   { &hf_pkixtsp_micros      , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkixtsp_INTEGER_1_999 },
322   { NULL, 0, 0, 0, NULL }
323 };
324
325 static int
326 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_) {
327   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
328                                    Accuracy_sequence, hf_index, ett_pkixtsp_Accuracy);
329
330   return offset;
331 }
332
333
334 static const ber_sequence_t TSTInfo_sequence[] = {
335   { &hf_pkixtsp_tst_version , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_Tst_version },
336   { &hf_pkixtsp_policy      , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_TSAPolicyId },
337   { &hf_pkixtsp_messageImprint, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_MessageImprint },
338   { &hf_pkixtsp_serialNumber, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_INTEGER },
339   { &hf_pkixtsp_genTime     , BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_pkixtsp_GeneralizedTime },
340   { &hf_pkixtsp_accuracy    , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_Accuracy },
341   { &hf_pkixtsp_ordering    , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_BOOLEAN },
342   { &hf_pkixtsp_nonce       , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkixtsp_INTEGER },
343   { &hf_pkixtsp_tsa         , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1implicit_GeneralName },
344   { &hf_pkixtsp_extensions  , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Extensions },
345   { NULL, 0, 0, 0, NULL }
346 };
347
348 static int
349 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_) {
350   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
351                                    TSTInfo_sequence, hf_index, ett_pkixtsp_TSTInfo);
352
353   return offset;
354 }
355
356
357 /*--- End of included file: packet-pkixtsp-fn.c ---*/
358 #line 57 "packet-pkixtsp-template.c"
359
360
361 static int
362 dissect_timestamp_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
363 {
364         proto_item *item=NULL;
365         proto_tree *tree=NULL;
366         asn1_ctx_t asn1_ctx;
367         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
368
369         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
370                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
371
372         if (check_col(pinfo->cinfo, COL_INFO)) {
373                 col_clear(pinfo->cinfo, COL_INFO);
374                 
375                 col_set_str(pinfo->cinfo, COL_INFO, "Reply");
376         }
377
378
379         if(parent_tree){
380                 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
381                 tree = proto_item_add_subtree(item, ett_pkixtsp);
382         }
383
384         return dissect_pkixtsp_TimeStampResp(FALSE, tvb, 0, &asn1_ctx, tree, -1);
385 }
386
387 static int
388 dissect_timestamp_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
389 {
390         proto_item *item=NULL;
391         proto_tree *tree=NULL;
392         asn1_ctx_t asn1_ctx;
393         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
394
395         if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
396                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
397
398         if (check_col(pinfo->cinfo, COL_INFO)) {
399                 col_clear(pinfo->cinfo, COL_INFO);
400                 
401                 col_set_str(pinfo->cinfo, COL_INFO, "Query");
402         }
403
404
405         if(parent_tree){
406                 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
407                 tree = proto_item_add_subtree(item, ett_pkixtsp);
408         }
409
410         return dissect_pkixtsp_TimeStampReq(FALSE, tvb, 0, &asn1_ctx, tree, -1);
411 }
412
413
414 /*--- proto_register_pkixtsp ----------------------------------------------*/
415 void proto_register_pkixtsp(void) {
416
417   /* List of fields */
418   static hf_register_info hf[] = {
419
420 /*--- Included file: packet-pkixtsp-hfarr.c ---*/
421 #line 1 "packet-pkixtsp-hfarr.c"
422     { &hf_pkixtsp_version,
423       { "version", "pkixtsp.version",
424         FT_INT32, BASE_DEC, VALS(pkixtsp_T_version_vals), 0,
425         "pkixtsp.T_version", HFILL }},
426     { &hf_pkixtsp_messageImprint,
427       { "messageImprint", "pkixtsp.messageImprint",
428         FT_NONE, BASE_NONE, NULL, 0,
429         "pkixtsp.MessageImprint", HFILL }},
430     { &hf_pkixtsp_reqPolicy,
431       { "reqPolicy", "pkixtsp.reqPolicy",
432         FT_OID, BASE_NONE, NULL, 0,
433         "pkixtsp.TSAPolicyId", HFILL }},
434     { &hf_pkixtsp_nonce,
435       { "nonce", "pkixtsp.nonce",
436         FT_INT32, BASE_DEC, NULL, 0,
437         "pkixtsp.INTEGER", HFILL }},
438     { &hf_pkixtsp_certReq,
439       { "certReq", "pkixtsp.certReq",
440         FT_BOOLEAN, 8, NULL, 0,
441         "pkixtsp.BOOLEAN", HFILL }},
442     { &hf_pkixtsp_extensions,
443       { "extensions", "pkixtsp.extensions",
444         FT_UINT32, BASE_DEC, NULL, 0,
445         "pkix1explicit.Extensions", HFILL }},
446     { &hf_pkixtsp_hashAlgorithm,
447       { "hashAlgorithm", "pkixtsp.hashAlgorithm",
448         FT_NONE, BASE_NONE, NULL, 0,
449         "pkix1explicit.AlgorithmIdentifier", HFILL }},
450     { &hf_pkixtsp_hashedMessage,
451       { "hashedMessage", "pkixtsp.hashedMessage",
452         FT_BYTES, BASE_HEX, NULL, 0,
453         "pkixtsp.OCTET_STRING", HFILL }},
454     { &hf_pkixtsp_status,
455       { "status", "pkixtsp.status",
456         FT_NONE, BASE_NONE, NULL, 0,
457         "pkixtsp.PKIStatusInfo", HFILL }},
458     { &hf_pkixtsp_timeStampToken,
459       { "timeStampToken", "pkixtsp.timeStampToken",
460         FT_NONE, BASE_NONE, NULL, 0,
461         "pkixtsp.TimeStampToken", HFILL }},
462     { &hf_pkixtsp_pki_status,
463       { "status", "pkixtsp.status",
464         FT_INT32, BASE_DEC, VALS(pkixtsp_PKIStatus_vals), 0,
465         "pkixtsp.PKIStatus", HFILL }},
466     { &hf_pkixtsp_failInfo,
467       { "failInfo", "pkixtsp.failInfo",
468         FT_BYTES, BASE_HEX, NULL, 0,
469         "pkixtsp.PKIFailureInfo", HFILL }},
470     { &hf_pkixtsp_tst_version,
471       { "version", "pkixtsp.version",
472         FT_INT32, BASE_DEC, VALS(pkixtsp_Tst_version_vals), 0,
473         "pkixtsp.Tst_version", HFILL }},
474     { &hf_pkixtsp_policy,
475       { "policy", "pkixtsp.policy",
476         FT_OID, BASE_NONE, NULL, 0,
477         "pkixtsp.TSAPolicyId", HFILL }},
478     { &hf_pkixtsp_serialNumber,
479       { "serialNumber", "pkixtsp.serialNumber",
480         FT_INT32, BASE_DEC, NULL, 0,
481         "pkixtsp.INTEGER", HFILL }},
482     { &hf_pkixtsp_genTime,
483       { "genTime", "pkixtsp.genTime",
484         FT_STRING, BASE_NONE, NULL, 0,
485         "pkixtsp.GeneralizedTime", HFILL }},
486     { &hf_pkixtsp_accuracy,
487       { "accuracy", "pkixtsp.accuracy",
488         FT_NONE, BASE_NONE, NULL, 0,
489         "pkixtsp.Accuracy", HFILL }},
490     { &hf_pkixtsp_ordering,
491       { "ordering", "pkixtsp.ordering",
492         FT_BOOLEAN, 8, NULL, 0,
493         "pkixtsp.BOOLEAN", HFILL }},
494     { &hf_pkixtsp_tsa,
495       { "tsa", "pkixtsp.tsa",
496         FT_UINT32, BASE_DEC, NULL, 0,
497         "pkix1implicit.GeneralName", HFILL }},
498     { &hf_pkixtsp_seconds,
499       { "seconds", "pkixtsp.seconds",
500         FT_INT32, BASE_DEC, NULL, 0,
501         "pkixtsp.INTEGER", HFILL }},
502     { &hf_pkixtsp_millis,
503       { "millis", "pkixtsp.millis",
504         FT_UINT32, BASE_DEC, NULL, 0,
505         "pkixtsp.INTEGER_1_999", HFILL }},
506     { &hf_pkixtsp_micros,
507       { "micros", "pkixtsp.micros",
508         FT_UINT32, BASE_DEC, NULL, 0,
509         "pkixtsp.INTEGER_1_999", HFILL }},
510     { &hf_pkixtsp_PKIFailureInfo_badAlg,
511       { "badAlg", "pkixtsp.badAlg",
512         FT_BOOLEAN, 8, NULL, 0x80,
513         "", HFILL }},
514     { &hf_pkixtsp_PKIFailureInfo_badRequest,
515       { "badRequest", "pkixtsp.badRequest",
516         FT_BOOLEAN, 8, NULL, 0x20,
517         "", HFILL }},
518     { &hf_pkixtsp_PKIFailureInfo_badDataFormat,
519       { "badDataFormat", "pkixtsp.badDataFormat",
520         FT_BOOLEAN, 8, NULL, 0x04,
521         "", HFILL }},
522     { &hf_pkixtsp_PKIFailureInfo_timeNotAvailable,
523       { "timeNotAvailable", "pkixtsp.timeNotAvailable",
524         FT_BOOLEAN, 8, NULL, 0x02,
525         "", HFILL }},
526     { &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy,
527       { "unacceptedPolicy", "pkixtsp.unacceptedPolicy",
528         FT_BOOLEAN, 8, NULL, 0x01,
529         "", HFILL }},
530     { &hf_pkixtsp_PKIFailureInfo_unacceptedExtension,
531       { "unacceptedExtension", "pkixtsp.unacceptedExtension",
532         FT_BOOLEAN, 8, NULL, 0x80,
533         "", HFILL }},
534     { &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable,
535       { "addInfoNotAvailable", "pkixtsp.addInfoNotAvailable",
536         FT_BOOLEAN, 8, NULL, 0x40,
537         "", HFILL }},
538     { &hf_pkixtsp_PKIFailureInfo_systemFailure,
539       { "systemFailure", "pkixtsp.systemFailure",
540         FT_BOOLEAN, 8, NULL, 0x40,
541         "", HFILL }},
542
543 /*--- End of included file: packet-pkixtsp-hfarr.c ---*/
544 #line 118 "packet-pkixtsp-template.c"
545   };
546
547   /* List of subtrees */
548   static gint *ett[] = {
549         &ett_pkixtsp,
550
551 /*--- Included file: packet-pkixtsp-ettarr.c ---*/
552 #line 1 "packet-pkixtsp-ettarr.c"
553     &ett_pkixtsp_TimeStampReq,
554     &ett_pkixtsp_MessageImprint,
555     &ett_pkixtsp_TimeStampResp,
556     &ett_pkixtsp_PKIStatusInfo,
557     &ett_pkixtsp_PKIFailureInfo,
558     &ett_pkixtsp_TSTInfo,
559     &ett_pkixtsp_Accuracy,
560
561 /*--- End of included file: packet-pkixtsp-ettarr.c ---*/
562 #line 124 "packet-pkixtsp-template.c"
563   };
564
565   /* Register protocol */
566   proto_pkixtsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
567
568   /* Register fields and subtrees */
569   proto_register_field_array(proto_pkixtsp, hf, array_length(hf));
570   proto_register_subtree_array(ett, array_length(ett));
571
572 }
573
574
575 /*--- proto_reg_handoff_pkixtsp -------------------------------------------*/
576 void proto_reg_handoff_pkixtsp(void) {
577         dissector_handle_t timestamp_reply_handle;
578         dissector_handle_t timestamp_query_handle;
579
580         timestamp_reply_handle = new_create_dissector_handle(dissect_timestamp_reply, proto_pkixtsp);
581         dissector_add_string("media_type", "application/timestamp-reply", timestamp_reply_handle);
582
583         timestamp_query_handle = new_create_dissector_handle(dissect_timestamp_query, proto_pkixtsp);
584         dissector_add_string("media_type", "application/timestamp-query", timestamp_query_handle);
585
586 /*#include "packet-pkixtsp-dis-tab.c"*/
587 }
588