comparison src/protocols/oscar/aim.h @ 5556:8ab1875e6d09

[gaim-migrate @ 5957] This is mostly some small changes to oscar to make it faster and more portable (like, to 64 bit platforms). It's pretty much all from The Ryan McCabe (odin). He's the man. I didn't actually test this, but CVS is probably broken right now anyway. Fear not--if it doesn't work I'll be sure to fix it real good now, ya hear. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 30 May 2003 02:35:44 +0000
parents 2d9f7d2e3558
children ac418a9dea99
comparison
equal deleted inserted replaced
5555:6503d24fda09 5556:8ab1875e6d09
36 #endif 36 #endif
37 37
38 /* XXX adjust these based on autoconf-detected platform */ 38 /* XXX adjust these based on autoconf-detected platform */
39 typedef unsigned char fu8_t; 39 typedef unsigned char fu8_t;
40 typedef unsigned short fu16_t; 40 typedef unsigned short fu16_t;
41 typedef unsigned long fu32_t; 41 typedef unsigned int fu32_t;
42 typedef fu32_t aim_snacid_t; 42 typedef fu32_t aim_snacid_t;
43 typedef fu16_t flap_seqnum_t; 43 typedef fu16_t flap_seqnum_t;
44 44
45 #if defined(mach) && defined(__APPLE__) 45 #if defined(mach) && defined(__APPLE__)
46 #define gethostbyname(x) gethostbyname2(x, AF_INET) 46 #define gethostbyname(x) gethostbyname2(x, AF_INET)
340 aim_conn_t *conn; /* the connection it came in on... */ 340 aim_conn_t *conn; /* the connection it came in on... */
341 struct aim_frame_s *next; 341 struct aim_frame_s *next;
342 } aim_frame_t; 342 } aim_frame_t;
343 343
344 typedef struct aim_msgcookie_s { 344 typedef struct aim_msgcookie_s {
345 unsigned char cookie[8]; 345 fu8_t cookie[8];
346 int type; 346 int type;
347 void *data; 347 void *data;
348 time_t addtime; 348 time_t addtime;
349 struct aim_msgcookie_s *next; 349 struct aim_msgcookie_s *next;
350 } aim_msgcookie_t; 350 } aim_msgcookie_t;
522 522
523 faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn); 523 faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn);
524 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); 524 faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn);
525 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); 525 faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn);
526 faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); 526 faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key);
527 faim_export int aim_encode_password_md5(const char *password, const char *key, unsigned char *digest); 527 faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest);
528 faim_export void aim_purge_rxqueue(aim_session_t *); 528 faim_export void aim_purge_rxqueue(aim_session_t *);
529 faim_export void aim_cleansnacs(aim_session_t *, int maxage); 529 faim_export void aim_cleansnacs(aim_session_t *, int maxage);
530 530
531 #define AIM_TX_QUEUED 0 /* default */ 531 #define AIM_TX_QUEUED 0 /* default */
532 #define AIM_TX_IMMEDIATE 1 532 #define AIM_TX_IMMEDIATE 1
552 faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn); 552 faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn);
553 faim_export int aim_conn_isconnecting(aim_conn_t *conn); 553 faim_export int aim_conn_isconnecting(aim_conn_t *conn);
554 554
555 typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va); 555 typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va);
556 faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t); 556 faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t);
557 faim_export void aim_session_init(aim_session_t *, unsigned long flags, int debuglevel); 557 faim_export void aim_session_init(aim_session_t *, fu32_t flags, int debuglevel);
558 faim_export void aim_session_kill(aim_session_t *); 558 faim_export void aim_session_kill(aim_session_t *);
559 faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password); 559 faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password);
560 faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type); 560 faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type);
561 faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type); 561 faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type);
562 faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd); 562 faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd);
594 #define AIM_CLIENTTYPE_UNKNOWN 0x0000 594 #define AIM_CLIENTTYPE_UNKNOWN 0x0000
595 #define AIM_CLIENTTYPE_MC 0x0001 595 #define AIM_CLIENTTYPE_MC 0x0001
596 #define AIM_CLIENTTYPE_WINAIM 0x0002 596 #define AIM_CLIENTTYPE_WINAIM 0x0002
597 #define AIM_CLIENTTYPE_WINAIM41 0x0003 597 #define AIM_CLIENTTYPE_WINAIM41 0x0003
598 #define AIM_CLIENTTYPE_AOL_TOC 0x0004 598 #define AIM_CLIENTTYPE_AOL_TOC 0x0004
599 faim_export unsigned short aim_im_fingerprint(unsigned char *msghdr, int len); 599 faim_export unsigned short aim_im_fingerprint(const fu8_t *msghdr, int len);
600 600
601 #define AIM_RATE_CODE_CHANGE 0x0001 601 #define AIM_RATE_CODE_CHANGE 0x0001
602 #define AIM_RATE_CODE_WARNING 0x0002 602 #define AIM_RATE_CODE_WARNING 0x0002
603 #define AIM_RATE_CODE_LIMIT 0x0003 603 #define AIM_RATE_CODE_LIMIT 0x0003
604 #define AIM_RATE_CODE_CLEARLIMIT 0x0004 604 #define AIM_RATE_CODE_CLEARLIMIT 0x0004
645 fu16_t maxrecverwarn; 645 fu16_t maxrecverwarn;
646 fu32_t minmsginterval; /* in milliseconds? */ 646 fu32_t minmsginterval; /* in milliseconds? */
647 }; 647 };
648 648
649 struct aim_chat_roominfo { 649 struct aim_chat_roominfo {
650 unsigned short exchange; 650 fu16_t exchange;
651 char *name; 651 char *name;
652 unsigned short instance; 652 fu16_t instance;
653 }; 653 };
654 654
655 #define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ 655 #define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */
656 #define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ 656 #define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */
657 #define AIM_IMFLAGS_UNICODE 0x0004 657 #define AIM_IMFLAGS_UNICODE 0x0004
829 829
830 /* SNAC sending functions */ 830 /* SNAC sending functions */
831 /* 0x0002 */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params); 831 /* 0x0002 */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params);
832 /* 0x0004 */ faim_export int aim_im_reqparams(aim_session_t *sess); 832 /* 0x0004 */ faim_export int aim_im_reqparams(aim_session_t *sess);
833 /* 0x0006 */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args); 833 /* 0x0006 */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args);
834 /* 0x0006 */ faim_export int aim_im_sendch1(aim_session_t *, const char *destsn, unsigned short flags, const char *msg); 834 /* 0x0006 */ faim_export int aim_im_sendch1(aim_session_t *, const char *destsn, fu16_t flags, const char *msg);
835 /* 0x0006 */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum); 835 /* 0x0006 */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum);
836 /* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); 836 /* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args);
837 /* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, const char *sn, const fu8_t *ip, fu16_t port); 837 /* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, const char *sn, const fu8_t *ip, fu16_t port);
838 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info); 838 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info);
839 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *info); 839 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *info);
840 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info); 840 /* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info);
841 /* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type); 841 /* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type);
842 /* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); 842 /* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message);
843 /* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags); 843 /* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags);
844 /* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, unsigned short code); 844 /* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code);
845 /* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2); 845 /* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2);
846 846
847 847
848 848
849 /* ft.c */ 849 /* ft.c */
997 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn); 997 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn);
998 998
999 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 999 #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0
1000 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 1000 #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1
1001 1001
1002 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, unsigned long offset, unsigned long len, const unsigned char *buf, unsigned char flag); 1002 faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag);
1003 1003
1004 #define AIM_GETINFO_GENERALINFO 0x00001 1004 #define AIM_GETINFO_GENERALINFO 0x00001
1005 #define AIM_GETINFO_AWAYMESSAGE 0x00003 1005 #define AIM_GETINFO_AWAYMESSAGE 0x00003
1006 #define AIM_GETINFO_CAPABILITIES 0x0004 1006 #define AIM_GETINFO_CAPABILITIES 0x0004
1007 1007
1027 #define AIM_COOKIETYPE_OFTSEND 0x12 1027 #define AIM_COOKIETYPE_OFTSEND 0x12
1028 #define AIM_COOKIETYPE_OFTVOICE 0x13 1028 #define AIM_COOKIETYPE_OFTVOICE 0x13
1029 #define AIM_COOKIETYPE_OFTIMAGE 0x14 1029 #define AIM_COOKIETYPE_OFTIMAGE 0x14
1030 #define AIM_COOKIETYPE_OFTICON 0x15 1030 #define AIM_COOKIETYPE_OFTICON 0x15
1031 1031
1032 /* 0x0005 */ faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short); 1032 /* 0x0005 */ faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, fu16_t);
1033 1033
1034 1034
1035 1035
1036 /* 0x0003 - buddylist.c */ 1036 /* 0x0003 - buddylist.c */
1037 /* 0x0004 */ faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *); 1037 /* 0x0004 */ faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *);
1378 (((*((buf)+2))<< 8)&0x0000ff00) + \ 1378 (((*((buf)+2))<< 8)&0x0000ff00) + \
1379 (((*((buf)+3) )&0x000000ff))) 1379 (((*((buf)+3) )&0x000000ff)))
1380 1380
1381 /* Little-endian versions (damn ICQ) */ 1381 /* Little-endian versions (damn ICQ) */
1382 #define aimutil_putle8(buf, data) ( \ 1382 #define aimutil_putle8(buf, data) ( \
1383 (*(buf) = (unsigned char)(data) & 0xff), \ 1383 (*(buf) = (fu8_t)(data) & 0xff), \
1384 1) 1384 1)
1385 #define aimutil_getle8(buf) ( \ 1385 #define aimutil_getle8(buf) ( \
1386 (*(buf)) & 0xff \ 1386 (*(buf)) & 0xff \
1387 ) 1387 )
1388 #define aimutil_putle16(buf, data) ( \ 1388 #define aimutil_putle16(buf, data) ( \
1389 (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff), \ 1389 (*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \
1390 (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \ 1390 (*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \
1391 2) 1391 2)
1392 #define aimutil_getle16(buf) ( \ 1392 #define aimutil_getle16(buf) ( \
1393 (((*((buf)+0)) << 0) & 0x00ff) + \ 1393 (((*((buf)+0)) << 0) & 0x00ff) + \
1394 (((*((buf)+1)) << 8) & 0xff00) \ 1394 (((*((buf)+1)) << 8) & 0xff00) \
1395 ) 1395 )
1396 #define aimutil_putle32(buf, data) ( \ 1396 #define aimutil_putle32(buf, data) ( \
1397 (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff), \ 1397 (*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \
1398 (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \ 1398 (*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \
1399 (*((buf)+2) = (unsigned char)((data) >> 16) & 0xff), \ 1399 (*((buf)+2) = (fu8_t)((data) >> 16) & 0xff), \
1400 (*((buf)+3) = (unsigned char)((data) >> 24) & 0xff), \ 1400 (*((buf)+3) = (fu8_t)((data) >> 24) & 0xff), \
1401 4) 1401 4)
1402 #define aimutil_getle32(buf) ( \ 1402 #define aimutil_getle32(buf) ( \
1403 (((*((buf)+0)) << 0) & 0x000000ff) + \ 1403 (((*((buf)+0)) << 0) & 0x000000ff) + \
1404 (((*((buf)+1)) << 8) & 0x0000ff00) + \ 1404 (((*((buf)+1)) << 8) & 0x0000ff00) + \
1405 (((*((buf)+2)) << 16) & 0x00ff0000) + \ 1405 (((*((buf)+2)) << 16) & 0x00ff0000) + \