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

📄 oscar.h

📁 Linux下的多协议即时通讯程序源代码
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * Purple's oscar protocol plugin * This file is the legal property of its developers. * Please see the AUTHORS file distributed alongside this file. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//* * 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 _OSCAR_H_#define _OSCAR_H_#include "circbuffer.h"#include "debug.h"#include "eventloop.h"#include "internal.h"#include "proxy.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"#endiftypedef struct _ByteStream         ByteStream;typedef struct _ClientInfo         ClientInfo;typedef struct _FlapConnection     FlapConnection;typedef struct _FlapFrame          FlapFrame;typedef struct _IcbmArgsCh2        IcbmArgsCh2;typedef struct _IcbmCookie         IcbmCookie;typedef struct _OscarData          OscarData;typedef struct _QueuedSnac         QueuedSnac;typedef guint32 aim_snacid_t;#include "snactypes.h"#ifdef __cplusplusextern "C" {#endif#define FAIM_SNAC_HASH_SIZE 16/* * 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! * * TODO: 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 _ClientInfo{	const char *clientstring;	guint16 clientid;	guint16 major;	guint16 minor;	guint16 point;	guint16 build;	guint32 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_AIM_5_9_3702 { \	"AOL Instant Messenger, version 5.9.3702/WIN32", \	0x0109, \	0x0005, 0x0009, \	0x0000, 0x0e76, \	0x00000111, \	"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", \}/* * TODO: Use PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION, and *       PURPLE_MICRO_VERSION?  Or did that break things? */#define CLIENTINFO_PURPLE { \	"Purple/" VERSION, \	0x0109, \	0x0005, 0x0001, \	0x0000, 0x0bdc, \	0x000000d2, \	"us", "en", \}#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777typedef enum{	OSCAR_DISCONNECT_DONE, /* not considered an error */	OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */	OSCAR_DISCONNECT_REMOTE_CLOSED,	OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */	OSCAR_DISCONNECT_LOST_CONNECTION,	OSCAR_DISCONNECT_INVALID_DATA,	OSCAR_DISCONNECT_COULD_NOT_CONNECT,	OSCAR_DISCONNECT_RETRYING /* peer connections only */} OscarDisconnectReason;typedef enum{	OSCAR_CAPABILITY_BUDDYICON            = 0x00000001,	OSCAR_CAPABILITY_TALK                 = 0x00000002,	OSCAR_CAPABILITY_DIRECTIM             = 0x00000004,	OSCAR_CAPABILITY_CHAT                 = 0x00000008,	OSCAR_CAPABILITY_GETFILE              = 0x00000010,	OSCAR_CAPABILITY_SENDFILE             = 0x00000020,	OSCAR_CAPABILITY_GAMES                = 0x00000040,	OSCAR_CAPABILITY_ADDINS               = 0x00000080,	OSCAR_CAPABILITY_SENDBUDDYLIST        = 0x00000100,	OSCAR_CAPABILITY_GAMES2               = 0x00000200,	OSCAR_CAPABILITY_ICQ_DIRECT           = 0x00000400,	OSCAR_CAPABILITY_APINFO               = 0x00000800,	OSCAR_CAPABILITY_ICQRTF               = 0x00001000,	OSCAR_CAPABILITY_EMPTY                = 0x00002000,	OSCAR_CAPABILITY_ICQSERVERRELAY       = 0x00004000,	OSCAR_CAPABILITY_UNICODEOLD           = 0x00008000,	OSCAR_CAPABILITY_TRILLIANCRYPT        = 0x00010000,	OSCAR_CAPABILITY_UNICODE              = 0x00020000,	OSCAR_CAPABILITY_INTEROPERATE         = 0x00040000,	OSCAR_CAPABILITY_ICHAT                = 0x00080000,	OSCAR_CAPABILITY_HIPTOP               = 0x00100000,	OSCAR_CAPABILITY_SECUREIM             = 0x00200000,	OSCAR_CAPABILITY_SMS                  = 0x00400000,	OSCAR_CAPABILITY_GENERICUNKNOWN       = 0x00800000,	OSCAR_CAPABILITY_VIDEO                = 0x01000000,	OSCAR_CAPABILITY_ICHATAV              = 0x02000000,	OSCAR_CAPABILITY_LIVEVIDEO            = 0x04000000,	OSCAR_CAPABILITY_CAMERA               = 0x08000000,	OSCAR_CAPABILITY_LAST                 = 0x10000000} OscarCapability;/* * 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. * */struct _ByteStream{	guint8 *data;	guint32 len;	guint32 offset;};struct _QueuedSnac{	guint16 family;	guint16 subtype;	FlapFrame *frame;};struct _FlapFrame{	guint8 channel;	guint16 seqnum;	ByteStream data;        /* payload stream */};struct _FlapConnection{	OscarData *od;              /**< Pointer to parent session. */	gboolean connected;	time_t lastactivity;             /**< Time of last transmit. */	guint destroy_timeout;	OscarDisconnectReason disconnect_reason;	gchar *error_message;	/* A few variables that are only used when connecting */	PurpleProxyConnectData *connect_data;	guint16 cookielen;	guint8 *cookie;	gpointer new_conn_data;	int fd;	guint8 header[6];	ssize_t header_received;	FlapFrame buffer_incoming;	PurpleCircBuffer *buffer_outgoing;	guint watcher_incoming;	guint watcher_outgoing;	guint16 type;	guint16 subtype;	guint16 seqnum_out; /**< The sequence number of most recently sent packet. */	guint16 seqnum_in; /**< The sequence number of most recently received packet. */	GSList *groups;	GSList *rateclasses; /* Contains nodes of struct rateclass. */

⌨️ 快捷键说明

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