Mercurial > pidgin
annotate libfaim/faim/aim.h @ 692:f4026275bc9f
[gaim-migrate @ 702]
chat mods
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 16 Aug 2000 01:00:27 +0000 |
parents | 525c566741da |
children | 58106806ac2b |
rev | line source |
---|---|
283 | 1 /* |
2 * Main libfaim header. Must be included in client for prototypes/macros. | |
3 * | |
4 */ | |
5 | |
6 #ifndef __AIM_H__ | |
7 #define __AIM_H__ | |
8 | |
9 #define FAIM_VERSION_MAJOR 0 | |
10 #define FAIM_VERSION_MINOR 99 | |
11 #define FAIM_VERSION_MINORMINOR 0 | |
12 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
13 #include <faim/faimconfig.h> |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
14 #include <faim/aim_cbtypes.h> |
283 | 15 |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
16 #if !defined(FAIM_USEPTHREADS) && !defined(FAIM_USEFAKELOCKS) |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
17 #error pthreads or fakelocks are currently required. |
283 | 18 #endif |
19 | |
20 #include <stdio.h> | |
21 #include <string.h> | |
22 #include <fcntl.h> | |
23 #include <sys/types.h> | |
24 #include <stdlib.h> | |
25 #include <stdarg.h> | |
26 #include <errno.h> | |
27 | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
28 #ifdef _WIN32 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
29 #include <windows.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
30 #include <time.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
31 #include <io.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
32 #else |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
33 #include <netdb.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
34 #include <sys/socket.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
35 #include <netinet/in.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
36 #include <sys/time.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
37 #include <unistd.h> |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
38 #endif |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
39 |
283 | 40 #ifdef FAIM_USEPTHREADS |
41 #include <pthread.h> | |
42 #define faim_mutex_t pthread_mutex_t | |
43 #define faim_mutex_init pthread_mutex_init | |
44 #define faim_mutex_lock pthread_mutex_lock | |
45 #define faim_mutex_unlock pthread_mutex_unlock | |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
46 #define faim_mutex_destroy pthread_mutex_destroy |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
47 #elif defined(FAIM_USEFAKELOCKS) |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
48 /* |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
49 * For platforms without pthreads, we also assume |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
50 * we're not linking against a threaded app. Which |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
51 * means we don't have to do real locking. The |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
52 * macros below do nothing really. They're a joke. |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
53 * But they get it to compile. |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
54 */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
55 #define faim_mutex_t char |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
56 #define faim_mutex_init(x, y) *x = 0 |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
57 #define faim_mutex_lock(x) *x = 1; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
58 #define faim_mutex_unlock(x) *x = 0; |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
59 #define faim_mutex_destroy(x) *x = 0; |
283 | 60 #endif |
61 | |
62 /* Portability stuff (DMP) */ | |
63 | |
64 #ifdef _WIN32 | |
65 #define sleep Sleep | |
66 #define strlen(x) (int)strlen(x) /* win32 has a unsigned size_t */ | |
67 #endif | |
68 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
69 #if defined(mach) && defined(__APPLE__) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
70 #define gethostbyname(x) gethostbyname2(x, AF_INET) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
71 #endif |
283 | 72 |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
73 #if !defined(MSG_WAITALL) |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
74 #warning FIX YOUR LIBC! MSG_WAITALL is required! |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
75 #define MSG_WAITALL 0x100 |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
76 #endif |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
77 |
283 | 78 /* |
79 * Current Maximum Length for Screen Names (not including NULL) | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
80 * |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
81 * Currently only names up to 16 characters can be registered |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
82 * however it is aparently legal for them to be larger. |
283 | 83 */ |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
84 #define MAXSNLEN 32 |
283 | 85 |
86 /* | |
87 * Current Maximum Length for Instant Messages | |
88 * | |
89 * This was found basically by experiment, but not wholly | |
90 * accurate experiment. It should not be regarded | |
91 * as completely correct. But its a decent approximation. | |
92 * | |
93 * Note that although we can send this much, its impossible | |
94 * for WinAIM clients (up through the latest (4.0.1957)) to | |
95 * send any more than 1kb. Amaze all your windows friends | |
331
f3c8d79688db
[gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
96 * with utterly oversized instant messages! |
283 | 97 * |
98 */ | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
99 #define MAXMSGLEN 7987 |
283 | 100 |
101 /* | |
102 * Current Maximum Length for Chat Room Messages | |
103 * | |
104 * This is actually defined by the protocol to be | |
105 * dynamic, but I have yet to see due cause to | |
106 * define it dynamically here. Maybe later. | |
107 * | |
108 */ | |
109 #define MAXCHATMSGLEN 512 | |
110 | |
111 /* | |
112 * Standard size of an AIM authorization cookie | |
113 */ | |
114 #define AIM_COOKIELEN 0x100 | |
115 | |
116 #if debug > 0 | |
117 #define faimdprintf(l, x...) {if (l >= debug) printf(x); } | |
118 #else | |
119 #define faimdprintf(l, x...) | |
120 #endif | |
121 | |
122 /* | |
123 * Login info. Passes information from the Authorization | |
124 * stage of login to the service (BOS, etc) connection | |
125 * phase. | |
126 * | |
127 */ | |
128 struct aim_login_struct { | |
129 char screen_name[MAXSNLEN+1]; | |
130 char *BOSIP; | |
131 char cookie[AIM_COOKIELEN]; | |
132 char *email; | |
133 u_short regstatus; | |
134 char *errorurl; | |
135 u_short errorcode; | |
136 }; | |
137 | |
138 /* | |
139 * Client info. Filled in by the client and passed | |
140 * in to aim_login(). The information ends up | |
141 * getting passed to OSCAR through the initial | |
142 * login command. | |
143 * | |
144 * XXX: Should this be per-session? -mid | |
145 * | |
146 */ | |
147 struct client_info_s { | |
148 char clientstring[100]; /* arbitrary size */ | |
149 int major; | |
150 int minor; | |
151 int build; | |
152 char country[3]; | |
153 char lang[3]; | |
446
6d78b988b479
[gaim-migrate @ 456]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
154 int major2; |
6d78b988b479
[gaim-migrate @ 456]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
155 int minor2; |
6d78b988b479
[gaim-migrate @ 456]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
156 long unknown; |
283 | 157 }; |
158 | |
159 #ifndef TRUE | |
160 #define TRUE 1 | |
161 #define FALSE 0 | |
162 #endif | |
163 | |
164 /* | |
165 * These could be arbitrary, but its easier to use the actual AIM values | |
166 */ | |
167 #define AIM_CONN_TYPE_AUTH 0x0007 | |
168 #define AIM_CONN_TYPE_ADS 0x0005 | |
169 #define AIM_CONN_TYPE_BOS 0x0002 | |
170 #define AIM_CONN_TYPE_CHAT 0x000e | |
171 #define AIM_CONN_TYPE_CHATNAV 0x000d | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
172 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
173 /* they start getting arbitrary in rendezvous stuff =) */ |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
174 #define AIM_CONN_TYPE_RENDEZVOUS 0x0101 /* these do not speak OSCAR! */ |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
175 #define AIM_CONN_TYPE_RENDEZVOUS_OUT 0x0102 /* socket waiting for accept() */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
176 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
177 /* |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
178 * Subtypes, we need these for OFT stuff. |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
179 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
180 #define AIM_CONN_SUBTYPE_OFT_DIRECTIM 0x0001 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
181 #define AIM_CONN_SUBTYPE_OFT_GETFILE 0x0002 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
182 #define AIM_CONN_SUBTYPE_OFT_SENDFILE 0x0003 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
183 #define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
184 #define AIM_CONN_SUBTYPE_OFT_VOICE 0x0005 |
283 | 185 |
186 /* | |
187 * Status values returned from aim_conn_new(). ORed together. | |
188 */ | |
189 #define AIM_CONN_STATUS_READY 0x0001 | |
190 #define AIM_CONN_STATUS_INTERNALERR 0x0002 | |
191 #define AIM_CONN_STATUS_RESOLVERR 0x0080 | |
192 #define AIM_CONN_STATUS_CONNERR 0x0040 | |
193 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
194 #define AIM_FRAMETYPE_OSCAR 0x0000 |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
195 #define AIM_FRAMETYPE_OFT 0x0001 |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
196 |
283 | 197 struct aim_conn_t { |
198 int fd; | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
199 unsigned short type; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
200 unsigned short subtype; |
283 | 201 int seqnum; |
202 int status; | |
203 void *priv; /* misc data the client may want to store */ | |
204 time_t lastactivity; /* time of last transmit */ | |
205 int forcedlatency; | |
206 struct aim_rxcblist_t *handlerlist; | |
207 faim_mutex_t active; /* lock around read/writes */ | |
208 faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
209 struct aim_conn_t *next; |
283 | 210 }; |
211 | |
212 /* struct for incoming commands */ | |
213 struct command_rx_struct { | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
214 unsigned char hdrtype; /* defines which piece of the union to use */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
215 union { |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
216 struct { |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
217 char type; |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
218 unsigned short seqnum; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
219 } oscar; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
220 struct { |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
221 unsigned short type; |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
222 unsigned char magic[4]; /* ODC2 OFT2 */ |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
223 unsigned short hdr2len; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
224 unsigned char *hdr2; /* rest of bloated header */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
225 } oft; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
226 } hdr; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
227 unsigned short commandlen; /* total payload length */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
228 unsigned char *data; /* packet data (from 7 byte on) */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
229 unsigned char lock; /* 0 = open, !0 = locked */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
230 unsigned char handled; /* 0 = new, !0 = been handled */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
231 unsigned char nofree; /* 0 = free data on purge, 1 = only unlink */ |
283 | 232 struct aim_conn_t *conn; /* the connection it came in on... */ |
233 struct command_rx_struct *next; /* ptr to next struct in list */ | |
234 }; | |
235 | |
236 /* struct for outgoing commands */ | |
237 struct command_tx_struct { | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
238 unsigned char hdrtype; /* defines which piece of the union to use */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
239 union { |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
240 struct { |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
241 unsigned char type; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
242 unsigned short seqnum; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
243 } oscar; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
244 struct { |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
245 unsigned short type; |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
246 unsigned char magic[4]; /* ODC2 OFT2 */ |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
247 unsigned short hdr2len; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
248 unsigned char *hdr2; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
249 } oft; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
250 } hdr; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
251 u_int commandlen; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
252 u_char *data; |
283 | 253 u_int lock; /* 0 = open, !0 = locked */ |
254 u_int sent; /* 0 = pending, !0 = has been sent */ | |
255 struct aim_conn_t *conn; | |
256 struct command_tx_struct *next; /* ptr to next struct in list */ | |
257 }; | |
258 | |
259 | |
260 /* | |
261 * AIM Session: The main client-data interface. | |
262 * | |
263 */ | |
264 struct aim_session_t { | |
265 | |
266 /* ---- Client Accessible ------------------------ */ | |
267 /* | |
268 * Login information. See definition above. | |
269 * | |
270 */ | |
271 struct aim_login_struct logininfo; | |
272 | |
273 /* | |
274 * Pointer to anything the client wants to | |
275 * explicitly associate with this session. | |
276 */ | |
277 void *aux_data; | |
278 | |
279 | |
280 /* ---- Internal Use Only ------------------------ */ | |
281 /* | |
282 * Connection information | |
283 */ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
284 struct aim_conn_t *connlist; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
285 faim_mutex_t connlistlock; |
283 | 286 |
287 /* | |
288 * TX/RX queues | |
289 */ | |
290 struct command_tx_struct *queue_outgoing; | |
291 struct command_rx_struct *queue_incoming; | |
292 | |
293 /* | |
294 * Tx Enqueuing function | |
295 */ | |
296 int (*tx_enqueue)(struct aim_session_t *, struct command_tx_struct *); | |
297 | |
298 /* | |
299 * This is a dreadful solution to the what-room-are-we-joining | |
300 * problem. (There's no connection between the service | |
301 * request and the resulting redirect.) | |
302 */ | |
303 char *pendingjoin; | |
304 | |
305 /* | |
306 * Outstanding snac handling | |
307 * | |
308 * XXX: Should these be per-connection? -mid | |
309 **/ | |
310 struct aim_snac_t *outstanding_snacs; | |
311 u_long snac_nextid; | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
312 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
313 struct aim_msgcookie_t *msgcookies; |
283 | 314 }; |
315 | |
316 | |
317 /* | |
318 * AIM User Info, Standard Form. | |
319 */ | |
320 struct aim_userinfo_s { | |
321 char sn[MAXSNLEN+1]; | |
322 u_short warnlevel; | |
323 u_short idletime; | |
324 u_short class; | |
325 u_long membersince; | |
326 u_long onlinesince; | |
327 u_long sessionlen; | |
328 u_short capabilities; | |
329 }; | |
330 | |
331 #define AIM_CLASS_TRIAL 0x0001 | |
332 #define AIM_CLASS_UNKNOWN2 0x0002 | |
333 #define AIM_CLASS_AOL 0x0004 | |
334 #define AIM_CLASS_UNKNOWN4 0x0008 | |
335 #define AIM_CLASS_FREE 0x0010 | |
336 #define AIM_CLASS_AWAY 0x0020 | |
337 #define AIM_CLASS_UNKNOWN40 0x0040 | |
338 #define AIM_CLASS_UNKNOWN80 0x0080 | |
339 | |
340 /* | |
341 * TLV handling | |
342 */ | |
343 | |
344 /* Generic TLV structure. */ | |
345 struct aim_tlv_t { | |
346 u_short type; | |
347 u_short length; | |
348 u_char *value; | |
349 }; | |
350 | |
351 /* List of above. */ | |
352 struct aim_tlvlist_t { | |
353 struct aim_tlv_t *tlv; | |
354 struct aim_tlvlist_t *next; | |
355 }; | |
356 | |
357 /* TLV-handling functions */ | |
358 struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen); | |
359 void aim_freetlvchain(struct aim_tlvlist_t **list); | |
360 struct aim_tlv_t *aim_grabtlv(u_char *src); | |
361 struct aim_tlv_t *aim_grabtlvstr(u_char *src); | |
362 struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int); | |
363 char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int); | |
364 int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv); | |
365 struct aim_tlv_t *aim_createtlv(void); | |
366 int aim_freetlv(struct aim_tlv_t **oldtlv); | |
367 int aim_puttlv_16(u_char *, u_short, u_short); | |
368 int aim_puttlv_32(u_char *, u_short, u_long); | |
369 int aim_puttlv_str(u_char *buf, u_short t, u_short l, u_char *v); | |
370 int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list); | |
371 int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val); | |
372 int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val); | |
373 int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len); | |
374 int aim_counttlvchain(struct aim_tlvlist_t **list); | |
375 | |
376 /* | |
377 * Get command from connections / Dispatch commands | |
378 * already in queue. | |
379 */ | |
380 int aim_get_command(struct aim_session_t *, struct aim_conn_t *); | |
381 int aim_rxdispatch(struct aim_session_t *); | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
382 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
383 u_long aim_debugconn_sendconnect(struct aim_session_t *sess, struct aim_conn_t *conn); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
384 |
283 | 385 int aim_logoff(struct aim_session_t *); |
386 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
387 void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn); |
283 | 388 |
389 typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...); | |
390 int aim_register_callbacks(rxcallback_t *); | |
391 | |
392 u_long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype); | |
393 u_long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *); | |
394 u_long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *); | |
395 | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
396 struct aim_fileheader_t *aim_oft_getfh(char *hdr); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
397 |
283 | 398 /* aim_login.c */ |
399 int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn); | |
400 int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); | |
401 int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *); | |
402 int aim_encode_password(const char *, u_char *); | |
331
f3c8d79688db
[gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
403 int aimicq_encode_password(const char *password, u_char *encoded); |
283 | 404 unsigned long aim_sendauthresp(struct aim_session_t *sess, |
405 struct aim_conn_t *conn, | |
406 char *sn, char *bosip, | |
407 char *cookie, char *email, | |
408 int regstatus); | |
409 int aim_gencookie(unsigned char *buf); | |
410 int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
411 unsigned long aim_sendredirect(struct aim_session_t *sess, | |
412 struct aim_conn_t *conn, | |
413 unsigned short servid, | |
414 char *ip, | |
415 char *cookie); | |
416 void aim_purge_rxqueue(struct aim_session_t *); | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
417 void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn); |
283 | 418 |
419 int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *command, ...); | |
420 int aim_parse_missed_im(struct aim_session_t *, struct command_rx_struct *, ...); | |
421 int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
422 int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn); |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
423 |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
424 struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen); |
283 | 425 int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *); |
426 int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *); | |
427 #define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y)) | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
428 int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur); |
283 | 429 u_int aim_get_next_txseqnum(struct aim_conn_t *); |
430 int aim_tx_flushqueue(struct aim_session_t *); | |
431 int aim_tx_printqueue(struct aim_session_t *); | |
432 void aim_tx_purgequeue(struct aim_session_t *); | |
433 | |
434 struct aim_rxcblist_t { | |
435 u_short family; | |
436 u_short type; | |
437 rxcallback_t handler; | |
438 u_short flags; | |
439 struct aim_rxcblist_t *next; | |
440 }; | |
441 | |
442 int aim_conn_setlatency(struct aim_conn_t *conn, int newval); | |
443 | |
444 int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, rxcallback_t newhandler, u_short flags); | |
445 rxcallback_t aim_callhandler(struct aim_conn_t *conn, u_short family, u_short type); | |
446 int aim_clearhandlers(struct aim_conn_t *conn); | |
447 | |
448 /* | |
449 * Generic SNAC structure. Rarely if ever used. | |
450 */ | |
451 struct aim_snac_t { | |
452 u_long id; | |
453 u_short family; | |
454 u_short type; | |
455 u_short flags; | |
456 void *data; | |
457 time_t issuetime; | |
458 struct aim_snac_t *next; | |
459 }; | |
460 u_long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac); | |
461 struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id); | |
462 int aim_cleansnacs(struct aim_session_t *, int maxage); | |
463 int aim_putsnac(u_char *, int, int, int, u_long); | |
464 | |
465 | |
466 void aim_connrst(struct aim_session_t *); | |
467 struct aim_conn_t *aim_conn_getnext(struct aim_session_t *); | |
468 void aim_conn_close(struct aim_conn_t *deadconn); | |
469 struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type); | |
470 struct aim_conn_t *aim_newconn(struct aim_session_t *, int type, char *dest); | |
471 int aim_conngetmaxfd(struct aim_session_t *); | |
472 struct aim_conn_t *aim_select(struct aim_session_t *, struct timeval *, int *); | |
473 int aim_conn_isready(struct aim_conn_t *); | |
474 int aim_conn_setstatus(struct aim_conn_t *, int); | |
475 void aim_session_init(struct aim_session_t *); | |
476 | |
477 /* aim_misc.c */ | |
478 | |
479 #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 | |
480 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 | |
481 #define AIM_VISIBILITYCHANGE_DENYADD 0x07 | |
482 #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 | |
483 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
484 u_long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *); |
283 | 485 u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long); |
486 u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *); | |
487 u_long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *); | |
488 u_long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned int); | |
489 u_long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long); | |
490 u_long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *); | |
491 u_long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *); | |
492 u_long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *); | |
493 u_long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long); | |
494 u_long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *); | |
495 u_long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short); | |
496 u_long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *); | |
497 u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *); | |
498 u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *); | |
499 u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *); | |
500 u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn); | |
501 | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
502 struct aim_fileheader_t *aim_getlisting(struct aim_session_t*); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
503 int aim_listenestablish(u_short); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
504 |
283 | 505 /* aim_rxhandlers.c */ |
506 int aim_rxdispatch(struct aim_session_t *); | |
507 int aim_authparse(struct aim_session_t *, struct command_rx_struct *); | |
508 int aim_handleredirect_middle(struct aim_session_t *, struct command_rx_struct *, ...); | |
509 int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...); | |
510 int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); | |
511 int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...); | |
512 int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...); | |
513 | |
514 /* aim_im.c */ | |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
515 struct aim_directim_priv { |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
516 unsigned char cookie[8]; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
517 char sn[MAXSNLEN+1]; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
518 char ip[30]; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
519 }; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
520 |
283 | 521 #define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */ |
522 #define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */ | |
523 | |
524 u_long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *); | |
525 int aim_parse_incoming_im_middle(struct aim_session_t *, struct command_rx_struct *); | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
526 int aim_parse_outgoing_im_middle(struct aim_session_t *, struct command_rx_struct *); |
283 | 527 u_long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn); |
528 int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *); | |
331
f3c8d79688db
[gaim-migrate @ 341]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
529 int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command); |
283 | 530 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
531 struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *); |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
532 int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
533 struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
534 |
283 | 535 /* aim_info.c */ |
536 #define AIM_CAPS_BUDDYICON 0x01 | |
537 #define AIM_CAPS_VOICE 0x02 | |
538 #define AIM_CAPS_IMIMAGE 0x04 | |
539 #define AIM_CAPS_CHAT 0x08 | |
540 #define AIM_CAPS_GETFILE 0x10 | |
541 #define AIM_CAPS_SENDFILE 0x20 | |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
542 |
283 | 543 extern u_char aim_caps[6][16]; |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
544 u_short aim_getcap(unsigned char *capblock, int buflen); |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
341
diff
changeset
|
545 int aim_putcap(unsigned char *capblock, int buflen, u_short caps); |
283 | 546 |
547 #define AIM_GETINFO_GENERALINFO 0x00001 | |
548 #define AIM_GETINFO_AWAYMESSAGE 0x00003 | |
549 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
550 struct aim_msgcookie_t { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
551 unsigned char cookie[8]; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
552 int type; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
553 void *data; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
554 time_t addtime; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
555 struct aim_msgcookie_t *next; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
556 }; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
557 |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
558 struct aim_fileheader_t { |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
559 #if 0 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
560 char magic[4]; /* 0 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
561 short hdrlen; /* 4 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
562 short hdrtype; /* 6 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
563 #endif |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
564 char bcookie[8]; /* 8 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
565 short encrypt; /* 16 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
566 short compress; /* 18 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
567 short totfiles; /* 20 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
568 short filesleft; /* 22 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
569 short totparts; /* 24 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
570 short partsleft; /* 26 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
571 long totsize; /* 28 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
572 long size; /* 32 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
573 long modtime; /* 36 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
574 long checksum; /* 40 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
575 long rfrcsum; /* 44 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
576 long rfsize; /* 48 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
577 long cretime; /* 52 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
578 long rfcsum; /* 56 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
579 long nrecvd; /* 60 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
580 long recvcsum; /* 64 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
581 char idstring[32]; /* 68 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
582 char flags; /* 100 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
583 char lnameoffset; /* 101 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
584 char lsizeoffset; /* 102 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
585 char dummy[69]; /* 103 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
586 char macfileinfo[16]; /* 172 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
587 short nencode; /* 188 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
588 short nlanguage; /* 190 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
589 char name[64]; /* 192 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
590 /* 256 */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
591 }; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
592 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
593 struct aim_filetransfer_priv { |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
594 char sn[MAXSNLEN]; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
595 char cookie[8]; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
596 char ip[30]; |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
597 int state; |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
598 struct aim_fileheader_t fh; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
599 }; |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
600 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
601 #define AIM_COOKIETYPE_UNKNOWN 0x00 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
602 #define AIM_COOKIETYPE_ICBM 0x01 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
603 #define AIM_COOKIETYPE_ADS 0x02 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
604 #define AIM_COOKIETYPE_BOS 0x03 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
605 #define AIM_COOKIETYPE_IM 0x04 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
606 #define AIM_COOKIETYPE_CHAT 0x05 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
607 #define AIM_COOKIETYPE_CHATNAV 0x06 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
608 /* we'll move OFT up a bit to give breathing room. not like it really |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
609 * matters. */ |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
610 #define AIM_COOKIETYPE_OFTIM 0x10 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
611 #define AIM_COOKIETYPE_OFTGET 0x11 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
612 #define AIM_COOKIETYPE_OFTSEND 0x12 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
613 #define AIM_COOKIETYPE_OFTVOICE 0x13 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
614 #define AIM_COOKIETYPE_OFTIMAGE 0x14 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
615 #define AIM_COOKIETYPE_OFTICON 0x15 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
616 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
617 int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie); |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
618 int aim_purgecookies(struct aim_session_t *sess, int maxage); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
619 struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, char *cookie, int type); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
620 struct aim_msgcookie_t *aim_mkcookie(unsigned char *, int, void *); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
621 struct aim_msgcookie_t *aim_checkcookie(struct aim_session_t *, char *, int); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
622 int aim_getcookietype(int); |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
623 |
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
624 int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
625 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
626 #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
627 #define AIM_TRANSFER_DENY_DECLINE 0x0001 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
628 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
629 u_long aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short code); |
503
6e318907bcce
[gaim-migrate @ 513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
446
diff
changeset
|
630 u_long aim_accepttransfer(struct aim_session_t *sess, struct aim_conn_t *conn,struct aim_conn_t *oftconn, char *sender, char *cookie, unsigned short rendid); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
331
diff
changeset
|
631 |
283 | 632 u_long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short); |
633 int aim_extractuserinfo(u_char *, struct aim_userinfo_s *); | |
634 int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *); | |
635 int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *); | |
636 int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *); | |
637 int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info); | |
638 int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info); | |
639 int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); | |
640 | |
641 | |
642 /* aim_auth.c */ | |
643 int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *); | |
644 u_long aim_auth_clientready(struct aim_session_t *, struct aim_conn_t *); | |
645 u_long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char *, char *); | |
646 | |
647 /* aim_buddylist.c */ | |
648 u_long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *); | |
649 u_long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *); | |
650 | |
651 /* aim_search.c */ | |
652 u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *); | |
653 /* u_long aim_usersearch_name(struct aim_session_t *, struct aim_conn_t *, char *); */ | |
654 | |
655 | |
656 struct aim_chat_roominfo { | |
657 u_short exchange; | |
658 char *name; | |
659 u_short instance; | |
660 }; | |
661 int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo); | |
662 int aim_chat_parse_infoupdate(struct aim_session_t *sess, struct command_rx_struct *command); | |
663 int aim_chat_parse_joined(struct aim_session_t *sess, struct command_rx_struct *command); | |
664 int aim_chat_parse_leave(struct aim_session_t *sess, struct command_rx_struct *command); | |
665 int aim_chat_parse_incoming(struct aim_session_t *sess, struct command_rx_struct *command); | |
666 u_long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg); | |
667 u_long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname); | |
668 u_long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
669 int aim_chat_attachname(struct aim_conn_t *conn, char *roomname); | |
670 char *aim_chat_getname(struct aim_conn_t *conn); | |
671 struct aim_conn_t *aim_chat_getconn(struct aim_session_t *, char *name); | |
672 | |
673 u_long aim_chatnav_reqrights(struct aim_session_t *sess, struct aim_conn_t *conn); | |
674 u_long aim_chatnav_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); | |
675 | |
676 u_long aim_chat_invite(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *msg, u_short exchange, char *roomname, u_short instance); | |
677 | |
678 struct aim_chat_exchangeinfo { | |
679 u_short number; | |
680 char *name; | |
681 char *charset1; | |
682 char *lang1; | |
683 char *charset2; | |
684 char *lang2; | |
685 }; | |
686 int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command); | |
687 u_long aim_chatnav_createroom(struct aim_session_t *sess, struct aim_conn_t *conn, char *name, u_short exchange); | |
688 int aim_chat_leaveroom(struct aim_session_t *sess, char *name); | |
689 | |
690 /* aim_util.c */ | |
691 #ifdef AIMUTIL_USEMACROS | |
692 /* | |
693 * These are really ugly. You'd think this was LISP. I wish it was. | |
694 */ | |
695 #define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1) | |
696 #define aimutil_get8(buf) ((*(buf))&0xff) | |
697 #define aimutil_put16(buf, data) ( \ | |
698 (*(buf) = (u_char)((data)>>8)&0xff), \ | |
699 (*((buf)+1) = (u_char)(data)&0xff), \ | |
700 2) | |
701 #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) | |
702 #define aimutil_put32(buf, data) ( \ | |
703 (*((buf)) = (u_char)((data)>>24)&0xff), \ | |
704 (*((buf)+1) = (u_char)((data)>>16)&0xff), \ | |
705 (*((buf)+2) = (u_char)((data)>>8)&0xff), \ | |
706 (*((buf)+3) = (u_char)(data)&0xff), \ | |
707 4) | |
708 #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ | |
709 (((*((buf)+1))<<16)&0x00ff0000) + \ | |
710 (((*((buf)+2))<< 8)&0x0000ff00) + \ | |
711 (((*((buf)+3) )&0x000000ff))) | |
712 #else | |
713 #warning Not using aimutil macros. May have performance problems. | |
714 int aimutil_put8(u_char *, u_char); | |
715 u_char aimutil_get8(u_char *buf); | |
716 int aimutil_put16(u_char *, u_short); | |
717 u_short aimutil_get16(u_char *); | |
718 int aimutil_put32(u_char *, u_long); | |
719 u_long aimutil_get32(u_char *); | |
720 #endif | |
721 | |
722 int aimutil_putstr(u_char *, const u_char *, int); | |
723 int aimutil_tokslen(char *toSearch, int index, char dl); | |
724 int aimutil_itemcnt(char *toSearch, char dl); | |
725 char *aimutil_itemidx(char *toSearch, int index, char dl); | |
726 | |
727 int aim_snlen(const char *sn); | |
728 int aim_sncmp(const char *sn1, const char *sn2); | |
729 | |
730 /* aim_meta.c */ | |
731 char *aim_getbuilddate(void); | |
732 char *aim_getbuildtime(void); | |
733 char *aim_getbuildstring(void); | |
734 | |
735 #endif /* __AIM_H__ */ | |
736 |