source: protocols/yahoo/yahoo2_callbacks.h @ 04a927c

Last change on this file since 04a927c was ba16895, checked in by Wilmer van der Gaast <wilmer@…>, at 2009-10-10T13:48:44Z

More Yahoo! fixes: Adding and removing buddies works, and for the first
time buddy add requests are actually handled; from what I can see this
simply didn't exist in libyahoo2 yet so far. :-(

I melded pieces of changes from http://geny.sf.net/ to make this stuff
work.

  • Property mode set to 100644
File size: 21.7 KB
RevLine 
[b7d3cc34]1/*
2 * libyahoo2: yahoo2_callbacks.h
3 *
4 * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 *
20 */
21
22/*
23 * The functions in this file *must* be defined in your client program
24 * If you want to use a callback structure instead of direct functions,
25 * then you must define USE_STRUCT_CALLBACKS in all files that #include
26 * this one.
27 *
28 * Register the callback structure by calling yahoo_register_callbacks -
29 * declared in this file and defined in libyahoo2.c
30 */
31
32
33#ifndef YAHOO2_CALLBACKS_H
34#define YAHOO2_CALLBACKS_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include "yahoo2_types.h"
41
42/*
43 * yahoo2_callbacks.h
44 *
45 * Callback interface for libyahoo2
46 */
47
48typedef enum {
49        YAHOO_INPUT_READ = 1 << 0,
50        YAHOO_INPUT_WRITE = 1 << 1,
51        YAHOO_INPUT_EXCEPTION = 1 << 2
52} yahoo_input_condition;
53
54/*
55 * A callback function called when an asynchronous connect completes.
56 *
57 * Params:
58 *     fd    - The file descriptor that has been connected, or -1 on error
59 *     error - The value of errno set by the call to connect or 0 if no error
60 *             Set both fd and error to 0 if the connect was cancelled by the
61 *             user
62 *     callback_data - the callback_data passed to the ext_yahoo_connect_async
63 *             function
64 */
65typedef void (*yahoo_connect_callback)(int fd, int error, void *callback_data);
66
67
68/*
69 * The following functions need to be implemented in the client
70 * interface.  They will be called by the library when each
71 * event occurs.
72 */
73
74/*
75 * should we use a callback structure or directly call functions
76 * if you want the structure, you *must* define USE_STRUCT_CALLBACKS
77 * both when you compile the library, and when you compile your code
78 * that uses the library
79 */
80
81#ifdef USE_STRUCT_CALLBACKS
82#define YAHOO_CALLBACK_TYPE(x)  (*x)
83struct yahoo_callbacks {
84#else
85#define YAHOO_CALLBACK_TYPE(x)  x
86#endif
87
88/*
89 * Name: ext_yahoo_login_response
90 *      Called when the login process is complete
91 * Params:
92 *      id   - the id that identifies the server connection
93 *      succ - enum yahoo_login_status
94 *      url  - url to reactivate account if locked
95 */
[cfc8d58]96void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url);
[b7d3cc34]97
98
99/*
100 * Name: ext_yahoo_got_buddies
101 *      Called when the contact list is got from the server
102 * Params:
103 *      id   - the id that identifies the server connection
104 *      buds - the buddy list
105 */
106void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies)(int id, YList * buds);
107
108
109/*
110 * Name: ext_yahoo_got_ignore
111 *      Called when the ignore list is got from the server
112 * Params:
113 *      id   - the id that identifies the server connection
114 *      igns - the ignore list
115 */
116void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore)(int id, YList * igns);
117
118
119/*
120 * Name: ext_yahoo_got_identities
121 *      Called when the contact list is got from the server
122 * Params:
123 *      id   - the id that identifies the server connection
124 *      ids  - the identity list
125 */
126void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities)(int id, YList * ids);
127
128
129/*
130 * Name: ext_yahoo_got_cookies
131 *      Called when the cookie list is got from the server
132 * Params:
133 *      id   - the id that identifies the server connection
134 */
135void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies)(int id);
136
137
[cfc8d58]138/*
139 * Name: ext_yahoo_got_ping
140 *      Called when the ping packet is received from the server
141 * Params:
142 *      id   - the id that identifies the server connection
143 *  errormsg - optional error message
144 */
145void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg);
[b7d3cc34]146
147
148/*
149 * Name: ext_yahoo_status_changed
150 *      Called when remote user's status changes.
151 * Params:
152 *      id   - the id that identifies the server connection
153 *      who  - the handle of the remote user
154 *      stat - status code (enum yahoo_status)
155 *      msg  - the message if stat == YAHOO_STATUS_CUSTOM
156 *      away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
[cfc8d58]157 *      idle - this is the number of seconds he is idle [if he is idle]
158 *      mobile - this is set for mobile users/buddies
159 *      TODO: add support for pager, chat, and game states
[b7d3cc34]160 */
[cfc8d58]161void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile);
[b7d3cc34]162
163
164/*
165 * Name: ext_yahoo_got_im
166 *      Called when remote user sends you a message.
167 * Params:
168 *      id   - the id that identifies the server connection
[cfc8d58]169 *      me   - the identity the message was sent to
[b7d3cc34]170 *      who  - the handle of the remote user
171 *      msg  - the message - NULL if stat == 2
172 *      tm   - timestamp of message if offline
173 *      stat - message status - 0
174 *                              1
175 *                              2 == error sending message
176 *                              5
177 *      utf8 - whether the message is encoded as utf8 or not
178 */
[cfc8d58]179void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8);
[b7d3cc34]180
181
182/*
183 * Name: ext_yahoo_got_conf_invite
184 *      Called when remote user sends you a conference invitation.
185 * Params:
186 *      id   - the id that identifies the server connection
[cfc8d58]187 *      me   - the identity the invitation was sent to
[b7d3cc34]188 *      who  - the user inviting you
189 *      room - the room to join
190 *      msg  - the message
191 *      members - the initial members of the conference (null terminated list)
192 */
[cfc8d58]193void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, const char *me, const char *who, const char *room, const char *msg, YList *members);
[b7d3cc34]194
195
196/*
197 * Name: ext_yahoo_conf_userdecline
198 *      Called when someone declines to join the conference.
199 * Params:
200 *      id   - the id that identifies the server connection
[cfc8d58]201 *      me   - the identity in the conference
[b7d3cc34]202 *      who  - the user who has declined
203 *      room - the room
204 *      msg  - the declining message
205 */
[cfc8d58]206void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg);
[b7d3cc34]207
208
209/*
210 * Name: ext_yahoo_conf_userjoin
211 *      Called when someone joins the conference.
212 * Params:
213 *      id   - the id that identifies the server connection
[cfc8d58]214 *      me   - the identity in the conference
[b7d3cc34]215 *      who  - the user who has joined
216 *      room - the room joined
217 */
[cfc8d58]218void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room);
[b7d3cc34]219
220
221/*
222 * Name: ext_yahoo_conf_userleave
223 *      Called when someone leaves the conference.
224 * Params:
225 *      id   - the id that identifies the server connection
[cfc8d58]226 *      me   - the identity in the conference
[b7d3cc34]227 *      who  - the user who has left
228 *      room - the room left
229 */
[cfc8d58]230void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room);
[b7d3cc34]231
232
233/*
234 * Name: ext_yahoo_chat_cat_xml
[cfc8d58]235 *      Called when ?
[b7d3cc34]236 * Params:
237 *      id      - the id that identifies the server connection
[cfc8d58]238 *      xml     - ?
[b7d3cc34]239 */
[cfc8d58]240void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml);
[b7d3cc34]241
242
243/*
244 * Name: ext_yahoo_chat_join
245 *      Called when joining the chatroom.
246 * Params:
247 *      id      - the id that identifies the server connection
[cfc8d58]248 *      me   - the identity in the chatroom
[b7d3cc34]249 *      room    - the room joined, used in all other chat calls, freed by
250 *                library after call
251 *      topic   - the topic of the room, freed by library after call
252 *      members - the initial members of the chatroom (null terminated YList
253 *                of yahoo_chat_member's) Must be freed by the client
254 *      fd      - the socket where the connection is coming from (for tracking)
255 */
[cfc8d58]256void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd);
[b7d3cc34]257
258
259/*
260 * Name: ext_yahoo_chat_userjoin
261 *      Called when someone joins the chatroom.
262 * Params:
263 *      id   - the id that identifies the server connection
[cfc8d58]264 *      me   - the identity in the chatroom
[b7d3cc34]265 *      room - the room joined
266 *      who  - the user who has joined, Must be freed by the client
267 */
[cfc8d58]268void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who);
[b7d3cc34]269
270
271/*
272 * Name: ext_yahoo_chat_userleave
273 *      Called when someone leaves the chatroom.
274 * Params:
275 *      id   - the id that identifies the server connection
[cfc8d58]276 *      me   - the identity in the chatroom
[b7d3cc34]277 *      room - the room left
278 *      who  - the user who has left (Just the User ID)
279 */
[cfc8d58]280void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who);
[b7d3cc34]281
282
283/*
284 * Name: ext_yahoo_chat_message
285 *      Called when someone messages in the chatroom.
286 * Params:
287 *      id   - the id that identifies the server connection
[cfc8d58]288 *      me   - the identity in the chatroom
[b7d3cc34]289 *      room - the room
290 *      who  - the user who messaged (Just the user id)
291 *      msg  - the message
292 *      msgtype  - 1 = Normal message
293 *                 2 = /me type message
294 *      utf8 - whether the message is utf8 encoded or not
295 */
[cfc8d58]296void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8);
297
[b7d3cc34]298
299/*
300 *
301 * Name: ext_yahoo_chat_yahoologout
302 *      called when yahoo disconnects your chat session
303 *      Note this is called whenver a disconnect happens, client or server
304 *      requested. Care should be taken to make sure you know the origin
305 *      of the disconnect request before doing anything here (auto-join's etc)
306 * Params:
307 *      id   - the id that identifies this connection
[cfc8d58]308 *      me   - the identity in the chatroom
[b7d3cc34]309 * Returns:
310 *      nothing.
311 */
[cfc8d58]312void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me);
313
[b7d3cc34]314
315/*
316 *
317 * Name: ext_yahoo_chat_yahooerror
318 *      called when yahoo sends back an error to you
319 *      Note this is called whenver chat message is sent into a room
320 *      in error (fd not connected, room doesn't exists etc)
321 *      Care should be taken to make sure you know the origin
322 *      of the error before doing anything about it.
323 * Params:
324 *      id   - the id that identifies this connection
[cfc8d58]325 *      me   - the identity in the chatroom
[b7d3cc34]326 * Returns:
327 *      nothing.
328 */
[cfc8d58]329void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me);
[b7d3cc34]330
331
332/*
333 * Name: ext_yahoo_conf_message
334 *      Called when someone messages in the conference.
335 * Params:
336 *      id   - the id that identifies the server connection
[cfc8d58]337 *      me   - the identity the conf message was sent to
[b7d3cc34]338 *      who  - the user who messaged
339 *      room - the room
340 *      msg  - the message
341 *      utf8 - whether the message is utf8 encoded or not
342 */
[cfc8d58]343void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
[b7d3cc34]344
345
346/*
347 * Name: ext_yahoo_got_file
348 *      Called when someone sends you a file
349 * Params:
350 *      id   - the id that identifies the server connection
[cfc8d58]351 *      me   - the identity the file was sent to
[b7d3cc34]352 *      who  - the user who sent the file
353 *      url  - the file url
354 *      expires  - the expiry date of the file on the server (timestamp)
355 *      msg  - the message
356 *      fname- the file name if direct transfer
357 *      fsize- the file size if direct transfer
358 */
[cfc8d58]359void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file)(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize);
[b7d3cc34]360
361
[ba16895]362/*
363 * Name: ext_yahoo_contact_auth_request
364 *      Called when a contact wants to add you to his/her contact list
365 * Params:
366 *      id   - the id that identifies the server connection
367 *      myid - the identity s/he added
368 *      who  - who did it
369 *      msg  - any message sent
370 */
371void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_auth_request)(int id, const char *myid, const char *who, const char *msg);
372
373
[b7d3cc34]374/*
375 * Name: ext_yahoo_contact_added
376 *      Called when a contact is added to your list
377 * Params:
378 *      id   - the id that identifies the server connection
379 *      myid - the identity he was added to
380 *      who  - who was added
381 *      msg  - any message sent
382 */
[cfc8d58]383void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, const char *myid, const char *who, const char *msg);
[b7d3cc34]384
385
386/*
387 * Name: ext_yahoo_rejected
388 *      Called when a contact rejects your add
389 * Params:
390 *      id   - the id that identifies the server connection
391 *      who  - who rejected you
392 *      msg  - any message sent
393 */
[cfc8d58]394void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg);
[b7d3cc34]395
396
397/*
398 * Name: ext_yahoo_typing_notify
399 *      Called when remote user starts or stops typing.
400 * Params:
401 *      id   - the id that identifies the server connection
[cfc8d58]402 *      me   - the handle of the identity the notification is sent to
[b7d3cc34]403 *      who  - the handle of the remote user
404 *      stat - 1 if typing, 0 if stopped typing
405 */
[cfc8d58]406void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat);
[b7d3cc34]407
408
409/*
410 * Name: ext_yahoo_game_notify
411 *      Called when remote user starts or stops a game.
412 * Params:
413 *      id   - the id that identifies the server connection
[cfc8d58]414 *      me   - the handle of the identity the notification is sent to
[b7d3cc34]415 *      who  - the handle of the remote user
416 *      stat - 1 if game, 0 if stopped gaming
417 */
[cfc8d58]418void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat);
[b7d3cc34]419
420
421/*
422 * Name: ext_yahoo_mail_notify
423 *      Called when you receive mail, or with number of messages
424 * Params:
425 *      id   - the id that identifies the server connection
426 *      from - who the mail is from - NULL if only mail count
427 *      subj - the subject of the mail - NULL if only mail count
428 *      cnt  - mail count - 0 if new mail notification
429 */
[cfc8d58]430void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt);
[b7d3cc34]431
432
433/*
434 * Name: ext_yahoo_system_message
435 *      System message
436 * Params:
437 *      id   - the id that identifies the server connection
438 *      msg  - the message
439 */
[cfc8d58]440void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *msg);
[b7d3cc34]441
[cfc8d58]442/*
443 * Name: ext_yahoo_got_buddyicon
444 *      Buddy icon received
445 * Params:
446 *      id - the id that identifies the server connection
447 *      me - the handle of the identity the notification is sent to
448 *      who - the person the buddy icon is for
449 *      url - the url to use to load the icon
450 *      checksum - the checksum of the icon content
451 */
452void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon)(int id, const char *me, const char *who, const char *url, int checksum);
[b7d3cc34]453
[cfc8d58]454/*
455 * Name: ext_yahoo_got_buddyicon_checksum
456 *      Buddy icon checksum received
457 * Params:
458 *      id - the id that identifies the server connection
459 *      me - the handle of the identity the notification is sent to
460 *      who - the yahoo id of the buddy icon checksum is for
461 *      checksum - the checksum of the icon content
462 */
463void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum)(int id, const char *me,const char *who, int checksum);
[b7d3cc34]464
[cfc8d58]465/*
466 * Name: ext_yahoo_got_buddyicon_request
467 *      Buddy icon request received
468 * Params:
469 *      id - the id that identifies the server connection
470 *      me - the handle of the identity the notification is sent to
471 *      who - the yahoo id of the buddy that requested the buddy icon
472 */
473void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request)(int id, const char *me, const char *who);
[b7d3cc34]474
[cfc8d58]475/*
476 * Name: ext_yahoo_got_buddyicon_request
477 *      Buddy icon request received
478 * Params:
479 *      id - the id that identifies the server connection
480 *      url - remote url, the uploaded buddy icon can be fetched from
481 */
482void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded)(int id, const char *url);
[b7d3cc34]483
484/*
485 * Name: ext_yahoo_got_webcam_image
486 *      Called when you get a webcam update
487 *      An update can either be receiving an image, a part of an image or
488 *      just an update with a timestamp
489 * Params:
490 *      id         - the id that identifies the server connection
491 *      who        - the user who's webcam we're viewing
492 *      image      - image data
493 *      image_size - length of the image in bytes
494 *      real_size  - actual length of image data
495 *      timestamp  - milliseconds since the webcam started
496 *
497 *      If the real_size is smaller then the image_size then only part of
498 *      the image has been read. This function will keep being called till
499 *      the total amount of bytes in image_size has been read. The image
500 *      received is in JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1).
501 *      The size of the image will be either 160x120 or 320x240.
502 *      Each webcam image contains a timestamp. This timestamp should be
503 *      used to keep the image in sync since some images can take longer
504 *      to transport then others. When image_size is 0 we can still receive
505 *      a timestamp to stay in sync
506 */
507void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image)(int id, const char * who,
508                const unsigned char *image, unsigned int image_size, unsigned int real_size,
509                unsigned int timestamp);
510
511
512/*
513 * Name: ext_yahoo_webcam_invite
514 *      Called when you get a webcam invitation
515 * Params:
516 *      id   - the id that identifies the server connection
[cfc8d58]517 *      me   - identity the invitation is to
[b7d3cc34]518 *      from - who the invitation is from
519 */
[cfc8d58]520void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from);
[b7d3cc34]521
522
523/*
524 * Name: ext_yahoo_webcam_invite_reply
525 *      Called when you get a response to a webcam invitation
526 * Params:
527 *      id   - the id that identifies the server connection
[cfc8d58]528 *      me   - identity the invitation response is to
[b7d3cc34]529 *      from - who the invitation response is from
530 *      accept - 0 (decline), 1 (accept)
531 */
[cfc8d58]532void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept);
[b7d3cc34]533
534
535/*
536 * Name: ext_yahoo_webcam_closed
537 *      Called when the webcam connection closed
538 * Params:
539 *      id   - the id that identifies the server connection
540 *      who  - the user who we where connected to
541 *      reason - reason why the connection closed
542 *               1 = user stopped broadcasting
543 *               2 = user cancelled viewing permission
544 *               3 = user declines permission
545 *               4 = user does not have webcam online
546 */
[cfc8d58]547void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason);
[b7d3cc34]548
549
550/*
551 * Name: ext_yahoo_got_search_result
552 *      Called when the search result received from server
553 * Params:
554 *      id       - the id that identifies the server connection
555 *      found    - total number of results returned in the current result set
556 *      start    - offset from where the current result set starts
557 *      total    - total number of results available (start + found <= total)
558 *      contacts - the list of results as a YList of yahoo_found_contact
559 *                 these will be freed after this function returns, so
560 *                 if you need to use the information, make a copy
561 */
562void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result)(int id, int found, int start, int total, YList *contacts);
563
564
565/*
566 * Name: ext_yahoo_error
567 *      Called on error.
568 * Params:
569 *      id   - the id that identifies the server connection
570 *      err  - the error message
571 *      fatal- whether this error is fatal to the connection or not
[cfc8d58]572 *      num  - Which error is this
[b7d3cc34]573 */
[cfc8d58]574void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num);
[b7d3cc34]575
576
577/*
578 * Name: ext_yahoo_webcam_viewer
579 *      Called when a viewer disconnects/connects/requests to connect
580 * Params:
581 *      id  - the id that identifies the server connection
582 *      who - the viewer
583 *      connect - 0=disconnect 1=connect 2=request
584 */
[cfc8d58]585void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect);
[b7d3cc34]586
587
588/*
589 * Name: ext_yahoo_webcam_data_request
590 *      Called when you get a request for webcam images
591 * Params:
592 *      id   - the id that identifies the server connection
593 *      send - whether to send images or not
594 */
595void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send);
596
597
598/*
599 * Name: ext_yahoo_log
600 *      Called to log a message.
601 * Params:
602 *      fmt  - the printf formatted message
603 * Returns:
604 *      0
605 */
[cfc8d58]606int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...);
[b7d3cc34]607
608
609/*
610 * Name: ext_yahoo_add_handler
611 *      Add a listener for the fd.  Must call yahoo_read_ready
612 *      when a YAHOO_INPUT_READ fd is ready and yahoo_write_ready
613 *      when a YAHOO_INPUT_WRITE fd is ready.
614 * Params:
615 *      id   - the id that identifies the server connection
616 *      fd   - the fd on which to listen
617 *      cond - the condition on which to call the callback
618 *      data - callback data to pass to yahoo_*_ready
619 *     
620 * Returns: a tag to be used when removing the handler
621 */
622int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler)(int id, int fd, yahoo_input_condition cond, void *data);
623
624
625/*
626 * Name: ext_yahoo_remove_handler
627 *      Remove the listener for the fd.
628 * Params:
629 *      id   - the id that identifies the connection
630 *      tag  - the handler tag to remove
631 */
632void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag);
633
634
635/*
636 * Name: ext_yahoo_connect
637 *      Connect to a host:port
638 * Params:
639 *      host - the host to connect to
640 *      port - the port to connect on
641 * Returns:
642 *      a unix file descriptor to the socket
643 */
[cfc8d58]644int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port);
[b7d3cc34]645
646
647/*
648 * Name: ext_yahoo_connect_async
649 *      Connect to a host:port asynchronously.  This function should return
650 *      immediately returing a tag used to identify the connection handler,
651 *      or a pre-connect error (eg: host name lookup failure).
652 *      Once the connect completes (successfully or unsuccessfully), callback
653 *      should be called (see the signature for yahoo_connect_callback).
654 *      The callback may safely be called before this function returns, but
655 *      it should not be called twice.
656 * Params:
657 *      id   - the id that identifies this connection
658 *      host - the host to connect to
659 *      port - the port to connect on
660 *      callback - function to call when connect completes
661 *      callback_data - data to pass to the callback function
662 * Returns:
663 *      a unix file descriptor to the socket
664 */
[cfc8d58]665int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port, 
[b7d3cc34]666                yahoo_connect_callback callback, void *callback_data);
667
668#ifdef USE_STRUCT_CALLBACKS
669};
670
671/*
672 * if using a callback structure, call yahoo_register_callbacks
673 * before doing anything else
674 */
675void yahoo_register_callbacks(struct yahoo_callbacks * tyc);
[cfc8d58]676
[b7d3cc34]677#undef YAHOO_CALLBACK_TYPE
678
679#endif
680
681#ifdef __cplusplus
682}
683#endif
684
685#endif
[cfc8d58]686
Note: See TracBrowser for help on using the repository browser.