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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
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
= NULL
;
54 proto_tree
*pdu_tree
= NULL
;
64 int first_sequence
=-1;
70 remaining_length
=tvb_reported_length_remaining(tvb
, offset
);
74 ti
= proto_tree_add_item(tree
, proto_ipsictl
, tvb
, offset
, remaining_length
, ENC_NA
);
75 ipsictl_tree
= proto_item_add_subtree(ti
, ett_ipsictl
);
79 magic
= tvb_get_ntohs(tvb
, offset
);
80 if (magic
== IPSICTL_PDU_MAGIC
)
86 ((remaining_length
=tvb_reported_length_remaining(tvb
, offset
)) > 6))
90 magic
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
91 length
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
94 if (remaining_length
>=2)
96 type
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
100 if (remaining_length
>=2)
102 sequence
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
105 if (first_sequence
==-1)
107 first_sequence
=sequence
;
109 last_sequence
=sequence
;
112 if (remaining_length
>=2)
114 field1
= tvb_get_ntohs(tvb
, loffset
);
120 ti
= proto_tree_add_uint(ipsictl_tree
, hf_ipsictl_pdu
, tvb
,
121 offset
, (length
+4), pdu
);
123 pdu_tree
= proto_item_add_subtree(ti
, ett_ipsictl_pdu
);
127 remaining_length
=tvb_reported_length_remaining(tvb
, offset
);
130 proto_tree_add_uint(pdu_tree
, hf_ipsictl_magic
, tvb
, loffset
, 2, magic
);
132 loffset
+=2; remaining_length
-=2;
134 proto_tree_add_uint(pdu_tree
, hf_ipsictl_length
, tvb
, loffset
, 2, length
);
136 loffset
+=2; remaining_length
-=2;
138 if (remaining_length
>=2)
141 proto_tree_add_uint(pdu_tree
, hf_ipsictl_type
, tvb
, loffset
, 2, type
);
143 loffset
+=2; remaining_length
-=2;
145 if (remaining_length
>=2)
148 proto_tree_add_uint(pdu_tree
, hf_ipsictl_sequence
, tvb
, loffset
, 2, sequence
);
150 loffset
+=2; remaining_length
-=2;
152 if (remaining_length
>=2)
155 proto_tree_add_uint(pdu_tree
, hf_ipsictl_field1
, tvb
, loffset
, 2, field1
);
157 loffset
+=2; remaining_length
-=2;
159 if (remaining_length
>=2)
162 proto_tree_add_item(pdu_tree
, hf_ipsictl_data
, tvb
, loffset
, llength
, ENC_NA
);
174 proto_tree_add_item(ipsictl_tree
, hf_ipsictl_data
, tvb
, offset
, -1, ENC_NA
);
178 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IPSICTL");
182 if (last_sequence
==-1)
184 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "PDUS=%d, Seq=0x%04x",
187 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "PDUS=%d, Seq=0x%04x-0x%04x",
188 pdu
,first_sequence
,last_sequence
);
191 col_set_str(pinfo
->cinfo
, COL_INFO
, "Initialization");
195 } /* dissect_ipsictl */
197 void proto_register_ipsictl(void)
200 static hf_register_info hf
[] = {
202 { "PDU", "ipsictl.pdu",
203 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
204 "IPSICTL PDU", HFILL
}},
206 { "Magic", "ipsictl.magic",
207 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
208 "IPSICTL Magic", HFILL
}},
209 { &hf_ipsictl_length
,
210 { "Length", "ipsictl.length",
211 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
212 "IPSICTL Length", HFILL
}},
214 { "Type", "ipsictl.type",
215 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
216 "IPSICTL Type", HFILL
}},
217 { &hf_ipsictl_sequence
,
218 { "Sequence", "ipsictl.sequence",
219 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
220 "IPSICTL Sequence", HFILL
}},
221 { &hf_ipsictl_field1
,
222 { "Field1", "ipsictl.field1",
223 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
224 "IPSICTL Field1", HFILL
}},
226 { "Data", "ipsictl.data",
227 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
228 "IPSICTL data", HFILL
}},
231 static gint
*ett
[] = {
236 proto_ipsictl
= proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
237 proto_register_field_array(proto_ipsictl
, hf
, array_length(hf
));
238 proto_register_subtree_array(ett
, array_length(ett
));
242 void proto_reg_handoff_ipsictl(void)
245 dissector_handle_t ipsictl_handle
= NULL
;
247 ipsictl_handle
= create_dissector_handle(dissect_ipsictl
, proto_ipsictl
);
249 dissector_add_uint("tcp.port", IPSICTL_PORT
, ipsictl_handle
);