* Copyright 2000, Ralf Hoelzer <ralf@well.com>
* Copyright 2004, Devin Heitmueller <dheitmueller@netilla.com>
*
- * $Id: packet-aim-messaging.c,v 1.8 2004/05/23 01:53:29 guy Exp $
+ * $Id: packet-aim-messaging.c,v 1.9 2004/06/03 04:19:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#define INCOMING_CH1_TYPING 0x000b
static const aim_tlv messaging_incoming_ch1_tlvs[] = {
- { INCOMING_CH1_MESSAGE_BLOCK, "Message Block", dissect_aim_tlv_value_bytes },
+ { INCOMING_CH1_MESSAGE_BLOCK, "Message Block", dissect_aim_tlv_value_messageblock },
{ INCOMING_CH1_SERVER_ACK_REQ, "Server Ack Requested", dissect_aim_tlv_value_bytes },
{ INCOMING_CH1_MESSAGE_AUTH_RESP, "Message is Auto Response", dissect_aim_tlv_value_bytes },
{ INCOMING_CH1_MESSAGE_OFFLINE, "Message was received offline", dissect_aim_tlv_value_bytes },
return 0;
case FAMILY_MESSAGING_OUTGOING:
- /* Unknown */
- offset += 10;
+ /* ICBM Cookie */
+ proto_tree_add_item(msg_tree, hf_aim_icbm_cookie, tvb, offset, 8, FALSE);
+ offset += 8;
- buddyname_length = aim_get_buddyname( buddyname, tvb, offset, offset + 1 );
-
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " to: %s", buddyname);
+ /* Message Channel ID */
+ proto_tree_add_item(msg_tree, hf_aim_message_channel_id, tvb, offset, 2,
+ FALSE);
+ offset += 2;
- if(msg_tree) {
- proto_tree_add_text(msg_tree, tvb, offset, buddyname_length + 1,
- "Screen Name: %s", buddyname);
+ /* Add the outgoing username to the info column */
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ buddyname_length = aim_get_buddyname(buddyname, tvb, offset,
+ offset + 1);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " to: %s", buddyname);
}
- /* Buddyname length and buddyname */
- offset += buddyname_length + 1;
+ offset = dissect_aim_buddyname(tvb, pinfo, offset, msg_tree);
- /* djh - My test suggest that this is broken. Need to give this a
- closer look @@@@@@@@@ */
- msg_length = tvb_ensure_length_remaining(tvb, offset);
- aim_get_message( msg, tvb, offset, msg_length );
-
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", msg);
-
- /* XXX - put the message into the protocol tree?
- In at least one capture, there's a bunch of bytes before the
- "<HTML>" tag for the message. "aim_get_message()" skips them,
- looking for the "<HTML>" tag - are they part of the message,
- or are they some other unknown field? */
+ while(tvb_reported_length_remaining(tvb, offset) > 0) {
+ /* djh - Note that we reuse the "incoming ch1 tlv" set even though this
+ is outgoing. We may need to split this to a separate TLV set, but
+ so far I haven't seen the need @@@@@@@@ */
+ offset = dissect_aim_tlv(tvb, pinfo, offset, msg_tree,
+ messaging_incoming_ch1_tlvs);
+ }
return offset;
* Routines for AIM Instant Messenger (OSCAR) dissection
* Copyright 2000, Ralf Hoelzer <ralf@well.com>
* Copyright 2004, Jelmer Vernooij <jelmer@samba.org>
+ * Copyright 2004, Devin Heitmueller <dheitmueller@netilla.com>
*
- * $Id: packet-aim.c,v 1.41 2004/05/05 09:30:56 guy Exp $
+ * $Id: packet-aim.c,v 1.42 2004/06/03 04:19:38 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
static int hf_aim_userclass_unknown200 = -1;
static int hf_aim_userclass_unknown400 = -1;
static int hf_aim_userclass_unknown800 = -1;
+static int hf_aim_messageblock_featuresdes = -1;
+static int hf_aim_messageblock_featureslen = -1;
+static int hf_aim_messageblock_features = -1;
+static int hf_aim_messageblock_info = -1;
+static int hf_aim_messageblock_len = -1;
+static int hf_aim_messageblock_charset = -1;
+static int hf_aim_messageblock_charsubset = -1;
+static int hf_aim_messageblock_message = -1;
+
/* Initialize the subtree pointers */
static gint ett_aim = -1;
static gint ett_aim_fnac = -1;
static gint ett_aim_tlv = -1;
static gint ett_aim_userclass = -1;
+static gint ett_aim_messageblock = -1;
/* desegmentation of AIM over TCP */
static gboolean aim_desegment = TRUE;
return 4;
}
+int dissect_aim_tlv_value_messageblock (proto_item *ti, guint16 valueid _U_, tvbuff_t *tvb){
+ proto_tree *entry;
+ guint8 *buf;
+ guint16 featurelen;
+ guint16 blocklen;
+ int offset=0;
+
+ /* Setup a new subtree */
+ entry = proto_item_add_subtree(ti, ett_aim_messageblock);
+
+ /* Features descriptor */
+ proto_tree_add_item(entry, hf_aim_messageblock_featuresdes, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* Features Length */
+ featurelen = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(entry, hf_aim_messageblock_featureslen, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* Features (should be expanded further @@@@@@@ ) */
+ proto_tree_add_item(entry, hf_aim_messageblock_features, tvb, offset,
+ featurelen, FALSE);
+ offset += featurelen;
+
+ /* There can be multiple messages in this message block */
+ while (tvb_length_remaining(tvb, offset) > 0) {
+ /* Info field */
+ proto_tree_add_item(entry, hf_aim_messageblock_info, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* Block length (includes charset and charsubset) */
+ blocklen = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(entry, hf_aim_messageblock_len, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* Character set */
+ proto_tree_add_item(entry, hf_aim_messageblock_charset, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* Character subset */
+ proto_tree_add_item(entry, hf_aim_messageblock_charsubset, tvb, offset, 2,
+ FALSE);
+ offset += 2;
+
+ /* The actual message */
+ buf = tvb_get_string(tvb, offset, blocklen - 4 );
+ proto_item_set_text(ti, "Message: %s", buf);
+ proto_tree_add_item(entry, hf_aim_messageblock_message, tvb, offset,
+ blocklen-4,
+ FALSE);
+ offset += tvb_length_remaining(tvb, offset);
+ g_free(buf);
+ }
+
+ return offset;
+}
+
/* Dissect a TLV value */
int dissect_aim_tlv(tvbuff_t *tvb, packet_info *pinfo _U_,
int offset, proto_tree *tree, const aim_tlv *tlv)
{ &hf_aim_userinfo_warninglevel,
{ "Warning Level", "aim.userinfo.warninglevel", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL },
},
+ { &hf_aim_messageblock_featuresdes,
+ { "Features", "aim.messageblock.featuresdes", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_featureslen,
+ { "Features Length", "aim.messageblock.featureslen", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_features,
+ { "Features", "aim.messageblock.features", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_info,
+ { "Block info", "aim.messageblock.info", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_len,
+ { "Block length", "aim.messageblock.length", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_charset,
+ { "Block Character set", "aim.messageblock.charset", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_charsubset,
+ { "Block Character subset", "aim.messageblock.charsubset", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL },
+ },
+ { &hf_aim_messageblock_message,
+ { "Message", "aim.messageblock.message", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL },
+ },
};
/* Setup protocol subtree array */
&ett_aim_fnac,
&ett_aim_tlv,
&ett_aim_buddyname,
- &ett_aim_userclass
+ &ett_aim_userclass,
+ &ett_aim_messageblock
};
module_t *aim_module;