2008-07-08 21:44:05 +00:00
|
|
|
/* packet-ipsi-ctl.c
|
|
|
|
* Routines for Avaya IPSI Control packet disassembly
|
|
|
|
* Traffic is encapsulated Avaya proprietary CCMS
|
|
|
|
* (Control Channel Message Set) between PCD and SIM
|
|
|
|
*
|
|
|
|
* Copyright 2008, Randy McEoin <rmceoin@ahbelo.com>
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-08 21:44:05 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2008-07-08 21:44:05 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#define IPSICTL_PORT 5010
|
|
|
|
#define IPSICTL_PDU_MAGIC 0x0300
|
|
|
|
|
|
|
|
static int proto_ipsictl = -1;
|
|
|
|
|
|
|
|
static int hf_ipsictl_pdu = -1;
|
|
|
|
static int hf_ipsictl_magic = -1;
|
|
|
|
static int hf_ipsictl_length = -1;
|
|
|
|
static int hf_ipsictl_type = -1;
|
|
|
|
static int hf_ipsictl_sequence = -1;
|
|
|
|
static int hf_ipsictl_field1 = -1;
|
|
|
|
static int hf_ipsictl_data = -1;
|
|
|
|
|
|
|
|
static gint ett_ipsictl = -1;
|
|
|
|
static gint ett_ipsictl_pdu = -1;
|
|
|
|
|
|
|
|
static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2011-01-16 03:35:29 +00:00
|
|
|
|
2008-07-08 21:44:05 +00:00
|
|
|
proto_tree *ipsictl_tree = NULL;
|
|
|
|
proto_tree *pdu_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
int offset = 0;
|
|
|
|
int loffset = 0;
|
|
|
|
int llength = 0;
|
|
|
|
int remaining_length;
|
|
|
|
guint16 magic;
|
|
|
|
guint16 length;
|
2008-07-09 14:50:05 +00:00
|
|
|
guint16 type=0;
|
2008-07-08 21:44:05 +00:00
|
|
|
guint16 sequence=0;
|
|
|
|
int first_sequence=-1;
|
|
|
|
int last_sequence=-1;
|
|
|
|
guint16 field1=0;
|
|
|
|
guint16 pdu=0;
|
|
|
|
int haspdus=0;
|
|
|
|
|
|
|
|
remaining_length=tvb_reported_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ipsictl, tvb, offset, remaining_length, ENC_NA);
|
2008-07-08 21:44:05 +00:00
|
|
|
ipsictl_tree = proto_item_add_subtree(ti, ett_ipsictl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
magic = tvb_get_ntohs(tvb, offset);
|
|
|
|
if (magic == IPSICTL_PDU_MAGIC)
|
|
|
|
{
|
|
|
|
haspdus=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (haspdus &&
|
|
|
|
((remaining_length=tvb_reported_length_remaining(tvb, offset)) > 6))
|
|
|
|
{
|
|
|
|
loffset = offset;
|
|
|
|
|
|
|
|
magic = tvb_get_ntohs(tvb, loffset); loffset+=2;
|
|
|
|
length = tvb_get_ntohs(tvb, loffset); loffset+=2;
|
|
|
|
llength=length;
|
|
|
|
remaining_length-=4;
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
type = tvb_get_ntohs(tvb, loffset); loffset+=2;
|
|
|
|
remaining_length-=2;
|
|
|
|
llength-=2;
|
|
|
|
}
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
sequence = tvb_get_ntohs(tvb, loffset); loffset+=2;
|
|
|
|
remaining_length-=2;
|
|
|
|
llength-=2;
|
|
|
|
if (first_sequence==-1)
|
|
|
|
{
|
|
|
|
first_sequence=sequence;
|
|
|
|
}else{
|
|
|
|
last_sequence=sequence;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
field1 = tvb_get_ntohs(tvb, loffset); loffset+=2;
|
|
|
|
remaining_length-=2;
|
|
|
|
llength-=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
|
|
|
|
ti = proto_tree_add_uint_format(ipsictl_tree, hf_ipsictl_pdu, tvb,
|
|
|
|
offset, (length+4), pdu,
|
|
|
|
"PDU: %d", pdu);
|
|
|
|
|
|
|
|
pdu_tree = proto_item_add_subtree(ti, ett_ipsictl_pdu);
|
|
|
|
}
|
|
|
|
|
|
|
|
loffset=offset;
|
|
|
|
remaining_length=tvb_reported_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(pdu_tree, hf_ipsictl_magic, tvb, loffset, 2, magic);
|
|
|
|
}
|
|
|
|
loffset+=2; remaining_length-=2;
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(pdu_tree, hf_ipsictl_length, tvb, loffset, 2, length);
|
|
|
|
}
|
|
|
|
loffset+=2; remaining_length-=2;
|
|
|
|
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(pdu_tree, hf_ipsictl_type, tvb, loffset, 2, type);
|
|
|
|
}
|
|
|
|
loffset+=2; remaining_length-=2;
|
|
|
|
}
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(pdu_tree, hf_ipsictl_sequence, tvb, loffset, 2, sequence);
|
|
|
|
}
|
|
|
|
loffset+=2; remaining_length-=2;
|
|
|
|
}
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_uint(pdu_tree, hf_ipsictl_field1, tvb, loffset, 2, field1);
|
|
|
|
}
|
|
|
|
loffset+=2; remaining_length-=2;
|
|
|
|
}
|
|
|
|
if (remaining_length>=2)
|
|
|
|
{
|
|
|
|
if (tree) {
|
2011-01-16 03:35:29 +00:00
|
|
|
proto_tree_add_item(pdu_tree, hf_ipsictl_data, tvb, loffset, llength, ENC_NA);
|
2008-07-08 21:44:05 +00:00
|
|
|
}
|
|
|
|
loffset+=llength; remaining_length-=llength;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset=loffset;
|
|
|
|
pdu++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!haspdus)
|
|
|
|
{
|
|
|
|
if (tree) {
|
2011-01-16 03:35:29 +00:00
|
|
|
proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
|
2008-07-08 21:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
|
2008-07-08 21:44:05 +00:00
|
|
|
|
|
|
|
if (haspdus)
|
|
|
|
{
|
2013-06-14 01:02:11 +00:00
|
|
|
if (last_sequence==-1)
|
|
|
|
{
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x",
|
|
|
|
pdu,first_sequence);
|
|
|
|
}else{
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "PDUS=%d, Seq=0x%04x-0x%04x",
|
|
|
|
pdu,first_sequence,last_sequence);
|
2008-07-08 21:44:05 +00:00
|
|
|
}
|
|
|
|
}else{
|
2009-09-24 19:50:43 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
|
2008-07-08 21:44:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* dissect_ipsictl */
|
|
|
|
|
2011-01-16 03:35:29 +00:00
|
|
|
void proto_register_ipsictl(void)
|
2008-07-08 21:44:05 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ipsictl_pdu,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "PDU", "ipsictl.pdu",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL PDU", HFILL }},
|
|
|
|
{ &hf_ipsictl_magic,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Magic", "ipsictl.magic",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL Magic", HFILL }},
|
|
|
|
{ &hf_ipsictl_length,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Length", "ipsictl.length",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL Length", HFILL }},
|
|
|
|
{ &hf_ipsictl_type,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Type", "ipsictl.type",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL Type", HFILL }},
|
|
|
|
{ &hf_ipsictl_sequence,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Sequence", "ipsictl.sequence",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL Sequence", HFILL }},
|
|
|
|
{ &hf_ipsictl_field1,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Field1", "ipsictl.field1",
|
2008-07-08 21:44:05 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
"IPSICTL Field1", HFILL }},
|
|
|
|
{ &hf_ipsictl_data,
|
2011-01-16 03:35:29 +00:00
|
|
|
{ "Data", "ipsictl.data",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
2008-07-08 21:44:05 +00:00
|
|
|
"IPSICTL data", HFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ipsictl,
|
|
|
|
&ett_ipsictl_pdu
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_ipsictl = proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
|
|
|
|
proto_register_field_array(proto_ipsictl, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-16 03:35:29 +00:00
|
|
|
void proto_reg_handoff_ipsictl(void)
|
2008-07-08 21:44:05 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
dissector_handle_t ipsictl_handle = NULL;
|
|
|
|
|
|
|
|
ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
|
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle);
|
2008-07-08 21:44:05 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|