1 /*
2 * This file is part of the Sofia-SIP package
3 *
4 * Copyright (C) 2005 Nokia Corporation.
5 *
6 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25 #ifndef SU_WAIT_H
26 /** Defined when <sofia-sip/su_wait.h> has been included. */
27 #define SU_WAIT_H
28
29 /**@ingroup su_wait
30 * @file sofia-sip/su_wait.h Syncronization and threading interface.
31 *
32 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
33 * @author Martti Mela <Martti.Mela@nokia.com>
34 *
35 * @date Created: Tue Sep 14 15:51:04 1999 ppessi
36 */
37
38 /* ---------------------------------------------------------------------- */
39 /* Includes */
40
41 #ifndef SU_H
42 #include "sofia-sip/su.h"
43 #endif
44
45 #ifndef SU_TIME_H
46 #include "sofia-sip/su_time.h"
47 #endif
48
49 #if SU_HAVE_POLL
50 #include <poll.h>
51 #endif
52
53 SOFIA_BEGIN_DECLS
54
55 /* ---------------------------------------------------------------------- */
56 /* Constants */
57
58 #if SU_HAVE_KQUEUE
59 /** Compare wait object. @HI */
60 #define SU_WAIT_CMP(x, y) \
61 (((x).ident - (y).ident) ? ((x).ident - (y).ident) : ((x).flags - (y).flags))
62
63 /** Incoming data is available on socket. @HI */
64 #define SU_WAIT_IN (EVFILT_READ)
65 /** Data can be sent on socket. @HI */
66 #define SU_WAIT_OUT (EVFILT_WRITE)
67 /** Socket is connected. @HI */
68 #define SU_WAIT_CONNECT (EVFILT_WRITE)
69 /** An error occurred on socket. @HI */
70 #define SU_WAIT_ERR (EV_ERROR)
71 /** The socket connection was closed. @HI */
72 #define SU_WAIT_HUP (EV_EOF)
73 /** A listening socket accepted a new connection. @HI */
74 #define SU_WAIT_ACCEPT (EVFILT_READ)
75
76 /** No timeout for su_wait(). */
77 #define SU_WAIT_FOREVER (-1)
78 /** The return value of su_wait() if timeout occurred. */
79 #define SU_WAIT_TIMEOUT (-2)
80
81 /** Initializer for a wait object. @HI */
82 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0, 0, 0, NULL }
83
84 /** Maximum number of sources supported by su_wait() */
85 #define SU_WAIT_MAX (0x7fffffff)
86
87 #elif SU_HAVE_POLL || DOCUMENTATION_ONLY
88 /** Compare wait object. @HI */
89 #define SU_WAIT_CMP(x, y) \
90 (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
91
92 /** Incoming data is available on socket. @HI */
93 #define SU_WAIT_IN (POLLIN)
94 /** Data can be sent on socket. @HI */
95 #define SU_WAIT_OUT (POLLOUT)
96 /** Socket is connected. @HI */
97 #define SU_WAIT_CONNECT (POLLOUT)
98 /** An error occurred on socket. @HI */
99 #define SU_WAIT_ERR (POLLERR)
100 /** The socket connection was closed. @HI */
101 #define SU_WAIT_HUP (POLLHUP)
102 /** A listening socket accepted a new connection. @HI */
103 #define SU_WAIT_ACCEPT (POLLIN)
104
105 /** No timeout for su_wait(). */
106 #define SU_WAIT_FOREVER (-1)
107 /** The return value of su_wait() if timeout occurred. */
108 #define SU_WAIT_TIMEOUT (-2)
109
110 /** Initializer for a wait object. @HI */
111 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
112
113 /** Maximum number of sources supported by su_wait() */
114 #define SU_WAIT_MAX (0x7fffffff)
115
116 #elif SU_HAVE_WINSOCK
117
118 #define SU_WAIT_CMP(x, y) ((intptr_t)(x) - (intptr_t)(y))
119
120 #define SU_WAIT_IN (FD_READ)
121 #define SU_WAIT_OUT (FD_WRITE)
122 #define SU_WAIT_CONNECT (FD_CONNECT)
123 #define SU_WAIT_ERR (0) /* let's get it on */
124 #define SU_WAIT_HUP (FD_CLOSE)
125 #define SU_WAIT_ACCEPT (FD_ACCEPT)
126
127 #define SU_WAIT_FOREVER (WSA_INFINITE)
128 #define SU_WAIT_TIMEOUT (WSA_WAIT_TIMEOUT)
129
130 #define SU_WAIT_INIT NULL
131
132 #define SU_WAIT_MAX (0x7fffffff)
133
134 #else
135 /* If nothing works, try these */
136
137 #define POLLIN 0x001
138 #define POLLPRI 0x002
139 #define POLLOUT 0x004
140
141 #ifdef __USE_XOPEN
142 #define POLLRDNORM 0x040
143 #define POLLRDBAND 0x080
144 #define POLLWRNORM 0x100
145 #define POLLWRBAND 0x200
146 #endif
147
148 /* These for pollfd.revents */
149 #define POLLERR 0x008
150 #define POLLHUP 0x010
151 #define POLLNVAL 0x020
152
153 #define SU_WAIT_CMP(x, y) \
154 (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
155
156 #define SU_WAIT_IN POLLIN
157 #define SU_WAIT_OUT POLLOUT
158 #define SU_WAIT_CONNECT POLLOUT
159 #define SU_WAIT_ERR POLLERR
160 #define SU_WAIT_HUP POLLHUP
161 #define SU_WAIT_ACCEPT POLLIN
162 #define SU_WAIT_FOREVER (-1)
163 #define SU_WAIT_TIMEOUT (-2)
164
165 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
166
167 /** Maximum number of sources supported by su_wait() */
168 #define SU_WAIT_MAX (0x7fffffff)
169
170 #endif
171
172 /* ---------------------------------------------------------------------- */
173 /* Types */
174
175 /** Wait object. */
176 #if SU_HAVE_KQUEUE
177 typedef struct kevent su_wait_t;
178 #elif SU_HAVE_POLL
179 typedef struct pollfd su_wait_t;
180 #elif SU_HAVE_WINSOCK
181 typedef HANDLE su_wait_t;
182 #else
183 /* typedef struct os_specific su_wait_t; */
184 typedef struct pollfd su_wait_t;
185 struct pollfd {
186 su_socket_t fd; /* file descriptor */
187 short events; /* requested events */
188 short revents; /* returned events */
189 };
190
191
192 /* Type used for the number of file descriptors. */
193 typedef unsigned long int nfds_t;
194
195 /* Poll the file descriptors described by the NFDS structures starting at
196 FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
197 an event to occur; if TIMEOUT is -1, block until an event occurs.
198 Returns the number of file descriptors with events, zero if timed out,
199 or -1 for errors. */
200 int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
201
202 #endif
203
204 /* Used by AD */
205 typedef int su_success_t;
206
207 /* ---------------------------------------------------------------------- */
208
209 /** <a href="#su_root_t">Root object</a> type. */
210 typedef struct su_root_s su_root_t;
211
212 #ifndef SU_ROOT_MAGIC_T
213 /**Default type of application context for <a href="#su_root_t">su_root_t</a>.
214 *
215 * Application may define the typedef ::su_root_magic_t to appropriate type
216 * by defining macro SU_ROOT_MAGIC_T before including <sofia-sip/su_wait.h>, for
217 * example,
218 * @code
219 * #define SU_ROOT_MAGIC_T struct context
220 f * #include <sofia-sip/su_wait.h>
221 * @endcode
222 */
223 #define SU_ROOT_MAGIC_T void
224 #endif
225
226 /** <a href="#su_root_t">Root context</a> pointer type.
227 *
228 * Application may define the typedef ::su_root_magic_t to appropriate type
229 * by defining macro SU_ROOT_MAGIC_T () before including <sofia-sip/su_wait.h>, for
230 * example,
231 * @code
232 * #define SU_ROOT_MAGIC_T struct context
233 * #include <sofia-sip/su_wait.h>
234 * @endcode
235 */
236 typedef SU_ROOT_MAGIC_T su_root_magic_t;
237
238 #ifndef SU_WAKEUP_ARG_T
239 /**Default type of @link ::su_wakeup_f wakeup function @endlink
240 * @link ::su_wakeup_arg_t argument type @endlink.
241 *
242 * The application can define the typedef ::su_wakeup_arg_t by defining
243 * the SU_WAKEUP_ARG_T () before including <sofia-sip/su_wait.h>, for example,
244 * @code
245 * #define SU_WAKEUP_ARG_T struct transport
246 * #include <sofia-sip/su_wait.h>
247 * @endcode
248 */
249 #define SU_WAKEUP_ARG_T void
250 #endif
251
252 /** @link ::su_wakeup_f Wakeup callback @endlink argument type.
253 *
254 * The application can define the typedef ::su_wakeup_arg_t by defining
255 * the SU_WAKEUP_ARG_T () before including <sofia-sip/su_wait.h>, for example,
256 * @code
257 * #define SU_WAKEUP_ARG_T struct transport
258 * #include <sofia-sip/su_wait.h>
259 * @endcode
260 */
261 typedef SU_WAKEUP_ARG_T su_wakeup_arg_t;
262
263 /** Wakeup callback function pointer type.
264 *
265 * Whenever a registered wait object receives an event, the @link
266 * ::su_wakeup_f callback function @endlink is invoked.
267 */
268 typedef int (*su_wakeup_f)(su_root_magic_t *,
269 su_wait_t *,
270 su_wakeup_arg_t *arg);
271
272 enum {
273 su_pri_normal, /**< Normal priority */
274 su_pri_first, /**< Elevated priority */
275 su_pri_realtime /**< Real-time priority */
276 };
277
278 struct _GSource;
279
280 /** Hint for number of registered fds in su_root */
281 SOFIAPUBVAR int su_root_size_hint;
282
283 /* ---------------------------------------------------------------------- */
284 /* Pre-poll callback */
285
286 #ifndef SU_PREPOLL_MAGIC_T
287 /**Default type of application context for prepoll function.
288 *
289 * Application may define the typedef ::su_prepoll_magic_t to appropriate type
290 * by defining macro #SU_PREPOLL_MAGIC_T before including <sofia-sip/su_wait.h>, for
291 * example,
292 * @code
293 * #define SU_PREPOLL_MAGIC_T struct context
294 * #include <sofia-sip/su_wait.h>
295 * @endcode
296 */
297 #define SU_PREPOLL_MAGIC_T void
298 #endif
299
300 /** <a href="#su_root_t">Root context</a> pointer type.
301 *
302 * Application may define the typedef ::su_prepoll_magic_t to appropriate type
303 * by defining macro #SU_PREPOLL_MAGIC_T before including <sofia-sip/su_wait.h>, for
304 * example,
305 * @code
306 * #define SU_PREPOLL_MAGIC_T struct context
307 * #include <sofia-sip/su_wait.h>
308 * @endcode
309 */
310 typedef SU_PREPOLL_MAGIC_T su_prepoll_magic_t;
311
312
313 /** Pre-poll callback function prototype.
314 *
315 *
316 */
317 typedef void su_prepoll_f(su_prepoll_magic_t *, su_root_t *);
318
319 /* ---------------------------------------------------------------------- */
320
321 /* Timers */
322 #ifdef SU_TIMER_T
323 #error SU_TIMER_T defined
324 #endif
325
326 #ifndef SU_TIMER_ARG_T
327 /** Default type of timer expiration callback function argument type.
328 * Application may define this to appropriate type before including
329 * <sofia-sip/su_wait.h>. */
330 #define SU_TIMER_ARG_T void
331 #endif
332
333 /** Timer object type. */
334 typedef struct su_timer_s su_timer_t;
335
336 /** Timer callback argument type. */
337 typedef SU_TIMER_ARG_T su_timer_arg_t;
338
339 /** Timeout function type. */
340 typedef void (*su_timer_f)(su_root_magic_t *magic,
341 su_timer_t *t,
342 su_timer_arg_t *arg);
343
344 #ifndef SU_TIMER_QUEUE_T
345 #define SU_TIMER_QUEUE_T su_timer_t *
346 #endif
347
348 typedef SU_TIMER_QUEUE_T su_timer_queue_t;
349
350 /* ---------------------------------------------------------------------- */
351
352 /* Tasks */
353
354 /** Port type. */
355 typedef struct su_port_s su_port_t;
356
357 typedef struct { su_port_t *sut_port; su_root_t *sut_root; } _su_task_t;
358
359 /** Task reference type. */
360 typedef _su_task_t su_task_r[1];
361
362 /** Initializer for a task reference. @HI */
363 #define SU_TASK_R_INIT {{ NULL, NULL }}
364
365 /* This must be used instead of su_task_r as return value type. */
366 typedef _su_task_t const *_su_task_r;
367
368 /* ---------------------------------------------------------------------- */
369
370 /* Messages */
371 #ifndef SU_MSG_ARG_T
372 /** Default type of su_msg_t message data. Application may define this to
373 * appropriate type before including <sofia-sip/su_wait.h>.
374 */
375 #define SU_MSG_ARG_T void
376 #endif
377
378 /** Message argument type. */
379 typedef SU_MSG_ARG_T su_msg_arg_t;
380
381 /** Message type. */
382 typedef struct su_msg_s su_msg_t;
383
384 /** Message reference type. */
385 typedef su_msg_t *su_msg_r[1];
386
387 /** Constant reference to su_msg.
388 *
389 * @note The reference is constant, but the message can be modified.
390 */
391 typedef su_msg_t * const su_msg_cr[1];
392
393 /** Initializer for a message reference. @HI */
394 #define SU_MSG_R_INIT { NULL }
395
396 /** Message delivery function type. */
397 typedef void su_msg_function(su_root_magic_t *magic,
398 su_msg_r msg,
399 su_msg_arg_t *arg);
400
401 /** Message deinitializer function type. @NEW_1_12_8 */
402 typedef void su_msg_deinit_function(su_msg_arg_t *arg);
403
404 /** Message delivery function pointer type. */
405 typedef su_msg_function *su_msg_f;
406
407
408 /* ---------------------------------------------------------------------- */
409
410 /* Clones */
411 #ifndef SU_CLONE_T
412 #define SU_CLONE_T struct su_clone_s
413 #endif
414
415 /** Clone reference. */
416 typedef SU_CLONE_T *su_clone_r[1];
417
418 /** Clone reference initializer. */
419 #define SU_CLONE_R_INIT {NULL}
420
421 /** Clone initialization function type. */
422 typedef int (*su_root_init_f)(su_root_t *, su_root_magic_t *);
423
424 /** Clone finalization function type. */
425 typedef void (*su_root_deinit_f)(su_root_t *, su_root_magic_t *);
426
427 /* ---------------------------------------------------------------------- */
428 /* Functions */
429
430 /* Wait */
431 SOFIAPUBFUN void su_wait_init(su_wait_t dst[1]);
432 SOFIAPUBFUN int su_wait_create(su_wait_t *dst, su_socket_t s, int events);
433 SOFIAPUBFUN int su_wait_destroy(su_wait_t *dst);
434 SOFIAPUBFUN int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
435 SOFIAPUBFUN int su_wait_events(su_wait_t *wait, su_socket_t s);
436 SOFIAPUBFUN int su_wait_mask(su_wait_t *dst, su_socket_t s, int events);
437
438 #if !HAVE_WIN32 && (SU_HAVE_POLL || HAVE_SELECT)
439 su_inline
su_wait_socket(su_wait_t * wait)440 su_socket_t su_wait_socket(su_wait_t *wait)
441 {
442 #if SU_HAVE_KQUEUE
443 return wait->ident;
444 #else
445 return wait->fd;
446 #endif
447 }
448 #endif
449
450 /* Root */
451 SOFIAPUBFUN su_root_t *su_root_create(su_root_magic_t *magic)
452 __attribute__((__malloc__));
453 SOFIAPUBFUN void su_root_destroy(su_root_t*);
454 SOFIAPUBFUN char const *su_root_name(su_root_t *self);
455 SOFIAPUBFUN int su_root_set_magic(su_root_t *self, su_root_magic_t *magic);
456 SOFIAPUBFUN su_root_magic_t *su_root_magic(su_root_t *root);
457 SOFIAPUBFUN int su_root_register(su_root_t*, su_wait_t *,
458 su_wakeup_f, su_wakeup_arg_t *,
459 int priority);
460 /* This is slow. Deprecated. */
461 SOFIAPUBFUN int su_root_unregister(su_root_t*, su_wait_t *,
462 su_wakeup_f, su_wakeup_arg_t*);
463 SOFIAPUBFUN int su_root_deregister(su_root_t*, int);
464 SOFIAPUBFUN int su_root_eventmask(su_root_t *,
465 int index, int socket, int events);
466 SOFIAPUBFUN su_duration_t su_root_step(su_root_t *root, su_duration_t timeout);
467 SOFIAPUBFUN su_duration_t su_root_sleep(su_root_t *root, su_duration_t);
468 SOFIAPUBFUN int su_root_multishot(su_root_t *root, int multishot);
469 SOFIAPUBFUN void su_root_run(su_root_t *root);
470 SOFIAPUBFUN void su_root_break(su_root_t *root);
471 SOFIAPUBFUN _su_task_r su_root_task(su_root_t const *root);
472 SOFIAPUBFUN _su_task_r su_root_parent(su_root_t const *root);
473
474 SOFIAPUBFUN int su_root_add_prepoll(su_root_t *root,
475 su_prepoll_f *,
476 su_prepoll_magic_t *);
477 SOFIAPUBFUN int su_root_remove_prepoll(su_root_t *root);
478
479 SOFIAPUBFUN struct _GSource *su_root_gsource(su_root_t *self);
480
481 SOFIAPUBFUN int su_root_yield(su_root_t *root);
482
483 SOFIAPUBFUN int su_root_release(su_root_t *root);
484 SOFIAPUBFUN int su_root_obtain(su_root_t *root);
485 SOFIAPUBFUN int su_root_has_thread(su_root_t *root);
486
487 SOFIAPUBFUN int su_root_set_max_defer(su_root_t *, su_duration_t max_defer);
488 SOFIAPUBFUN su_duration_t su_root_get_max_defer(su_root_t const *self);
489
490 SOFIAPUBFUN su_root_t *su_root_clone(su_root_t *root, su_root_magic_t *magic)
491 __attribute__((__malloc__));
492
493 /* Timers */
494 SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
495 __attribute__((__malloc__));
496 SOFIAPUBFUN void su_timer_destroy(su_timer_t *);
497 SOFIAPUBFUN int su_timer_is_set(su_timer_t const *t); /* 1.12.11 */
498 SOFIAPUBFUN su_time_t su_timer_latest(su_timer_t const *t);
499 SOFIAPUBFUN int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *);
500 SOFIAPUBFUN int su_timer_set_interval(su_timer_t *t, su_timer_f,
501 su_timer_arg_t *, su_duration_t);
502 SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
503 su_timer_arg_t *, su_time_t);
504 SOFIAPUBFUN int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *);
505 SOFIAPUBFUN int su_timer_set_for_ever(su_timer_t *, su_timer_f,
506 su_timer_arg_t *);
507 SOFIAPUBFUN int su_timer_reset(su_timer_t *);
508
509 SOFIAPUBFUN su_root_t *su_timer_root(su_timer_t const *);
510
511 SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const,
512 su_duration_t *tout,
513 su_time_t now);
514 SOFIAPUBFUN int su_timer_deferrable(su_timer_t *t, int value); /* 1.12.11 */
515
516 /* Tasks */
517
518 SOFIAPUBVAR su_task_r const su_task_null;
519
520 SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
521 SOFIAPUBFUN void su_task_deinit(su_task_r task);
522
523 SOFIAPUBFUN void su_task_copy(su_task_r dst, su_task_r const src);
524 SOFIAPUBFUN void su_task_move(su_task_r dst, su_task_r src);
525 SOFIAPUBFUN int su_task_cmp(su_task_r const, su_task_r const);
526 SOFIAPUBFUN int su_task_is_running(su_task_r const);
527
528 SOFIAPUBFUN su_root_t *su_task_root(su_task_r const self);
529 SOFIAPUBFUN su_timer_queue_t *su_task_timers(su_task_r const self);
530 SOFIAPUBFUN su_timer_queue_t *su_task_deferrable(su_task_r const task);
531
532 SOFIAPUBFUN int su_task_wakeup(su_task_r const task);
533
534 SOFIAPUBFUN int su_task_execute(su_task_r const task,
535 int (*function)(void *), void *arg,
536 int *return_value);
537
538 /* Messages */
539 SOFIAPUBFUN int su_msg_create(su_msg_r msg,
540 su_task_r const to, su_task_r const from,
541 su_msg_f wakeup, isize_t size);
542 SOFIAPUBFUN int su_msg_report(su_msg_r msg, su_msg_f report);
543 SOFIAPUBFUN int su_msg_deinitializer(su_msg_r msg, su_msg_deinit_function *);
544 SOFIAPUBFUN int su_msg_reply(su_msg_r reply, su_msg_cr msg,
545 su_msg_f wakeup, isize_t size);
546 SOFIAPUBFUN void su_msg_destroy(su_msg_r msg);
547 SOFIAPUBFUN void su_msg_save(su_msg_r msg, su_msg_r msg0);
548 SOFIAPUBFUN void su_msg_remove_refs(su_msg_cr msg);
549 SOFIAPUBFUN su_msg_arg_t *su_msg_data(su_msg_cr msg);
550 SOFIAPUBFUN isize_t su_msg_size(su_msg_cr msg);
551 SOFIAPUBFUN _su_task_r su_msg_from(su_msg_cr msg);
552 SOFIAPUBFUN _su_task_r su_msg_to(su_msg_cr msg);
553 SOFIAPUBFUN int su_msg_send(su_msg_r msg);
554
555 SOFIAPUBFUN int su_msg_new(su_msg_r msg, size_t size);
556 SOFIAPUBFUN int su_msg_send_to(su_msg_r msg,
557 su_task_r const to,
558 su_msg_f wakeup);
559
560 /** Does reference contain a message? */
561 #if SU_HAVE_INLINE
562 static SU_INLINE
su_msg_is_non_null(su_msg_cr msg)563 int su_msg_is_non_null(su_msg_cr msg)
564 {
565 return msg && *msg != NULL;
566 }
567 #else
568 #define su_msg_is_non_null(msg) ((msg) && (*(msg)) != NULL)
569 #endif
570
571 /* Clones */
572 SOFIAPUBFUN int su_root_threading(su_root_t *self, int enable);
573 SOFIAPUBFUN int su_clone_start(su_root_t *root,
574 su_clone_r,
575 su_root_magic_t *magic,
576 su_root_init_f,
577 su_root_deinit_f);
578 SOFIAPUBFUN _su_task_r su_clone_task(su_clone_r);
579 SOFIAPUBFUN void su_clone_forget(su_clone_r);
580 SOFIAPUBFUN void su_clone_stop(su_clone_r);
581 SOFIAPUBFUN void su_clone_wait(su_root_t *root, su_clone_r clone);
582
583 SOFIAPUBFUN int su_clone_pause(su_clone_r);
584 SOFIAPUBFUN int su_clone_resume(su_clone_r);
585
586 /* ---------------------------------------------------------------------- */
587 /* Different su_root_t implementations */
588
589 typedef su_port_t *su_port_create_f(void);
590 typedef int su_clone_start_f(su_root_t *parent,
591 su_clone_r return_clone,
592 su_root_magic_t *magic,
593 su_root_init_f init,
594 su_root_deinit_f deinit);
595
596 SOFIAPUBFUN void su_port_prefer(su_port_create_f *f, su_clone_start_f *);
597
598 SOFIAPUBFUN su_port_create_f su_default_port_create;
599 SOFIAPUBFUN su_port_create_f su_epoll_port_create;
600 SOFIAPUBFUN su_port_create_f su_poll_port_create;
601 SOFIAPUBFUN su_port_create_f su_wsaevent_port_create;
602 SOFIAPUBFUN su_port_create_f su_select_port_create;
603 SOFIAPUBFUN su_port_create_f su_kqueue_port_create;
604 SOFIAPUBFUN su_port_create_f su_devpoll_port_create;
605
606 SOFIAPUBFUN su_clone_start_f su_default_clone_start;
607 SOFIAPUBFUN su_clone_start_f su_epoll_clone_start;
608 SOFIAPUBFUN su_clone_start_f su_poll_clone_start;
609 SOFIAPUBFUN su_clone_start_f su_wsaevent_clone_start;
610 SOFIAPUBFUN su_clone_start_f su_select_clone_start;
611 SOFIAPUBFUN su_clone_start_f su_kqueue_clone_start;
612 SOFIAPUBFUN su_clone_start_f su_devpoll_clone_start;
613
614 SOFIA_END_DECLS
615
616 #endif /* SU_WAIT_H */
617