diff options
author | Klaus Kurzmann <mok@fluxnetz.de> | 2011-04-08 17:25:46 +0200 |
---|---|---|
committer | Klaus Kurzmann <mok@fluxnetz.de> | 2011-04-08 17:25:46 +0200 |
commit | 2793836073b3672c632ab24a55e71539b07aadc6 (patch) | |
tree | aa73145b35a4806ed35367df62d920048e0470fc | |
parent | fecbfc8fc60e3c9fb92fa7ce1b426f1e1304d926 (diff) | |
download | isi-wireshark-plugin-2793836073b3672c632ab24a55e71539b07aadc6.tar.bz2 |
isi-nameservice: correctly dissect all known messages
Signed-off-by: Klaus Kurzmann <mok@fluxnetz.de>
-rw-r--r-- | src/isi-nameservice.c | 83 | ||||
-rw-r--r-- | src/packet-isi.c | 4 |
2 files changed, 84 insertions, 3 deletions
diff --git a/src/isi-nameservice.c b/src/isi-nameservice.c index d0b9ec1..c317188 100644 --- a/src/isi-nameservice.c +++ b/src/isi-nameservice.c @@ -39,10 +39,25 @@ static const value_string isi_nameservice_id[] = { {0x00, NULL} }; +static const value_string isi_nameservice_reason[] = { + {0x00, "PN_NAME_OK"}, + {0x01, "PN_NAME_NOT_ALLOWED"}, + {0x02, "PN_NAME_NO_ROOM"}, + {0x03, "PN_NAME_UNKNOWN"}, +}; + static dissector_handle_t isi_nameservice_handle; static void dissect_isi_nameservice(tvbuff_t *tvb, packet_info *pinfo, proto_item *tree); static guint32 hf_isi_nameservice_cmd = -1; +static guint32 hf_isi_nameservice_name = -1; +static guint32 hf_isi_nameservice_dev = -1; +static guint32 hf_isi_nameservice_obj = -1; +static guint32 hf_isi_nameservice_flags = -1; +static guint32 hf_isi_nameservice_reason = -1; +static guint32 hf_isi_nameservice_bitmask = -1; +static guint32 hf_isi_nameservice_matches_total = -1; +static guint32 hf_isi_nameservice_matches = -1; void proto_reg_handoff_isi_nameservice(void) { @@ -57,13 +72,41 @@ void proto_reg_handoff_isi_nameservice(void) { void proto_register_isi_nameservice(void) { static hf_register_info hf[] = { { &hf_isi_nameservice_cmd, - { "Command", "isi.nameservice.cmd", FT_UINT8, BASE_HEX, isi_nameservice_id, 0x0, "Command", HFILL }} + { "Command", "isi.nameservice.cmd", FT_UINT8, BASE_HEX, isi_nameservice_id, 0x0, "Command", HFILL }}, + { &hf_isi_nameservice_name, + { "Name", "isi.nameservice.name", FT_UINT32, BASE_HEX, NULL, 0x0, "Name", HFILL }}, + { &hf_isi_nameservice_dev, + { "Dev", "isi.nameservice.dev", FT_UINT8, BASE_HEX, NULL, 0x0, "Dev", HFILL }}, + { &hf_isi_nameservice_obj, + { "Object", "isi.nameservice.obj", FT_UINT8, BASE_HEX, NULL, 0x0, "Object", HFILL }}, + { &hf_isi_nameservice_flags, + { "Flags", "isi.nameservice.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "Flags", HFILL }}, + { &hf_isi_nameservice_reason, + { "Reason", "isi.nameservice.reason", FT_UINT8, BASE_HEX, isi_nameservice_reason, 0x0, "Reason", HFILL }}, + { &hf_isi_nameservice_bitmask, + { "Bitmask", "isi.nameservice.bitmask", FT_UINT32, BASE_HEX, NULL, 0x0, "Bitmask", HFILL }}, + { &hf_isi_nameservice_matches_total, + { "Total Matches", "isi.nameservice.total_matches", FT_UINT16, BASE_DEC, NULL, 0x0, "Matches", HFILL }}, + { &hf_isi_nameservice_matches, + { "Matches in Message", "isi.nameservice.matches_in_message", FT_UINT16, BASE_DEC, NULL, 0x0, "Matches", HFILL }} }; proto_register_field_array(proto_isi, hf, array_length(hf)); register_dissector("isi.nameservice", dissect_isi_nameservice, proto_isi); } +static void dissect_isi_nameservice_name(guint32 count, guint32 offset, tvbuff_t *tvb, packet_info *pinfo, proto_item *tree) { + guint32 nr; + for(nr = 0; nr < count; nr++, count--) { + proto_item *subitem = proto_tree_add_text(tree, tvb, offset, 0x08, "Entry %d", nr + 1); + proto_tree *subtree = proto_item_add_subtree(subitem, ett_isi_msg); + proto_tree_add_item(subtree, hf_isi_nameservice_name, tvb, 3, 4, FALSE); + proto_tree_add_item(subtree, hf_isi_nameservice_dev, tvb, 8, 1, FALSE); + proto_tree_add_item(subtree, hf_isi_nameservice_obj, tvb, 9, 1, FALSE); + proto_tree_add_item(subtree, hf_isi_nameservice_flags, tvb, 10, 1, FALSE); + } +} + static void dissect_isi_nameservice(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) { proto_item *item = NULL; @@ -78,8 +121,44 @@ static void dissect_isi_nameservice(tvbuff_t *tvb, packet_info *pinfo, proto_ite cmd = tvb_get_guint8(tvb, 0); switch (cmd) { + case 0x01: /* PNS_NAME_QUERY_REQ */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Query Request"); + proto_tree_add_item(tree, hf_isi_nameservice_name, tvb, 3, 4, FALSE); + proto_tree_add_item(tree, hf_isi_nameservice_bitmask, tvb, 8, 4, FALSE); + break; + case 0x02: /* PNS_NAME_QUERY_RESP */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Query Response"); + proto_tree_add_item(tree, hf_isi_nameservice_matches_total, tvb, 1, 2, FALSE); + proto_tree_add_item(tree, hf_isi_nameservice_matches, tvb, 3, 2, FALSE); + dissect_isi_nameservice_name(hf_isi_nameservice_matches, 5, tvb, pinfo, tree); + break; + case 0x03: /* PNS_NAME_ADD_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Add Indication"); + proto_tree_add_item(tree, hf_isi_nameservice_matches_total, tvb, 1, 2, FALSE); + proto_tree_add_item(tree, hf_isi_nameservice_matches, tvb, 3, 2, FALSE); + dissect_isi_nameservice_name(hf_isi_nameservice_matches, 5, tvb, pinfo, tree); + break; + case 0x04: /* PNS_NAME_REMOVE_IND */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Remove Indication"); + proto_tree_add_item(tree, hf_isi_nameservice_matches_total, tvb, 1, 2, FALSE); + proto_tree_add_item(tree, hf_isi_nameservice_matches, tvb, 3, 2, FALSE); + dissect_isi_nameservice_name(hf_isi_nameservice_matches, 5, tvb, pinfo, tree); + break; case 0x05: /* PNS_NAME_ADD_REQ */ - col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Add "); + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Add Request"); + dissect_isi_nameservice_name(1, 5, tvb, pinfo, tree); + break; + case 0x06: /* PNS_NAME_ADD_RESPONSE */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Add Response"); + proto_tree_add_item(tree, hf_isi_nameservice_reason, tvb, 1, 1, FALSE); + break; + case 0x07: /* PNS_NAME_REMOVE_REQ */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Remove Request"); + proto_tree_add_item(tree, hf_isi_nameservice_name, tvb, 3, 4, FALSE); + break; + case 0x08: /* PNS_NAME_REMOVE_RESP */ + col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Remove Response"); + proto_tree_add_item(tree, hf_isi_nameservice_reason, tvb, 1, 1, FALSE); break; case 0xF0: /* COMMON_MESSAGE */ diff --git a/src/packet-isi.c b/src/packet-isi.c index 2c17087..5638185 100644 --- a/src/packet-isi.c +++ b/src/packet-isi.c @@ -327,6 +327,7 @@ static guint32 hf_isi_version_minor = -1; static guint32 ett_isi = -1; guint32 ett_isi_msg = -1; guint32 ett_isi_network_gsm_band_info = -1; +guint32 ett_isi_nameservice_entry = -1; #ifdef ISI_USB /* Experimental approach based upon the one used for PPP*/ @@ -416,7 +417,8 @@ void proto_register_isi(void) { static gint *ett[] = { &ett_isi, &ett_isi_msg, - &ett_isi_network_gsm_band_info + &ett_isi_network_gsm_band_info, + &ett_isi_nameservice_entry, }; proto_isi = proto_register_protocol("Intelligent Service Interface", "ISI", "isi"); |