2 * Routines for BEA Tuxedo ATMI protocol
4 * metatech <metatech@flashmail.com>
6 * $Id: packet-tuxedo.c,v 1.1 2004/04/20 05:07:23 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
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.
32 #include <epan/packet.h>
33 #include <epan/conversation.h>
35 static int proto_tuxedo = -1;
36 static int hf_tuxedo_magic = -1;
37 static int hf_tuxedo_opcode = -1;
39 static gint ett_tuxedo = -1;
41 static dissector_handle_t tuxedo_handle;
43 #define TUXEDO_MAGIC 0x91039858
44 #define TUXEDO_SMAGIC 0x73903842
46 #define TUXEDO_ATMI_CALL 1
47 #define TUXEDO_ATMI_REPLY 2
48 #define TUXEDO_ATMI_FAILURE 3
49 #define TUXEDO_ATMI_CONNECT 4
50 #define TUXEDO_ATMI_DATA 5
51 #define TUXEDO_ATMI_DISCON 6
52 #define TUXEDO_ATMI_PREPARE 7
53 #define TUXEDO_ATMI_READY 8
54 #define TUXEDO_ATMI_COMMIT 9
55 #define TUXEDO_ATMI_DONE 10
56 #define TUXEDO_ATMI_COMPLETE 11
57 #define TUXEDO_ATMI_ROLLBACK 12
58 #define TUXEDO_ATMI_HEURISTIC 13
59 #define TUXEDO_ATMI_PRE_NW_ACALL1 14
60 #define TUXEDO_ATMI_PRE_NW_ACALL1_RPLY 15
61 #define TUXEDO_ATMI_PRE_NW_ACALL2 16
62 #define TUXEDO_ATMI_PRE_NW_ACALL2_RPLY 17
63 #define TUXEDO_ATMI_PRE_NW_ACALL3 18
64 #define TUXEDO_ATMI_PRE_NW_ACALL3_RPLY 19
65 #define TUXEDO_ATMI_PRE_NW_LLE 20
66 #define TUXEDO_ATMI_PRE_NW_LLE_RPLY 21
67 #define TUXEDO_ATMI_SEC_EXCHG_RQST 22
68 #define TUXEDO_ATMI_SEC_EXCHG_RPLY 23
69 #define TUXEDO_ATMI_SEC_NW_ACALL3 24
70 #define TUXEDO_ATMI_SEC_NW_ACALL3_RPLY 25
73 static const value_string tuxedo_opcode_vals[] = {
74 { TUXEDO_ATMI_CALL, "CALL" },
75 { TUXEDO_ATMI_REPLY, "REPLY" },
76 { TUXEDO_ATMI_FAILURE, "FAILURE" },
77 { TUXEDO_ATMI_CONNECT, "CONNECT" },
78 { TUXEDO_ATMI_DATA, "DATA" },
79 { TUXEDO_ATMI_DISCON, "DISCON" },
80 { TUXEDO_ATMI_PREPARE, "PREPARE" },
81 { TUXEDO_ATMI_READY, "READY" },
82 { TUXEDO_ATMI_COMMIT, "COMMIT" },
83 { TUXEDO_ATMI_DONE, "DONE" },
84 { TUXEDO_ATMI_COMPLETE, "COMPLETE" },
85 { TUXEDO_ATMI_ROLLBACK, "ROLLBACK" },
86 { TUXEDO_ATMI_HEURISTIC, "HEURISTIC" },
87 { TUXEDO_ATMI_PRE_NW_ACALL1, "ACALL1" },
88 { TUXEDO_ATMI_PRE_NW_ACALL1_RPLY, "ACALL1_REPLY" },
89 { TUXEDO_ATMI_PRE_NW_ACALL2, "ACALL2" },
90 { TUXEDO_ATMI_PRE_NW_ACALL2_RPLY, "ACALL2_REPLY" },
91 { TUXEDO_ATMI_PRE_NW_ACALL3, "ACALL3" },
92 { TUXEDO_ATMI_PRE_NW_ACALL3_RPLY, "ACALL3_REPLY" },
93 { TUXEDO_ATMI_PRE_NW_LLE, "LLE" },
94 { TUXEDO_ATMI_PRE_NW_LLE_RPLY, "LLE_REPLY" },
95 { TUXEDO_ATMI_SEC_EXCHG_RQST, "SEC_EXCHANGE" },
96 { TUXEDO_ATMI_SEC_EXCHG_RPLY, "SEC_EXCHANGE_REPLY" },
97 { TUXEDO_ATMI_SEC_NW_ACALL3, "SEC_ACALL3" },
98 { TUXEDO_ATMI_SEC_NW_ACALL3_RPLY, "SEC_ACALL3_REPLY" },
104 dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
106 proto_tree *tuxedoroot_tree = NULL;
111 if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "TUXEDO");
113 if (tvb_length(tvb) >= 8)
115 magic = tvb_get_ntohl(tvb, 0);
116 if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC)
118 opcode = tvb_get_ntohl(tvb, 4);
120 if (check_col(pinfo->cinfo, COL_INFO))
122 col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)"));
127 ti = proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, FALSE);
128 tuxedoroot_tree = proto_item_add_subtree(ti, ett_tuxedo);
130 proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_magic, tvb, 0, 4, FALSE);
131 proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_opcode, tvb, 4, 4, FALSE);
136 /* This packet is a continuation */
137 if (check_col(pinfo->cinfo, COL_INFO)) col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
140 ti = proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, FALSE);
147 dissect_tuxedo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
149 if (tvb_length(tvb) >= 8)
152 magic = tvb_get_ntohl(tvb, 0);
153 if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC)
155 /* Register this dissector for this conversation */
156 conversation_t *conversation = NULL;
157 conversation = find_conversation(&pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
158 if (conversation == NULL)
160 conversation = conversation_new(&pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
162 conversation_set_dissector(conversation, tuxedo_handle);
164 dissect_tuxedo(tvb, pinfo, tree);
172 proto_register_tuxedo(void)
174 static hf_register_info hf[] = {
176 { "Magic", "tuxedo.magic", FT_UINT32, BASE_HEX, NULL, 0x0, "TUXEDO magic", HFILL }},
179 { "Opcode", "tuxedo.opcode", FT_UINT32, BASE_HEX, VALS(tuxedo_opcode_vals), 0x0, "TUXEDO opcode", HFILL }}
182 static gint *ett[] = {
186 proto_tuxedo = proto_register_protocol("BEA Tuxedo", "TUXEDO", "tuxedo");
187 proto_register_field_array(proto_tuxedo, hf, array_length(hf));
188 proto_register_subtree_array(ett, array_length(ett));
190 tuxedo_handle = create_dissector_handle(dissect_tuxedo, proto_tuxedo);
195 proto_reg_handoff_tuxedo(void)
197 heur_dissector_add("tcp", dissect_tuxedo_heur, proto_tuxedo);
198 dissector_add_handle("tcp.port", tuxedo_handle);