2 * Routines for Avaya IPSI Control packet disassembly
3 * Traffic is encapsulated Avaya proprietary CCMS
4 * (Control Channel Message Set) between PCD and SIM
6 * Copyright 2008, Randy McEoin <rmceoin@ahbelo.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #include <epan/packet.h>
38 #define IPSICTL_PORT 5010
39 #define IPSICTL_PDU_MAGIC 0x0300
41 static int proto_ipsictl = -1;
43 static int hf_ipsictl_pdu = -1;
44 static int hf_ipsictl_magic = -1;
45 static int hf_ipsictl_length = -1;
46 static int hf_ipsictl_type = -1;
47 static int hf_ipsictl_sequence = -1;
48 static int hf_ipsictl_field1 = -1;
49 static int hf_ipsictl_data = -1;
51 static gint ett_ipsictl = -1;
52 static gint ett_ipsictl_pdu = -1;
54 static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
57 proto_tree *ipsictl_tree = NULL;
58 proto_tree *pdu_tree = NULL;
68 int first_sequence=-1;
75 remaining_length=tvb_reported_length_remaining(tvb, offset);
79 ti = proto_tree_add_item(tree, proto_ipsictl, tvb, offset, remaining_length, FALSE);
80 ipsictl_tree = proto_item_add_subtree(ti, ett_ipsictl);
84 magic = tvb_get_ntohs(tvb, offset);
85 if (magic == IPSICTL_PDU_MAGIC)
91 ((remaining_length=tvb_reported_length_remaining(tvb, offset)) > 6))
95 magic = tvb_get_ntohs(tvb, loffset); loffset+=2;
96 length = tvb_get_ntohs(tvb, loffset); loffset+=2;
99 if (remaining_length>=2)
101 type = tvb_get_ntohs(tvb, loffset); loffset+=2;
105 if (remaining_length>=2)
107 sequence = tvb_get_ntohs(tvb, loffset); loffset+=2;
110 if (first_sequence==-1)
112 first_sequence=sequence;
114 last_sequence=sequence;
117 if (remaining_length>=2)
119 field1 = tvb_get_ntohs(tvb, loffset); loffset+=2;
123 data = tvb_get_ptr(tvb, loffset, remaining_length);
127 ti = proto_tree_add_uint_format(ipsictl_tree, hf_ipsictl_pdu, tvb,
128 offset, (length+4), pdu,
131 pdu_tree = proto_item_add_subtree(ti, ett_ipsictl_pdu);
135 remaining_length=tvb_reported_length_remaining(tvb, offset);
138 proto_tree_add_uint(pdu_tree, hf_ipsictl_magic, tvb, loffset, 2, magic);
140 loffset+=2; remaining_length-=2;
142 proto_tree_add_uint(pdu_tree, hf_ipsictl_length, tvb, loffset, 2, length);
144 loffset+=2; remaining_length-=2;
146 if (remaining_length>=2)
149 proto_tree_add_uint(pdu_tree, hf_ipsictl_type, tvb, loffset, 2, type);
151 loffset+=2; remaining_length-=2;
153 if (remaining_length>=2)
156 proto_tree_add_uint(pdu_tree, hf_ipsictl_sequence, tvb, loffset, 2, sequence);
158 loffset+=2; remaining_length-=2;
160 if (remaining_length>=2)
163 proto_tree_add_uint(pdu_tree, hf_ipsictl_field1, tvb, loffset, 2, field1);
165 loffset+=2; remaining_length-=2;
167 if (remaining_length>=2)
170 proto_tree_add_bytes(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, data);
172 loffset+=llength; remaining_length-=llength;
181 data = tvb_get_ptr(tvb, offset, remaining_length);
184 proto_tree_add_bytes(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, data);
188 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
192 if (check_col(pinfo->cinfo, COL_INFO)) {
193 if (last_sequence==-1)
195 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x",
198 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x",
199 pdu,first_sequence,last_sequence);
203 col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
207 } /* dissect_ipsictl */
209 void proto_register_ipsictl(void)
212 static hf_register_info hf[] = {
214 { "PDU", "ipsictl.pdu",
215 FT_UINT16, BASE_HEX, NULL, 0x0,
216 "IPSICTL PDU", HFILL }},
218 { "Magic", "ipsictl.magic",
219 FT_UINT16, BASE_HEX, NULL, 0x0,
220 "IPSICTL Magic", HFILL }},
221 { &hf_ipsictl_length,
222 { "Length", "ipsictl.length",
223 FT_UINT16, BASE_HEX, NULL, 0x0,
224 "IPSICTL Length", HFILL }},
226 { "Type", "ipsictl.type",
227 FT_UINT16, BASE_HEX, NULL, 0x0,
228 "IPSICTL Type", HFILL }},
229 { &hf_ipsictl_sequence,
230 { "Sequence", "ipsictl.sequence",
231 FT_UINT16, BASE_HEX, NULL, 0x0,
232 "IPSICTL Sequence", HFILL }},
233 { &hf_ipsictl_field1,
234 { "Field1", "ipsictl.field1",
235 FT_UINT16, BASE_HEX, NULL, 0x0,
236 "IPSICTL Field1", HFILL }},
238 { "Data", "ipsictl.data",
239 FT_BYTES, BASE_NONE, NULL, 0x0,
240 "IPSICTL data", HFILL }},
243 static gint *ett[] = {
248 proto_ipsictl = proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
249 proto_register_field_array(proto_ipsictl, hf, array_length(hf));
250 proto_register_subtree_array(ett, array_length(ett));
254 void proto_reg_handoff_ipsictl(void)
257 dissector_handle_t ipsictl_handle = NULL;
259 ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
261 dissector_add("tcp.port", IPSICTL_PORT, ipsictl_handle);