Ethereal-dev: [Ethereal-dev] [PATCH] More Oscar Updates

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jelmer Vernooij <jelmer@xxxxxxxxx>
Date: Sat, 18 Sep 2004 03:32:19 +0200
Hi again,

Some more small oscar fixes:
 - Support client capabilities list
 - Fix incorrect TLV usage

Cheers,

Jelmer
Index: epan/dissectors/packet-aim.c
===================================================================
--- epan/dissectors/packet-aim.c	(revision 12030)
+++ epan/dissectors/packet-aim.c	(working copy)
@@ -371,6 +371,7 @@
 static gint ett_aim_tlv      = -1;
 static gint ett_aim_userclass = -1;
 static gint ett_aim_messageblock = -1;
+static gint ett_aim_client_capabilities = -1;
 
 /* desegmentation of AIM over TCP */
 static gboolean aim_desegment = TRUE;
@@ -806,10 +807,163 @@
    return offset+buddyname_length;
 }
 
+typedef struct _e_uuid_t {
+    guint32 Data1;
+    guint16 Data2;
+    guint16 Data3;
+    guint8 Data4[8];
+} e_uuid_t;
 
+typedef struct _aim_client_capabilities {
+	const char *description;
+	e_uuid_t clsid;
+} aim_client_capabilities;
+
+static const aim_client_capabilities client_caps[] = {
+	{ "iChat",
+	 {0x09460000, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Security",
+	 {0x09460001, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Video Chat",
+	 {0x09460100, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Live Video",
+	 {0x09460101, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Camera",
+	 {0x09460102, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "iChatAV info",
+	 {0x09460105, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}},
+
+	{ "Hiptop",
+	 {0x09461323, 0x4c7f, 0x11d1, 
+	   { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Voice Chat",
+	 {0x09461341, 0x4c7f, 0x11d1, 
+		 { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Send File",
+	 {0x09461343, 0x4c7f, 0x11d1, 
+		 { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Receive File",
+	 {0x09461348, 0x4c7f, 0x11d1,
+		 { 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+
+	{ "Direct ICQ Communication",
+	 {0x09461344, 0x4c7f, 0x11d1, 
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Direct Instant Messaging",
+	 {0x09461345, 0x4c7f, 0x11d1, 
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Buddy Icon",
+	 {0x09461346, 0x4c7f, 0x11d1, 
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Add-Ins",
+	 {0x09461347, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+
+	{ "ICQ Server Relaying",
+	 {0x09461349, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Games",
+	 {0x0946134a, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+	
+	{ "Games",
+	 {0x0946134a, 0x4c7f, 0x11d1,
+		 {0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Send Buddy List",
+	 {0x0946134b, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "AIM/ICQ Interoperability",
+	 {0x0946134d, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "ICQ UTF8 Support",
+	 {0x0946134e, 0x4c7f, 0x11d1,
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "Old ICQ UTF8 Support",
+	 {0x2e7a6475, 0xfadf, 0x4dc8,
+		 {0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}},
+
+	{ "Chat",
+	 {0x748f2420, 0x6287, 0x11d1, 
+		 {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}},
+
+	{ "ICQ Rich Text Format Messages",
+	 {0x97b12751, 0x243c, 0x4334,
+		 {0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}},
+
+	{ "AP User", 
+	 {0xaa4a32b5, 0xf884, 0x48c6,
+		 {0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}},
+
+	{ "Trillian Encryption",
+	 {0xf2e7c7f4, 0xfead, 0x4dfb,
+		 {0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}},
+
+	{ "Unknown", {0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } }
+};
+
+
 int dissect_aim_tlv_value_client_capabilities(proto_item *ti _U_, guint16 valueid _U_, tvbuff_t *tvb)
 {
-	/* FIXME */
+	int offset = 0;
+	proto_tree *entry;
+
+	proto_item_set_text(ti, "Client Capabilities List");
+
+	entry = proto_item_add_subtree(ti, ett_aim_client_capabilities);
+	
+  	while (tvb_length_remaining(tvb, offset) > 0) {
+		int i;
+		const aim_client_capabilities *caps;
+		guint32 Data1 = tvb_get_ntoh24(tvb, offset);
+		guint16 Data2 = tvb_get_ntohs(tvb, offset+4);
+		guint16 Data3 = tvb_get_ntohs(tvb, offset+6);
+		guint8 Data4[8];
+		tvb_memcpy(tvb, Data4, offset+8, 8);
+
+		caps = &client_caps[0];
+
+		for(i = 0; !strcmp(client_caps[i].description, "Unknown"); i++) {
+			caps = &client_caps[i];
+
+			if(Data1 == caps->clsid.Data1 && Data2 == caps->clsid.Data2 && 
+			   Data3 == caps->clsid.Data3 && !memcmp(caps->clsid.Data4, Data4, 8))
+				break;
+		}
+
+		proto_tree_add_text(entry, tvb, offset, 16, 
+			"%s {%06x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", 
+			caps->description, Data1, Data2, 
+			Data3, Data4[0], Data4[1], Data4[2], Data4[3], Data4[4],
+			Data4[5], Data4[6], Data4[7]
+			);
+
+		offset+=16;
+	}
+
 	return tvb_length(tvb);
 }
 
@@ -1181,7 +1335,8 @@
 	  &ett_aim_tlv,
 	  &ett_aim_buddyname,
 	  &ett_aim_userclass,
-	  &ett_aim_messageblock
+	  &ett_aim_messageblock,
+	  &ett_aim_client_capabilities
   };
   module_t *aim_module;
 
Index: epan/dissectors/packet-aim-location.c
===================================================================
--- epan/dissectors/packet-aim-location.c	(revision 12030)
+++ epan/dissectors/packet-aim-location.c	(working copy)
@@ -86,15 +86,23 @@
 
 #define AIM_LOCATION_RIGHTS_TLV_MAX_PROFILE_LENGTH 	0x0001
 #define AIM_LOCATION_RIGHTS_TLV_MAX_CAPABILITIES 	0x0002
-#define AIM_LOCATION_RIGHTS_TLV_CLIENT_CAPABILITIES 0x0005
 
 static const aim_tlv location_rights_tlvs[] = {
   { AIM_LOCATION_RIGHTS_TLV_MAX_PROFILE_LENGTH, "Max Profile Length", dissect_aim_tlv_value_uint16 },
   { AIM_LOCATION_RIGHTS_TLV_MAX_CAPABILITIES, "Max capabilities", dissect_aim_tlv_value_uint16 },
-  { AIM_LOCATION_RIGHTS_TLV_CLIENT_CAPABILITIES, "Client capabilities", dissect_aim_tlv_value_client_capabilities },
   { 0, "Unknown", NULL }
 };
 
+
+#define AIM_LOCATION_USERINFO_TLV_MIME_TYPE			  0x0001
+#define AIM_LOCATION_USERINFO_TLV_CLIENT_CAPABILITIES 0x0005
+
+static const aim_tlv location_userinfo_tlvs[] = {
+	{ AIM_LOCATION_USERINFO_TLV_MIME_TYPE, "Mime Type", dissect_aim_tlv_value_string },
+	{ AIM_LOCATION_USERINFO_TLV_CLIENT_CAPABILITIES, "Client capabilities", dissect_aim_tlv_value_client_capabilities },
+	{ 0, "Unknown", NULL }
+};
+
 #define FAMILY_LOCATION_USERINFO_INFOTYPE_GENERALINFO  0x0001
 #define FAMILY_LOCATION_USERINFO_INFOTYPE_AWAYMSG      0x0003
 #define FAMILY_LOCATION_USERINFO_INFOTYPE_CAPS         0x0005
@@ -150,7 +158,7 @@
 	  return 0;
 	case FAMILY_LOCATION_SETUSERINFO:
 	  while(tvb_length_remaining(tvb, offset) > 0) {
-		offset = dissect_aim_tlv(tvb, pinfo, offset, loc_tree, location_rights_tlvs);
+		offset = dissect_aim_tlv(tvb, pinfo, offset, loc_tree, location_userinfo_tlvs);
 	  }
 	  return 0;
 	case FAMILY_LOCATION_WATCHERSUBREQ: