Sat, 10 Jun 2000 03:34:51 +0000
[gaim-migrate @ 386]
hm de hm hm
| 283 | 1 | /* |
| 2 | * Main libfaim header. Must be included in client for prototypes/macros. | |
| 3 | * | |
| 4 | */ | |
| 5 | ||
| 6 | #ifndef __AIM_H__ | |
| 7 | #define __AIM_H__ | |
| 8 | ||
| 9 | #define FAIM_VERSION_MAJOR 0 | |
| 10 | #define FAIM_VERSION_MINOR 99 | |
| 11 | #define FAIM_VERSION_MINORMINOR 0 | |
| 12 | ||
|
341
12054177cff4
[gaim-migrate @ 351]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
338
diff
changeset
|
13 | #include <faimconfig.h> |
|
12054177cff4
[gaim-migrate @ 351]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
338
diff
changeset
|
14 | #include <aim_cbtypes.h> |
| 283 | 15 | |
| 16 | #ifndef FAIM_USEPTHREADS | |
| 17 | #error pthreads are currently required. | |
| 18 | #endif | |
| 19 | ||
| 20 | #include <stdio.h> | |
| 21 | #include <string.h> | |
| 22 | #include <fcntl.h> | |
| 23 | #include <sys/types.h> | |
| 24 | #include <stdlib.h> | |
| 25 | #include <stdarg.h> | |
| 26 | #include <errno.h> | |
| 27 | ||
| 28 | #ifdef FAIM_USEPTHREADS | |
| 29 | #include <pthread.h> | |
| 30 | #define faim_mutex_t pthread_mutex_t | |
| 31 | #define faim_mutex_init pthread_mutex_init | |
| 32 | #define faim_mutex_lock pthread_mutex_lock | |
| 33 | #define faim_mutex_unlock pthread_mutex_unlock | |
| 34 | #endif | |
| 35 | ||
| 36 | #ifdef _WIN32 | |
| 37 | #include <windows.h> | |
| 38 | #include <time.h> | |
| 39 | #include <io.h> | |
| 40 | #else | |
| 41 | #include <netdb.h> | |
| 42 | #include <sys/socket.h> | |
| 43 | #include <netinet/in.h> | |
| 44 | #include <sys/time.h> | |
| 45 | #include <unistd.h> | |
| 46 | #endif | |
| 47 | ||
| 48 | /* Portability stuff (DMP) */ | |
| 49 | ||
| 50 | #ifdef _WIN32 | |
| 51 | #define sleep Sleep | |
| 52 | #define strlen(x) (int)strlen(x) /* win32 has a unsigned size_t */ | |
| 53 | #endif | |
| 54 | ||
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
55 | #if defined(mach) && defined(__APPLE__) |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
56 | #define gethostbyname(x) gethostbyname2(x, AF_INET) |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
57 | #endif |
| 283 | 58 | |
| 59 | /* | |
| 60 | * Current Maximum Length for Screen Names (not including NULL) | |
| 61 | */ | |
| 62 | #define MAXSNLEN 16 | |
| 63 | ||
| 64 | /* | |
| 65 | * Current Maximum Length for Instant Messages | |
| 66 | * | |
| 67 | * This was found basically by experiment, but not wholly | |
| 68 | * accurate experiment. It should not be regarded | |
| 69 | * as completely correct. But its a decent approximation. | |
| 70 | * | |
| 71 | * Note that although we can send this much, its impossible | |
| 72 | * for WinAIM clients (up through the latest (4.0.1957)) to | |
| 73 | * send any more than 1kb. Amaze all your windows friends | |
|
331
a89ce2ecac3e
[gaim-migrate @ 341]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
283
diff
changeset
|
74 | * with utterly oversized instant messages! |
| 283 | 75 | * |
| 76 | */ | |
| 77 | #define MAXMSGLEN 7988 | |
| 78 | ||
| 79 | /* | |
| 80 | * Current Maximum Length for Chat Room Messages | |
| 81 | * | |
| 82 | * This is actually defined by the protocol to be | |
| 83 | * dynamic, but I have yet to see due cause to | |
| 84 | * define it dynamically here. Maybe later. | |
| 85 | * | |
| 86 | */ | |
| 87 | #define MAXCHATMSGLEN 512 | |
| 88 | ||
| 89 | /* | |
| 90 | * Standard size of an AIM authorization cookie | |
| 91 | */ | |
| 92 | #define AIM_COOKIELEN 0x100 | |
| 93 | ||
| 94 | #if debug > 0 | |
| 95 | #define faimdprintf(l, x...) {if (l >= debug) printf(x); } | |
| 96 | #else | |
| 97 | #define faimdprintf(l, x...) | |
| 98 | #endif | |
| 99 | ||
| 100 | /* | |
| 101 | * Login info. Passes information from the Authorization | |
| 102 | * stage of login to the service (BOS, etc) connection | |
| 103 | * phase. | |
| 104 | * | |
| 105 | */ | |
| 106 | struct aim_login_struct { | |
| 107 | char screen_name[MAXSNLEN+1]; | |
| 108 | char *BOSIP; | |
| 109 | char cookie[AIM_COOKIELEN]; | |
| 110 | char *email; | |
| 111 | u_short regstatus; | |
| 112 | char *errorurl; | |
| 113 | u_short errorcode; | |
| 114 | }; | |
| 115 | ||
| 116 | /* | |
| 117 | * Client info. Filled in by the client and passed | |
| 118 | * in to aim_login(). The information ends up | |
| 119 | * getting passed to OSCAR through the initial | |
| 120 | * login command. | |
| 121 | * | |
| 122 | * XXX: Should this be per-session? -mid | |
| 123 | * | |
| 124 | */ | |
| 125 | struct client_info_s { | |
| 126 | char clientstring[100]; /* arbitrary size */ | |
| 127 | int major; | |
| 128 | int minor; | |
| 129 | int build; | |
| 130 | char country[3]; | |
| 131 | char lang[3]; | |
| 132 | }; | |
| 133 | ||
| 134 | #ifndef TRUE | |
| 135 | #define TRUE 1 | |
| 136 | #define FALSE 0 | |
| 137 | #endif | |
| 138 | ||
| 139 | /* | |
| 140 | * These could be arbitrary, but its easier to use the actual AIM values | |
| 141 | */ | |
| 142 | #define AIM_CONN_TYPE_AUTH 0x0007 | |
| 143 | #define AIM_CONN_TYPE_ADS 0x0005 | |
| 144 | #define AIM_CONN_TYPE_BOS 0x0002 | |
| 145 | #define AIM_CONN_TYPE_CHAT 0x000e | |
| 146 | #define AIM_CONN_TYPE_CHATNAV 0x000d | |
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
147 | #define AIM_CONN_TYPE_RENDEZVOUS 0x0101 /* these do not speak OSCAR! */ |
| 283 | 148 | |
| 149 | /* | |
| 150 | * Status values returned from aim_conn_new(). ORed together. | |
| 151 | */ | |
| 152 | #define AIM_CONN_STATUS_READY 0x0001 | |
| 153 | #define AIM_CONN_STATUS_INTERNALERR 0x0002 | |
| 154 | #define AIM_CONN_STATUS_RESOLVERR 0x0080 | |
| 155 | #define AIM_CONN_STATUS_CONNERR 0x0040 | |
| 156 | ||
| 157 | struct aim_conn_t { | |
| 158 | int fd; | |
| 159 | int type; | |
| 160 | int seqnum; | |
| 161 | int status; | |
| 162 | void *priv; /* misc data the client may want to store */ | |
| 163 | time_t lastactivity; /* time of last transmit */ | |
| 164 | int forcedlatency; | |
| 165 | struct aim_rxcblist_t *handlerlist; | |
| 166 | faim_mutex_t active; /* lock around read/writes */ | |
| 167 | faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */ | |
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
168 | struct aim_conn_t *next; |
| 283 | 169 | }; |
| 170 | ||
| 171 | /* struct for incoming commands */ | |
| 172 | struct command_rx_struct { | |
| 173 | /* byte 1 assumed to always be 0x2a */ | |
| 174 | char type; /* type code (byte 2) */ | |
| 175 | u_int seqnum; /* sequence number (bytes 3 and 4) */ | |
| 176 | u_int commandlen; /* total packet len - 6 (bytes 5 and 6) */ | |
| 177 | u_char *data; /* packet data (from 7 byte on) */ | |
| 178 | u_int lock; /* 0 = open, !0 = locked */ | |
| 179 | u_int handled; /* 0 = new, !0 = been handled */ | |
| 180 | u_int nofree; /* 0 = free data on purge, 1 = only unlink */ | |
| 181 | struct aim_conn_t *conn; /* the connection it came in on... */ | |
| 182 | struct command_rx_struct *next; /* ptr to next struct in list */ | |
| 183 | }; | |
| 184 | ||
| 185 | /* struct for outgoing commands */ | |
| 186 | struct command_tx_struct { | |
| 187 | /* byte 1 assumed to be 0x2a */ | |
| 188 | char type; /* type/family code */ | |
| 189 | u_int seqnum; /* seqnum dynamically assigned on tx */ | |
| 190 | u_int commandlen; /* SNAC length */ | |
| 191 | u_char *data; /* packet data */ | |
| 192 | u_int lock; /* 0 = open, !0 = locked */ | |
| 193 | u_int sent; /* 0 = pending, !0 = has been sent */ | |
| 194 | struct aim_conn_t *conn; | |
| 195 | struct command_tx_struct *next; /* ptr to next struct in list */ | |
| 196 | }; | |
| 197 | ||
| 198 | ||
| 199 | /* | |
| 200 | * AIM Session: The main client-data interface. | |
| 201 | * | |
| 202 | */ | |
| 203 | struct aim_session_t { | |
| 204 | ||
| 205 | /* ---- Client Accessible ------------------------ */ | |
| 206 | /* | |
| 207 | * Login information. See definition above. | |
| 208 | * | |
| 209 | */ | |
| 210 | struct aim_login_struct logininfo; | |
| 211 | ||
| 212 | /* | |
| 213 | * Pointer to anything the client wants to | |
| 214 | * explicitly associate with this session. | |
| 215 | */ | |
| 216 | void *aux_data; | |
| 217 | ||
| 218 | ||
| 219 | /* ---- Internal Use Only ------------------------ */ | |
| 220 | /* | |
| 221 | * Connection information | |
| 222 | */ | |
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
223 | struct aim_conn_t *connlist; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
224 | faim_mutex_t connlistlock; |
| 283 | 225 | |
| 226 | /* | |
| 227 | * TX/RX queues | |
| 228 | */ | |
| 229 | struct command_tx_struct *queue_outgoing; | |
| 230 | struct command_rx_struct *queue_incoming; | |
| 231 | ||
| 232 | /* | |
| 233 | * Tx Enqueuing function | |
| 234 | */ | |
| 235 | int (*tx_enqueue)(struct aim_session_t *, struct command_tx_struct *); | |
| 236 | ||
| 237 | /* | |
| 238 | * This is a dreadful solution to the what-room-are-we-joining | |
| 239 | * problem. (There's no connection between the service | |
| 240 | * request and the resulting redirect.) | |
| 241 | */ | |
| 242 | char *pendingjoin; | |
| 243 | ||
| 244 | /* | |
| 245 | * Outstanding snac handling | |
| 246 | * | |
| 247 | * XXX: Should these be per-connection? -mid | |
| 248 | **/ | |
| 249 | struct aim_snac_t *outstanding_snacs; | |
| 250 | u_long snac_nextid; | |
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
251 | |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
252 | struct aim_msgcookie_t *msgcookies; |
| 283 | 253 | }; |
| 254 | ||
| 255 | ||
| 256 | /* | |
| 257 | * AIM User Info, Standard Form. | |
| 258 | */ | |
| 259 | struct aim_userinfo_s { | |
| 260 | char sn[MAXSNLEN+1]; | |
| 261 | u_short warnlevel; | |
| 262 | u_short idletime; | |
| 263 | u_short class; | |
| 264 | u_long membersince; | |
| 265 | u_long onlinesince; | |
| 266 | u_long sessionlen; | |
| 267 | u_short capabilities; | |
| 268 | }; | |
| 269 | ||
| 270 | #define AIM_CLASS_TRIAL 0x0001 | |
| 271 | #define AIM_CLASS_UNKNOWN2 0x0002 | |
| 272 | #define AIM_CLASS_AOL 0x0004 | |
| 273 | #define AIM_CLASS_UNKNOWN4 0x0008 | |
| 274 | #define AIM_CLASS_FREE 0x0010 | |
| 275 | #define AIM_CLASS_AWAY 0x0020 | |
| 276 | #define AIM_CLASS_UNKNOWN40 0x0040 | |
| 277 | #define AIM_CLASS_UNKNOWN80 0x0080 | |
| 278 | ||
| 279 | /* | |
| 280 | * TLV handling | |
| 281 | */ | |
| 282 | ||
| 283 | /* Generic TLV structure. */ | |
| 284 | struct aim_tlv_t { | |
| 285 | u_short type; | |
| 286 | u_short length; | |
| 287 | u_char *value; | |
| 288 | }; | |
| 289 | ||
| 290 | /* List of above. */ | |
| 291 | struct aim_tlvlist_t { | |
| 292 | struct aim_tlv_t *tlv; | |
| 293 | struct aim_tlvlist_t *next; | |
| 294 | }; | |
| 295 | ||
| 296 | /* TLV-handling functions */ | |
| 297 | struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen); | |
| 298 | void aim_freetlvchain(struct aim_tlvlist_t **list); | |
| 299 | struct aim_tlv_t *aim_grabtlv(u_char *src); | |
| 300 | struct aim_tlv_t *aim_grabtlvstr(u_char *src); | |
| 301 | struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int); | |
| 302 | char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int); | |
| 303 | int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv); | |
| 304 | struct aim_tlv_t *aim_createtlv(void); | |
| 305 | int aim_freetlv(struct aim_tlv_t **oldtlv); | |
| 306 | int aim_puttlv_16(u_char *, u_short, u_short); | |
| 307 | int aim_puttlv_32(u_char *, u_short, u_long); | |
| 308 | int aim_puttlv_str(u_char *buf, u_short t, u_short l, u_char *v); | |
| 309 | int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list); | |
| 310 | int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val); | |
| 311 | int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val); | |
| 312 | int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len); | |
| 313 | int aim_counttlvchain(struct aim_tlvlist_t **list); | |
| 314 | ||
| 315 | /* | |
| 316 | * Get command from connections / Dispatch commands | |
| 317 | * already in queue. | |
| 318 | */ | |
| 319 | int aim_get_command(struct aim_session_t *, struct aim_conn_t *); | |
| 320 | int aim_rxdispatch(struct aim_session_t *); | |
| 321 | ||
| 322 | int aim_logoff(struct aim_session_t *); | |
| 323 | ||
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
324 | void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn); |
| 283 | 325 | |
| 326 | typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 327 | int aim_register_callbacks(rxcallback_t *); | |
| 328 | ||
| 329 | u_long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype); | |
| 330 | u_long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *); | |
| 331 | u_long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *); | |
| 332 | ||
| 333 | /* aim_login.c */ | |
| 334 | int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 335 | int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); | |
| 336 | int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *); | |
| 337 | int aim_encode_password(const char *, u_char *); | |
|
331
a89ce2ecac3e
[gaim-migrate @ 341]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
283
diff
changeset
|
338 | int aimicq_encode_password(const char *password, u_char *encoded); |
| 283 | 339 | unsigned long aim_sendauthresp(struct aim_session_t *sess, |
| 340 | struct aim_conn_t *conn, | |
| 341 | char *sn, char *bosip, | |
| 342 | char *cookie, char *email, | |
| 343 | int regstatus); | |
| 344 | int aim_gencookie(unsigned char *buf); | |
| 345 | int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 346 | unsigned long aim_sendredirect(struct aim_session_t *sess, | |
| 347 | struct aim_conn_t *conn, | |
| 348 | unsigned short servid, | |
| 349 | char *ip, | |
| 350 | char *cookie); | |
| 351 | void aim_purge_rxqueue(struct aim_session_t *); | |
| 352 | ||
| 353 | ||
| 354 | int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *command, ...); | |
| 355 | int aim_parse_missed_im(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 356 | int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 357 | ||
| 358 | struct command_tx_struct *aim_tx_new(int, struct aim_conn_t *, int); | |
| 359 | int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *); | |
| 360 | int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *); | |
| 361 | #define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y)) | |
| 362 | int aim_tx_sendframe(struct command_tx_struct *cur); | |
| 363 | u_int aim_get_next_txseqnum(struct aim_conn_t *); | |
| 364 | int aim_tx_flushqueue(struct aim_session_t *); | |
| 365 | int aim_tx_printqueue(struct aim_session_t *); | |
| 366 | void aim_tx_purgequeue(struct aim_session_t *); | |
| 367 | ||
| 368 | struct aim_rxcblist_t { | |
| 369 | u_short family; | |
| 370 | u_short type; | |
| 371 | rxcallback_t handler; | |
| 372 | u_short flags; | |
| 373 | struct aim_rxcblist_t *next; | |
| 374 | }; | |
| 375 | ||
| 376 | int aim_conn_setlatency(struct aim_conn_t *conn, int newval); | |
| 377 | ||
| 378 | int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, rxcallback_t newhandler, u_short flags); | |
| 379 | rxcallback_t aim_callhandler(struct aim_conn_t *conn, u_short family, u_short type); | |
| 380 | int aim_clearhandlers(struct aim_conn_t *conn); | |
| 381 | ||
| 382 | /* | |
| 383 | * Generic SNAC structure. Rarely if ever used. | |
| 384 | */ | |
| 385 | struct aim_snac_t { | |
| 386 | u_long id; | |
| 387 | u_short family; | |
| 388 | u_short type; | |
| 389 | u_short flags; | |
| 390 | void *data; | |
| 391 | time_t issuetime; | |
| 392 | struct aim_snac_t *next; | |
| 393 | }; | |
| 394 | u_long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac); | |
| 395 | struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id); | |
| 396 | int aim_cleansnacs(struct aim_session_t *, int maxage); | |
| 397 | int aim_putsnac(u_char *, int, int, int, u_long); | |
| 398 | ||
| 399 | ||
| 400 | void aim_connrst(struct aim_session_t *); | |
| 401 | struct aim_conn_t *aim_conn_getnext(struct aim_session_t *); | |
| 402 | void aim_conn_close(struct aim_conn_t *deadconn); | |
| 403 | struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type); | |
| 404 | struct aim_conn_t *aim_newconn(struct aim_session_t *, int type, char *dest); | |
| 405 | int aim_conngetmaxfd(struct aim_session_t *); | |
| 406 | struct aim_conn_t *aim_select(struct aim_session_t *, struct timeval *, int *); | |
| 407 | int aim_conn_isready(struct aim_conn_t *); | |
| 408 | int aim_conn_setstatus(struct aim_conn_t *, int); | |
| 409 | void aim_session_init(struct aim_session_t *); | |
| 410 | ||
| 411 | /* aim_misc.c */ | |
| 412 | ||
| 413 | #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 | |
| 414 | #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 | |
| 415 | #define AIM_VISIBILITYCHANGE_DENYADD 0x07 | |
| 416 | #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 | |
| 417 | ||
| 418 | u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long); | |
| 419 | u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *); | |
| 420 | u_long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *); | |
| 421 | u_long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned int); | |
| 422 | u_long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long); | |
| 423 | u_long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *); | |
| 424 | u_long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *); | |
| 425 | u_long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *); | |
| 426 | u_long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long); | |
| 427 | u_long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *); | |
| 428 | u_long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short); | |
| 429 | u_long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *); | |
| 430 | u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *); | |
| 431 | u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *); | |
| 432 | u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *); | |
| 433 | u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 434 | ||
| 435 | /* aim_rxhandlers.c */ | |
| 436 | int aim_rxdispatch(struct aim_session_t *); | |
| 437 | int aim_authparse(struct aim_session_t *, struct command_rx_struct *); | |
| 438 | int aim_handleredirect_middle(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 439 | int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 440 | int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); | |
| 441 | int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...); | |
| 442 | int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...); | |
| 443 | ||
| 444 | /* aim_im.c */ | |
| 445 | #define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */ | |
| 446 | #define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */ | |
| 447 | ||
| 448 | u_long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *); | |
| 449 | int aim_parse_incoming_im_middle(struct aim_session_t *, struct command_rx_struct *); | |
| 450 | u_long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn); | |
| 451 | int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *); | |
|
331
a89ce2ecac3e
[gaim-migrate @ 341]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
283
diff
changeset
|
452 | int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command); |
| 283 | 453 | |
| 454 | /* aim_info.c */ | |
| 455 | #define AIM_CAPS_BUDDYICON 0x01 | |
| 456 | #define AIM_CAPS_VOICE 0x02 | |
| 457 | #define AIM_CAPS_IMIMAGE 0x04 | |
| 458 | #define AIM_CAPS_CHAT 0x08 | |
| 459 | #define AIM_CAPS_GETFILE 0x10 | |
| 460 | #define AIM_CAPS_SENDFILE 0x20 | |
| 461 | extern u_char aim_caps[6][16]; | |
| 462 | ||
| 463 | #define AIM_GETINFO_GENERALINFO 0x00001 | |
| 464 | #define AIM_GETINFO_AWAYMESSAGE 0x00003 | |
| 465 | ||
|
338
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
466 | #define AIM_RENDEZVOUS_VOICE 0x0000 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
467 | #define AIM_RENDEZVOUS_FILETRANSFER 0x0001 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
468 | #define AIM_RENDEZVOUS_CHAT_EX3 0x0003 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
469 | #define AIM_RENDEZVOUS_CHAT_EX4 0x0004 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
470 | #define AIM_RENDEZVOUS_CHAT_EX5 0x0005 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
471 | #define AIM_RENDEZVOUS_FILETRANSFER_GET 0x0012 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
472 | |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
473 | struct aim_msgcookie_t { |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
474 | unsigned char cookie[8]; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
475 | unsigned char extended[16]; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
476 | int type; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
477 | void *data; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
478 | time_t addtime; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
479 | struct aim_msgcookie_t *next; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
480 | }; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
481 | |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
482 | struct aim_filetransfer_t { |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
483 | char sender[MAXSNLEN]; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
484 | char ip[30]; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
485 | char *filename; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
486 | }; |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
487 | int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie); |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
488 | struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, char *cookie); |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
489 | int aim_purgecookies(struct aim_session_t *sess); |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
490 | |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
491 | #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
492 | #define AIM_TRANSFER_DENY_DECLINE 0x0001 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
493 | #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
494 | u_long aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short code); |
|
21c93bc7ae83
[gaim-migrate @ 348]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
331
diff
changeset
|
495 | |
| 283 | 496 | u_long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short); |
| 497 | int aim_extractuserinfo(u_char *, struct aim_userinfo_s *); | |
| 498 | int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *); | |
| 499 | int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *); | |
| 500 | int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *); | |
| 501 | int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info); | |
| 502 | int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info); | |
| 503 | int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); | |
| 504 | ||
| 505 | ||
| 506 | /* aim_auth.c */ | |
| 507 | int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *); | |
| 508 | u_long aim_auth_clientready(struct aim_session_t *, struct aim_conn_t *); | |
| 509 | u_long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char *, char *); | |
| 510 | ||
| 511 | /* aim_buddylist.c */ | |
| 512 | u_long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *); | |
| 513 | u_long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *); | |
| 514 | ||
| 515 | /* aim_search.c */ | |
| 516 | u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *); | |
| 517 | /* u_long aim_usersearch_name(struct aim_session_t *, struct aim_conn_t *, char *); */ | |
| 518 | ||
| 519 | ||
| 520 | struct aim_chat_roominfo { | |
| 521 | u_short exchange; | |
| 522 | char *name; | |
| 523 | u_short instance; | |
| 524 | }; | |
| 525 | int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo); | |
| 526 | int aim_chat_parse_infoupdate(struct aim_session_t *sess, struct command_rx_struct *command); | |
| 527 | int aim_chat_parse_joined(struct aim_session_t *sess, struct command_rx_struct *command); | |
| 528 | int aim_chat_parse_leave(struct aim_session_t *sess, struct command_rx_struct *command); | |
| 529 | int aim_chat_parse_incoming(struct aim_session_t *sess, struct command_rx_struct *command); | |
| 530 | u_long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg); | |
| 531 | u_long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname); | |
| 532 | u_long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 533 | int aim_chat_attachname(struct aim_conn_t *conn, char *roomname); | |
| 534 | char *aim_chat_getname(struct aim_conn_t *conn); | |
| 535 | struct aim_conn_t *aim_chat_getconn(struct aim_session_t *, char *name); | |
| 536 | ||
| 537 | u_long aim_chatnav_reqrights(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 538 | u_long aim_chatnav_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
| 539 | ||
| 540 | u_long aim_chat_invite(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *msg, u_short exchange, char *roomname, u_short instance); | |
| 541 | ||
| 542 | struct aim_chat_exchangeinfo { | |
| 543 | u_short number; | |
| 544 | char *name; | |
| 545 | char *charset1; | |
| 546 | char *lang1; | |
| 547 | char *charset2; | |
| 548 | char *lang2; | |
| 549 | }; | |
| 550 | int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command); | |
| 551 | u_long aim_chatnav_createroom(struct aim_session_t *sess, struct aim_conn_t *conn, char *name, u_short exchange); | |
| 552 | int aim_chat_leaveroom(struct aim_session_t *sess, char *name); | |
| 553 | ||
| 554 | /* aim_util.c */ | |
| 555 | #ifdef AIMUTIL_USEMACROS | |
| 556 | /* | |
| 557 | * These are really ugly. You'd think this was LISP. I wish it was. | |
| 558 | */ | |
| 559 | #define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1) | |
| 560 | #define aimutil_get8(buf) ((*(buf))&0xff) | |
| 561 | #define aimutil_put16(buf, data) ( \ | |
| 562 | (*(buf) = (u_char)((data)>>8)&0xff), \ | |
| 563 | (*((buf)+1) = (u_char)(data)&0xff), \ | |
| 564 | 2) | |
| 565 | #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) | |
| 566 | #define aimutil_put32(buf, data) ( \ | |
| 567 | (*((buf)) = (u_char)((data)>>24)&0xff), \ | |
| 568 | (*((buf)+1) = (u_char)((data)>>16)&0xff), \ | |
| 569 | (*((buf)+2) = (u_char)((data)>>8)&0xff), \ | |
| 570 | (*((buf)+3) = (u_char)(data)&0xff), \ | |
| 571 | 4) | |
| 572 | #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ | |
| 573 | (((*((buf)+1))<<16)&0x00ff0000) + \ | |
| 574 | (((*((buf)+2))<< 8)&0x0000ff00) + \ | |
| 575 | (((*((buf)+3) )&0x000000ff))) | |
| 576 | #else | |
| 577 | #warning Not using aimutil macros. May have performance problems. | |
| 578 | int aimutil_put8(u_char *, u_char); | |
| 579 | u_char aimutil_get8(u_char *buf); | |
| 580 | int aimutil_put16(u_char *, u_short); | |
| 581 | u_short aimutil_get16(u_char *); | |
| 582 | int aimutil_put32(u_char *, u_long); | |
| 583 | u_long aimutil_get32(u_char *); | |
| 584 | #endif | |
| 585 | ||
| 586 | int aimutil_putstr(u_char *, const u_char *, int); | |
| 587 | int aimutil_tokslen(char *toSearch, int index, char dl); | |
| 588 | int aimutil_itemcnt(char *toSearch, char dl); | |
| 589 | char *aimutil_itemidx(char *toSearch, int index, char dl); | |
| 590 | ||
| 591 | int aim_snlen(const char *sn); | |
| 592 | int aim_sncmp(const char *sn1, const char *sn2); | |
| 593 | ||
| 594 | /* aim_meta.c */ | |
| 595 | char *aim_getbuilddate(void); | |
| 596 | char *aim_getbuildtime(void); | |
| 597 | char *aim_getbuildstring(void); | |
| 598 | ||
| 599 | #endif /* __AIM_H__ */ | |
| 600 |