]> andersk Git - libfaim.git/blame - faim/aim.h
Forgot this.
[libfaim.git] / faim / aim.h
CommitLineData
bd71fa88 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
0cc57340 9#define FAIM_VERSION_MAJOR 0
10#define FAIM_VERSION_MINOR 99
11#define FAIM_VERSION_MINORMINOR 0
12
bd71fa88 13#include <faim/faimconfig.h>
14#include <faim/aim_cbtypes.h>
15
e88ba395 16#ifndef FAIM_USEPTHREADS
17#error pthreads are currently required.
18#endif
19
bd71fa88 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
e88ba395 28#ifdef FAIM_USEPTHREADS
29#include <pthread.h>
30#define faim_mutex_t pthread_mutex_t
31#define faim_mutex_init pthread_mutex_init
32#define faim_mutex_lock pthread_mutex_lock
33#define faim_mutex_unlock pthread_mutex_unlock
34#endif
35
bd71fa88 36#ifdef _WIN32
37#include <windows.h>
38#include <time.h>
39#include <io.h>
40#else
41#include <netdb.h>
42#include <sys/socket.h>
43#include <netinet/in.h>
44#include <sys/time.h>
45#include <unistd.h>
46#endif
47
48/* Portability stuff (DMP) */
49
50#ifdef _WIN32
51#define sleep Sleep
52#define strlen(x) (int)strlen(x) /* win32 has a unsigned size_t */
53#endif
54
040457cc 55#if defined(mach) && defined(__APPLE__)
56#define gethostbyname(x) gethostbyname2(x, AF_INET)
57#endif
bd71fa88 58
59/*
60 * Current Maximum Length for Screen Names (not including NULL)
61 */
62#define MAXSNLEN 16
63
91931247 64/*
65 * Current Maximum Length for Instant Messages
66 *
67 * This was found basically by experiment, but not wholly
68 * accurate experiment. It should not be regarded
69 * as completely correct. But its a decent approximation.
70 *
71 * Note that although we can send this much, its impossible
72 * for WinAIM clients (up through the latest (4.0.1957)) to
73 * send any more than 1kb. Amaze all your windows friends
5e02cf44 74 * with utterly oversized instant messages!
91931247 75 *
76 */
b69540e3 77#define MAXMSGLEN 7987
91931247 78
79/*
80 * Current Maximum Length for Chat Room Messages
81 *
82 * This is actually defined by the protocol to be
83 * dynamic, but I have yet to see due cause to
84 * define it dynamically here. Maybe later.
85 *
86 */
87#define MAXCHATMSGLEN 512
88
bd71fa88 89/*
90 * Standard size of an AIM authorization cookie
91 */
92#define AIM_COOKIELEN 0x100
93
b8d0da45 94#if debug > 0
95#define faimdprintf(l, x...) {if (l >= debug) printf(x); }
96#else
97#define faimdprintf(l, x...)
98#endif
99
bd71fa88 100/*
101 * Login info. Passes information from the Authorization
102 * stage of login to the service (BOS, etc) connection
103 * phase.
104 *
105 */
106struct aim_login_struct {
107 char screen_name[MAXSNLEN+1];
108 char *BOSIP;
109 char cookie[AIM_COOKIELEN];
110 char *email;
111 u_short regstatus;
01b59e1e 112 char *errorurl;
113 u_short errorcode;
bd71fa88 114};
115
116/*
117 * Client info. Filled in by the client and passed
118 * in to aim_login(). The information ends up
119 * getting passed to OSCAR through the initial
120 * login command.
121 *
122 * XXX: Should this be per-session? -mid
123 *
124 */
125struct client_info_s {
126 char clientstring[100]; /* arbitrary size */
127 int major;
128 int minor;
129 int build;
130 char country[3];
131 char lang[3];
132};
133
134#ifndef TRUE
135#define TRUE 1
136#define FALSE 0
137#endif
138
139/*
140 * These could be arbitrary, but its easier to use the actual AIM values
141 */
142#define AIM_CONN_TYPE_AUTH 0x0007
143#define AIM_CONN_TYPE_ADS 0x0005
144#define AIM_CONN_TYPE_BOS 0x0002
145#define AIM_CONN_TYPE_CHAT 0x000e
146#define AIM_CONN_TYPE_CHATNAV 0x000d
040457cc 147#define AIM_CONN_TYPE_RENDEZVOUS 0x0101 /* these do not speak OSCAR! */
bd71fa88 148
149/*
150 * Status values returned from aim_conn_new(). ORed together.
151 */
152#define AIM_CONN_STATUS_READY 0x0001
153#define AIM_CONN_STATUS_INTERNALERR 0x0002
154#define AIM_CONN_STATUS_RESOLVERR 0x0080
155#define AIM_CONN_STATUS_CONNERR 0x0040
156
b69540e3 157#define AIM_FRAMETYPE_OSCAR 0x0000
158#define AIM_FRAMETYPE_OFT 0x0001
159
bd71fa88 160struct aim_conn_t {
161 int fd;
162 int type;
163 int seqnum;
164 int status;
165 void *priv; /* misc data the client may want to store */
166 time_t lastactivity; /* time of last transmit */
167 int forcedlatency;
168 struct aim_rxcblist_t *handlerlist;
df5a99fb 169 faim_mutex_t active; /* lock around read/writes */
170 faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */
040457cc 171 struct aim_conn_t *next;
bd71fa88 172};
173
174/* struct for incoming commands */
175struct command_rx_struct {
b69540e3 176 unsigned char hdrtype; /* defines which piece of the union to use */
177 union {
178 struct {
179 char type;
180 unsigned short seqnum;
181 } oscar;
182 struct {
183 unsigned short type;
184 unsigned short hdr2len;
185 unsigned char *hdr2; /* rest of bloated header */
186 } oft;
187 } hdr;
188 unsigned short commandlen; /* total payload length */
189 unsigned char *data; /* packet data (from 7 byte on) */
190 unsigned char lock; /* 0 = open, !0 = locked */
191 unsigned char handled; /* 0 = new, !0 = been handled */
192 unsigned char nofree; /* 0 = free data on purge, 1 = only unlink */
bd71fa88 193 struct aim_conn_t *conn; /* the connection it came in on... */
194 struct command_rx_struct *next; /* ptr to next struct in list */
195};
196
197/* struct for outgoing commands */
198struct command_tx_struct {
b69540e3 199 unsigned char hdrtype; /* defines which piece of the union to use */
200 union {
201 struct {
202 unsigned char type;
203 unsigned short seqnum;
204 } oscar;
205 struct {
206 unsigned short type;
207 unsigned short hdr2len;
208 unsigned char *hdr2;
209 } oft;
210 } hdr;
211 u_int commandlen;
212 u_char *data;
bd71fa88 213 u_int lock; /* 0 = open, !0 = locked */
214 u_int sent; /* 0 = pending, !0 = has been sent */
215 struct aim_conn_t *conn;
216 struct command_tx_struct *next; /* ptr to next struct in list */
217};
218
219
220/*
221 * AIM Session: The main client-data interface.
222 *
223 */
224struct aim_session_t {
225
226 /* ---- Client Accessible ------------------------ */
227 /*
228 * Login information. See definition above.
229 *
230 */
231 struct aim_login_struct logininfo;
232
233 /*
234 * Pointer to anything the client wants to
235 * explicitly associate with this session.
236 */
237 void *aux_data;
238
239
240 /* ---- Internal Use Only ------------------------ */
241 /*
242 * Connection information
243 */
040457cc 244 struct aim_conn_t *connlist;
245 faim_mutex_t connlistlock;
bd71fa88 246
247 /*
248 * TX/RX queues
249 */
e88ba395 250 struct command_tx_struct *queue_outgoing;
bd71fa88 251 struct command_rx_struct *queue_incoming;
252
e88ba395 253 /*
254 * Tx Enqueuing function
255 */
256 int (*tx_enqueue)(struct aim_session_t *, struct command_tx_struct *);
257
0c20631f 258 /*
259 * This is a dreadful solution to the what-room-are-we-joining
260 * problem. (There's no connection between the service
261 * request and the resulting redirect.)
262 */
263 char *pendingjoin;
264
bd71fa88 265 /*
266 * Outstanding snac handling
267 *
268 * XXX: Should these be per-connection? -mid
269 **/
270 struct aim_snac_t *outstanding_snacs;
271 u_long snac_nextid;
040457cc 272
273 struct aim_msgcookie_t *msgcookies;
bd71fa88 274};
275
276
277/*
278 * AIM User Info, Standard Form.
279 */
280struct aim_userinfo_s {
281 char sn[MAXSNLEN+1];
282 u_short warnlevel;
283 u_short idletime;
284 u_short class;
285 u_long membersince;
286 u_long onlinesince;
287 u_long sessionlen;
5b79dc93 288 u_short capabilities;
bd71fa88 289};
290
0c20631f 291#define AIM_CLASS_TRIAL 0x0001
292#define AIM_CLASS_UNKNOWN2 0x0002
293#define AIM_CLASS_AOL 0x0004
294#define AIM_CLASS_UNKNOWN4 0x0008
295#define AIM_CLASS_FREE 0x0010
296#define AIM_CLASS_AWAY 0x0020
297#define AIM_CLASS_UNKNOWN40 0x0040
298#define AIM_CLASS_UNKNOWN80 0x0080
299
bd71fa88 300/*
301 * TLV handling
302 */
303
304/* Generic TLV structure. */
305struct aim_tlv_t {
306 u_short type;
307 u_short length;
308 u_char *value;
309};
310
311/* List of above. */
312struct aim_tlvlist_t {
313 struct aim_tlv_t *tlv;
314 struct aim_tlvlist_t *next;
315};
316
317/* TLV-handling functions */
318struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen);
319void aim_freetlvchain(struct aim_tlvlist_t **list);
320struct aim_tlv_t *aim_grabtlv(u_char *src);
321struct aim_tlv_t *aim_grabtlvstr(u_char *src);
322struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int);
323char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int);
324int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv);
325struct aim_tlv_t *aim_createtlv(void);
326int aim_freetlv(struct aim_tlv_t **oldtlv);
327int aim_puttlv_16(u_char *, u_short, u_short);
01b59e1e 328int aim_puttlv_32(u_char *, u_short, u_long);
329int aim_puttlv_str(u_char *buf, u_short t, u_short l, u_char *v);
0e2be272 330int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list);
331int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val);
e6b05d80 332int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val);
333int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len);
334int aim_counttlvchain(struct aim_tlvlist_t **list);
bd71fa88 335
336/*
337 * Get command from connections / Dispatch commands
338 * already in queue.
339 */
f1a5efe0 340int aim_get_command(struct aim_session_t *, struct aim_conn_t *);
bd71fa88 341int aim_rxdispatch(struct aim_session_t *);
342
343int aim_logoff(struct aim_session_t *);
344
040457cc 345void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn);
bd71fa88 346
347typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
348int aim_register_callbacks(rxcallback_t *);
349
350u_long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype);
351u_long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *);
352u_long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *);
353
354/* aim_login.c */
01b59e1e 355int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn);
356int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
bd71fa88 357int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *);
358int aim_encode_password(const char *, u_char *);
5e02cf44 359int aimicq_encode_password(const char *password, u_char *encoded);
e6b05d80 360unsigned long aim_sendauthresp(struct aim_session_t *sess,
361 struct aim_conn_t *conn,
362 char *sn, char *bosip,
363 char *cookie, char *email,
364 int regstatus);
365int aim_gencookie(unsigned char *buf);
366int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn);
367unsigned long aim_sendredirect(struct aim_session_t *sess,
368 struct aim_conn_t *conn,
369 unsigned short servid,
370 char *ip,
371 char *cookie);
b8d0da45 372void aim_purge_rxqueue(struct aim_session_t *);
bd71fa88 373
374
375int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *command, ...);
376int aim_parse_missed_im(struct aim_session_t *, struct command_rx_struct *, ...);
377int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...);
378
b69540e3 379
380struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen);
e88ba395 381int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *);
382int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *);
383#define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y))
384int aim_tx_sendframe(struct command_tx_struct *cur);
bd71fa88 385u_int aim_get_next_txseqnum(struct aim_conn_t *);
386int aim_tx_flushqueue(struct aim_session_t *);
387int aim_tx_printqueue(struct aim_session_t *);
b8d0da45 388void aim_tx_purgequeue(struct aim_session_t *);
bd71fa88 389
390struct aim_rxcblist_t {
391 u_short family;
392 u_short type;
393 rxcallback_t handler;
394 u_short flags;
395 struct aim_rxcblist_t *next;
396};
397
398int aim_conn_setlatency(struct aim_conn_t *conn, int newval);
399
400int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, rxcallback_t newhandler, u_short flags);
401rxcallback_t aim_callhandler(struct aim_conn_t *conn, u_short family, u_short type);
402int aim_clearhandlers(struct aim_conn_t *conn);
403
404/*
405 * Generic SNAC structure. Rarely if ever used.
406 */
407struct aim_snac_t {
408 u_long id;
409 u_short family;
410 u_short type;
411 u_short flags;
412 void *data;
413 time_t issuetime;
414 struct aim_snac_t *next;
415};
416u_long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac);
417struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id);
418int aim_cleansnacs(struct aim_session_t *, int maxage);
419int aim_putsnac(u_char *, int, int, int, u_long);
420
421
422void aim_connrst(struct aim_session_t *);
423struct aim_conn_t *aim_conn_getnext(struct aim_session_t *);
424void aim_conn_close(struct aim_conn_t *deadconn);
425struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type);
426struct aim_conn_t *aim_newconn(struct aim_session_t *, int type, char *dest);
427int aim_conngetmaxfd(struct aim_session_t *);
b8d0da45 428struct aim_conn_t *aim_select(struct aim_session_t *, struct timeval *, int *);
bd71fa88 429int aim_conn_isready(struct aim_conn_t *);
430int aim_conn_setstatus(struct aim_conn_t *, int);
431void aim_session_init(struct aim_session_t *);
432
433/* aim_misc.c */
434
435#define AIM_VISIBILITYCHANGE_PERMITADD 0x05
436#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06
437#define AIM_VISIBILITYCHANGE_DENYADD 0x07
438#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08
439
f0a7908e 440u_long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
bd71fa88 441u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
442u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
443u_long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *);
5b79dc93 444u_long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned int);
bd71fa88 445u_long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long);
446u_long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *);
447u_long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *);
448u_long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *);
449u_long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long);
450u_long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *);
451u_long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short);
452u_long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *);
453u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *);
454u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *);
455u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *);
0c20631f 456u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
bd71fa88 457
458/* aim_rxhandlers.c */
459int aim_rxdispatch(struct aim_session_t *);
460int aim_authparse(struct aim_session_t *, struct command_rx_struct *);
461int aim_handleredirect_middle(struct aim_session_t *, struct command_rx_struct *, ...);
462int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...);
463int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...);
464int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...);
01b59e1e 465int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...);
bd71fa88 466
467/* aim_im.c */
468#define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */
469#define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */
470
471u_long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *);
472int aim_parse_incoming_im_middle(struct aim_session_t *, struct command_rx_struct *);
473u_long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn);
474int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *);
5e02cf44 475int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command);
bd71fa88 476
477/* aim_info.c */
5b79dc93 478#define AIM_CAPS_BUDDYICON 0x01
479#define AIM_CAPS_VOICE 0x02
480#define AIM_CAPS_IMIMAGE 0x04
481#define AIM_CAPS_CHAT 0x08
482#define AIM_CAPS_GETFILE 0x10
483#define AIM_CAPS_SENDFILE 0x20
b69540e3 484
5b79dc93 485extern u_char aim_caps[6][16];
b69540e3 486u_short aim_getcap(unsigned char *capblock, int buflen);
487int aim_putcap(unsigned char *capblock, int buflen, u_short caps);
262272cc 488
489#define AIM_GETINFO_GENERALINFO 0x00001
490#define AIM_GETINFO_AWAYMESSAGE 0x00003
491
040457cc 492struct aim_msgcookie_t {
493 unsigned char cookie[8];
040457cc 494 int type;
495 void *data;
496 time_t addtime;
497 struct aim_msgcookie_t *next;
498};
499
500struct aim_filetransfer_t {
501 char sender[MAXSNLEN];
502 char ip[30];
503 char *filename;
504};
505int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie);
506struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, char *cookie);
507int aim_purgecookies(struct aim_session_t *sess);
508
509#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
510#define AIM_TRANSFER_DENY_DECLINE 0x0001
511#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
512u_long aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short code);
b69540e3 513u_long aim_accepttransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short rendid);
040457cc 514
262272cc 515u_long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short);
bd71fa88 516int aim_extractuserinfo(u_char *, struct aim_userinfo_s *);
517int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *);
518int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *);
519int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *);
50443ea0 520int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info);
521int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info);
522int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
bd71fa88 523
f1a5efe0 524
bd71fa88 525/* aim_auth.c */
526int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *);
527u_long aim_auth_clientready(struct aim_session_t *, struct aim_conn_t *);
528u_long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char *, char *);
529
530/* aim_buddylist.c */
531u_long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *);
532u_long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *);
533
534/* aim_search.c */
535u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *);
536/* u_long aim_usersearch_name(struct aim_session_t *, struct aim_conn_t *, char *); */
537
0c20631f 538
539struct aim_chat_roominfo {
540 u_short exchange;
541 char *name;
542 u_short instance;
543};
544int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo);
545int aim_chat_parse_infoupdate(struct aim_session_t *sess, struct command_rx_struct *command);
546int aim_chat_parse_joined(struct aim_session_t *sess, struct command_rx_struct *command);
547int aim_chat_parse_leave(struct aim_session_t *sess, struct command_rx_struct *command);
548int aim_chat_parse_incoming(struct aim_session_t *sess, struct command_rx_struct *command);
549u_long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg);
550u_long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname);
551u_long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn);
552int aim_chat_attachname(struct aim_conn_t *conn, char *roomname);
553char *aim_chat_getname(struct aim_conn_t *conn);
554struct aim_conn_t *aim_chat_getconn(struct aim_session_t *, char *name);
555
556u_long aim_chatnav_reqrights(struct aim_session_t *sess, struct aim_conn_t *conn);
557u_long aim_chatnav_clientready(struct aim_session_t *sess, struct aim_conn_t *conn);
558
559u_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);
560
561struct aim_chat_exchangeinfo {
562 u_short number;
563 char *name;
564 char *charset1;
565 char *lang1;
566 char *charset2;
567 char *lang2;
568};
569int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command);
570u_long aim_chatnav_createroom(struct aim_session_t *sess, struct aim_conn_t *conn, char *name, u_short exchange);
571int aim_chat_leaveroom(struct aim_session_t *sess, char *name);
572
bd71fa88 573/* aim_util.c */
f1a5efe0 574#ifdef AIMUTIL_USEMACROS
575/*
576 * These are really ugly. You'd think this was LISP. I wish it was.
577 */
578#define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1)
579#define aimutil_get8(buf) ((*(buf))&0xff)
580#define aimutil_put16(buf, data) ( \
581 (*(buf) = (u_char)((data)>>8)&0xff), \
582 (*((buf)+1) = (u_char)(data)&0xff), \
583 2)
584#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
585#define aimutil_put32(buf, data) ( \
586 (*((buf)) = (u_char)((data)>>24)&0xff), \
587 (*((buf)+1) = (u_char)((data)>>16)&0xff), \
588 (*((buf)+2) = (u_char)((data)>>8)&0xff), \
589 (*((buf)+3) = (u_char)(data)&0xff), \
590 4)
591#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
592 (((*((buf)+1))<<16)&0x00ff0000) + \
593 (((*((buf)+2))<< 8)&0x0000ff00) + \
594 (((*((buf)+3) )&0x000000ff)))
595#else
596#warning Not using aimutil macros. May have performance problems.
bd71fa88 597int aimutil_put8(u_char *, u_char);
598u_char aimutil_get8(u_char *buf);
599int aimutil_put16(u_char *, u_short);
600u_short aimutil_get16(u_char *);
601int aimutil_put32(u_char *, u_long);
602u_long aimutil_get32(u_char *);
f1a5efe0 603#endif
604
bd71fa88 605int aimutil_putstr(u_char *, const u_char *, int);
606int aimutil_tokslen(char *toSearch, int index, char dl);
607int aimutil_itemcnt(char *toSearch, char dl);
608char *aimutil_itemidx(char *toSearch, int index, char dl);
609
e6b05d80 610int aim_snlen(const char *sn);
611int aim_sncmp(const char *sn1, const char *sn2);
612
0cc57340 613/* aim_meta.c */
91931247 614char *aim_getbuilddate(void);
615char *aim_getbuildtime(void);
0cc57340 616char *aim_getbuildstring(void);
617
bd71fa88 618#endif /* __AIM_H__ */
619
This page took 0.137736 seconds and 5 git commands to generate.