Frameworks/libpurple.framework/Versions/0.6.0/Headers/peer.h
changeset 2592 e8d15275025e
parent 2591 f66a716bfc79
child 2593 b4bd28402abc
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.6.0/Headers/peer.h	Fri Aug 21 13:24:36 2009 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,281 +0,0 @@
     1.4 -/*
     1.5 - * Purple's oscar protocol plugin
     1.6 - * This file is the legal property of its developers.
     1.7 - * Please see the AUTHORS file distributed alongside this file.
     1.8 - *
     1.9 - * This library is free software; you can redistribute it and/or
    1.10 - * modify it under the terms of the GNU Lesser General Public
    1.11 - * License as published by the Free Software Foundation; either
    1.12 - * version 2 of the License, or (at your option) any later version.
    1.13 - *
    1.14 - * This library is distributed in the hope that it will be useful,
    1.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 - * Lesser General Public License for more details.
    1.18 - *
    1.19 - * You should have received a copy of the GNU Lesser General Public
    1.20 - * License along with this library; if not, write to the Free Software
    1.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    1.22 -*/
    1.23 -
    1.24 -/*
    1.25 - * OFT and ODC Services
    1.26 - */
    1.27 -
    1.28 -#ifndef _PEER_H_
    1.29 -#define _PEER_H_
    1.30 -
    1.31 -#include "ft.h"
    1.32 -#include "network.h"
    1.33 -#include "proxy.h"
    1.34 -
    1.35 -typedef struct _ChecksumData          ChecksumData;
    1.36 -typedef struct _OdcFrame              OdcFrame;
    1.37 -typedef struct _OftFrame              OftFrame;
    1.38 -typedef struct _ProxyFrame            ProxyFrame;
    1.39 -typedef struct _PeerConnection        PeerConnection;
    1.40 -
    1.41 -#define PEER_CONNECTION_FLAG_INITIATED_BY_ME  0x0001
    1.42 -#define PEER_CONNECTION_FLAG_APPROVED         0x0002
    1.43 -#define PEER_CONNECTION_FLAG_TRIED_DIRECT     0x0004
    1.44 -#define PEER_CONNECTION_FLAG_TRIED_INCOMING   0x0008
    1.45 -#define PEER_CONNECTION_FLAG_TRIED_PROXY      0x0010
    1.46 -#define PEER_CONNECTION_FLAG_IS_INCOMING      0x0020
    1.47 -
    1.48 -#define PEER_TYPE_PROMPT 0x0101 /* "I am going to send you this file, is that ok?" */
    1.49 -#define PEER_TYPE_RESUMEACCEPT 0x0106 /* We are accepting the resume */
    1.50 -#define PEER_TYPE_ACK 0x0202 /* "Yes, it is ok for you to send me that file" */
    1.51 -#define PEER_TYPE_DONE 0x0204 /* "I received that file with no problems, thanks a bunch" */
    1.52 -#define PEER_TYPE_RESUME 0x0205 /* Resume transferring, sent by whoever receives */
    1.53 -#define PEER_TYPE_RESUMEACK 0x0207 /* Our resume accept was ACKed */
    1.54 -
    1.55 -#define PEER_TYPE_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */
    1.56 -#define PEER_TYPE_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */
    1.57 -#define PEER_TYPE_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? I'm just guessing about this one... */
    1.58 -#define PEER_TYPE_GETFILE_ACKLISTING 0x120b /* "I received the listing.txt file successfully" */
    1.59 -#define PEER_TYPE_GETFILE_REQUESTFILE 0x120c /* "Please send me this file" */
    1.60 -
    1.61 -/*
    1.62 - * For peer proxying
    1.63 - */
    1.64 -#define PEER_PROXY_SERVER         "ars.oscar.aol.com"
    1.65 -#define PEER_PROXY_PORT           5190   /* The port we should always connect to */
    1.66 -#define PEER_PROXY_PACKET_VERSION 0x044a
    1.67 -
    1.68 -/* Thanks to Keith Lea and the Joust project for documenting these */
    1.69 -#define PEER_PROXY_TYPE_ERROR   0x0001
    1.70 -#define PEER_PROXY_TYPE_CREATE  0x0002
    1.71 -#define PEER_PROXY_TYPE_CREATED 0x0003
    1.72 -#define PEER_PROXY_TYPE_JOIN    0x0004
    1.73 -#define PEER_PROXY_TYPE_READY   0x0005
    1.74 -
    1.75 -struct _OdcFrame
    1.76 -{
    1.77 -	/* guchar magic[4]; */        /* 0 */
    1.78 -	/* guint16 length; */         /* 4 */
    1.79 -	guint16 type;                 /* 6 */
    1.80 -	guint16 subtype;              /* 8 */
    1.81 -	/* Unknown */                 /* 10 */
    1.82 -	guchar cookie[8];		      /* 12 */
    1.83 -	/* Unknown */
    1.84 -	/* guint32 payloadlength; */  /* 28 */
    1.85 -	guint16 encoding;             /* 32 */
    1.86 -	/* Unknown */
    1.87 -	guint16 flags;                /* 38 */
    1.88 -	/* Unknown */
    1.89 -	guchar bn[32];                /* 44 */
    1.90 -	/* Unknown */
    1.91 -	ByteStream payload;           /* 76 */
    1.92 -};
    1.93 -
    1.94 -struct _OftFrame
    1.95 -{
    1.96 -	/* guchar magic[4]; */   /* 0 */
    1.97 -	/* guint16 length; */    /* 4 */
    1.98 -	guint16 type;            /* 6 */
    1.99 -	guchar cookie[8];        /* 8 */
   1.100 -	guint16 encrypt;         /* 16 */
   1.101 -	guint16 compress;        /* 18 */
   1.102 -	guint16 totfiles;        /* 20 */
   1.103 -	guint16 filesleft;       /* 22 */
   1.104 -	guint16 totparts;        /* 24 */
   1.105 -	guint16 partsleft;       /* 26 */
   1.106 -	guint32 totsize;         /* 28 */
   1.107 -	guint32 size;            /* 32 */
   1.108 -	guint32 modtime;         /* 36 */
   1.109 -	guint32 checksum;        /* 40 */
   1.110 -	guint32 rfrcsum;         /* 44 */
   1.111 -	guint32 rfsize;          /* 48 */
   1.112 -	guint32 cretime;         /* 52 */
   1.113 -	guint32 rfcsum;          /* 56 */
   1.114 -	guint32 nrecvd;          /* 60 */
   1.115 -	guint32 recvcsum;        /* 64 */
   1.116 -	guchar idstring[32];     /* 68 */
   1.117 -	guint8 flags;            /* 100 */
   1.118 -	guint8 lnameoffset;      /* 101 */
   1.119 -	guint8 lsizeoffset;      /* 102 */
   1.120 -	guchar dummy[69];        /* 103 */
   1.121 -	guchar macfileinfo[16];  /* 172 */
   1.122 -	guint16 nencode;         /* 188 */
   1.123 -	guint16 nlanguage;       /* 190 */
   1.124 -	guchar *name;            /* 192 */
   1.125 -	size_t name_length;
   1.126 -	/* Payload? */           /* 256 */
   1.127 -};
   1.128 -
   1.129 -struct _ProxyFrame
   1.130 -{
   1.131 -	/* guint16 length; */    /* 0 */
   1.132 -	guint16 version;         /* 2 */
   1.133 -	guint16 type;            /* 4 */
   1.134 -	guint32 unknown;         /* 6 */
   1.135 -	guint16 flags;           /* 10 */
   1.136 -	ByteStream payload;      /* 12 */
   1.137 -};
   1.138 -
   1.139 -struct _PeerConnection
   1.140 -{
   1.141 -	OscarData *od;
   1.142 -	OscarCapability type;
   1.143 -	char *bn;
   1.144 -	guchar magic[4];
   1.145 -	guchar cookie[8];
   1.146 -	guint16 lastrequestnumber;
   1.147 -
   1.148 -	gboolean ready;
   1.149 -	int flags;                       /**< Bitmask of PEER_CONNECTION_FLAG_ */
   1.150 -	time_t lastactivity;             /**< Time of last transmit. */
   1.151 -	guint destroy_timeout;
   1.152 -	OscarDisconnectReason disconnect_reason;
   1.153 -	char *error_message;
   1.154 -
   1.155 -	/**
   1.156 -	 * A pointer to either an OdcFrame or an OftFrame.
   1.157 -	 */
   1.158 -	gpointer frame;
   1.159 -
   1.160 -	/**
   1.161 -	 * This is only used when the peer connection is being established.
   1.162 -	 */
   1.163 -	PurpleProxyConnectData *client_connect_data;
   1.164 -	PurpleProxyConnectData *verified_connect_data;
   1.165 -
   1.166 -	/**
   1.167 -	 * This is only used when the peer connection is being established.
   1.168 -	 */
   1.169 -	PurpleNetworkListenData *listen_data;
   1.170 -
   1.171 -
   1.172 -	/**
   1.173 -	 * This is only used when the peer connection is being established.
   1.174 -	 */
   1.175 -	guint connect_timeout_timer;
   1.176 -
   1.177 -	/**
   1.178 -	 * This is only used while the remote user is attempting to
   1.179 -	 * connect to us.
   1.180 -	 */
   1.181 -	int listenerfd;
   1.182 -
   1.183 -	int fd;
   1.184 -	guint8 header[6];
   1.185 -	gssize header_received;
   1.186 -	guint8 proxy_header[12];
   1.187 -	gssize proxy_header_received;
   1.188 -	ByteStream buffer_incoming;
   1.189 -	PurpleCircBuffer *buffer_outgoing;
   1.190 -	guint watcher_incoming;
   1.191 -	guint watcher_outgoing;
   1.192 -
   1.193 -	/**
   1.194 -	 * IP address of the proxy server, if applicable.
   1.195 -	 */
   1.196 -	gchar *proxyip;
   1.197 -
   1.198 -	/**
   1.199 -	 * IP address of the remote user from THEIR point of view.
   1.200 -	 */
   1.201 -	gchar *clientip;
   1.202 -
   1.203 -	/**
   1.204 -	 * IP address of the remote user from the oscar server's
   1.205 -	 * point of view.
   1.206 -	 */
   1.207 -	gchar *verifiedip;
   1.208 -
   1.209 -	guint16 port;
   1.210 -	gboolean use_proxy;
   1.211 -
   1.212 -	/**
   1.213 -	 * Checksumming
   1.214 -	 */
   1.215 -	ChecksumData *checksum_data;
   1.216 -
   1.217 -	/* TODOFT */
   1.218 -	PurpleXfer *xfer;
   1.219 -	OftFrame xferdata;
   1.220 -	guint sending_data_timer;
   1.221 -};
   1.222 -
   1.223 -/*
   1.224 - * For all peer connections
   1.225 - */
   1.226 -
   1.227 -/**
   1.228 - * Create a new PeerConnection structure and initialize it with some
   1.229 - * sane defaults.
   1.230 - *
   1.231 - * @param type The type of the peer connection.  One of
   1.232 - *        OSCAR_CAPABILITY_DIRECTIM or OSCAR_CAPABILITY_SENDFILE.
   1.233 - */
   1.234 -PeerConnection *peer_connection_new(OscarData *od, OscarCapability type, const char *bn);
   1.235 -
   1.236 -void peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
   1.237 -void peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
   1.238 -PeerConnection *peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type);
   1.239 -PeerConnection *peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie);
   1.240 -
   1.241 -void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond);
   1.242 -void peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond);
   1.243 -void peer_connection_send(PeerConnection *conn, ByteStream *bs);
   1.244 -
   1.245 -void peer_connection_trynext(PeerConnection *conn);
   1.246 -void peer_connection_finalize_connection(PeerConnection *conn);
   1.247 -void peer_connection_propose(OscarData *od, OscarCapability type, const char *bn);
   1.248 -void peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args);
   1.249 -
   1.250 -/*
   1.251 - * For ODC
   1.252 - */
   1.253 -void peer_odc_close(PeerConnection *conn);
   1.254 -void peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs);
   1.255 -void peer_odc_send_cookie(PeerConnection *conn);
   1.256 -void peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing);
   1.257 -void peer_odc_send_im(PeerConnection *conn, const char *msg, int len, int encoding, gboolean autoreply);
   1.258 -
   1.259 -/*
   1.260 - * For OFT
   1.261 - */
   1.262 -void peer_oft_close(PeerConnection *conn);
   1.263 -void peer_oft_recv_frame(PeerConnection *conn, ByteStream *bs);
   1.264 -void peer_oft_send_prompt(PeerConnection *conn);
   1.265 -void peer_oft_checksum_destroy(ChecksumData *checksum_data);
   1.266 -
   1.267 -/* Xfer callbacks for receiving a file */
   1.268 -void peer_oft_recvcb_init(PurpleXfer *xfer);
   1.269 -void peer_oft_recvcb_end(PurpleXfer *xfer);
   1.270 -void peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size);
   1.271 -
   1.272 -/* Xfer callbacks for sending a file */
   1.273 -void peer_oft_sendcb_init(PurpleXfer *xfer);
   1.274 -void peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size);
   1.275 -
   1.276 -/* Xfer callbacks for both sending and receiving */
   1.277 -void peer_oft_cb_generic_cancel(PurpleXfer *xfer);
   1.278 -
   1.279 -/*
   1.280 - * For peer proxying
   1.281 - */
   1.282 -void peer_proxy_connection_established_cb(gpointer data, gint source, const gchar *error_message);
   1.283 -
   1.284 -#endif /* _PEER_H_ */