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>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
32 void proto_register_ipsictl(void);
33 void proto_reg_handoff_ipsictl(void);
35 #define IPSICTL_PORT 5010
36 #define IPSICTL_PDU_MAGIC 0x0300
38 static int proto_ipsictl = -1;
40 static int hf_ipsictl_pdu = -1;
41 static int hf_ipsictl_magic = -1;
42 static int hf_ipsictl_length = -1;
43 static int hf_ipsictl_type = -1;
44 static int hf_ipsictl_sequence = -1;
45 static int hf_ipsictl_field1 = -1;
46 static int hf_ipsictl_data = -1;
48 static gint ett_ipsictl = -1;
49 static gint ett_ipsictl_pdu = -1;
51 static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
54 proto_tree *ipsictl_tree = NULL;
55 proto_tree *pdu_tree = NULL;
65 int first_sequence=-1;
71 remaining_length=tvb_reported_length_remaining(tvb, offset);
75 ti = proto_tree_add_item(tree, proto_ipsictl, tvb, offset, remaining_length, ENC_NA);
76 ipsictl_tree = proto_item_add_subtree(ti, ett_ipsictl);
80 magic = tvb_get_ntohs(tvb, offset);
81 if (magic == IPSICTL_PDU_MAGIC)
87 ((remaining_length=tvb_reported_length_remaining(tvb, offset)) > 6))
91 magic = tvb_get_ntohs(tvb, loffset); loffset+=2;
92 length = tvb_get_ntohs(tvb, loffset); loffset+=2;
95 if (remaining_length>=2)
97 type = tvb_get_ntohs(tvb, loffset); loffset+=2;
101 if (remaining_length>=2)
103 sequence = tvb_get_ntohs(tvb, loffset); loffset+=2;
106 if (first_sequence==-1)
108 first_sequence=sequence;
110 last_sequence=sequence;
113 if (remaining_length>=2)
115 field1 = tvb_get_ntohs(tvb, loffset);
121 ti = proto_tree_add_uint(ipsictl_tree, hf_ipsictl_pdu, tvb,
122 offset, (length+4), pdu);
124 pdu_tree = proto_item_add_subtree(ti, ett_ipsictl_pdu);
128 remaining_length=tvb_reported_length_remaining(tvb, offset);
131 proto_tree_add_uint(pdu_tree, hf_ipsictl_magic, tvb, loffset, 2, magic);
133 loffset+=2; remaining_length-=2;
135 proto_tree_add_uint(pdu_tree, hf_ipsictl_length, tvb, loffset, 2, length);
137 loffset+=2; remaining_length-=2;
139 if (remaining_length>=2)
142 proto_tree_add_uint(pdu_tree, hf_ipsictl_type, tvb, loffset, 2, type);
144 loffset+=2; remaining_length-=2;
146 if (remaining_length>=2)
149 proto_tree_add_uint(pdu_tree, hf_ipsictl_sequence, tvb, loffset, 2, sequence);
151 loffset+=2; remaining_length-=2;
153 if (remaining_length>=2)
156 proto_tree_add_uint(pdu_tree, hf_ipsictl_field1, tvb, loffset, 2, field1);
158 loffset+=2; remaining_length-=2;
160 if (remaining_length>=2)
163 proto_tree_add_item(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, ENC_NA);
175 proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
179 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
183 if (last_sequence==-1)
185 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x",
188 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x",
189 pdu,first_sequence,last_sequence);
192 col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
196 } /* dissect_ipsictl */
198 void proto_register_ipsictl(void)
201 static hf_register_info hf[] = {
203 { "PDU", "ipsictl.pdu",
204 FT_UINT16, BASE_DEC, NULL, 0x0,
205 "IPSICTL PDU", HFILL }},
207 { "Magic", "ipsictl.magic",
208 FT_UINT16, BASE_HEX, NULL, 0x0,
209 "IPSICTL Magic", HFILL }},
210 { &hf_ipsictl_length,
211 { "Length", "ipsictl.length",
212 FT_UINT16, BASE_HEX, NULL, 0x0,
213 "IPSICTL Length", HFILL }},
215 { "Type", "ipsictl.type",
216 FT_UINT16, BASE_HEX, NULL, 0x0,
217 "IPSICTL Type", HFILL }},
218 { &hf_ipsictl_sequence,
219 { "Sequence", "ipsictl.sequence",
220 FT_UINT16, BASE_HEX, NULL, 0x0,
221 "IPSICTL Sequence", HFILL }},
222 { &hf_ipsictl_field1,
223 { "Field1", "ipsictl.field1",
224 FT_UINT16, BASE_HEX, NULL, 0x0,
225 "IPSICTL Field1", HFILL }},
227 { "Data", "ipsictl.data",
228 FT_BYTES, BASE_NONE, NULL, 0x0,
229 "IPSICTL data", HFILL }},
232 static gint *ett[] = {
237 proto_ipsictl = proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
238 proto_register_field_array(proto_ipsictl, hf, array_length(hf));
239 proto_register_subtree_array(ett, array_length(ett));
243 void proto_reg_handoff_ipsictl(void)
246 dissector_handle_t ipsictl_handle = NULL;
248 ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
250 dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle);