2 * Routines for RFC2634 Extended Security Services packet dissection
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #include <epan/packet.h>
36 #include <epan/asn1.h>
37 #include "packet-ber.h"
38 #include "packet-pkixtsp.h"
39 #include "packet-pkix1explicit.h"
40 #include "packet-pkix1implicit.h"
41 #include "packet-cms.h"
43 #define PNAME "PKIX Time Stamp Protocol"
44 #define PSNAME "PKIXTSP"
45 #define PFNAME "pkixtsp"
47 /* Initialize the protocol and registered fields */
48 static int proto_pkixtsp = -1;
49 #include "packet-pkixtsp-hf.c"
51 /* Initialize the subtree pointers */
52 static gint ett_pkixtsp = -1;
53 #include "packet-pkixtsp-ett.c"
56 #include "packet-pkixtsp-fn.c"
60 dissect_timestamp_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
62 proto_item *item=NULL;
63 proto_tree *tree=NULL;
65 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
67 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
69 if (check_col(pinfo->cinfo, COL_INFO)) {
70 col_set_str(pinfo->cinfo, COL_INFO, "Reply");
75 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
76 tree = proto_item_add_subtree(item, ett_pkixtsp);
79 return dissect_pkixtsp_TimeStampResp(FALSE, tvb, 0, &asn1_ctx, tree, -1);
83 dissect_timestamp_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
85 proto_item *item=NULL;
86 proto_tree *tree=NULL;
88 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
90 col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP");
92 if (check_col(pinfo->cinfo, COL_INFO)) {
93 col_set_str(pinfo->cinfo, COL_INFO, "Query");
98 item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE);
99 tree = proto_item_add_subtree(item, ett_pkixtsp);
102 return dissect_pkixtsp_TimeStampReq(FALSE, tvb, 0, &asn1_ctx, tree, -1);
106 /*--- proto_register_pkixtsp ----------------------------------------------*/
107 void proto_register_pkixtsp(void) {
110 static hf_register_info hf[] = {
111 #include "packet-pkixtsp-hfarr.c"
114 /* List of subtrees */
115 static gint *ett[] = {
117 #include "packet-pkixtsp-ettarr.c"
120 /* Register protocol */
121 proto_pkixtsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
123 /* Register fields and subtrees */
124 proto_register_field_array(proto_pkixtsp, hf, array_length(hf));
125 proto_register_subtree_array(ett, array_length(ett));
130 /*--- proto_reg_handoff_pkixtsp -------------------------------------------*/
131 void proto_reg_handoff_pkixtsp(void) {
132 dissector_handle_t timestamp_reply_handle;
133 dissector_handle_t timestamp_query_handle;
135 timestamp_reply_handle = new_create_dissector_handle(dissect_timestamp_reply, proto_pkixtsp);
136 dissector_add_string("media_type", "application/timestamp-reply", timestamp_reply_handle);
138 timestamp_query_handle = new_create_dissector_handle(dissect_timestamp_query, proto_pkixtsp);
139 dissector_add_string("media_type", "application/timestamp-query", timestamp_query_handle);
141 #include "packet-pkixtsp-dis-tab.c"