X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/blobdiff_plain/7392c79fff9e408331844fcfb9dc6e6533ebe3e4..98c88242811131668c416faa1e8775b1ff386a88:/faim/aim.h diff --git a/faim/aim.h b/faim/aim.h index bbc1d30..6f5165e 100644 --- a/faim/aim.h +++ b/faim/aim.h @@ -40,9 +40,10 @@ #ifdef FAIM_USEPTHREADS #include #define faim_mutex_t pthread_mutex_t -#define faim_mutex_init pthread_mutex_init -#define faim_mutex_lock pthread_mutex_lock -#define faim_mutex_unlock pthread_mutex_unlock +#define faim_mutex_init(x) pthread_mutex_init(x, NULL) +#define faim_mutex_lock(x) pthread_mutex_lock(x) +#define faim_mutex_unlock(x) pthread_mutex_unlock(x) +#define faim_mutex_destroy(x) pthread_mutex_destroy(x) #elif defined(FAIM_USEFAKELOCKS) /* * For platforms without pthreads, we also assume @@ -52,9 +53,10 @@ * But they get it to compile. */ #define faim_mutex_t char -#define faim_mutex_init(x, y) *x = 0 +#define faim_mutex_init(x) *x = 0 #define faim_mutex_lock(x) *x = 1; #define faim_mutex_unlock(x) *x = 0; +#define faim_mutex_destroy(x) *x = 0; #endif /* Portability stuff (DMP) */ @@ -92,6 +94,8 @@ * for WinAIM clients (up through the latest (4.0.1957)) to * send any more than 1kb. Amaze all your windows friends * with utterly oversized instant messages! + * + * XXX: the real limit is the total SNAC size at 8192. Fix this. * */ #define MAXMSGLEN 7987 @@ -111,6 +115,8 @@ */ #define AIM_COOKIELEN 0x100 +#define AIM_MD5_STRING "AOL Instant Messenger (SM)" + #if debug > 0 #define faimdprintf(l, x...) {if (l >= debug) printf(x); } #else @@ -304,8 +310,9 @@ struct aim_session_t { * Outstanding snac handling * * XXX: Should these be per-connection? -mid - **/ - struct aim_snac_t *outstanding_snacs; + */ + struct aim_snac_t *snac_hash[FAIM_SNAC_HASH_SIZE]; + faim_mutex_t snac_hash_locks[FAIM_SNAC_HASH_SIZE]; u_long snac_nextid; struct aim_msgcookie_t *msgcookies; @@ -326,15 +333,17 @@ struct aim_userinfo_s { u_short capabilities; }; -#define AIM_CLASS_TRIAL 0x0001 -#define AIM_CLASS_UNKNOWN2 0x0002 +#define AIM_CLASS_TRIAL 0x0001 /* "damned transients" */ +#define AIM_CLASS_ADMINISTRATOR 0x0002 #define AIM_CLASS_AOL 0x0004 -#define AIM_CLASS_UNKNOWN4 0x0008 +#define AIM_CLASS_OSCAR_PAY 0x0008 #define AIM_CLASS_FREE 0x0010 #define AIM_CLASS_AWAY 0x0020 #define AIM_CLASS_UNKNOWN40 0x0040 #define AIM_CLASS_UNKNOWN80 0x0080 +#define AIM_CLASS_ALLUSERS 0x001f + /* * TLV handling */ @@ -396,9 +405,7 @@ struct aim_fileheader_t *aim_oft_getfh(char *hdr); /* aim_login.c */ int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn); int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); -int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *); -int aim_encode_password(const char *, u_char *); -int aimicq_encode_password(const char *password, u_char *encoded); +int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *, char *key); unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *bosip, @@ -406,6 +413,7 @@ unsigned long aim_sendauthresp(struct aim_session_t *sess, int regstatus); int aim_gencookie(unsigned char *buf); int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn); +int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command); unsigned long aim_sendredirect(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned short servid, @@ -455,6 +463,7 @@ struct aim_snac_t { time_t issuetime; struct aim_snac_t *next; }; +void aim_initsnachash(struct aim_session_t *sess); u_long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac); struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id); int aim_cleansnacs(struct aim_session_t *, int maxage); @@ -479,6 +488,12 @@ void aim_session_init(struct aim_session_t *); #define AIM_VISIBILITYCHANGE_DENYADD 0x07 #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 +#define AIM_PRIVFLAGS_ALLOWIDLE 0x01 +#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 + +#define AIM_WARN_ANON 0x01 + +int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon); u_long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long); u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *); @@ -508,6 +523,9 @@ int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...); int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...); int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...); +int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command); +int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command); +int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command); /* aim_im.c */ struct aim_directim_priv { @@ -526,7 +544,7 @@ u_long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn); int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *); int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command); -struct aim_conn_t * aim_directim_intiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *); +struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *); int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *); struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *);