su  1.13.17
su_wait.h
Go to the documentation of this file.
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-email.address.hidden>
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
27 #define SU_WAIT_H
28 
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
60 #define SU_WAIT_CMP(x, y) \
61  (((x).ident - (y).ident) ? ((x).ident - (y).ident) : ((x).flags - (y).flags))
62 
64 #define SU_WAIT_IN (EVFILT_READ)
66 #define SU_WAIT_OUT (EVFILT_WRITE)
68 #define SU_WAIT_CONNECT (EVFILT_WRITE)
70 #define SU_WAIT_ERR (EV_ERROR)
72 #define SU_WAIT_HUP (EV_EOF)
74 #define SU_WAIT_ACCEPT (EVFILT_READ)
75 
77 #define SU_WAIT_FOREVER (-1)
79 #define SU_WAIT_TIMEOUT (-2)
80 
82 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0, 0, 0, NULL }
83 
85 #define SU_WAIT_MAX (0x7fffffff)
86 
87 #elif SU_HAVE_POLL || DOCUMENTATION_ONLY
89 #define SU_WAIT_CMP(x, y) \
90  (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
91 
93 #define SU_WAIT_IN (POLLIN)
95 #define SU_WAIT_OUT (POLLOUT)
97 #define SU_WAIT_CONNECT (POLLOUT)
99 #define SU_WAIT_ERR (POLLERR)
101 #define SU_WAIT_HUP (POLLHUP)
103 #define SU_WAIT_ACCEPT (POLLIN)
104 
106 #define SU_WAIT_FOREVER (-1)
108 #define SU_WAIT_TIMEOUT (-2)
109 
111 #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
112 
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 
168 #define SU_WAIT_MAX (0x7fffffff)
169 
170 #endif
171 
172 /* ---------------------------------------------------------------------- */
173 /* Types */
174 
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 
210 typedef struct su_root_s su_root_t;
211 
212 #ifndef SU_ROOT_MAGIC_T
223 #define SU_ROOT_MAGIC_T void
224 #endif
225 
237 
238 #ifndef SU_WAKEUP_ARG_T
249 #define SU_WAKEUP_ARG_T void
250 #endif
251 
262 
268 typedef int (*su_wakeup_f)(su_root_magic_t *,
269  su_wait_t *,
270  su_wakeup_arg_t *arg);
271 
272 enum {
276 };
277 
278 struct _GSource;
279 
282 
283 /* ---------------------------------------------------------------------- */
284 /* Pre-poll callback */
285 
286 #ifndef SU_PREPOLL_MAGIC_T
297 #define SU_PREPOLL_MAGIC_T void
298 #endif
299 
311 
312 
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
330 #define SU_TIMER_ARG_T void
331 #endif
332 
334 typedef struct su_timer_s su_timer_t;
335 
338 
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 
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 
360 typedef _su_task_t su_task_r[1];
361 
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
375 #define SU_MSG_ARG_T void
376 #endif
377 
380 
382 typedef struct su_msg_s su_msg_t;
383 
385 typedef su_msg_t *su_msg_r[1];
386 
391 typedef su_msg_t * const su_msg_cr[1];
392 
394 #define SU_MSG_R_INIT { NULL }
395 
397 typedef void su_msg_function(su_root_magic_t *magic,
398  su_msg_r msg,
399  su_msg_arg_t *arg);
400 
403 
406 
407 
408 /* ---------------------------------------------------------------------- */
409 
410 /* Clones */
411 #ifndef SU_CLONE_T
412 #define SU_CLONE_T struct su_clone_s
413 #endif
414 
416 typedef SU_CLONE_T *su_clone_r[1];
417 
419 #define SU_CLONE_R_INIT {NULL}
420 
423 
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);
434 SOFIAPUBFUN int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
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
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 */
452  __attribute__((__malloc__));
454 SOFIAPUBFUN char const *su_root_name(su_root_t *self);
459  int priority);
460 /* This is slow. Deprecated. */
465  int index, int socket, int events);
468 SOFIAPUBFUN int su_root_multishot(su_root_t *root, int multishot);
469 SOFIAPUBFUN void su_root_run(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 
475  su_prepoll_f *,
478 
479 SOFIAPUBFUN struct _GSource *su_root_gsource(su_root_t *self);
480 
482 
486 
489 
491  __attribute__((__malloc__));
492 
493 /* Timers */
495  __attribute__((__malloc__));
497 SOFIAPUBFUN int su_timer_is_set(su_timer_t const *t); /* 1.12.11 */
502 SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
506  su_timer_arg_t *);
508 
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 
519 
520 SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
522 
523 SOFIAPUBFUN void su_task_copy(su_task_r dst, su_task_r const src);
525 SOFIAPUBFUN int su_task_cmp(su_task_r const, su_task_r const);
527 
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 */
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);
545  su_msg_f wakeup, isize_t size);
547 SOFIAPUBFUN void su_msg_save(su_msg_r msg, su_msg_r msg0);
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);
554 
555 SOFIAPUBFUN int su_msg_new(su_msg_r msg, size_t size);
557  su_task_r const to,
558  su_msg_f wakeup);
559 
561 #if SU_HAVE_INLINE
562 static SU_INLINE
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);
574  su_clone_r,
575  su_root_magic_t *magic,
581 SOFIAPUBFUN void su_clone_wait(su_root_t *root, su_clone_r clone);
582 
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 */
int su_root_size_hint
Hint for number of registered fds in su_root.
Definition: su_root.c:118
Time in seconds and microsecondcs.
Definition: su_time.h:48
Socket and network address interface.
int su_socket_t
Socket descriptor type.
Definition: su.h:128
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition: su_config.h:66
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition: su_config.h:68
#define su_inline
Define as suitable declarator static inline functions.
Definition: su_configure.h:90
#define SU_INLINE
Define as suitable declarator inline functions.
Definition: su_configure.h:88
Time types and functions.
long su_duration_t
Time difference in microseconds.
Definition: su_time.h:61
su_task_r su_root_task(su_root_t const *root)
Get task reference.
Definition: su_root.c:915
struct su_root_t su_root_t
Root object type.
Definition: su_wait.h:210
SU_WAKEUP_ARG_T su_wakeup_arg_t
Wakeup callback argument type.
Definition: su_wait.h:261
int su_clone_resume(su_clone_r)
Resume a clone.
Definition: su_port.c:413
void su_msg_save(su_msg_r msg, su_msg_r msg0)
Save a message.
Definition: su_root.c:1165
su_time_t su_timer_latest(su_timer_t const *t)
Return when the timer has been last expired.
Definition: su_timer.c:367
int su_root_register(su_root_t *, su_wait_t *, su_wakeup_f, su_wakeup_arg_t *, int priority)
Register a su_wait_t object.
Definition: su_root.c:643
void su_wait_init(su_wait_t dst[1])
Initialize a wait object.
Definition: su_wait.c:106
int su_timer_is_set(su_timer_t const *t)
Check if the timer has been set.
Definition: su_timer.c:350
void(* su_root_deinit_f)(su_root_t *, su_root_magic_t *)
Clone finalization function type.
Definition: su_wait.h:425
int su_timer_set_interval(su_timer_t *t, su_timer_f, su_timer_arg_t *, su_duration_t)
Set the timer for the given interval.
Definition: su_timer.c:385
int su_msg_send(su_msg_r msg)
Send a message.
Definition: su_root.c:1282
int(* su_wakeup_f)(su_root_magic_t *, su_wait_t *, su_wakeup_arg_t *arg)
Wakeup callback function pointer type.
Definition: su_wait.h:268
su_task_r su_msg_from(su_msg_cr msg)
Get sending task.
Definition: su_root.c:1236
su_root_t * su_root_create(su_root_magic_t *magic))
Create a reactor object.
Definition: su_root.c:407
int su_root_multishot(su_root_t *root, int multishot)
Set multishot mode.
Definition: su_root.c:793
su_task_r su_root_parent(su_root_t const *root)
Get parent task reference.
Definition: su_root.c:932
int su_msg_report(su_msg_r msg, su_msg_f report)
Add a delivery report function to a message.
Definition: su_root.c:1077
void su_root_destroy(su_root_t *)
Destroy a root object.
Definition: su_root.c:500
su_duration_t su_root_sleep(su_root_t *root, su_duration_t)
Run event and message loop for given duration.
Definition: su_root.c:873
int su_root_obtain(su_root_t *root)
Obtain the root port from other thread.
Definition: su_root.c:984
#define SU_MSG_ARG_T
Default type of su_msg_t message data.
Definition: su_wait.h:375
void su_task_move(su_task_r dst, su_task_r src)
Moves a task handle.
Definition: su_root.c:223
SU_ROOT_MAGIC_T su_root_magic_t
Root context pointer type.
Definition: su_wait.h:236
void su_timer_destroy(su_timer_t *)
Destroy a timer.
Definition: su_timer.c:333
void su_root_run(su_root_t *root)
Run event and message loop.
Definition: su_root.c:813
int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *)
Set the timer for the default interval.
Definition: su_timer.c:407
struct pollfd su_wait_t
Wait object.
Definition: su_wait.h:184
void su_msg_function(su_root_magic_t *magic, su_msg_r msg, su_msg_arg_t *arg)
Message delivery function type.
Definition: su_wait.h:397
int(* su_root_init_f)(su_root_t *, su_root_magic_t *)
Clone initialization function type.
Definition: su_wait.h:422
_su_task_t su_task_r[1]
Task reference type.
Definition: su_wait.h:360
su_timer_t * su_timer_create(su_task_r const, su_duration_t msec))
Create a timer.
Definition: su_timer.c:308
int su_msg_create(su_msg_r msg, su_task_r const to, su_task_r const from, su_msg_f wakeup, isize_t size)
Allocates a message of given size.
Definition: su_root.c:1054
void su_msg_remove_refs(su_msg_cr msg)
Remove references to 'from' and 'to' tasks from a message.
Definition: su_root.c:1262
su_root_magic_t * su_root_magic(su_root_t *root)
Get context pointer.
Definition: su_root.c:606
#define SU_ROOT_MAGIC_T
Default type of application context for su_root_t.
Definition: su_wait.h:223
su_root_t * su_task_root(su_task_r const self)
Get root pointer attached to a task handle.
Definition: su_root.c:302
SU_PREPOLL_MAGIC_T su_prepoll_magic_t
Root context pointer type.
Definition: su_wait.h:310
#define SU_TIMER_ARG_T
Default type of timer expiration callback function argument type.
Definition: su_wait.h:330
su_duration_t su_root_get_max_defer(su_root_t const *self)
Get maximum defer time.
Definition: su_root.c:722
struct su_msg_s su_msg_t
Message type.
Definition: su_wait.h:382
int su_root_set_max_defer(su_root_t *, su_duration_t max_defer)
Set maximum defer time.
Definition: su_root.c:702
int su_root_yield(su_root_t *root)
Check wait events in callbacks that take lots of time.
Definition: su_root.c:898
struct _GSource * su_root_gsource(su_root_t *self)
Get a GSource.
Definition: su_root.c:615
su_msg_function * su_msg_f
Message delivery function pointer type.
Definition: su_wait.h:405
void su_task_copy(su_task_r dst, su_task_r const src)
Duplicates a task handle.
Definition: su_root.c:198
SU_CLONE_T * su_clone_r[1]
Clone reference.
Definition: su_wait.h:416
int su_root_deregister(su_root_t *, int)
Remove a su_wait_t registration.
Definition: su_root.c:743
int su_task_execute(su_task_r const task, int(*function)(void *), void *arg, int *return_value)
Execute the function by task thread.
Definition: su_root.c:366
su_duration_t su_root_step(su_root_t *root, su_duration_t timeout)
Process events, timers and messages.
Definition: su_root.c:853
int su_root_threading(su_root_t *self, int enable)
Set threading option.
Definition: su_root.c:584
int su_root_has_thread(su_root_t *root)
Check if a thread has obtained the root.
Definition: su_root.c:1002
int su_wait_destroy(su_wait_t *dst)
Destroy a wait object.
Definition: su_wait.c:185
void su_clone_wait(su_root_t *root, su_clone_r clone)
Stop a clone and wait until it is has completed.
Definition: su_port.c:369
int su_msg_deinitializer(su_msg_r msg, su_msg_deinit_function *)
Add a deinitializer function to a message.
Definition: su_root.c:1100
int su_root_set_magic(su_root_t *self, su_root_magic_t *magic)
Set the context pointer.
Definition: su_root.c:566
su_task_r su_msg_to(su_msg_cr msg)
Get destination task.
Definition: su_root.c:1253
su_root_t * su_timer_root(su_timer_t const *)
Get the root object owning the timer.
Definition: su_timer.c:661
int su_root_eventmask(su_root_t *, int index, int socket, int events)
Set mask for a registered event.
Definition: su_root.c:767
int su_root_remove_prepoll(su_root_t *root)
Remove a pre-poll callback.
Definition: su_root.c:953
su_task_r const su_task_null
NULL task.
Definition: su_root.c:133
su_msg_t *const su_msg_cr[1]
Constant reference to su_msg.
Definition: su_wait.h:391
void(* su_timer_f)(su_root_magic_t *magic, su_timer_t *t, su_timer_arg_t *arg)
Timeout function type.
Definition: su_wait.h:340
int su_msg_reply(su_msg_r reply, su_msg_cr msg, su_msg_f wakeup, isize_t size)
Allocates a reply message of given size.
Definition: su_root.c:1122
SU_TIMER_ARG_T su_timer_arg_t
Timer callback argument type.
Definition: su_wait.h:337
struct su_port_s su_port_t
Port type.
Definition: su_wait.h:355
void su_clone_stop(su_clone_r)
Stop the clone.
Definition: su_port.c:348
int su_task_cmp(su_task_r const, su_task_r const)
Compare two tasks with each other.
Definition: su_root.c:241
int su_wait_events(su_wait_t *wait, su_socket_t s)
Get events.
Definition: su_wait.c:298
int su_root_add_prepoll(su_root_t *root, su_prepoll_f *, su_prepoll_magic_t *)
Add a pre-poll callback.
Definition: su_root.c:941
su_timer_queue_t * su_task_deferrable(su_task_r const task)
Return the queue for deferrable timers associated with given task.
Definition: su_root.c:339
int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *)
Set the timer for regular intervals.
Definition: su_timer.c:455
int su_msg_new(su_msg_r msg, size_t size)
Allocate a su message of given size.
Definition: su_root.c:1026
int su_root_release(su_root_t *root)
Release the root port for other threads.
Definition: su_root.c:966
int su_wait_create(su_wait_t *dst, su_socket_t s, int events)
Create a wait object.
Definition: su_wait.c:132
int su_clone_start(su_root_t *root, su_clone_r, su_root_magic_t *magic, su_root_init_f, su_root_deinit_f)
Start a clone task.
Definition: su_port.c:288
su_msg_arg_t * su_msg_data(su_msg_cr msg)
Gets a pointer to the message data area.
Definition: su_root.c:1211
char const * su_root_name(su_root_t *self)
Get instance name.
Definition: su_root.c:548
int su_root_unregister(su_root_t *, su_wait_t *, su_wakeup_f, su_wakeup_arg_t *)
Unregister a su_wait_t object.
Definition: su_root.c:670
SU_MSG_ARG_T su_msg_arg_t
Message argument type.
Definition: su_wait.h:379
struct su_timer_s su_timer_t
Timer object type.
Definition: su_wait.h:334
void su_prepoll_f(su_prepoll_magic_t *, su_root_t *)
Pre-poll callback function prototype.
Definition: su_wait.h:317
void su_msg_deinit_function(su_msg_arg_t *arg)
Message deinitializer function type.
Definition: su_wait.h:402
su_root_t * su_root_clone(su_root_t *root, su_root_magic_t *magic))
Create a a new root object sharing port/thread with existing one.
Definition: su_root.c:432
int su_task_wakeup(su_task_r const task)
Wakeup a task.
Definition: su_root.c:356
#define SU_PREPOLL_MAGIC_T
Default type of application context for prepoll function.
Definition: su_wait.h:297
@ su_pri_first
Elevated priority.
Definition: su_wait.h:274
@ su_pri_normal
Normal priority.
Definition: su_wait.h:273
@ su_pri_realtime
Real-time priority.
Definition: su_wait.h:275
#define SU_WAKEUP_ARG_T
Default type of wakeup function argument type .
Definition: su_wait.h:249
void su_msg_destroy(su_msg_r msg)
Destroys an unsent message.
Definition: su_root.c:1182
int su_task_is_running(su_task_r const)
Tests if a task is running.
Definition: su_root.c:269
int su_timer_deferrable(su_timer_t *t, int value)
Change timer as deferrable (or as undeferrable).
Definition: su_timer.c:685
int su_timer_reset(su_timer_t *)
Reset the timer.
Definition: su_timer.c:509
int su_wait_mask(su_wait_t *dst, su_socket_t s, int events)
Set event mask.
Definition: su_wait.c:326
void su_root_break(su_root_t *root)
Terminate event loop.
Definition: su_root.c:829
void su_port_prefer(su_port_create_f *f, su_clone_start_f *)
Explicitly set the preferred su_port_t implementation.
Definition: su_port.c:102
isize_t su_msg_size(su_msg_cr msg)
Get size of message data area.
Definition: su_root.c:1220
int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
Wait for multiple events.
Definition: su_wait.c:222
int su_msg_send_to(su_msg_r msg, su_task_r const to, su_msg_f wakeup)
Send message to the to_task and mark from_task as sender.
Definition: su_root.c:1304
int su_clone_pause(su_clone_r)
Pause a clone.
Definition: su_port.c:386
void su_task_deinit(su_task_r task)
Destroy a task handle.
Definition: su_root.c:164
su_timer_queue_t * su_task_timers(su_task_r const self)
Return the timer list associated with given task.
Definition: su_root.c:326
su_task_r su_task_init(su_task_r task)
Initialize a task handle with su_task_null.
Definition: su_root.c:151
su_task_r su_clone_task(su_clone_r)
Get reference to a clone task.
Definition: su_port.c:323
su_msg_t * su_msg_r[1]
Message reference type.
Definition: su_wait.h:385
void su_clone_forget(su_clone_r)
Forget the clone.
Definition: su_port.c:336
int su_timer_set_for_ever(su_timer_t *, su_timer_f, su_timer_arg_t *)
Set the timer for regular intervals.
Definition: su_timer.c:486

Sofia-SIP 1.13.17 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.