2 * Routines for BEA Tuxedo ATMI protocol
4 * metatech <metatech@flashmail.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include <epan/conversation.h>
33 static int proto_tuxedo
= -1;
34 static int hf_tuxedo_magic
= -1;
35 static int hf_tuxedo_opcode
= -1;
37 static gint ett_tuxedo
= -1;
39 static dissector_handle_t tuxedo_handle
;
41 #define TUXEDO_MAGIC 0x91039858
42 #define TUXEDO_SMAGIC 0x73903842
44 #define TUXEDO_ATMI_CALL 1
45 #define TUXEDO_ATMI_REPLY 2
46 #define TUXEDO_ATMI_FAILURE 3
47 #define TUXEDO_ATMI_CONNECT 4
48 #define TUXEDO_ATMI_DATA 5
49 #define TUXEDO_ATMI_DISCON 6
50 #define TUXEDO_ATMI_PREPARE 7
51 #define TUXEDO_ATMI_READY 8
52 #define TUXEDO_ATMI_COMMIT 9
53 #define TUXEDO_ATMI_DONE 10
54 #define TUXEDO_ATMI_COMPLETE 11
55 #define TUXEDO_ATMI_ROLLBACK 12
56 #define TUXEDO_ATMI_HEURISTIC 13
57 #define TUXEDO_ATMI_PRE_NW_ACALL1 14
58 #define TUXEDO_ATMI_PRE_NW_ACALL1_RPLY 15
59 #define TUXEDO_ATMI_PRE_NW_ACALL2 16
60 #define TUXEDO_ATMI_PRE_NW_ACALL2_RPLY 17
61 #define TUXEDO_ATMI_PRE_NW_ACALL3 18
62 #define TUXEDO_ATMI_PRE_NW_ACALL3_RPLY 19
63 #define TUXEDO_ATMI_PRE_NW_LLE 20
64 #define TUXEDO_ATMI_PRE_NW_LLE_RPLY 21
65 #define TUXEDO_ATMI_SEC_EXCHG_RQST 22
66 #define TUXEDO_ATMI_SEC_EXCHG_RPLY 23
67 #define TUXEDO_ATMI_SEC_NW_ACALL3 24
68 #define TUXEDO_ATMI_SEC_NW_ACALL3_RPLY 25
71 static const value_string tuxedo_opcode_vals
[] = {
72 { TUXEDO_ATMI_CALL
, "CALL" },
73 { TUXEDO_ATMI_REPLY
, "REPLY" },
74 { TUXEDO_ATMI_FAILURE
, "FAILURE" },
75 { TUXEDO_ATMI_CONNECT
, "CONNECT" },
76 { TUXEDO_ATMI_DATA
, "DATA" },
77 { TUXEDO_ATMI_DISCON
, "DISCON" },
78 { TUXEDO_ATMI_PREPARE
, "PREPARE" },
79 { TUXEDO_ATMI_READY
, "READY" },
80 { TUXEDO_ATMI_COMMIT
, "COMMIT" },
81 { TUXEDO_ATMI_DONE
, "DONE" },
82 { TUXEDO_ATMI_COMPLETE
, "COMPLETE" },
83 { TUXEDO_ATMI_ROLLBACK
, "ROLLBACK" },
84 { TUXEDO_ATMI_HEURISTIC
, "HEURISTIC" },
85 { TUXEDO_ATMI_PRE_NW_ACALL1
, "ACALL1" },
86 { TUXEDO_ATMI_PRE_NW_ACALL1_RPLY
, "ACALL1_REPLY" },
87 { TUXEDO_ATMI_PRE_NW_ACALL2
, "ACALL2" },
88 { TUXEDO_ATMI_PRE_NW_ACALL2_RPLY
, "ACALL2_REPLY" },
89 { TUXEDO_ATMI_PRE_NW_ACALL3
, "ACALL3" },
90 { TUXEDO_ATMI_PRE_NW_ACALL3_RPLY
, "ACALL3_REPLY" },
91 { TUXEDO_ATMI_PRE_NW_LLE
, "LLE" },
92 { TUXEDO_ATMI_PRE_NW_LLE_RPLY
, "LLE_REPLY" },
93 { TUXEDO_ATMI_SEC_EXCHG_RQST
, "SEC_EXCHANGE" },
94 { TUXEDO_ATMI_SEC_EXCHG_RPLY
, "SEC_EXCHANGE_REPLY" },
95 { TUXEDO_ATMI_SEC_NW_ACALL3
, "SEC_ACALL3" },
96 { TUXEDO_ATMI_SEC_NW_ACALL3_RPLY
, "SEC_ACALL3_REPLY" },
102 dissect_tuxedo(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
104 proto_tree
*tuxedoroot_tree
= NULL
;
109 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TUXEDO");
111 if (tvb_length(tvb
) >= 8)
113 magic
= tvb_get_ntohl(tvb
, 0);
114 if (magic
== TUXEDO_MAGIC
|| magic
== TUXEDO_SMAGIC
)
116 opcode
= tvb_get_ntohl(tvb
, 4);
118 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(opcode
, tuxedo_opcode_vals
, "Unknown (0x%02x)"));
122 ti
= proto_tree_add_item(tree
, proto_tuxedo
, tvb
, 0, -1, ENC_NA
);
123 tuxedoroot_tree
= proto_item_add_subtree(ti
, ett_tuxedo
);
125 proto_tree_add_item(tuxedoroot_tree
, hf_tuxedo_magic
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
126 proto_tree_add_item(tuxedoroot_tree
, hf_tuxedo_opcode
, tvb
, 4, 4, ENC_BIG_ENDIAN
);
131 /* This packet is a continuation */
132 col_set_str(pinfo
->cinfo
, COL_INFO
, "Continuation");
135 proto_tree_add_item(tree
, proto_tuxedo
, tvb
, 0, -1, ENC_NA
);
142 dissect_tuxedo_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
144 if (tvb_length(tvb
) >= 8)
147 magic
= tvb_get_ntohl(tvb
, 0);
148 if (magic
== TUXEDO_MAGIC
|| magic
== TUXEDO_SMAGIC
)
150 /* Register this dissector for this conversation */
151 conversation_t
*conversation
= NULL
;
152 conversation
= find_or_create_conversation(pinfo
);
153 conversation_set_dissector(conversation
, tuxedo_handle
);
155 dissect_tuxedo(tvb
, pinfo
, tree
);
163 proto_register_tuxedo(void)
165 static hf_register_info hf
[] = {
167 { "Magic", "tuxedo.magic", FT_UINT32
, BASE_HEX
, NULL
, 0x0, "TUXEDO magic", HFILL
}},
170 { "Opcode", "tuxedo.opcode", FT_UINT32
, BASE_HEX
, VALS(tuxedo_opcode_vals
), 0x0, "TUXEDO opcode", HFILL
}}
173 static gint
*ett
[] = {
177 proto_tuxedo
= proto_register_protocol("BEA Tuxedo", "TUXEDO", "tuxedo");
178 proto_register_field_array(proto_tuxedo
, hf
, array_length(hf
));
179 proto_register_subtree_array(ett
, array_length(ett
));
185 proto_reg_handoff_tuxedo(void)
187 tuxedo_handle
= create_dissector_handle(dissect_tuxedo
, proto_tuxedo
);
188 dissector_add_handle("tcp.port", tuxedo_handle
);
189 heur_dissector_add("tcp", dissect_tuxedo_heur
, proto_tuxedo
);