diff options
author | Olivier Biot <obiot.ethereal@gmail.com> | 2004-04-26 18:21:10 +0000 |
---|---|---|
committer | Olivier Biot <obiot.ethereal@gmail.com> | 2004-04-26 18:21:10 +0000 |
commit | 3226647c01191bb8cec307af24ae9a9dfa31e292 (patch) | |
tree | 966968d1f4e4ed4e1fa4d5515ebb5341fff981cb /packet-aim-ssi.c | |
parent | 5bc27b16b65fbcd63d35b924b21fc82b57409ef9 (diff) | |
download | wireshark-3226647c01191bb8cec307af24ae9a9dfa31e292.tar.gz wireshark-3226647c01191bb8cec307af24ae9a9dfa31e292.tar.bz2 wireshark-3226647c01191bb8cec307af24ae9a9dfa31e292.zip |
From Jelmer Vernooij:
Add support form extra SNACs. All TLV's are now recognized.
svn path=/trunk/; revision=10712
Diffstat (limited to 'packet-aim-ssi.c')
-rw-r--r-- | packet-aim-ssi.c | 142 |
1 files changed, 83 insertions, 59 deletions
diff --git a/packet-aim-ssi.c b/packet-aim-ssi.c index 0094af864f..a09e942e5c 100644 --- a/packet-aim-ssi.c +++ b/packet-aim-ssi.c @@ -3,7 +3,7 @@ * Copyright 2004, Jelmer Vernooij <jelmer@samba.org> * Copyright 2000, Ralf Hoelzer <ralf@well.com> * - * $Id: packet-aim-ssi.c,v 1.2 2004/04/20 04:48:32 guy Exp $ + * $Id: packet-aim-ssi.c,v 1.3 2004/04/26 18:21:10 obiot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -109,6 +109,10 @@ static const value_string aim_fnac_family_ssi_types[] = { { 0, NULL } }; +static const aim_tlv ssi_rights_tlvs[] = { + { 0, NULL, NULL } +}; + static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *tree, guint16 subtype _U_); @@ -116,6 +120,7 @@ static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo _U_, static int proto_aim_ssi = -1; static int hf_aim_fnac_subtype_ssi_version = -1; static int hf_aim_fnac_subtype_ssi_numitems = -1; +static int hf_aim_fnac_subtype_ssi_last_change_time = -1; static int hf_aim_fnac_subtype_ssi_buddyname_len = -1; static int hf_aim_fnac_subtype_ssi_buddyname = -1; static int hf_aim_fnac_subtype_ssi_gid = -1; @@ -128,6 +133,57 @@ static int hf_aim_fnac_subtype_ssi_data = -1; static gint ett_aim_ssi = -1; static gint ett_ssi = -1; +static int dissect_ssi_item(tvbuff_t *tvb, packet_info *pinfo _U_, + int offset, proto_tree *ssi_entry, + guint16 subtype _U_) +{ + guint16 buddyname_length = 0; + int endoffset; + guint16 tlv_len = 0; + /* Buddy Name Length */ + buddyname_length = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname_len, + tvb, offset, 2, FALSE); + offset += 2; + + /* Buddy Name */ + if (buddyname_length > 0) { + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname, tvb, + offset, buddyname_length, FALSE); + offset += buddyname_length; + } + + /* Buddy group ID */ + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_gid, tvb, offset, + 2, FALSE); + offset += 2; + + /* Buddy ID */ + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_bid, tvb, offset, + 2, FALSE); + offset += 2; + + /* Buddy Type */ + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_type, tvb, offset, + 2, FALSE); + offset += 2; + + /* Size of the following TLV in bytes (as opposed to the number of + TLV objects in the chain) */ + tlv_len = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_tlvlen, tvb, + offset, 2, FALSE); + offset += 2; + + endoffset = offset; + /* For now, we just dump the TLV contents as-is, since there is not a + TLV dissection utility that works based on total chain length */ + while(endoffset < offset+tlv_len) { + endoffset = dissect_aim_tlv(tvb, pinfo, endoffset, ssi_entry, client_tlvs); + } + return endoffset; +} + static int dissect_aim_snac_ssi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) { @@ -137,7 +193,7 @@ static int dissect_aim_snac_ssi(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ssi_tree = NULL; if(tree) { - ti = proto_tree_add_text(tree, tvb, 0, -1,"AIM Service Side Information Service"); + ti = proto_tree_add_text(tree, tvb, 0, -1,"AIM Server Side Information Service"); ssi_tree = proto_item_add_subtree(ti, ett_ssi); } @@ -147,26 +203,34 @@ static int dissect_aim_snac_ssi(tvbuff_t *tvb, packet_info *pinfo _U_, return dissect_aim_snac_error(tvb, pinfo, offset, ssi_tree); case FAMILY_SSI_LIST: return dissect_aim_snac_ssi_list(tvb, pinfo, offset, ssi_tree, aiminfo->subtype); - case FAMILY_SSI_REQRIGHTS: case FAMILY_SSI_RIGHTSINFO: - case FAMILY_SSI_REQLIST_FIRSTTIME: - case FAMILY_SSI_REQLIST: + while(tvb_length_remaining(tvb, offset) > 0) { + offset = dissect_aim_tlv(tvb, pinfo, offset, ssi_tree, ssi_rights_tlvs); + } + return offset; + case FAMILY_SSI_REQRIGHTS: case FAMILY_SSI_ACTIVATE: + case FAMILY_SSI_EDITSTART: + case FAMILY_SSI_EDITSTOP: + case FAMILY_SSI_REQLIST_FIRSTTIME: + /* No data */ + return 0; case FAMILY_SSI_ADD: case FAMILY_SSI_MOD: case FAMILY_SSI_DEL: + return dissect_ssi_item(tvb, pinfo, offset, ssi_tree, aiminfo->subtype); + case FAMILY_SSI_WAS_ADDED: + return dissect_aim_buddyname(tvb, pinfo, offset, ssi_tree); + case FAMILY_SSI_REQLIST: case FAMILY_SSI_SRVACK: case FAMILY_SSI_NOLIST: - case FAMILY_SSI_EDITSTART: - case FAMILY_SSI_EDITSTOP: case FAMILY_SSI_GRANT_FUTURE_AUTH: case FAMILY_SSI_FUTUR_AUTH_GRANTED: case FAMILY_SSI_SEND_AUTH_REQ: case FAMILY_SSI_AUTH_REQ: case FAMILY_SSI_SEND_AUTH_REPLY: case FAMILY_SSI_AUTH_REPLY: - case FAMILY_SSI_WAS_ADDED: - + /* FIXME */ return 0; @@ -177,13 +241,11 @@ static int dissect_aim_snac_ssi(tvbuff_t *tvb, packet_info *pinfo _U_, static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *tree, - guint16 subtype _U_) + guint16 subtype) { - guint16 buddyname_length = 0; - guint16 tlv_len = 0; - int endoffset; proto_item *ti; proto_tree *ssi_entry = NULL; + guint16 num_items, i; /* SSI Version */ proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_version, tvb, offset, 1, @@ -193,56 +255,15 @@ static int dissect_aim_snac_ssi_list(tvbuff_t *tvb, packet_info *pinfo _U_, /* Number of items */ proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_numitems, tvb, offset, 2, FALSE); + num_items = tvb_get_ntohs(tvb, offset); offset += 2; - while (tvb_length_remaining(tvb, offset) > 4) { - + for(i = 0; i < num_items; i++) { ti = proto_tree_add_text(tree, tvb, offset, tvb_get_ntohs(tvb, offset+10)+10, "SSI Entry"); ssi_entry = proto_item_add_subtree(ti, ett_aim_ssi); - - /* Buddy Name Length */ - buddyname_length = tvb_get_ntohs(tvb, offset); - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname_len, - tvb, offset, 2, FALSE); - offset += 2; - - /* Buddy Name */ - if (buddyname_length > 0) { - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_buddyname, tvb, - offset, buddyname_length, FALSE); - offset += buddyname_length; - } - - /* Buddy group ID */ - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_gid, tvb, offset, - 2, FALSE); - offset += 2; - - /* Buddy ID */ - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_bid, tvb, offset, - 2, FALSE); - offset += 2; - - /* Buddy Type */ - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_type, tvb, offset, - 2, FALSE); - offset += 2; - - /* Size of the following TLV in bytes (as opposed to the number of - TLV objects in the chain) */ - tlv_len = tvb_get_ntohs(tvb, offset); - proto_tree_add_item(ssi_entry, hf_aim_fnac_subtype_ssi_tlvlen, tvb, - offset, 2, FALSE); - offset += 2; - - endoffset = offset; - /* For now, we just dump the TLV contents as-is, since there is not a - TLV dissection utility that works based on total chain length */ - while(endoffset < offset+tlv_len) { - endoffset = dissect_aim_tlv(tvb, pinfo, endoffset, ssi_entry); - } - offset = endoffset; - } + offset = dissect_ssi_item(tvb, pinfo, offset, ssi_entry, subtype); + } + proto_tree_add_item(tree, hf_aim_fnac_subtype_ssi_last_change_time, tvb, offset, 4, FALSE); return offset; } @@ -259,6 +280,9 @@ proto_register_aim_ssi(void) { &hf_aim_fnac_subtype_ssi_numitems, { "SSI Object count", "aim.fnac.ssi.numitems", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } }, + { &hf_aim_fnac_subtype_ssi_last_change_time, + { "SSI Last Change Time", "aim.fnac.ssi.last_change_time", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL } + }, { &hf_aim_fnac_subtype_ssi_buddyname_len, { "SSI Buddy Name length", "aim.fnac.ssi.buddyname_len", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } }, |