source: protocols/yahoo/yahoo2_callbacks.h @ 73ee390

Last change on this file since 73ee390 was 6f10697, checked in by dequis <dx@…>, at 2015-01-16T19:50:23Z

Fix incorrect Free Software Foundation address

  • Property mode set to 100644
File size: 24.7 KB
Line 
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  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#ifndef YAHOO2_CALLBACKS_H
33#define YAHOO2_CALLBACKS_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include "yahoo2_types.h"
40
41/*
42 * yahoo2_callbacks.h
43 *
44 * Callback interface for libyahoo2
45 */
46
47        typedef enum {
48                YAHOO_INPUT_READ = 1 << 0,
49                YAHOO_INPUT_WRITE = 1 << 1,
50                YAHOO_INPUT_EXCEPTION = 1 << 2
51        } yahoo_input_condition;
52
53/*
54 * A callback function called when an asynchronous connect completes.
55 *
56 * Params:
57 *     fd    - The file descriptor object that has been connected, or NULL on
58 *             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 */
65        typedef void (*yahoo_connect_callback) (void *fd, int error,
66                void *callback_data);
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 */
96        void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response) (int id, int succ,
97                const char *url);
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 */
106        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies) (int id, YList *buds);
107
108/*
109 * Name: ext_yahoo_got_ignore
110 *      Called when the ignore list is got from the server
111 * Params:
112 *      id   - the id that identifies the server connection
113 *      igns - the ignore list
114 */
115//      void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore) (int id, YList *igns);
116
117/*
118 * Name: ext_yahoo_got_identities
119 *      Called when the contact list is got from the server
120 * Params:
121 *      id   - the id that identifies the server connection
122 *      ids  - the identity list
123 */
124        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities) (int id, YList *ids);
125
126/*
127 * Name: ext_yahoo_got_cookies
128 *      Called when the cookie list is got from the server
129 * Params:
130 *      id   - the id that identifies the server connection
131 */
132        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies) (int id);
133
134/*
135 * Name: ext_yahoo_got_ping
136 *      Called when the ping packet is received from the server
137 * Params:
138 *      id   - the id that identifies the server connection
139 *  errormsg - optional error message
140 */
141        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping) (int id,
142                const char *errormsg);
143
144/*
145 * Name: ext_yahoo_status_changed
146 *      Called when remote user's status changes.
147 * Params:
148 *      id   - the id that identifies the server connection
149 *      who  - the handle of the remote user
150 *      stat - status code (enum yahoo_status)
151 *      msg  - the message if stat == YAHOO_STATUS_CUSTOM
152 *      away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
153 *      idle - this is the number of seconds he is idle [if he is idle]
154 *      mobile - this is set for mobile users/buddies
155 *      TODO: add support for pager, chat, and game states
156 */
157        void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed) (int id,
158                const char *who, int stat, const char *msg, int away, int idle,
159                int mobile);
160
161/*
162 * Name: ext_yahoo_got_buzz
163 *      Called when remote user sends you a buzz.
164 * Params:
165 *      id   - the id that identifies the server connection
166 *      me   - the identity the message was sent to
167 *      who  - the handle of the remote user
168 *      tm   - timestamp of message if offline
169 */
170        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buzz) (int id, const char *me,
171                const char *who, long tm);
172
173/*
174 * Name: ext_yahoo_got_im
175 *      Called when remote user sends you a message.
176 * Params:
177 *      id   - the id that identifies the server connection
178 *      me   - the identity the message was sent to
179 *      who  - the handle of the remote user
180 *      msg  - the message - NULL if stat == 2
181 *      tm   - timestamp of message if offline
182 *      stat - message status - 0
183 *                              1
184 *                              2 == error sending message
185 *                              5
186 *      utf8 - whether the message is encoded as utf8 or not
187 */
188        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im) (int id, const char *me,
189                const char *who, const char *msg, long tm, int stat, int utf8);
190
191/*
192 * Name: ext_yahoo_got_conf_invite
193 *      Called when remote user sends you a conference invitation.
194 * Params:
195 *      id   - the id that identifies the server connection
196 *      me   - the identity the invitation was sent to
197 *      who  - the user inviting you
198 *      room - the room to join
199 *      msg  - the message
200 *      members - the initial members of the conference (null terminated list)
201 */
202        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite) (int id,
203                const char *me, const char *who, const char *room,
204                const char *msg, YList *members);
205
206/*
207 * Name: ext_yahoo_conf_userdecline
208 *      Called when someone declines to join the conference.
209 * Params:
210 *      id   - the id that identifies the server connection
211 *      me   - the identity in the conference
212 *      who  - the user who has declined
213 *      room - the room
214 *      msg  - the declining message
215 */
216        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline) (int id,
217                const char *me, const char *who, const char *room,
218                const char *msg);
219
220/*
221 * Name: ext_yahoo_conf_userjoin
222 *      Called when someone joins the conference.
223 * Params:
224 *      id   - the id that identifies the server connection
225 *      me   - the identity in the conference
226 *      who  - the user who has joined
227 *      room - the room joined
228 */
229        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin) (int id,
230                const char *me, const char *who, const char *room);
231
232/*
233 * Name: ext_yahoo_conf_userleave
234 *      Called when someone leaves the conference.
235 * Params:
236 *      id   - the id that identifies the server connection
237 *      me   - the identity in the conference
238 *      who  - the user who has left
239 *      room - the room left
240 */
241        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave) (int id,
242                const char *me, const char *who, const char *room);
243
244/*
245 * Name: ext_yahoo_chat_cat_xml
246 *      Called when ?
247 * Params:
248 *      id      - the id that identifies the server connection
249 *      xml     - ?
250 */
251        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml) (int id,
252                const char *xml);
253
254/*
255 * Name: ext_yahoo_chat_join
256 *      Called when joining the chatroom.
257 * Params:
258 *      id      - the id that identifies the server connection
259 *      me   - the identity in the chatroom
260 *      room    - the room joined, used in all other chat calls, freed by
261 *                library after call
262 *      topic   - the topic of the room, freed by library after call
263 *      members - the initial members of the chatroom (null terminated YList
264 *                of yahoo_chat_member's) Must be freed by the client
265 *      fd      - the object where the connection is coming from (for tracking)
266 */
267        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join) (int id, const char *me,
268                const char *room, const char *topic, YList *members, void *fd);
269
270/*
271 * Name: ext_yahoo_chat_userjoin
272 *      Called when someone joins the chatroom.
273 * Params:
274 *      id   - the id that identifies the server connection
275 *      me   - the identity in the chatroom
276 *      room - the room joined
277 *      who  - the user who has joined, Must be freed by the client
278 */
279        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin) (int id,
280                const char *me, const char *room,
281                struct yahoo_chat_member *who);
282
283/*
284 * Name: ext_yahoo_chat_userleave
285 *      Called when someone leaves the chatroom.
286 * Params:
287 *      id   - the id that identifies the server connection
288 *      me   - the identity in the chatroom
289 *      room - the room left
290 *      who  - the user who has left (Just the User ID)
291 */
292        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave) (int id,
293                const char *me, const char *room, const char *who);
294
295/*
296 * Name: ext_yahoo_chat_message
297 *      Called when someone messages in the chatroom.
298 * Params:
299 *      id   - the id that identifies the server connection
300 *      me   - the identity in the chatroom
301 *      room - the room
302 *      who  - the user who messaged (Just the user id)
303 *      msg  - the message
304 *      msgtype  - 1 = Normal message
305 *                 2 = /me type message
306 *      utf8 - whether the message is utf8 encoded or not
307 */
308        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message) (int id,
309                const char *me, const char *who, const char *room,
310                const char *msg, int msgtype, int utf8);
311
312/*
313 *
314 * Name: ext_yahoo_chat_yahoologout
315 *      called when yahoo disconnects your chat session
316 *      Note this is called whenver a disconnect happens, client or server
317 *      requested. Care should be taken to make sure you know the origin
318 *      of the disconnect request before doing anything here (auto-join's etc)
319 * Params:
320 *      id   - the id that identifies this connection
321 *      me   - the identity in the chatroom
322 * Returns:
323 *      nothing.
324 */
325        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout) (int id,
326                const char *me);
327
328/*
329 *
330 * Name: ext_yahoo_chat_yahooerror
331 *      called when yahoo sends back an error to you
332 *      Note this is called whenver chat message is sent into a room
333 *      in error (fd not connected, room doesn't exists etc)
334 *      Care should be taken to make sure you know the origin
335 *      of the error before doing anything about it.
336 * Params:
337 *      id   - the id that identifies this connection
338 *      me   - the identity in the chatroom
339 * Returns:
340 *      nothing.
341 */
342        void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror) (int id,
343                const char *me);
344
345/*
346 * Name: ext_yahoo_conf_message
347 *      Called when someone messages in the conference.
348 * Params:
349 *      id   - the id that identifies the server connection
350 *      me   - the identity the conf message was sent to
351 *      who  - the user who messaged
352 *      room - the room
353 *      msg  - the message
354 *      utf8 - whether the message is utf8 encoded or not
355 */
356        void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message) (int id,
357                const char *me, const char *who, const char *room,
358                const char *msg, int utf8);
359
360/*
361 * Name: ext_yahoo_got_file
362 *      Called when someone sends you a file
363 * Params:
364 *      id   - the id that identifies the server connection
365 *      me   - the identity the file was sent to
366 *      who  - the user who sent the file
367 *      msg  - the message
368 *      fname- the file name if direct transfer
369 *      fsize- the file size if direct transfer
370 *      trid - transfer id. Unique for this transfer
371 *
372 * NOTE: Subsequent callbacks for file transfer do not send all of this
373 * information again since it is wasteful. Implementations are expected to
374 * save this information and supply it as callback data when the file or
375 * confirmation is sent
376 */
377        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file) (int id, const char *me,
378                const char *who, const char *msg, const char *fname,
379                unsigned long fesize, char *trid);
380
381/*
382 * Name: ext_yahoo_got_ft_data
383 *      Called multiple times when parts of the file are received
384 * Params:
385 *      id   - the id that identifies the server connection
386 *      in   - The data
387 *      len  - Length of the data
388 *      data - callback data
389 */
390        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ft_data) (int id,
391                const unsigned char *in, int len, void *data);
392
393/*
394 * Name: ext_yahoo_file_transfer_done
395 *      File transfer is done
396 * Params:
397 *      id     - the id that identifies the server connection
398 *      result - To notify if it finished successfully or with a failure
399 *      data   - callback data
400 */
401        void YAHOO_CALLBACK_TYPE(ext_yahoo_file_transfer_done) (int id,
402                int result, void *data);
403
404/*
405 * Name: ext_yahoo_contact_added
406 *      Called when a contact is added to your list
407 * Params:
408 *      id   - the id that identifies the server connection
409 *      myid - the identity he was added to
410 *      who  - who was added
411 *      msg  - any message sent
412 */
413        void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added) (int id,
414                const char *myid, const char *who, const char *msg);
415
416/*
417 * Name: ext_yahoo_rejected
418 *      Called when a contact rejects your add
419 * Params:
420 *      id   - the id that identifies the server connection
421 *      who  - who rejected you
422 *      msg  - any message sent
423 */
424        void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected) (int id, const char *who,
425                const char *msg);
426
427/*
428 * Name: ext_yahoo_typing_notify
429 *      Called when remote user starts or stops typing.
430 * Params:
431 *      id   - the id that identifies the server connection
432 *      me   - the handle of the identity the notification is sent to
433 *      who  - the handle of the remote user
434 *      stat - 1 if typing, 0 if stopped typing
435 */
436        void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify) (int id,
437                const char *me, const char *who, int stat);
438
439/*
440 * Name: ext_yahoo_game_notify
441 *      Called when remote user starts or stops a game.
442 * Params:
443 *      id   - the id that identifies the server connection
444 *      me   - the handle of the identity the notification is sent to
445 *      who  - the handle of the remote user
446 *      stat - 1 if game, 0 if stopped gaming
447 *      msg  - game description and/or other text
448 */
449        void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify) (int id, const char *me,
450                const char *who, int stat, const char *msg);
451
452/*
453 * Name: ext_yahoo_mail_notify
454 *      Called when you receive mail, or with number of messages
455 * Params:
456 *      id   - the id that identifies the server connection
457 *      from - who the mail is from - NULL if only mail count
458 *      subj - the subject of the mail - NULL if only mail count
459 *      cnt  - mail count - 0 if new mail notification
460 */
461        void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify) (int id,
462                const char *from, const char *subj, int cnt);
463
464/*
465 * Name: ext_yahoo_system_message
466 *      System message
467 * Params:
468 *      id   - the id that identifies the server connection
469 *      me   - the handle of the identity the notification is sent to
470 *      who  - the source of the system message (there are different types)
471 *      msg  - the message
472 */
473        void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message) (int id,
474                const char *me, const char *who, const char *msg);
475
476/*
477 * Name: ext_yahoo_got_buddyicon
478 *      Buddy icon received
479 * Params:
480 *      id - the id that identifies the server connection
481 *      me - the handle of the identity the notification is sent to
482 *      who - the person the buddy icon is for
483 *      url - the url to use to load the icon
484 *      checksum - the checksum of the icon content
485 */
486        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon) (int id,
487                const char *me, const char *who, const char *url, int checksum);
488
489/*
490 * Name: ext_yahoo_got_buddyicon_checksum
491 *      Buddy icon checksum received
492 * Params:
493 *      id - the id that identifies the server connection
494 *      me - the handle of the identity the notification is sent to
495 *      who - the yahoo id of the buddy icon checksum is for
496 *      checksum - the checksum of the icon content
497 */
498        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_checksum) (int id,
499                const char *me, const char *who, int checksum);
500
501/*
502 * Name: ext_yahoo_got_buddyicon_request
503 *      Buddy icon request received
504 * Params:
505 *      id - the id that identifies the server connection
506 *      me - the handle of the identity the notification is sent to
507 *      who - the yahoo id of the buddy that requested the buddy icon
508 */
509        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddyicon_request) (int id,
510                const char *me, const char *who);
511
512/*
513 * Name: ext_yahoo_got_buddyicon_request
514 *      Buddy icon request received
515 * Params:
516 *      id - the id that identifies the server connection
517 *      url - remote url, the uploaded buddy icon can be fetched from
518 */
519        void YAHOO_CALLBACK_TYPE(ext_yahoo_buddyicon_uploaded) (int id,
520                const char *url);
521
522/*
523 * Name: ext_yahoo_got_webcam_image
524 *      Called when you get a webcam update
525 *      An update can either be receiving an image, a part of an image or
526 *      just an update with a timestamp
527 * Params:
528 *      id         - the id that identifies the server connection
529 *      who        - the user who's webcam we're viewing
530 *      image      - image data
531 *      image_size - length of the image in bytes
532 *      real_size  - actual length of image data
533 *      timestamp  - milliseconds since the webcam started
534 *
535 *      If the real_size is smaller then the image_size then only part of
536 *      the image has been read. This function will keep being called till
537 *      the total amount of bytes in image_size has been read. The image
538 *      received is in JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1).
539 *      The size of the image will be either 160x120 or 320x240.
540 *      Each webcam image contains a timestamp. This timestamp should be
541 *      used to keep the image in sync since some images can take longer
542 *      to transport then others. When image_size is 0 we can still receive
543 *      a timestamp to stay in sync
544 */
545        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image) (int id,
546                const char *who, const unsigned char *image,
547                unsigned int image_size, unsigned int real_size,
548                unsigned int timestamp);
549
550/*
551 * Name: ext_yahoo_webcam_invite
552 *      Called when you get a webcam invitation
553 * Params:
554 *      id   - the id that identifies the server connection
555 *      me   - identity the invitation is to
556 *      from - who the invitation is from
557 */
558        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite) (int id,
559                const char *me, const char *from);
560
561/*
562 * Name: ext_yahoo_webcam_invite_reply
563 *      Called when you get a response to a webcam invitation
564 * Params:
565 *      id   - the id that identifies the server connection
566 *      me   - identity the invitation response is to
567 *      from - who the invitation response is from
568 *      accept - 0 (decline), 1 (accept)
569 */
570        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply) (int id,
571                const char *me, const char *from, int accept);
572
573/*
574 * Name: ext_yahoo_webcam_closed
575 *      Called when the webcam connection closed
576 * Params:
577 *      id   - the id that identifies the server connection
578 *      who  - the user who we where connected to
579 *      reason - reason why the connection closed
580 *               1 = user stopped broadcasting
581 *               2 = user cancelled viewing permission
582 *               3 = user declines permission
583 *               4 = user does not have webcam online
584 */
585        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed) (int id,
586                const char *who, int reason);
587
588/*
589 * Name: ext_yahoo_got_search_result
590 *      Called when the search result received from server
591 * Params:
592 *      id       - the id that identifies the server connection
593 *      found    - total number of results returned in the current result set
594 *      start    - offset from where the current result set starts
595 *      total    - total number of results available (start + found <= total)
596 *      contacts - the list of results as a YList of yahoo_found_contact
597 *                 these will be freed after this function returns, so
598 *                 if you need to use the information, make a copy
599 */
600        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result) (int id,
601                int found, int start, int total, YList *contacts);
602
603/*
604 * Name: ext_yahoo_error
605 *      Called on error.
606 * Params:
607 *      id   - the id that identifies the server connection
608 *      err  - the error message
609 *      fatal- whether this error is fatal to the connection or not
610 *      num  - Which error is this
611 */
612        void YAHOO_CALLBACK_TYPE(ext_yahoo_error) (int id, const char *err,
613                int fatal, int num);
614
615/*
616 * Name: ext_yahoo_webcam_viewer
617 *      Called when a viewer disconnects/connects/requests to connect
618 * Params:
619 *      id  - the id that identifies the server connection
620 *      who - the viewer
621 *      connect - 0=disconnect 1=connect 2=request
622 */
623        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer) (int id,
624                const char *who, int connect);
625
626/*
627 * Name: ext_yahoo_webcam_data_request
628 *      Called when you get a request for webcam images
629 * Params:
630 *      id   - the id that identifies the server connection
631 *      send - whether to send images or not
632 */
633        void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request) (int id,
634                int send);
635
636/*
637 * Name: ext_yahoo_log
638 *      Called to log a message.
639 * Params:
640 *      fmt  - the printf formatted message
641 * Returns:
642 *      0
643 */
644        int YAHOO_CALLBACK_TYPE(ext_yahoo_log) (const char *fmt, ...);
645
646/*
647 * Name: ext_yahoo_add_handler
648 *      Add a listener for the fd.  Must call yahoo_read_ready
649 *      when a YAHOO_INPUT_READ fd is ready and yahoo_write_ready
650 *      when a YAHOO_INPUT_WRITE fd is ready.
651 * Params:
652 *      id   - the id that identifies the server connection
653 *      fd   - the fd object on which to listen
654 *      cond - the condition on which to call the callback
655 *      data - callback data to pass to yahoo_*_ready
656 *     
657 * Returns: a tag to be used when removing the handler
658 */
659        int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler) (int id, void *fd,
660                yahoo_input_condition cond, void *data);
661
662/*
663 * Name: ext_yahoo_remove_handler
664 *      Remove the listener for the fd.
665 * Params:
666 *      id   - the id that identifies the connection
667 *      tag  - the handler tag to remove
668 */
669        void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler) (int id, int tag);
670
671/*
672 * Name: ext_yahoo_connect
673 *      Connect to a host:port
674 * Params:
675 *      host - the host to connect to
676 *      port - the port to connect on
677 * Returns:
678 *      a unix file descriptor to the socket
679 */
680//      int YAHOO_CALLBACK_TYPE(ext_yahoo_connect) (const char *host, int port);
681
682/*
683 * Name: ext_yahoo_connect_async
684 *      Connect to a host:port asynchronously. This function should return
685 *      immediately returing a tag used to identify the connection handler,
686 *      or a pre-connect error (eg: host name lookup failure).
687 *      Once the connect completes (successfully or unsuccessfully), callback
688 *      should be called (see the signature for yahoo_connect_callback).
689 *      The callback may safely be called before this function returns, but
690 *      it should not be called twice.
691 * Params:
692 *      id   - the id that identifies this connection
693 *      host - the host to connect to
694 *      port - the port to connect on
695 *      callback - function to call when connect completes
696 *      callback_data - data to pass to the callback function
697 *      use_ssl - Whether we need an SSL connection
698 * Returns:
699 *      a tag signifying the connection attempt
700 */
701        int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async) (int id,
702                const char *host, int port, yahoo_connect_callback callback,
703                void *callback_data, int use_ssl);
704
705/*
706 * Name: ext_yahoo_get_ip_addr
707 *      get IP Address for a domain name
708 * Params:
709 *      domain - Domain name
710 * Returns:
711 *      Newly allocated string containing the IP Address in IPv4 notation
712 */
713        char *YAHOO_CALLBACK_TYPE(ext_yahoo_get_ip_addr) (const char *domain);
714
715/*
716 * Name: ext_yahoo_write
717 *      Write data from the buffer into the socket for the specified connection
718 * Params:
719 *      fd  - the file descriptor object that identifies this connection
720 *      buf - Buffer to write the data from
721 *      len - Length of the data
722 * Returns:
723 *      Number of bytes written or -1 for error
724 */
725        int YAHOO_CALLBACK_TYPE(ext_yahoo_write) (void *fd, char *buf, int len);
726
727/*
728 * Name: ext_yahoo_read
729 *      Read data into a buffer from socket for the specified connection
730 * Params:
731 *      fd  - the file descriptor object that identifies this connection
732 *      buf - Buffer to read the data into
733 *      len - Max length to read
734 * Returns:
735 *      Number of bytes read or -1 for error
736 */
737        int YAHOO_CALLBACK_TYPE(ext_yahoo_read) (void *fd, char *buf, int len);
738
739/*
740 * Name: ext_yahoo_close
741 *      Close the file descriptor object and free its resources. Libyahoo2 will not
742 *      use this object again.
743 * Params:
744 *      fd  - the file descriptor object that identifies this connection
745 * Returns:
746 *      Nothing
747 */
748        void YAHOO_CALLBACK_TYPE(ext_yahoo_close) (void *fd);
749
750/*
751 * Name: ext_yahoo_got_buddy_change_group
752 *      Acknowledgement of buddy changing group
753 * Params:
754 *      id: client id
755 *      me: The user
756 *      who: Buddy name
757 *      old_group: Old group name
758 *      new_group: New group name
759 * Returns:
760 *      Nothing
761 */
762        void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddy_change_group) (int id,
763                const char *me, const char *who, const char *old_group,
764                const char *new_group);
765
766#ifdef USE_STRUCT_CALLBACKS
767};
768
769/*
770 * if using a callback structure, call yahoo_register_callbacks
771 * before doing anything else
772 */
773void yahoo_register_callbacks(struct yahoo_callbacks *tyc);
774
775#undef YAHOO_CALLBACK_TYPE
776
777#endif
778
779#ifdef __cplusplus
780}
781#endif
782
783#endif
Note: See TracBrowser for help on using the repository browser.