3 * Routines for Transport Adapter Layer Interface (TALI) version 1.0 dissection (RFC 3094)
5 * Copyright : 2004 Viorel Suman, <vsuman[AT]avmob.ro>
6 * In association with Avalanche Mobile BV, http://www.avmob.com
8 * Dissector of a TALI (Transport Adapter Layer Interface) version 1.0, as defined by the
9 * Tekelec (www.tekelec.com) in RFC 3094, https://www.ietf.org/rfc/rfc3094
11 * Refer to the AUTHORS file or the AUTHORS section in the man page
12 * for contacting the author(s) of this file.
14 * Wireshark - Network traffic analyzer
15 * By Gerald Combs <gerald@wireshark.org>
16 * Copyright 1998 Gerald Combs
18 * SPDX-License-Identifier: GPL-2.0-or-later
22 #include <epan/packet.h>
23 #include <epan/prefs.h>
24 #include "packet-tcp.h"
26 #define TALI_SYNC_LENGTH 4
27 #define TALI_OPCODE_LENGTH 4
28 #define TALI_MSU_LENGTH 2
29 #define TALI_HEADER_LENGTH TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH + TALI_MSU_LENGTH
31 #define TALI_SYNC "TALI"
32 #define TALI_TEST "test"
33 #define TALI_ALLO "allo"
34 #define TALI_PROH "proh"
35 #define TALI_PROA "proa"
36 #define TALI_MONI "moni"
37 #define TALI_MONA "mona"
38 #define TALI_SCCP "sccp"
39 #define TALI_ISOT "isot"
40 #define TALI_MTP3 "mtp3"
41 #define TALI_SAAL "saal"
43 void proto_reg_handoff_tali(void);
44 void proto_register_tali(void);
46 static int proto_tali
;
48 static int hf_tali_length_indicator
;
49 static int hf_tali_opcode_indicator
;
50 static int hf_tali_sync_indicator
;
52 /* Initialize the subtree pointers */
54 static int ett_tali_sync
;
55 static int ett_tali_opcode
;
56 static int ett_tali_msu_length
;
58 static dissector_table_t tali_dissector_table
;
60 /* Desegment TALI messages */
61 static bool tali_desegment
= true;
63 /* Code to actually dissect the packets */
65 get_tali_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
69 length
= tvb_get_letohs(tvb
, offset
+ TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
);
70 return length
+TALI_HEADER_LENGTH
;
74 dissect_tali_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
76 char *opcode
; /* TALI opcode */
77 uint16_t length
; /* TALI length */
78 tvbuff_t
*payload_tvb
= NULL
;
80 /* Set up structures needed to add the protocol subtree and manage it */
81 proto_item
*tali_item
= NULL
;
82 proto_tree
*tali_tree
= NULL
;
84 opcode
= (char *) tvb_get_string_enc(pinfo
->pool
, tvb
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
, ENC_ASCII
|ENC_NA
);
85 length
= tvb_get_letohs(tvb
, TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
);
87 /* Make entries in Protocol column on summary display */
88 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TALI");
90 col_clear(pinfo
->cinfo
, COL_INFO
);
91 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "[%s] packet, [%u] bytes in payload", opcode
, length
);
94 /* create display subtree for the protocol */
95 tali_item
= proto_tree_add_item(tree
, proto_tali
, tvb
, 0, TALI_HEADER_LENGTH
, ENC_NA
);
96 tali_tree
= proto_item_add_subtree(tali_item
, ett_tali
);
97 proto_tree_add_string(tali_tree
, hf_tali_sync_indicator
, tvb
, 0, TALI_SYNC_LENGTH
, TALI_SYNC
);
98 proto_tree_add_string(tali_tree
, hf_tali_opcode_indicator
, tvb
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
, opcode
);
99 proto_tree_add_uint(tali_tree
, hf_tali_length_indicator
, tvb
, TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
, TALI_MSU_LENGTH
, length
);
103 payload_tvb
= tvb_new_subset_remaining(tvb
, TALI_HEADER_LENGTH
);
104 if (payload_tvb
!= NULL
&& !dissector_try_string(tali_dissector_table
, opcode
, payload_tvb
, pinfo
, tree
, NULL
)) {
105 call_data_dissector(payload_tvb
, pinfo
, tree
);
109 return tvb_captured_length(tvb
);
113 dissect_tali(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
115 tcp_dissect_pdus(tvb
, pinfo
, tree
, tali_desegment
, TALI_HEADER_LENGTH
,
116 get_tali_pdu_len
, dissect_tali_pdu
, data
);
117 return tvb_captured_length(tvb
);
121 * A 'heuristic dissector' that attemtps to establish whether we have
124 * the fixed header is there
125 * it is a 'well-known' operation
128 dissect_tali_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
130 char opcode
[TALI_OPCODE_LENGTH
]; /* TALI opcode */
133 * If we don't have at least TALI_HEADER_LENGTH bytes worth of captured
134 * data (i.e., available to look at), we can't determine whether this
135 * looks like a TALI packet or not. We must use tvb_captured_length()
136 * because the data must be present in the capture, not sliced off due
137 * to the snapshot length specified for the capture.
139 if (tvb_captured_length(tvb
) < TALI_HEADER_LENGTH
) /* Mandatory header */
142 if (tvb_strneql(tvb
, 0, TALI_SYNC
, TALI_SYNC_LENGTH
) != 0)
145 tvb_memcpy(tvb
, (uint8_t*)opcode
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
);
146 if (strncmp(opcode
, TALI_TEST
, TALI_OPCODE_LENGTH
) != 0 &&
147 strncmp(opcode
, TALI_ALLO
, TALI_OPCODE_LENGTH
) != 0 &&
148 strncmp(opcode
, TALI_PROH
, TALI_OPCODE_LENGTH
) != 0 &&
149 strncmp(opcode
, TALI_PROA
, TALI_OPCODE_LENGTH
) != 0 &&
150 strncmp(opcode
, TALI_MONI
, TALI_OPCODE_LENGTH
) != 0 &&
151 strncmp(opcode
, TALI_MONA
, TALI_OPCODE_LENGTH
) != 0 &&
152 strncmp(opcode
, TALI_SCCP
, TALI_OPCODE_LENGTH
) != 0 &&
153 strncmp(opcode
, TALI_ISOT
, TALI_OPCODE_LENGTH
) != 0 &&
154 strncmp(opcode
, TALI_MTP3
, TALI_OPCODE_LENGTH
) != 0 &&
155 strncmp(opcode
, TALI_SAAL
, TALI_OPCODE_LENGTH
) != 0)
158 dissect_tali(tvb
, pinfo
, tree
, data
);
163 proto_register_tali(void)
165 static hf_register_info hf
[] = {
166 { &hf_tali_sync_indicator
,
167 { "Sync", "tali.sync",
168 FT_STRING
, BASE_NONE
, NULL
, 0x00,
171 { &hf_tali_opcode_indicator
,
172 { "Opcode", "tali.opcode",
173 FT_STRING
, BASE_NONE
, NULL
, 0x00,
174 "TALI Operation Code", HFILL
}
176 { &hf_tali_length_indicator
,
177 { "Length", "tali.msu_length",
178 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
179 "TALI MSU Length", HFILL
}
183 /* Setup protocol subtree array */
184 static int *ett
[] = {
190 module_t
*tali_module
;
192 /* Register the protocol name and description */
193 proto_tali
= proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali");
194 proto_register_field_array(proto_tali
, hf
, array_length(hf
));
195 proto_register_subtree_array(ett
, array_length(ett
));
197 register_dissector("tali", dissect_tali
, proto_tali
);
199 tali_dissector_table
= register_dissector_table("tali.opcode", "Tali OPCODE", proto_tali
, FT_STRING
, STRING_CASE_SENSITIVE
);
201 tali_module
= prefs_register_protocol(proto_tali
, NULL
);
202 prefs_register_bool_preference(tali_module
, "reassemble",
203 "Reassemble TALI messages spanning multiple TCP segments",
204 "Whether the TALI dissector should reassemble messages spanning multiple TCP segments."
205 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
210 proto_reg_handoff_tali(void)
212 heur_dissector_add("tcp", dissect_tali_heur
, "Tali over TCP", "tali_tcp", proto_tali
, HEURISTIC_ENABLE
);
216 * Editor modelines - https://www.wireshark.org/tools/modelines.html
221 * indent-tabs-mode: nil
224 * ex: set shiftwidth=2 tabstop=8 expandtab:
225 * :indentSize=2:tabSize=8:noTabs=true: