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.
29 #include <epan/packet.h>
31 void proto_register_ipsictl(void);
32 void proto_reg_handoff_ipsictl(void);
34 #define IPSICTL_PORT 5010
35 #define IPSICTL_PDU_MAGIC 0x0300
37 static int proto_ipsictl = -1;
39 static int hf_ipsictl_pdu = -1;
40 static int hf_ipsictl_magic = -1;
41 static int hf_ipsictl_length = -1;
42 static int hf_ipsictl_type = -1;
43 static int hf_ipsictl_sequence = -1;
44 static int hf_ipsictl_field1 = -1;
45 static int hf_ipsictl_data = -1;
47 static gint ett_ipsictl = -1;
48 static gint ett_ipsictl_pdu = -1;
50 static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
53 proto_tree *ipsictl_tree;
64 int first_sequence=-1;
70 remaining_length=tvb_reported_length_remaining(tvb, offset);
72 ti = proto_tree_add_item(tree, proto_ipsictl, tvb, offset, remaining_length, ENC_NA);
73 ipsictl_tree = proto_item_add_subtree(ti, ett_ipsictl);
75 magic = tvb_get_ntohs(tvb, offset);
76 if (magic == IPSICTL_PDU_MAGIC)
82 ((remaining_length=tvb_reported_length_remaining(tvb, offset)) > 6))
86 magic = tvb_get_ntohs(tvb, loffset); loffset+=2;
87 length = tvb_get_ntohs(tvb, loffset); loffset+=2;
90 if (remaining_length>=2)
92 type = tvb_get_ntohs(tvb, loffset); loffset+=2;
96 if (remaining_length>=2)
98 sequence = tvb_get_ntohs(tvb, loffset); loffset+=2;
101 if (first_sequence==-1)
103 first_sequence=sequence;
105 last_sequence=sequence;
108 if (remaining_length>=2)
110 field1 = tvb_get_ntohs(tvb, loffset);
114 ti = proto_tree_add_uint(ipsictl_tree, hf_ipsictl_pdu, tvb,
115 offset, (length+4), pdu);
116 pdu_tree = proto_item_add_subtree(ti, ett_ipsictl_pdu);
119 remaining_length=tvb_reported_length_remaining(tvb, offset);
122 proto_tree_add_uint(pdu_tree, hf_ipsictl_magic, tvb, loffset, 2, magic);
124 loffset+=2; remaining_length-=2;
126 proto_tree_add_uint(pdu_tree, hf_ipsictl_length, tvb, loffset, 2, length);
128 loffset+=2; remaining_length-=2;
130 if (remaining_length>=2)
133 proto_tree_add_uint(pdu_tree, hf_ipsictl_type, tvb, loffset, 2, type);
135 loffset+=2; remaining_length-=2;
137 if (remaining_length>=2)
140 proto_tree_add_uint(pdu_tree, hf_ipsictl_sequence, tvb, loffset, 2, sequence);
142 loffset+=2; remaining_length-=2;
144 if (remaining_length>=2)
147 proto_tree_add_uint(pdu_tree, hf_ipsictl_field1, tvb, loffset, 2, field1);
149 loffset+=2; remaining_length-=2;
151 if (remaining_length>=2)
154 proto_tree_add_item(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, ENC_NA);
166 proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
170 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
174 if (last_sequence==-1)
176 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x",
179 col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x",
180 pdu,first_sequence,last_sequence);
183 col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
187 } /* dissect_ipsictl */
189 void proto_register_ipsictl(void)
192 static hf_register_info hf[] = {
194 { "PDU", "ipsictl.pdu",
195 FT_UINT16, BASE_DEC, NULL, 0x0,
196 "IPSICTL PDU", HFILL }},
198 { "Magic", "ipsictl.magic",
199 FT_UINT16, BASE_HEX, NULL, 0x0,
200 "IPSICTL Magic", HFILL }},
201 { &hf_ipsictl_length,
202 { "Length", "ipsictl.length",
203 FT_UINT16, BASE_HEX, NULL, 0x0,
204 "IPSICTL Length", HFILL }},
206 { "Type", "ipsictl.type",
207 FT_UINT16, BASE_HEX, NULL, 0x0,
208 "IPSICTL Type", HFILL }},
209 { &hf_ipsictl_sequence,
210 { "Sequence", "ipsictl.sequence",
211 FT_UINT16, BASE_HEX, NULL, 0x0,
212 "IPSICTL Sequence", HFILL }},
213 { &hf_ipsictl_field1,
214 { "Field1", "ipsictl.field1",
215 FT_UINT16, BASE_HEX, NULL, 0x0,
216 "IPSICTL Field1", HFILL }},
218 { "Data", "ipsictl.data",
219 FT_BYTES, BASE_NONE, NULL, 0x0,
220 "IPSICTL data", HFILL }},
223 static gint *ett[] = {
228 proto_ipsictl = proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
229 proto_register_field_array(proto_ipsictl, hf, array_length(hf));
230 proto_register_subtree_array(ett, array_length(ett));
234 void proto_reg_handoff_ipsictl(void)
237 dissector_handle_t ipsictl_handle = NULL;
239 ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
241 dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle);
246 * Editor modelines - http://www.wireshark.org/tools/modelines.html
251 * indent-tabs-mode: nil
254 * ex: set shiftwidth=2 tabstop=8 expandtab:
255 * :indentSize=2:tabSize=8:noTabs=true: