From: mid Date: Sat, 16 Dec 2000 01:41:03 +0000 (+0000) Subject: - Sat Dec 16 01:34:19 UTC 2000 X-Git-Tag: rel_0_99_2~79 X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/commitdiff_plain/d6c9fcf0b85e7c3948d5e58a55692772d08981ae - Sat Dec 16 01:34:19 UTC 2000 - Rename paramid to rateclass - Add a long comment about the rate system - Add a few other comments - Clean up aim_bos_clientready(). --- diff --git a/CHANGES b/CHANGES index 0ed63f5..3f04d26 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ No release numbers ------------------ + - Sat Dec 16 01:34:19 UTC 2000 + - Rename paramid to rateclass + - Add a long comment about the rate system + - Add a few other comments + - Clean up aim_bos_clientready(). + - Fri Dec 15 23:35:01 UTC 2000 - Add genericerr callback/middle. - This is for catching the errors that come back, for instance, from diff --git a/aim_login.c b/aim_login.c index 5a4c779..8f880b1 100644 --- a/aim_login.c +++ b/aim_login.c @@ -361,6 +361,14 @@ faim_internal int aim_authparse(struct aim_session_t *sess, /* * The registration status. (Not real sure what it means.) * Not available for ICQ logins. + * + * 1 = No disclosure + * 2 = Limited disclosure + * 3 = Full disclosure + * + * This has to do with whether your email address is available + * to other users or not. AFAIK, this feature is no longer used. + * */ if (aim_gettlv(tlvlist, 0x0013, 1)) regstatus = aim_gettlv16(tlvlist, 0x0013, 1); diff --git a/aim_misc.c b/aim_misc.c index 590d981..f5e78d7 100644 --- a/aim_misc.c +++ b/aim_misc.c @@ -301,79 +301,57 @@ faim_internal int aim_parse_bosrights(struct aim_session_t *sess, * * Send Client Ready. * - * TODO: Dynamisize. - * */ faim_export unsigned long aim_bos_clientready(struct aim_session_t *sess, struct aim_conn_t *conn) { - u_char command_2[] = { - /* placeholders for dynamic data */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, - /* real data */ - 0x00, 0x01, - 0x00, 0x03, - 0x00, 0x04, - 0x06, 0x86, /* the good ones */ -#if 0 - 0x07, 0xda, /* DUPLE OF DEATH! */ -#endif - - 0x00, 0x02, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - - 0x00, 0x03, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - - 0x00, 0x04, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - - 0x00, 0x06, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - 0x00, 0x08, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - - 0x00, 0x09, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - 0x00, 0x0a, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01, - - 0x00, 0x0b, - 0x00, 0x01, - 0x00, 0x04, - 0x00, 0x01 +#define AIM_TOOL_JAVA 0x0001 +#define AIM_TOOL_MAC 0x0002 +#define AIM_TOOL_WIN16 0x0003 +#define AIM_TOOL_WIN32 0x0004 +#define AIM_TOOL_MAC68K 0x0005 +#define AIM_TOOL_MACPPC 0x0006 + struct aim_tool_version { + unsigned short group; + unsigned short version; + unsigned short tool; + unsigned short toolversion; + } tools[] = { + {0x0001, 0x0003, AIM_TOOL_WIN32, 0x0686}, + {0x0002, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x0003, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x0004, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x0006, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x0008, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x0009, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x000a, 0x0001, AIM_TOOL_WIN32, 0x0001}, + {0x000b, 0x0001, AIM_TOOL_WIN32, 0x0001} }; - int command_2_len = 0x52; + int i,j; struct command_tx_struct *newpacket; - - if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, command_2_len))) + int toolcount = sizeof(tools)/sizeof(struct aim_tool_version); + + if (!(newpacket = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152))) return -1; newpacket->lock = 1; - memcpy(newpacket->data, command_2, command_2_len); - - /* This write over the dynamic parts of the byte block */ - aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid); + i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid); + aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0); + + for (j = 0; j < toolcount; j++) { + i += aimutil_put16(newpacket->data+i, tools[j].group); + i += aimutil_put16(newpacket->data+i, tools[j].version); + i += aimutil_put16(newpacket->data+i, tools[j].tool); + i += aimutil_put16(newpacket->data+i, tools[j].toolversion); + } + + newpacket->commandlen = i; + newpacket->lock = 0; aim_tx_enqueue(sess, newpacket); - return (sess->snac_nextid++); + return sess->snac_nextid; } /* diff --git a/aim_rxhandlers.c b/aim_rxhandlers.c index 16b7744..7840167 100644 --- a/aim_rxhandlers.c +++ b/aim_rxhandlers.c @@ -659,13 +659,62 @@ faim_internal int aim_parse_msgack_middle(struct aim_session_t *sess, struct com return ret; } +/* + * The Rate Limiting System, An Abridged Guide to Nonsense. + * + * OSCAR defines several 'rate classes'. Each class has seperate + * rate limiting properties (limit level, alert level, disconnect + * level, etc), and a set of SNAC family/type pairs associated with + * it. The rate classes, their limiting properties, and the definitions + * of which SNACs are belong to which class, are defined in the + * Rate Response packet at login to each host. + * + * Logically, all rate offenses within one class count against further + * offenses for other SNACs in the same class (ie, sending messages + * too fast will limit the number of user info requests you can send, + * since those two SNACs are in the same rate class). + * + * Since the rate classes are defined dynamically at login, the values + * below may change. But they seem to be fairly constant. + * + * Currently, BOS defines five rate classes, with the commonly used + * members as follows... + * + * Rate class 0x0001: + * - Everything thats not in any of the other classes + * + * Rate class 0x0002: + * - Buddy list add/remove + * - Permit list add/remove + * - Deny list add/remove + * + * Rate class 0x0003: + * - User information requests + * - Outgoing ICBMs + * + * Rate class 0x0004: + * - A few unknowns: 2/9, 2/b, and f/2 + * + * Rate class 0x0005: + * - Chat room create + * - Outgoing chat ICBMs + * + * The only other thing of note is that class 5 (chat) has slightly looser + * limiting properties than class 3 (normal messages). But thats just a + * small bit of trivia for you. + * + * The last thing that needs to be learned about the rate limiting + * system is how the actual numbers relate to the passing of time. This + * seems to be a big mystery. + * + */ faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) { rxcallback_t userfunc = NULL; int ret = 1; int i; int code; - unsigned long parmid, windowsize, clear, alert, limit, disconnect; + unsigned long rateclass, windowsize, clear, alert, limit, disconnect; unsigned long currentavg, maxavg; i = 10; @@ -673,7 +722,7 @@ faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct code = aimutil_get16(command->data+i); i += 2; - parmid = aimutil_get16(command->data+i); + rateclass = aimutil_get16(command->data+i); i += 2; windowsize = aimutil_get32(command->data+i); @@ -692,7 +741,7 @@ faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct i += 4; if ((userfunc = aim_callhandler(command->conn, 0x0001, 0x000a))) - ret = userfunc(sess, command, code, parmid, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); + ret = userfunc(sess, command, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg); return ret; } diff --git a/utils/faimtest/faimtest.c b/utils/faimtest/faimtest.c index 3afbc7d..d0c0453 100644 --- a/utils/faimtest/faimtest.c +++ b/utils/faimtest/faimtest.c @@ -1631,7 +1631,7 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru "limit cleared"}; va_list ap; int code; - unsigned long parmid, windowsize, clear, alert, limit, disconnect; + unsigned long rateclass, windowsize, clear, alert, limit, disconnect; unsigned long currentavg, maxavg; va_start(ap, command); @@ -1640,12 +1640,9 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru code = va_arg(ap, int); /* - * Known parameter ID's... - * 0x0001 Warnings - * 0x0003 BOS (normal ICBMs, userinfo requests, etc) - * 0x0005 Chat messages + * See comments above aim_parse_ratechange_middle() in aim_rxhandlers.c. */ - parmid = va_arg(ap, unsigned long); + rateclass = va_arg(ap, unsigned long); /* * Not sure what this is exactly. I think its the temporal @@ -1665,9 +1662,9 @@ int faimtest_parse_ratechange(struct aim_session_t *sess, struct command_rx_stru va_end(ap); - printf("faimtest: rate %s (paramid 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n", + printf("faimtest: rate %s (rate class 0x%04lx): curavg = %ld, maxavg = %ld, alert at %ld, clear warning at %ld, limit at %ld, disconnect at %ld (window size = %ld)\n", (code < 5)?codes[code]:"invalid", - parmid, + rateclass, currentavg, maxavg, alert, clear, limit, disconnect,