2 * Routines for BEA Tuxedo ATMI protocol
4 * metatech <metatech@flashmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <epan/packet.h>
29 #include <epan/conversation.h>
31 void proto_register_tuxedo(void);
32 void proto_reg_handoff_tuxedo(void);
34 static int proto_tuxedo = -1;
35 static int hf_tuxedo_magic = -1;
36 static int hf_tuxedo_opcode = -1;
38 static gint ett_tuxedo = -1;
40 static dissector_handle_t tuxedo_handle;
42 #define TUXEDO_MAGIC 0x91039858
43 #define TUXEDO_SMAGIC 0x73903842
45 #define TUXEDO_ATMI_CALL 1
46 #define TUXEDO_ATMI_REPLY 2
47 #define TUXEDO_ATMI_FAILURE 3
48 #define TUXEDO_ATMI_CONNECT 4
49 #define TUXEDO_ATMI_DATA 5
50 #define TUXEDO_ATMI_DISCON 6
51 #define TUXEDO_ATMI_PREPARE 7
52 #define TUXEDO_ATMI_READY 8
53 #define TUXEDO_ATMI_COMMIT 9
54 #define TUXEDO_ATMI_DONE 10
55 #define TUXEDO_ATMI_COMPLETE 11
56 #define TUXEDO_ATMI_ROLLBACK 12
57 #define TUXEDO_ATMI_HEURISTIC 13
58 #define TUXEDO_ATMI_PRE_NW_ACALL1 14
59 #define TUXEDO_ATMI_PRE_NW_ACALL1_RPLY 15
60 #define TUXEDO_ATMI_PRE_NW_ACALL2 16
61 #define TUXEDO_ATMI_PRE_NW_ACALL2_RPLY 17
62 #define TUXEDO_ATMI_PRE_NW_ACALL3 18
63 #define TUXEDO_ATMI_PRE_NW_ACALL3_RPLY 19
64 #define TUXEDO_ATMI_PRE_NW_LLE 20
65 #define TUXEDO_ATMI_PRE_NW_LLE_RPLY 21
66 #define TUXEDO_ATMI_SEC_EXCHG_RQST 22
67 #define TUXEDO_ATMI_SEC_EXCHG_RPLY 23
68 #define TUXEDO_ATMI_SEC_NW_ACALL3 24
69 #define TUXEDO_ATMI_SEC_NW_ACALL3_RPLY 25
72 static const value_string tuxedo_opcode_vals[] = {
73 { TUXEDO_ATMI_CALL, "CALL" },
74 { TUXEDO_ATMI_REPLY, "REPLY" },
75 { TUXEDO_ATMI_FAILURE, "FAILURE" },
76 { TUXEDO_ATMI_CONNECT, "CONNECT" },
77 { TUXEDO_ATMI_DATA, "DATA" },
78 { TUXEDO_ATMI_DISCON, "DISCON" },
79 { TUXEDO_ATMI_PREPARE, "PREPARE" },
80 { TUXEDO_ATMI_READY, "READY" },
81 { TUXEDO_ATMI_COMMIT, "COMMIT" },
82 { TUXEDO_ATMI_DONE, "DONE" },
83 { TUXEDO_ATMI_COMPLETE, "COMPLETE" },
84 { TUXEDO_ATMI_ROLLBACK, "ROLLBACK" },
85 { TUXEDO_ATMI_HEURISTIC, "HEURISTIC" },
86 { TUXEDO_ATMI_PRE_NW_ACALL1, "ACALL1" },
87 { TUXEDO_ATMI_PRE_NW_ACALL1_RPLY, "ACALL1_REPLY" },
88 { TUXEDO_ATMI_PRE_NW_ACALL2, "ACALL2" },
89 { TUXEDO_ATMI_PRE_NW_ACALL2_RPLY, "ACALL2_REPLY" },
90 { TUXEDO_ATMI_PRE_NW_ACALL3, "ACALL3" },
91 { TUXEDO_ATMI_PRE_NW_ACALL3_RPLY, "ACALL3_REPLY" },
92 { TUXEDO_ATMI_PRE_NW_LLE, "LLE" },
93 { TUXEDO_ATMI_PRE_NW_LLE_RPLY, "LLE_REPLY" },
94 { TUXEDO_ATMI_SEC_EXCHG_RQST, "SEC_EXCHANGE" },
95 { TUXEDO_ATMI_SEC_EXCHG_RPLY, "SEC_EXCHANGE_REPLY" },
96 { TUXEDO_ATMI_SEC_NW_ACALL3, "SEC_ACALL3" },
97 { TUXEDO_ATMI_SEC_NW_ACALL3_RPLY, "SEC_ACALL3_REPLY" },
103 dissect_tuxedo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
105 proto_tree *tuxedoroot_tree = NULL;
110 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TUXEDO");
112 if (tvb_captured_length(tvb) >= 8)
114 magic = tvb_get_ntohl(tvb, 0);
115 if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC)
117 opcode = tvb_get_ntohl(tvb, 4);
119 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, tuxedo_opcode_vals, "Unknown (0x%02x)"));
123 ti = proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, ENC_NA);
124 tuxedoroot_tree = proto_item_add_subtree(ti, ett_tuxedo);
126 proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_magic, tvb, 0, 4, ENC_BIG_ENDIAN);
127 proto_tree_add_item(tuxedoroot_tree, hf_tuxedo_opcode, tvb, 4, 4, ENC_BIG_ENDIAN);
132 /* This packet is a continuation */
133 col_set_str(pinfo->cinfo, COL_INFO, "Continuation");
136 proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, ENC_NA);
143 dissect_tuxedo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
145 if (tvb_captured_length(tvb) >= 8)
148 magic = tvb_get_ntohl(tvb, 0);
149 if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC)
151 /* Register this dissector for this conversation */
152 conversation_t *conversation = NULL;
153 conversation = find_or_create_conversation(pinfo);
154 conversation_set_dissector(conversation, tuxedo_handle);
156 dissect_tuxedo(tvb, pinfo, tree);
164 proto_register_tuxedo(void)
166 static hf_register_info hf[] = {
168 { "Magic", "tuxedo.magic", FT_UINT32, BASE_HEX, NULL, 0x0, "TUXEDO magic", HFILL }},
171 { "Opcode", "tuxedo.opcode", FT_UINT32, BASE_HEX, VALS(tuxedo_opcode_vals), 0x0, "TUXEDO opcode", HFILL }}
174 static gint *ett[] = {
178 proto_tuxedo = proto_register_protocol("BEA Tuxedo", "TUXEDO", "tuxedo");
179 proto_register_field_array(proto_tuxedo, hf, array_length(hf));
180 proto_register_subtree_array(ett, array_length(ett));
186 proto_reg_handoff_tuxedo(void)
188 tuxedo_handle = create_dissector_handle(dissect_tuxedo, proto_tuxedo);
189 dissector_add_handle("tcp.port", tuxedo_handle);
190 heur_dissector_add("tcp", dissect_tuxedo_heur, proto_tuxedo);