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.
34 #include <epan/packet.h>
36 #define IPSICTL_PORT 5010
37 #define IPSICTL_PDU_MAGIC 0x0300
39 static int proto_ipsictl = -1;
41 static int hf_ipsictl_pdu = -1;
42 static int hf_ipsictl_magic = -1;
43 static int hf_ipsictl_length = -1;
44 static int hf_ipsictl_type = -1;
45 static int hf_ipsictl_sequence = -1;
46 static int hf_ipsictl_field1 = -1;
47 static int hf_ipsictl_data = -1;
49 static gint ett_ipsictl = -1;
50 static gint ett_ipsictl_pdu = -1;
52 static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
55 proto_tree *ipsictl_tree = NULL;
56 proto_tree *pdu_tree = NULL;
66 int first_sequence=-1;
73 remaining_length=tvb_reported_length_remaining(tvb, offset);
77 ti = proto_tree_add_item(tree, proto_ipsictl, tvb, offset, remaining_length, FALSE);
78 ipsictl_tree = proto_item_add_subtree(ti, ett_ipsictl);
82 magic = tvb_get_ntohs(tvb, offset);
83 if (magic == IPSICTL_PDU_MAGIC)
89 ((remaining_length=tvb_reported_length_remaining(tvb, offset)) > 6))
93 magic = tvb_get_ntohs(tvb, loffset); loffset+=2;
94 length = tvb_get_ntohs(tvb, loffset); loffset+=2;
97 if (remaining_length>=2)
99 type = tvb_get_ntohs(tvb, loffset); loffset+=2;
103 if (remaining_length>=2)
105 sequence = tvb_get_ntohs(tvb, loffset); loffset+=2;
108 if (first_sequence==-1)
110 first_sequence=sequence;
112 last_sequence=sequence;
115 if (remaining_length>=2)
117 field1 = tvb_get_ntohs(tvb, loffset); loffset+=2;
121 data = tvb_get_ptr(tvb, loffset, remaining_length);
125 ti = proto_tree_add_uint_format(ipsictl_tree, hf_ipsictl_pdu, tvb,
126 offset, (length+4), pdu,
129 pdu_tree = proto_item_add_subtree(ti, ett_ipsictl_pdu);
133 remaining_length=tvb_reported_length_remaining(tvb, offset);
136 proto_tree_add_uint(pdu_tree, hf_ipsictl_magic, tvb, loffset, 2, magic);
138 loffset+=2; remaining_length-=2;
140 proto_tree_add_uint(pdu_tree, hf_ipsictl_length, tvb, loffset, 2, length);
142 loffset+=2; remaining_length-=2;
144 if (remaining_length>=2)
147 proto_tree_add_uint(pdu_tree, hf_ipsictl_type, tvb, loffset, 2, type);
149 loffset+=2; remaining_length-=2;
151 if (remaining_length>=2)
154 proto_tree_add_uint(pdu_tree, hf_ipsictl_sequence, tvb, loffset, 2, sequence);
156 loffset+=2; remaining_length-=2;
158 if (remaining_length>=2)
161 proto_tree_add_uint(pdu_tree, hf_ipsictl_field1, tvb, loffset, 2, field1);
163 loffset+=2; remaining_length-=2;
165 if (remaining_length>=2)
168 proto_tree_add_bytes(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, data);
170 loffset+=llength; remaining_length-=llength;
179 data = tvb_get_ptr(tvb, offset, remaining_length);
182 proto_tree_add_bytes(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, data);
186 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
190 if (check_col(pinfo->cinfo, COL_INFO)) {
191 if (last_sequence==-1)
193 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x",
196 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x",
197 pdu,first_sequence,last_sequence);
201 col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
205 } /* dissect_ipsictl */
207 void proto_register_ipsictl(void)
210 static hf_register_info hf[] = {
212 { "PDU", "ipsictl.pdu",
213 FT_UINT16, BASE_HEX, NULL, 0x0,
214 "IPSICTL PDU", HFILL }},
216 { "Magic", "ipsictl.magic",
217 FT_UINT16, BASE_HEX, NULL, 0x0,
218 "IPSICTL Magic", HFILL }},
219 { &hf_ipsictl_length,
220 { "Length", "ipsictl.length",
221 FT_UINT16, BASE_HEX, NULL, 0x0,
222 "IPSICTL Length", HFILL }},
224 { "Type", "ipsictl.type",
225 FT_UINT16, BASE_HEX, NULL, 0x0,
226 "IPSICTL Type", HFILL }},
227 { &hf_ipsictl_sequence,
228 { "Sequence", "ipsictl.sequence",
229 FT_UINT16, BASE_HEX, NULL, 0x0,
230 "IPSICTL Sequence", HFILL }},
231 { &hf_ipsictl_field1,
232 { "Field1", "ipsictl.field1",
233 FT_UINT16, BASE_HEX, NULL, 0x0,
234 "IPSICTL Field1", HFILL }},
236 { "Data", "ipsictl.data",
237 FT_BYTES, BASE_NONE, NULL, 0x0,
238 "IPSICTL data", HFILL }},
241 static gint *ett[] = {
246 proto_ipsictl = proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
247 proto_register_field_array(proto_ipsictl, hf, array_length(hf));
248 proto_register_subtree_array(ett, array_length(ett));
252 void proto_reg_handoff_ipsictl(void)
255 dissector_handle_t ipsictl_handle = NULL;
257 ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
259 dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle);