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 <wsutil/array.h>
25 #include "packet-tcp.h"
27 #define TALI_SYNC_LENGTH 4
28 #define TALI_OPCODE_LENGTH 4
29 #define TALI_MSU_LENGTH 2
30 #define TALI_HEADER_LENGTH TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH + TALI_MSU_LENGTH
32 #define TALI_SYNC "TALI"
33 #define TALI_TEST "test"
34 #define TALI_ALLO "allo"
35 #define TALI_PROH "proh"
36 #define TALI_PROA "proa"
37 #define TALI_MONI "moni"
38 #define TALI_MONA "mona"
39 #define TALI_SCCP "sccp"
40 #define TALI_ISOT "isot"
41 #define TALI_MTP3 "mtp3"
42 #define TALI_SAAL "saal"
44 void proto_reg_handoff_tali(void);
45 void proto_register_tali(void);
47 static int proto_tali
;
49 static int hf_tali_length_indicator
;
50 static int hf_tali_opcode_indicator
;
51 static int hf_tali_sync_indicator
;
53 /* Initialize the subtree pointers */
55 static int ett_tali_sync
;
56 static int ett_tali_opcode
;
57 static int ett_tali_msu_length
;
59 static dissector_table_t tali_dissector_table
;
61 /* Desegment TALI messages */
62 static bool tali_desegment
= true;
64 /* Code to actually dissect the packets */
66 get_tali_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
70 length
= tvb_get_letohs(tvb
, offset
+ TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
);
71 return length
+TALI_HEADER_LENGTH
;
75 dissect_tali_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
77 char *opcode
; /* TALI opcode */
78 uint16_t length
; /* TALI length */
79 tvbuff_t
*payload_tvb
= NULL
;
81 /* Set up structures needed to add the protocol subtree and manage it */
82 proto_item
*tali_item
= NULL
;
83 proto_tree
*tali_tree
= NULL
;
85 opcode
= (char *) tvb_get_string_enc(pinfo
->pool
, tvb
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
, ENC_ASCII
|ENC_NA
);
86 length
= tvb_get_letohs(tvb
, TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
);
88 /* Make entries in Protocol column on summary display */
89 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TALI");
91 col_clear(pinfo
->cinfo
, COL_INFO
);
92 col_append_fstr(pinfo
->cinfo
, COL_INFO
, "[%s] packet, [%u] bytes in payload", opcode
, length
);
95 /* create display subtree for the protocol */
96 tali_item
= proto_tree_add_item(tree
, proto_tali
, tvb
, 0, TALI_HEADER_LENGTH
, ENC_NA
);
97 tali_tree
= proto_item_add_subtree(tali_item
, ett_tali
);
98 proto_tree_add_string(tali_tree
, hf_tali_sync_indicator
, tvb
, 0, TALI_SYNC_LENGTH
, TALI_SYNC
);
99 proto_tree_add_string(tali_tree
, hf_tali_opcode_indicator
, tvb
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
, opcode
);
100 proto_tree_add_uint(tali_tree
, hf_tali_length_indicator
, tvb
, TALI_SYNC_LENGTH
+ TALI_OPCODE_LENGTH
, TALI_MSU_LENGTH
, length
);
104 payload_tvb
= tvb_new_subset_remaining(tvb
, TALI_HEADER_LENGTH
);
105 if (payload_tvb
!= NULL
&& !dissector_try_string_with_data(tali_dissector_table
, opcode
, payload_tvb
, pinfo
, tree
, true, NULL
)) {
106 call_data_dissector(payload_tvb
, pinfo
, tree
);
110 return tvb_captured_length(tvb
);
114 dissect_tali(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
116 tcp_dissect_pdus(tvb
, pinfo
, tree
, tali_desegment
, TALI_HEADER_LENGTH
,
117 get_tali_pdu_len
, dissect_tali_pdu
, data
);
118 return tvb_captured_length(tvb
);
122 * A 'heuristic dissector' that attemtps to establish whether we have
125 * the fixed header is there
126 * it is a 'well-known' operation
129 dissect_tali_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
131 char opcode
[TALI_OPCODE_LENGTH
]; /* TALI opcode */
134 * If we don't have at least TALI_HEADER_LENGTH bytes worth of captured
135 * data (i.e., available to look at), we can't determine whether this
136 * looks like a TALI packet or not. We must use tvb_captured_length()
137 * because the data must be present in the capture, not sliced off due
138 * to the snapshot length specified for the capture.
140 if (tvb_captured_length(tvb
) < TALI_HEADER_LENGTH
) /* Mandatory header */
143 if (tvb_strneql(tvb
, 0, TALI_SYNC
, TALI_SYNC_LENGTH
) != 0)
146 tvb_memcpy(tvb
, (uint8_t*)opcode
, TALI_SYNC_LENGTH
, TALI_OPCODE_LENGTH
);
147 if (strncmp(opcode
, TALI_TEST
, TALI_OPCODE_LENGTH
) != 0 &&
148 strncmp(opcode
, TALI_ALLO
, TALI_OPCODE_LENGTH
) != 0 &&
149 strncmp(opcode
, TALI_PROH
, TALI_OPCODE_LENGTH
) != 0 &&
150 strncmp(opcode
, TALI_PROA
, TALI_OPCODE_LENGTH
) != 0 &&
151 strncmp(opcode
, TALI_MONI
, TALI_OPCODE_LENGTH
) != 0 &&
152 strncmp(opcode
, TALI_MONA
, TALI_OPCODE_LENGTH
) != 0 &&
153 strncmp(opcode
, TALI_SCCP
, TALI_OPCODE_LENGTH
) != 0 &&
154 strncmp(opcode
, TALI_ISOT
, TALI_OPCODE_LENGTH
) != 0 &&
155 strncmp(opcode
, TALI_MTP3
, TALI_OPCODE_LENGTH
) != 0 &&
156 strncmp(opcode
, TALI_SAAL
, TALI_OPCODE_LENGTH
) != 0)
159 dissect_tali(tvb
, pinfo
, tree
, data
);
164 proto_register_tali(void)
166 static hf_register_info hf
[] = {
167 { &hf_tali_sync_indicator
,
168 { "Sync", "tali.sync",
169 FT_STRING
, BASE_NONE
, NULL
, 0x00,
172 { &hf_tali_opcode_indicator
,
173 { "Opcode", "tali.opcode",
174 FT_STRING
, BASE_NONE
, NULL
, 0x00,
175 "TALI Operation Code", HFILL
}
177 { &hf_tali_length_indicator
,
178 { "Length", "tali.msu_length",
179 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
180 "TALI MSU Length", HFILL
}
184 /* Setup protocol subtree array */
185 static int *ett
[] = {
191 module_t
*tali_module
;
193 /* Register the protocol name and description */
194 proto_tali
= proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali");
195 proto_register_field_array(proto_tali
, hf
, array_length(hf
));
196 proto_register_subtree_array(ett
, array_length(ett
));
198 register_dissector("tali", dissect_tali
, proto_tali
);
200 tali_dissector_table
= register_dissector_table("tali.opcode", "Tali OPCODE", proto_tali
, FT_STRING
, STRING_CASE_SENSITIVE
);
202 tali_module
= prefs_register_protocol(proto_tali
, NULL
);
203 prefs_register_bool_preference(tali_module
, "reassemble",
204 "Reassemble TALI messages spanning multiple TCP segments",
205 "Whether the TALI dissector should reassemble messages spanning multiple TCP segments."
206 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
211 proto_reg_handoff_tali(void)
213 heur_dissector_add("tcp", dissect_tali_heur
, "Tali over TCP", "tali_tcp", proto_tali
, HEURISTIC_ENABLE
);
217 * Editor modelines - https://www.wireshark.org/tools/modelines.html
222 * indent-tabs-mode: nil
225 * ex: set shiftwidth=2 tabstop=8 expandtab:
226 * :indentSize=2:tabSize=8:noTabs=true: