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 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/conversation.h>
18 void proto_register_tuxedo(void);
19 void proto_reg_handoff_tuxedo(void);
21 static int proto_tuxedo
;
22 static int hf_tuxedo_magic
;
23 static int hf_tuxedo_opcode
;
25 static int ett_tuxedo
;
27 static dissector_handle_t tuxedo_handle
;
29 #define TUXEDO_MAGIC 0x91039858
30 #define TUXEDO_SMAGIC 0x73903842
32 #define TUXEDO_ATMI_CALL 1
33 #define TUXEDO_ATMI_REPLY 2
34 #define TUXEDO_ATMI_FAILURE 3
35 #define TUXEDO_ATMI_CONNECT 4
36 #define TUXEDO_ATMI_DATA 5
37 #define TUXEDO_ATMI_DISCON 6
38 #define TUXEDO_ATMI_PREPARE 7
39 #define TUXEDO_ATMI_READY 8
40 #define TUXEDO_ATMI_COMMIT 9
41 #define TUXEDO_ATMI_DONE 10
42 #define TUXEDO_ATMI_COMPLETE 11
43 #define TUXEDO_ATMI_ROLLBACK 12
44 #define TUXEDO_ATMI_HEURISTIC 13
45 #define TUXEDO_ATMI_PRE_NW_ACALL1 14
46 #define TUXEDO_ATMI_PRE_NW_ACALL1_RPLY 15
47 #define TUXEDO_ATMI_PRE_NW_ACALL2 16
48 #define TUXEDO_ATMI_PRE_NW_ACALL2_RPLY 17
49 #define TUXEDO_ATMI_PRE_NW_ACALL3 18
50 #define TUXEDO_ATMI_PRE_NW_ACALL3_RPLY 19
51 #define TUXEDO_ATMI_PRE_NW_LLE 20
52 #define TUXEDO_ATMI_PRE_NW_LLE_RPLY 21
53 #define TUXEDO_ATMI_SEC_EXCHG_RQST 22
54 #define TUXEDO_ATMI_SEC_EXCHG_RPLY 23
55 #define TUXEDO_ATMI_SEC_NW_ACALL3 24
56 #define TUXEDO_ATMI_SEC_NW_ACALL3_RPLY 25
59 static const value_string tuxedo_opcode_vals
[] = {
60 { TUXEDO_ATMI_CALL
, "CALL" },
61 { TUXEDO_ATMI_REPLY
, "REPLY" },
62 { TUXEDO_ATMI_FAILURE
, "FAILURE" },
63 { TUXEDO_ATMI_CONNECT
, "CONNECT" },
64 { TUXEDO_ATMI_DATA
, "DATA" },
65 { TUXEDO_ATMI_DISCON
, "DISCON" },
66 { TUXEDO_ATMI_PREPARE
, "PREPARE" },
67 { TUXEDO_ATMI_READY
, "READY" },
68 { TUXEDO_ATMI_COMMIT
, "COMMIT" },
69 { TUXEDO_ATMI_DONE
, "DONE" },
70 { TUXEDO_ATMI_COMPLETE
, "COMPLETE" },
71 { TUXEDO_ATMI_ROLLBACK
, "ROLLBACK" },
72 { TUXEDO_ATMI_HEURISTIC
, "HEURISTIC" },
73 { TUXEDO_ATMI_PRE_NW_ACALL1
, "ACALL1" },
74 { TUXEDO_ATMI_PRE_NW_ACALL1_RPLY
, "ACALL1_REPLY" },
75 { TUXEDO_ATMI_PRE_NW_ACALL2
, "ACALL2" },
76 { TUXEDO_ATMI_PRE_NW_ACALL2_RPLY
, "ACALL2_REPLY" },
77 { TUXEDO_ATMI_PRE_NW_ACALL3
, "ACALL3" },
78 { TUXEDO_ATMI_PRE_NW_ACALL3_RPLY
, "ACALL3_REPLY" },
79 { TUXEDO_ATMI_PRE_NW_LLE
, "LLE" },
80 { TUXEDO_ATMI_PRE_NW_LLE_RPLY
, "LLE_REPLY" },
81 { TUXEDO_ATMI_SEC_EXCHG_RQST
, "SEC_EXCHANGE" },
82 { TUXEDO_ATMI_SEC_EXCHG_RPLY
, "SEC_EXCHANGE_REPLY" },
83 { TUXEDO_ATMI_SEC_NW_ACALL3
, "SEC_ACALL3" },
84 { TUXEDO_ATMI_SEC_NW_ACALL3_RPLY
, "SEC_ACALL3_REPLY" },
90 dissect_tuxedo(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
92 proto_tree
*tuxedoroot_tree
= NULL
;
97 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TUXEDO");
99 if (tvb_reported_length(tvb
) >= 8)
101 magic
= tvb_get_ntohl(tvb
, 0);
102 if (magic
== TUXEDO_MAGIC
|| magic
== TUXEDO_SMAGIC
)
104 opcode
= tvb_get_ntohl(tvb
, 4);
106 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(opcode
, tuxedo_opcode_vals
, "Unknown (0x%02x)"));
110 ti
= proto_tree_add_item(tree
, proto_tuxedo
, tvb
, 0, -1, ENC_NA
);
111 tuxedoroot_tree
= proto_item_add_subtree(ti
, ett_tuxedo
);
113 proto_tree_add_item(tuxedoroot_tree
, hf_tuxedo_magic
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
114 proto_tree_add_item(tuxedoroot_tree
, hf_tuxedo_opcode
, tvb
, 4, 4, ENC_BIG_ENDIAN
);
119 /* This packet is a continuation */
120 col_set_str(pinfo
->cinfo
, COL_INFO
, "Continuation");
123 proto_tree_add_item(tree
, proto_tuxedo
, tvb
, 0, -1, ENC_NA
);
127 return tvb_captured_length(tvb
);
131 dissect_tuxedo_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
133 if (tvb_captured_length(tvb
) >= 8)
136 magic
= tvb_get_ntohl(tvb
, 0);
137 if (magic
== TUXEDO_MAGIC
|| magic
== TUXEDO_SMAGIC
)
139 /* Register this dissector for this conversation */
140 conversation_t
*conversation
= NULL
;
141 conversation
= find_or_create_conversation(pinfo
);
142 conversation_set_dissector(conversation
, tuxedo_handle
);
144 dissect_tuxedo(tvb
, pinfo
, tree
, data
);
152 proto_register_tuxedo(void)
154 static hf_register_info hf
[] = {
156 { "Magic", "tuxedo.magic", FT_UINT32
, BASE_HEX
, NULL
, 0x0, "TUXEDO magic", HFILL
}},
159 { "Opcode", "tuxedo.opcode", FT_UINT32
, BASE_HEX
, VALS(tuxedo_opcode_vals
), 0x0, "TUXEDO opcode", HFILL
}}
162 static int *ett
[] = {
166 proto_tuxedo
= proto_register_protocol("BEA Tuxedo", "TUXEDO", "tuxedo");
167 proto_register_field_array(proto_tuxedo
, hf
, array_length(hf
));
168 proto_register_subtree_array(ett
, array_length(ett
));
170 tuxedo_handle
= register_dissector("tuxedo", dissect_tuxedo
, proto_tuxedo
);
174 proto_reg_handoff_tuxedo(void)
176 dissector_add_for_decode_as_with_preference("tcp.port", tuxedo_handle
);
177 heur_dissector_add("tcp", dissect_tuxedo_heur
, "Tuxedo over TCP", "tuxedo_tcp", proto_tuxedo
, HEURISTIC_ENABLE
);
181 * Editor modelines - https://www.wireshark.org/tools/modelines.html
186 * indent-tabs-mode: t
189 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
190 * :indentSize=8:tabSize=8:noTabs=false: