From d9ec02bb0610287288326c9e6acf5e4607affb4b Mon Sep 17 00:00:00 2001 From: Klaus Kurzmann Date: Sun, 17 Apr 2011 10:24:11 +0200 Subject: add isi-commgr Signed-off-by: Klaus Kurzmann --- Makefile | 3 +- src/isi-commgr.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/isi-commgr.h | 8 ++++ src/packet-isi.c | 6 ++- src/packet-isi.h | 2 + 5 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 src/isi-commgr.c create mode 100644 src/isi-commgr.h diff --git a/Makefile b/Makefile index 71ec5d9..f1690a7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ OBJECTS:=src/packet-isi.o \ src/isi-radiosettings.o \ src/isi-phoneinfo.o \ src/isi-call.o \ - src/isi-light.o + src/isi-light.o \ + src/isi-commgr.o \ all: isi.so diff --git a/src/isi-commgr.c b/src/isi-commgr.c new file mode 100644 index 0000000..0f7da89 --- /dev/null +++ b/src/isi-commgr.c @@ -0,0 +1,116 @@ +/* isi-commgr.c + * Dissector for ISI's commgr resource + * Copyright 2011, Klaus Kurzmann + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + +#include +#include +#include + +#include "packet-isi.h" +#include "isi-commgr.h" + +static const value_string isi_commgr_id[] = { + {0x10, "PNS_SUBSCRIBED_RESOURCES_IND"}, + {0x11, "PNS_SUBSCRIBED_RESOURCES_PMM_IND"}, + {0x12, "PNS_SUBSCRIBED_RESOURCES_EXTEND_IND"}, + {0x13, "PNS_SUBSCRIBED_RESOURCES_PMM_EXTEND_IND"}, + {0x00, NULL} +}; + + +static dissector_handle_t isi_commgr_handle; +static void dissect_isi_commgr(tvbuff_t *tvb, packet_info *pinfo, proto_item *tree); + +static guint32 hf_isi_commgr_cmd = -1; +static guint32 hf_isi_commgr_resource_count = -1; + + +void proto_reg_handoff_isi_commgr(void) { + static gboolean initialized=FALSE; + + if (!initialized) { + isi_commgr_handle = create_dissector_handle(dissect_isi_commgr, proto_isi); + dissector_add("isi.resource", 0x10, isi_commgr_handle); + } +} + +void proto_register_isi_commgr(void) { + static hf_register_info hf[] = { + { &hf_isi_commgr_cmd, + { "Command", "isi.commgr.cmd", FT_UINT8, BASE_HEX, isi_commgr_id, 0x0, "Command", HFILL }}, + { &hf_isi_commgr_resource_count, + { "Resource-Count", "isi.commgr.resource_count", FT_UINT8, BASE_DEC, NULL, 0x0, "Resource-Count", HFILL }}, + }; + + proto_register_field_array(proto_isi, hf, array_length(hf)); + register_dissector("isi.commgr", dissect_isi_commgr, proto_isi); +} + +static void _show_resources(tvbuff_t *tvb, proto_tree *tree) { + guint8 cnt, f; + + cnt = tvb_get_guint8(tvb, 1); + proto_tree_add_item(tree, hf_isi_commgr_resource_count, tvb, 1, 1, FALSE); + for(f = 0; f < cnt; f++) { + proto_tree_add_item(tree, hf_isi_res, tvb, 2+f, 1, FALSE); + } +} + +static void dissect_isi_commgr(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { + proto_item *item = NULL; + proto_tree *tree = NULL; + guint8 cmd, code; + + if(isitree) { + item = proto_tree_add_text(isitree, tvb, 0, -1, "Payload"); + tree = proto_item_add_subtree(item, ett_isi_msg); + + proto_tree_add_item(tree, hf_isi_commgr_cmd, tvb, 0, 1, FALSE); + cmd = tvb_get_guint8(tvb, 0); + + switch (cmd) { + case 0x10: /* PNS_SUBSCRIBED_RESOURCES_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Subscribed Resources Indication"); + _show_resources(tvb, tree); + break; + case 0x11: /* PNS_SUBSCRIBED_RESOURCES_PMM_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Subscribed Resources PMM Indication"); + _show_resources(tvb, tree); + break; + case 0x12: /* PNS_SUBSCRIBED_RESOURCES_EXTEND_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Subscribed Resources Extended Indication"); + _show_resources(tvb, tree); + break; + case 0x13: /* PNS_SUBSCRIBED_RESOURCES_PMM_EXTEND_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Subscribed Resources PMM Extended Indication"); + _show_resources(tvb, tree); + break; + + default: + col_set_str(pinfo->cinfo, COL_INFO, "unknown Indication packet"); + expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet"); + break; + } + } +} + + + diff --git a/src/isi-commgr.h b/src/isi-commgr.h new file mode 100644 index 0000000..41cd9f3 --- /dev/null +++ b/src/isi-commgr.h @@ -0,0 +1,8 @@ +#ifndef _ISI_INDICATION_H +#define _ISI_INDICATION_H + +void proto_reg_handoff_isi_indication(void); +void proto_register_isi_indication(void); + +#endif + diff --git a/src/packet-isi.c b/src/packet-isi.c index fd63edc..b9f500c 100644 --- a/src/packet-isi.c +++ b/src/packet-isi.c @@ -67,7 +67,7 @@ static const value_string hf_isi_resource[] = { {0x0D, "Blackberry Email"}, {0x0E, "Plato Panel"}, {0x0F, "Echo"}, - {0x10, "Indication"}, + {0x10, "ComMgr"}, {0x11, "Java"}, {0x12, "Local Connectivity"}, {0x13, "Calendar"}, @@ -314,7 +314,7 @@ static const value_string isi_common_cmd[] = { static guint32 hf_isi_rdev = -1; static guint32 hf_isi_sdev = -1; -static guint32 hf_isi_res = -1; +guint32 hf_isi_res = -1; static guint32 hf_isi_len = -1; static guint32 hf_isi_robj = -1; static guint32 hf_isi_sobj = -1; @@ -370,6 +370,7 @@ void proto_reg_handoff_isi(void) { proto_reg_handoff_isi_phoneinfo(); proto_reg_handoff_isi_call(); proto_reg_handoff_isi_light(); + proto_reg_handoff_isi_commgr(); #ifdef ISI_USB heur_dissector_add("usb.bulk", dissect_usb_isi, proto_isi); @@ -442,6 +443,7 @@ void proto_register_isi(void) { proto_register_isi_phoneinfo(); proto_register_isi_call(); proto_register_isi_light(); + proto_register_isi_commgr(); } void dissect_isi_subpacket(guint32 hf_sub_type, guint8 offset, tvbuff_t *tvb, diff --git a/src/packet-isi.h b/src/packet-isi.h index 1175101..d9e74cd 100644 --- a/src/packet-isi.h +++ b/src/packet-isi.h @@ -9,6 +9,8 @@ extern guint32 ett_isi_msg; extern guint32 ett_isi_network_gsm_band_info; extern guint32 ett_isi_info; +extern guint32 hf_isi_res; + void dissect_isi_common(const char *resource, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); void dissect_isi_subpacket(guint32 hf_sub_type, guint8 offset, tvbuff_t *tvb, packet_info *pinfo, proto_item *item, proto_tree *tree, void (*detail_cb)(guint8, tvbuff_t*, packet_info*, proto_item*, proto_tree*)); -- cgit v1.2.3