X-Git-Url: http://andersk.mit.edu/gitweb/libfaim.git/blobdiff_plain/7392c79fff9e408331844fcfb9dc6e6533ebe3e4..a3619f23f4aeff53f82fbde8578382db13c65cf9:/faim/aim.h diff --git a/faim/aim.h b/faim/aim.h index bbc1d30..244c28b 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) */ @@ -68,9 +70,8 @@ #define gethostbyname(x) gethostbyname2(x, AF_INET) #endif -#if !defined(MSG_WAITALL) -#warning FIX YOUR LIBC! MSG_WAITALL is required! -#define MSG_WAITALL 0x100 +#if defined(MSG_WAITALL) +#define FAIM_HAS_MSG_WAITALL #endif /* @@ -92,6 +93,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 +114,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 +309,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 +332,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 +404,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 +412,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 +462,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 +487,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 *); @@ -495,6 +509,7 @@ u_long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *); +unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn); u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn); struct aim_fileheader_t *aim_getlisting(struct aim_session_t*); @@ -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 { @@ -525,8 +543,10 @@ int aim_parse_outgoing_im_middle(struct aim_session_t *, struct command_rx_struc 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); +int aim_parse_bosrights(struct aim_session_t *sess, struct command_rx_struct *command, ...); +int aim_parse_missedcall(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 *); @@ -635,7 +655,7 @@ int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct * int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info); int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info); int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); - +int aim_parse_locateerr(struct aim_session_t *sess, struct command_rx_struct *command); /* aim_auth.c */ int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *); @@ -645,6 +665,7 @@ u_long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char * /* aim_buddylist.c */ u_long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *); u_long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *); +int aim_parse_buddyrights(struct aim_session_t *sess, struct command_rx_struct *command, ...); /* aim_search.c */ u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *); @@ -725,6 +746,9 @@ char *aimutil_itemidx(char *toSearch, int index, char dl); int aim_snlen(const char *sn); int aim_sncmp(const char *sn1, const char *sn2); +/* for libc's that dont have it */ +char *aim_strsep(char **pp, const char *delim); + /* aim_meta.c */ char *aim_getbuilddate(void); char *aim_getbuildtime(void);