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

📄 aim.h

📁 oscar message protocol stack
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * 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 Myer * */#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>#ifndef _WIN32#include <sys/time.h>#include <unistd.h>#include <netdb.h>#include <netinet/in.h>#include <sys/socket.h>#else#include "libc_interface.h"#endif#ifdef __cplusplusextern "C" {#endif/* XXX adjust these based on autoconf-detected platform */typedef unsigned char fu8_t;typedef unsigned short fu16_t;typedef unsigned int fu32_t;typedef fu32_t aim_snacid_t;typedef fu16_t flap_seqnum_t;#if defined(mach) && defined(__APPLE__)#define gethostbyname(x) gethostbyname2(x, AF_INET) #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#ifndef FALSE#define FALSE (0)#endif#ifndef TRUE#define TRUE (!FALSE)#endif#ifndef bool#define bool fu8_t#endif/*  * Current Maximum Length for Screen Names (not including NULL)  * * Currently only names up to 16 characters can be registered * however it is apparently legal for them to be larger. */#define MAXSNLEN 97/* * 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/** * Maximum length for the password of an ICQ account */#define MAXICQPASSLEN 8#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;	fu16_t major;	fu16_t minor;	fu16_t point;	fu16_t build;	fu32_t distrib;	const char *country; /* two-letter abbrev */	const char *lang; /* two-letter abbrev */};/* Needs to be checked */#define CLIENTINFO_AIM_3_5_1670 { \	"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \	0x0004, \	0x0003, 0x0005, \	0x0000, 0x0686, \	0x0000002a, \	"us", "en", \}/* Needs to be checked *//* Latest winaim without ssi */#define CLIENTINFO_AIM_4_1_2010 { \	"AOL Instant Messenger (SM), version 4.1.2010/WIN32", \	0x0004, \	0x0004, 0x0001, \	0x0000, 0x07da, \	0x0000004b, \	"us", "en", \}/* Needs to be checked */#define CLIENTINFO_AIM_4_3_2188 { \	"AOL Instant Messenger (SM), version 4.3.2188/WIN32", \	0x0109, \	0x0400, 0x0003, \	0x0000, 0x088c, \	0x00000086, \	"us", "en", \}/* Needs to be checked */#define CLIENTINFO_AIM_4_8_2540 { \	"AOL Instant Messenger (SM), version 4.8.2540/WIN32", \	0x0109, \	0x0004, 0x0008, \	0x0000, 0x09ec, \	0x000000af, \	"us", "en", \}/* Needs to be checked */#define CLIENTINFO_AIM_5_0_2938 { \	"AOL Instant Messenger, version 5.0.2938/WIN32", \	0x0109, \	0x0005, 0x0000, \	0x0000, 0x0b7a, \	0x00000000, \	"us", "en", \}#define CLIENTINFO_AIM_5_1_3036 { \	"AOL Instant Messenger, version 5.1.3036/WIN32", \	0x0109, \	0x0005, 0x0001, \	0x0000, 0x0bdc, \	0x000000d2, \	"us", "en", \}#define CLIENTINFO_AIM_5_5_3415 { \	"AOL Instant Messenger, version 5.5.3415/WIN32", \	0x0109, \	0x0005, 0x0005, \	0x0000, 0x0057, \	0x000000ef, \	"us", "en", \}#define CLIENTINFO_ICHAT_1_0 { \	"Apple iChat", \	0x311a, \	0x0001, 0x0000, \	0x0000, 0x003c, \	0x000000c6, \	"us", "en", \}/* Needs to be checked */#define CLIENTINFO_ICQ_4_65_3281 { \	"ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \	0x010a, \	0x0004, 0x0041, \	0x0001, 0x0cd1, \	0x00000055, \	"us", "en", \}/* Needs to be checked */#define CLIENTINFO_ICQ_5_34_3728 { \	"ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \	0x010a, \	0x0005, 0x0022, \	0x0001, 0x0e8f, \	0x00000055, \	"us", "en", \}#define CLIENTINFO_ICQ_5_45_3777 { \	"ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \	0x010a, \	0x0005, 0x002d, \	0x0001, 0x0ec1, \	0x00000055, \	"us", "en", \}#define CLIENTINFO_ICQBASIC_14_3_1068 { \	"ICQBasic", \	0x010a, \	0x0014, 0x0003, \	0x0000, 0x042c, \	0x0000043d, \	"us", "en", \}#define CLIENTINFO_NETSCAPE_7_0_1 { \	"Netscape 2000 an approved user of AOL Instant Messenger (SM)", \	0x1d0d, \	0x0007, 0x0000, \	0x0001, 0x0000, \	0x00000058, \	"us", "en", \}#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777/*  * These could be arbitrary, but its easier to use the actual AIM values  */#define AIM_CONN_TYPE_BOS		0x0002#define AIM_CONN_TYPE_ADS		0x0005#define AIM_CONN_TYPE_AUTH		0x0007#define AIM_CONN_TYPE_CHATNAV	0x000d#define AIM_CONN_TYPE_CHAT		0x000e#define AIM_CONN_TYPE_SEARCH	0x000f#define AIM_CONN_TYPE_ICON		0x0010#define AIM_CONN_TYPE_EMAIL		0x0018/* they start getting arbitrary for rendezvous stuff =) */#define AIM_CONN_TYPE_RENDEZVOUS	0xfffe /* these do not speak FLAP! */#define AIM_CONN_TYPE_LISTENER		0xffff /* 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;	fu32_t len;	fu32_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 channel;			flap_seqnum_t seqnum;     		} flap;		struct {			fu8_t magic[4];	/* ODC2 or OFT2 */			fu16_t hdrlen;			fu16_t type;		} rend;	} hdr;	aim_bstream_t data;		/* payload stream */	aim_conn_t *conn;		/* the connection it came in on/is going out on */	fu8_t handled;			/* 0 = new, !0 = been handled */	struct aim_frame_s *next;} aim_frame_t;typedef struct aim_msgcookie_s {	fu8_t cookie[8];	int type;

⌨️ 快捷键说明

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