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