⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aim.h

📁 AnyQ服务端源代码(2004/10/28)源码
💻 H
📖 第 1 页 / 共 3 页
字号:
/*  * Main libfaim header.  Must be included in client for prototypes/macros. * * "come on, i turned a chick lesbian; i think this is the hackish equivalent" *                                                -- Josh Meyer * */#ifndef __AIM_H__#define __AIM_H__#define FAIM_VERSION_MAJOR 0#define FAIM_VERSION_MINOR 99#define FAIM_VERSION_MINORMINOR 1#include <faimconfig.h>#include <aim_cbtypes.h>#include <stdio.h>#include <string.h>#include <fcntl.h>#include <sys/types.h>#include <stdlib.h>#include <stdarg.h>#include <errno.h>#include <time.h>#ifdef _WIN32#include <windows.h>#include <io.h>#else#include <sys/time.h>#include <unistd.h>#include <netinet/in.h>#include <sys/socket.h>#endif/* XXX adjust these based on autoconf-detected platform */typedef unsigned char fu8_t;typedef unsigned short fu16_t;typedef unsigned long fu32_t;typedef fu32_t aim_snacid_t;typedef fu16_t flap_seqnum_t;/* Portability stuff (DMP) */#ifdef _WIN32#define sleep(x) Sleep((x)*1000)#define snprintf _snprintf /* I'm not sure whats wrong with Microsoft here */#define close(x) closesocket(x) /* no comment */#endif#if defined(mach) && defined(__APPLE__)#define gethostbyname(x) gethostbyname2(x, AF_INET) #endif#if defined(_WIN32) || defined(STRICT_ANSI)#define faim_shortfunc#else#define faim_shortfunc inline#endif#if defined(_WIN32) && !defined(WIN32_STATIC)/* * For a win32 DLL, we define WIN32_INDLL if this file * is included while compiling the DLL. If its not  * defined (its included in a client app), the symbols * will be imported instead of exported. */#ifdef WIN32_INDLL#define faim_export __declspec(dllexport)#else #define faim_export __declspec(dllimport)#endif /* WIN32_INDLL */#define faim_internal#else/* * Nothing normally needed for unix... */#define faim_export#define faim_internal#endif/*  * Current Maximum Length for Screen Names (not including NULL)  * * Currently only names up to 16 characters can be registered * however it is aparently legal for them to be larger. */#define MAXSNLEN 32/* * Current Maximum Length for Instant Messages * * This was found basically by experiment, but not wholly * accurate experiment.  It should not be regarded * as completely correct.  But its a decent approximation. * * Note that although we can send this much, its impossible * 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/* * Maximum size of a Buddy Icon. */#define MAXICONLEN 7168#define AIM_ICONIDENT "AVT1picture.id"/* * Current Maximum Length for Chat Room Messages * * This is actually defined by the protocol to be * dynamic, but I have yet to see due cause to  * define it dynamically here.  Maybe later. * */#define MAXCHATMSGLEN 512/* * Standard size of an AIM authorization cookie */#define AIM_COOKIELEN            0x100#define AIM_MD5_STRING "AOL Instant Messenger (SM)"/* * Client info.  Filled in by the client and passed in to  * aim_send_login().  The information ends up getting passed to OSCAR * through the initial login command. * */struct client_info_s {	const char *clientstring;	fu16_t clientid;	int major;	int minor;	int point;	int build;	const char *country; /* two-letter abbrev */	const char *lang; /* two-letter abbrev */};#define AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 { \	"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \	0x0004, \	0x0003, \	0x0005, \	0x0000, \	0x0686, \	"us", \	"en", \}#define AIM_CLIENTINFO_KNOWNGOOD_4_1_2010 { \	  "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \	  0x0004, \	  0x0004, \	  0x0001, \	  0x0000, \	  0x07da, \	  "us", \	  "en", \}/* * I would make 4.1.2010 the default, but they seem to have found * an alternate way of breaking that one.  * * 3.5.1670 should work fine, however, you will be subjected to the * memory test, which may require you to have a WinAIM binary laying  * around. (see login.c::memrequest()) */#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670#ifndef TRUE#define TRUE 1#define FALSE 0#endif/*  * These could be arbitrary, but its easier to use the actual AIM values  */#define AIM_CONN_TYPE_AUTH          0x0007#define AIM_CONN_TYPE_ADS           0x0005#define AIM_CONN_TYPE_BOS           0x0002#define AIM_CONN_TYPE_CHAT          0x000e#define AIM_CONN_TYPE_CHATNAV       0x000d/* they start getting arbitrary in rendezvous stuff =) */#define AIM_CONN_TYPE_RENDEZVOUS    0x0101 /* these do not speak FLAP! */#define AIM_CONN_TYPE_RENDEZVOUS_OUT 0x0102 /* socket waiting for accept() *//* * Subtypes, we need these for OFT stuff. */#define AIM_CONN_SUBTYPE_OFT_DIRECTIM  0x0001#define AIM_CONN_SUBTYPE_OFT_GETFILE   0x0002#define AIM_CONN_SUBTYPE_OFT_SENDFILE  0x0003#define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004#define AIM_CONN_SUBTYPE_OFT_VOICE     0x0005/* * Status values returned from aim_conn_new().  ORed together. */#define AIM_CONN_STATUS_READY       0x0001#define AIM_CONN_STATUS_INTERNALERR 0x0002#define AIM_CONN_STATUS_RESOLVERR   0x0040#define AIM_CONN_STATUS_CONNERR     0x0080#define AIM_CONN_STATUS_INPROGRESS  0x0100#define AIM_FRAMETYPE_FLAP 0x0000#define AIM_FRAMETYPE_OFT  0x0001typedef struct aim_conn_s {	int fd;	fu16_t type;	fu16_t subtype;	flap_seqnum_t seqnum;	fu32_t status;	void *priv; /* misc data the client may want to store */	void *internal; /* internal conn-specific libfaim data */	time_t lastactivity; /* time of last transmit */	int forcedlatency; 	void *handlerlist;	void *sessv; /* pointer to parent session */	void *inside; /* only accessible from inside libfaim */	struct aim_conn_s *next;} aim_conn_t;/* * Byte Stream type. Sort of. * * Use of this type serves a couple purposes: *   - Buffer/buflen pairs are passed all around everywhere. This turns *     that into one value, as well as abstracting it slightly. *   - Through the abstraction, it is possible to enable bounds checking *     for robustness at the cost of performance.  But a clean failure on *     weird packets is much better than a segfault. *   - I like having variables named "bs". * * Don't touch the insides of this struct.  Or I'll have to kill you. * */typedef struct aim_bstream_s {	fu8_t *data;	fu16_t len;	fu16_t offset;} aim_bstream_t;typedef struct aim_frame_s {	fu8_t hdrtype; /* defines which piece of the union to use */	union {		struct { 			fu8_t type;			flap_seqnum_t seqnum;     		} flap;		struct {			fu16_t type;			fu8_t magic[4]; /* ODC2 OFT2 */			fu16_t hdr2len;			fu8_t *hdr2; /* rest of bloated header */		} oft;	} hdr;	aim_bstream_t data;	/* payload stream */	fu8_t handled;		/* 0 = new, !0 = been handled */	fu8_t nofree;		/* 0 = free data on purge, 1 = only unlink */	aim_conn_t *conn;  /* the connection it came in on... */	struct aim_frame_s *next;} aim_frame_t;typedef struct aim_msgcookie_s {	unsigned char cookie[8];	int type;	void *data;	time_t addtime;	struct aim_msgcookie_s *next;} aim_msgcookie_t;/* * AIM Session: The main client-data interface.   * */typedef struct aim_session_s {	/* ---- Client Accessible ------------------------ */	/* Our screen name. */	char sn[MAXSNLEN+1];	/*	 * Pointer to anything the client wants to 	 * explicitly associate with this session.	 *	 * This is for use in the callbacks mainly. In any	 * callback, you can access this with sess->aux_data.	 *	 */	void *aux_data;	/* ---- Internal Use Only ------------------------ */	/* Connection information */	aim_conn_t *connlist;	/*	 * Transmit/receive queues.	 *	 * These are only used when you don't use your own lowlevel	 * I/O.  I don't suggest that you use libfaim's internal I/O.	 * Its really bad and the API/event model is quirky at best.	 *  	 */	aim_frame_t *queue_outgoing;   	aim_frame_t *queue_incoming; 	/*	 * Tx Enqueuing function.	 *	 * This is how you override the transmit direction of libfaim's	 * internal I/O.  This function will be called whenever it needs	 * to send something.	 *	 */	int (*tx_enqueue)(struct aim_session_s *, aim_frame_t *);	/*	 * Outstanding snac handling 	 *	 * XXX: Should these be per-connection? -mid	 */	void *snac_hash[FAIM_SNAC_HASH_SIZE];	aim_snacid_t snacid_next;	struct {		char server[128];		char username[128];		char password[128];	} socksproxy;	fu32_t flags; /* AIM_SESS_FLAGS_ */	int debug;	void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */	aim_msgcookie_t *msgcookies;	void *modlistv;} aim_session_t;/* Values for sess->flags */#define AIM_SESS_FLAGS_SNACLOGIN         0x00000001#define AIM_SESS_FLAGS_XORLOGIN          0x00000002#define AIM_SESS_FLAGS_NONBLOCKCONNECT   0x00000004#define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -