2 * Routines for MSX mapi packet dissection
4 * $Id: packet-mapi.c,v 1.12 2001/01/03 06:55:30 guy Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-tftp.c
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #ifdef HAVE_SYS_TYPES_H
34 # include <sys/types.h>
37 #ifdef HAVE_NETINET_IN_H
38 # include <netinet/in.h>
45 static int proto_mapi = -1;
46 static int hf_mapi_request = -1;
47 static int hf_mapi_response = -1;
49 static gint ett_mapi = -1;
51 #define TCP_PORT_MAPI 1065
54 dissect_mapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
56 proto_tree *mapi_tree, *ti;
58 CHECK_DISPLAY_AS_DATA(proto_mapi, tvb, pinfo, tree);
60 pinfo->current_proto = "MAPI";
62 if (check_col(pinfo->fd, COL_PROTOCOL))
63 col_set_str(pinfo->fd, COL_PROTOCOL, "MAPI");
65 if (check_col(pinfo->fd, COL_INFO))
67 col_add_fstr(pinfo->fd, COL_INFO, "%s",
68 (pinfo->match_port == pinfo->destport) ? "Request" : "Response");
73 ti = proto_tree_add_item(tree, proto_mapi, tvb, 0,
74 tvb_length(tvb), FALSE);
75 mapi_tree = proto_item_add_subtree(ti, ett_mapi);
77 if (pinfo->match_port == pinfo->destport)
79 proto_tree_add_boolean_hidden(mapi_tree, hf_mapi_request, tvb,
80 0, tvb_length(tvb), TRUE);
81 proto_tree_add_text(mapi_tree, tvb, 0,
82 tvb_length(tvb), "Request: <opaque data>" );
86 proto_tree_add_boolean_hidden(mapi_tree, hf_mapi_response, tvb,
87 0, tvb_length(tvb), TRUE);
88 proto_tree_add_text(mapi_tree, tvb, 0,
89 tvb_length(tvb), "Response: <opaque data>");
95 proto_register_mapi(void)
97 static hf_register_info hf[] = {
99 { "Response", "mapi.response",
100 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
101 "TRUE if MAPI response" }},
104 { "Request", "mapi.request",
105 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
106 "TRUE if MAPI request" }}
109 static gint *ett[] = {
112 proto_mapi = proto_register_protocol("MAPI", "MAPI", "mapi");
113 proto_register_field_array(proto_mapi, hf, array_length(hf));
114 proto_register_subtree_array(ett, array_length(ett));
118 proto_reg_handoff_mapi(void)
120 dissector_add("tcp.port", TCP_PORT_MAPI, dissect_mapi);