2 * Routines for Online Certificate Status Protocol (RFC2560) 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>
35 #include "packet-ber.h"
36 #include "packet-ocsp.h"
37 #include "packet-x509af.h"
38 #include "packet-x509ce.h"
39 #include "packet-pkix1implicit.h"
40 #include "packet-pkix1explicit.h"
42 #define PNAME "Online Certificate Status Protocol"
46 /* Initialize the protocol and registered fields */
48 static int hf_ocsp_responseType_id = -1;
49 #include "packet-ocsp-hf.c"
51 /* Initialize the subtree pointers */
52 static gint ett_ocsp = -1;
53 #include "packet-ocsp-ett.c"
55 static const char *responseType_id;
58 #include "packet-ocsp-fn.c"
62 dissect_ocsp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
64 proto_item *item=NULL;
65 proto_tree *tree=NULL;
67 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
69 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
71 col_set_str(pinfo->cinfo, COL_INFO, "Request");
75 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
76 tree = proto_item_add_subtree(item, ett_ocsp);
79 return dissect_ocsp_OCSPRequest(FALSE, tvb, 0, &asn1_ctx, tree, -1);
84 dissect_ocsp_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
86 proto_item *item=NULL;
87 proto_tree *tree=NULL;
89 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
91 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCSP");
93 col_set_str(pinfo->cinfo, COL_INFO, "Response");
97 item=proto_tree_add_item(parent_tree, proto_ocsp, tvb, 0, -1, FALSE);
98 tree = proto_item_add_subtree(item, ett_ocsp);
101 return dissect_ocsp_OCSPResponse(FALSE, tvb, 0, &asn1_ctx, tree, -1);
104 /*--- proto_register_ocsp ----------------------------------------------*/
105 void proto_register_ocsp(void) {
108 static hf_register_info hf[] = {
109 { &hf_ocsp_responseType_id,
110 { "ResponseType Id", "x509af.responseType.id",
111 FT_STRING, BASE_NONE, NULL, 0,
113 #include "packet-ocsp-hfarr.c"
116 /* List of subtrees */
117 static gint *ett[] = {
119 #include "packet-ocsp-ettarr.c"
122 /* Register protocol */
123 proto_ocsp = proto_register_protocol(PNAME, PSNAME, PFNAME);
125 /* Register fields and subtrees */
126 proto_register_field_array(proto_ocsp, hf, array_length(hf));
127 proto_register_subtree_array(ett, array_length(ett));
131 /*--- proto_reg_handoff_ocsp -------------------------------------------*/
132 void proto_reg_handoff_ocsp(void) {
133 dissector_handle_t ocsp_request_handle;
134 dissector_handle_t ocsp_response_handle;
136 ocsp_request_handle = new_create_dissector_handle(dissect_ocsp_request, proto_ocsp);
137 ocsp_response_handle = new_create_dissector_handle(dissect_ocsp_response, proto_ocsp);
139 dissector_add_string("media_type", "application/ocsp-request", ocsp_request_handle);
140 dissector_add_string("media_type", "application/ocsp-response", ocsp_response_handle);
142 #include "packet-ocsp-dis-tab.c"