su  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
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
26 
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 <sys/poll.h>
51 #endif
52 
53 SOFIA_BEGIN_DECLS
54 
55 /* ---------------------------------------------------------------------- */
56 /* Constants */
57 
58 #if SU_HAVE_KQUEUE
59 
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)
65 
66 #define SU_WAIT_OUT (EVFILT_WRITE)
67 
68 #define SU_WAIT_CONNECT (EVFILT_WRITE)
69 
70 #define SU_WAIT_ERR (EV_ERROR)
71 
72 #define SU_WAIT_HUP (EV_EOF)
73 
74 #define SU_WAIT_ACCEPT (EVFILT_READ)
75 
77 #define SU_WAIT_FOREVER (-1)
78 
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
88 
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)
94 
95 #define SU_WAIT_OUT (POLLOUT)
96 
97 #define SU_WAIT_CONNECT (POLLOUT)
98 
99 #define SU_WAIT_ERR (POLLERR)
100 
101 #define SU_WAIT_HUP (POLLHUP)
102 
103 #define SU_WAIT_ACCEPT (POLLIN)
104 
106 #define SU_WAIT_FOREVER (-1)
107 
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 (64)
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
213 
223 #define SU_ROOT_MAGIC_T void
224 #endif
225 
237 
238 #ifndef SU_WAKEUP_ARG_T
239 
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
287 
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
327 
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
372 
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 
492 
494  __attribute__((__malloc__));
495 
496 /* Timers */
498  __attribute__((__malloc__));
500 SOFIAPUBFUN int su_timer_is_set(su_timer_t const *t); /* 1.12.11 */
505 SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
509  su_timer_arg_t *);
511 
513 
514 SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const,
515  su_duration_t *tout,
516  su_time_t now);
517 SOFIAPUBFUN int su_timer_deferrable(su_timer_t *t, int value); /* 1.12.11 */
518 
519 /* Tasks */
520 
522 
523 SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
525 
526 SOFIAPUBFUN void su_task_copy(su_task_r dst, su_task_r const src);
528 SOFIAPUBFUN int su_task_cmp(su_task_r const, su_task_r const);
530 
532 SOFIAPUBFUN su_timer_queue_t *su_task_timers(su_task_r const self);
533 SOFIAPUBFUN su_timer_queue_t *su_task_deferrable(su_task_r const task);
534 
535 SOFIAPUBFUN int su_task_wakeup(su_task_r const task);
536 
537 SOFIAPUBFUN int su_task_execute(su_task_r const task,
538  int (*function)(void *), void *arg,
539  int *return_value);
540 
541 /* Messages */
543  su_task_r const to, su_task_r const from,
544  su_msg_f wakeup, isize_t size);
545 SOFIAPUBFUN int su_msg_report(su_msg_r msg, su_msg_f report);
548  su_msg_f wakeup, isize_t size);
550 SOFIAPUBFUN void su_msg_save(su_msg_r msg, su_msg_r msg0);
553 SOFIAPUBFUN isize_t su_msg_size(su_msg_cr msg);
554 SOFIAPUBFUN _su_task_r su_msg_from(su_msg_cr msg);
555 SOFIAPUBFUN _su_task_r su_msg_to(su_msg_cr msg);
557 
558 SOFIAPUBFUN int su_msg_new(su_msg_r msg, size_t size);
560  su_task_r const to,
561  su_msg_f wakeup);
562 
564 #if SU_HAVE_INLINE
565 static SU_INLINE
566 int su_msg_is_non_null(su_msg_cr msg)
567 {
568  return msg && *msg != NULL;
569 }
570 #else
571 #define su_msg_is_non_null(msg) ((msg) && (*(msg)) != NULL)
572 #endif
573 
574 /* Clones */
575 SOFIAPUBFUN int su_root_threading(su_root_t *self, int enable);
577  su_clone_r,
578  su_root_magic_t *magic,
584 SOFIAPUBFUN void su_clone_wait(su_root_t *root, su_clone_r clone);
585 
588 
589 /* ---------------------------------------------------------------------- */
590 /* Different su_root_t implementations */
591 
592 typedef su_port_t *su_port_create_f(void);
593 typedef int su_clone_start_f(su_root_t *parent,
594  su_clone_r return_clone,
595  su_root_magic_t *magic,
596  su_root_init_f init,
597  su_root_deinit_f deinit);
598 
599 SOFIAPUBFUN void su_port_prefer(su_port_create_f *f, su_clone_start_f *);
600 
601 SOFIAPUBFUN su_port_create_f su_default_port_create;
602 SOFIAPUBFUN su_port_create_f su_epoll_port_create;
603 SOFIAPUBFUN su_port_create_f su_poll_port_create;
604 SOFIAPUBFUN su_port_create_f su_wsaevent_port_create;
605 SOFIAPUBFUN su_port_create_f su_select_port_create;
606 SOFIAPUBFUN su_port_create_f su_kqueue_port_create;
607 SOFIAPUBFUN su_port_create_f su_devpoll_port_create;
608 
609 SOFIAPUBFUN su_clone_start_f su_default_clone_start;
610 SOFIAPUBFUN su_clone_start_f su_epoll_clone_start;
611 SOFIAPUBFUN su_clone_start_f su_poll_clone_start;
612 SOFIAPUBFUN su_clone_start_f su_wsaevent_clone_start;
613 SOFIAPUBFUN su_clone_start_f su_select_clone_start;
614 SOFIAPUBFUN su_clone_start_f su_kqueue_clone_start;
615 SOFIAPUBFUN su_clone_start_f su_devpoll_clone_start;
616 
617 SOFIA_END_DECLS
618 
619 #endif /* SU_WAIT_H */
int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
Wait for multiple events.
Definition: su_wait.c:222
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_WAKEUP_ARG_T su_wakeup_arg_t
Wakeup callback argument type.
Definition: su_wait.h:261
su_task_r const su_task_null
NULL task.
Definition: su_root.c:133
int su_task_is_running(su_task_r const)
Tests if a task is running.
Definition: su_root.c:269
su_time64_t su_root_stamp64(su_root_t const *)
Get cached timestamp.
Definition: su_root.c:748
Normal priority.
Definition: su_wait.h:273
su_duration_t su_root_step(su_root_t *root, su_duration_t timeout)
Process events, timers and messages.
Definition: su_root.c:896
Elevated priority.
Definition: su_wait.h:274
SU_PREPOLL_MAGIC_T su_prepoll_magic_t
Root context pointer type.
Definition: su_wait.h:310
#define SU_WAKEUP_ARG_T
Default type of wakeup function argument type .
Definition: su_wait.h:249
Real-time priority.
Definition: su_wait.h:275
#define su_inline
Define as suitable declarator static inline functions.
Definition: su_configure.h:90
int su_msg_report(su_msg_r msg, su_msg_f report)
Add a delivery report function to a message.
Definition: su_root.c:1120
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
int su_root_remove_prepoll(su_root_t *root)
Remove a pre-poll callback.
Definition: su_root.c:996
void su_task_copy(su_task_r dst, su_task_r const src)
Duplicates a task handle.
Definition: su_root.c:198
int su_clone_pause(su_clone_r)
Pause a clone.
Definition: su_port.c:386
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
su_task_r su_root_task(su_root_t const *root)
Get task reference.
Definition: su_root.c:958
int su_task_wakeup(su_task_r const task)
Wakeup a task.
Definition: su_root.c:356
void su_msg_remove_refs(su_msg_cr msg)
Remove references to 'from' and 'to' tasks from a message.
Definition: su_root.c:1305
#define SU_MSG_ARG_T
Default type of su_msg_t message data.
Definition: su_wait.h:375
int su_msg_send(su_msg_r msg)
Send a message.
Definition: su_root.c:1325
int su_socket_t
Socket descriptor type.
Definition: su.h:128
int su_root_has_thread(su_root_t *root)
Check if a thread has obtained the root.
Definition: su_root.c:1045
uint64_t su_time64_t
Time in nanoseconds.
Definition: su_time.h:44
void su_clone_forget(su_clone_r)
Forget the clone.
Definition: su_port.c:336
long su_duration_t
Time difference in microseconds.
Definition: su_time.h:70
void su_wait_init(su_wait_t dst[1])
Initialize a wait object.
Definition: su_wait.c:106
#define SU_PREPOLL_MAGIC_T
Default type of application context for prepoll function.
Definition: su_wait.h:297
void su_task_deinit(su_task_r task)
Destroy a task handle.
Definition: su_root.c:164
int su_root_multishot(su_root_t *root, int multishot)
Set multishot mode.
Definition: su_root.c:836
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:374
void su_msg_deinit_function(su_msg_arg_t *arg)
Message deinitializer function type.
Definition: su_wait.h:402
int su_wait_mask(su_wait_t *dst, su_socket_t s, int events)
Set event mask.
Definition: su_wait.c:299
su_task_r su_task_init(su_task_r task)
Initialize a task handle with su_task_null.
Definition: su_root.c:151
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:984
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_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *)
Set the timer for regular intervals.
Definition: su_timer.c:444
isize_t su_msg_size(su_msg_cr msg)
Get size of message data area.
Definition: su_root.c:1263
int su_root_release(su_root_t *root)
Release the root port for other threads.
Definition: su_root.c:1009
int su_root_yield(su_root_t *root)
Check wait events in callbacks that take lots of time.
Definition: su_root.c:941
int(* su_root_init_f)(su_root_t *, su_root_magic_t *)
Clone initialization function type.
Definition: su_wait.h:422
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:1347
su_msg_t *const su_msg_cr[1]
Constant reference to su_msg.
Definition: su_wait.h:391
int su_msg_new(su_msg_r msg, size_t size)
Allocate a su message of given size.
Definition: su_root.c:1069
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:671
int su_root_obtain(su_root_t *root)
Obtain the root port from other thread.
Definition: su_root.c:1027
struct su_timer_s su_timer_t
Timer object type.
Definition: su_wait.h:334
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition: su_config.h:66
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_msg_arg_t * su_msg_data(su_msg_cr msg)
Gets a pointer to the message data area.
Definition: su_root.c:1254
int su_wait_destroy(su_wait_t *dst)
Destroy a wait object.
Definition: su_wait.c:185
struct su_port_s su_port_t
Port type.
Definition: su_wait.h:355
su_msg_function * su_msg_f
Message delivery function pointer type.
Definition: su_wait.h:405
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_root_set_magic(su_root_t *self, su_root_magic_t *magic)
Set the context pointer.
Definition: su_root.c:567
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
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition: su_config.h:68
SU_MSG_ARG_T su_msg_arg_t
Message argument type.
Definition: su_wait.h:379
int su_wait_events(su_wait_t *wait, su_socket_t s)
Get events.
Definition: su_wait.c:271
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:1097
su_dur64_t su_root_stamp64_offset(su_root_t const *)
Get cached offset between monotonic timestamps and UTC time.
Definition: su_root.c:767
int su_timer_deferrable(su_timer_t *t, int value)
Change timer as deferrable (or as undeferrable).
Definition: su_timer.c:674
int64_t su_dur64_t
Time offset (duration) in nanoseconds.
Definition: su_time.h:50
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:433
struct su_msg_s su_msg_t
Message type.
Definition: su_wait.h:382
char const * su_root_name(su_root_t *self)
Get instance name.
Definition: su_root.c:549
int su_root_size_hint
Hint for number of registered fds in su_root.
Definition: su_root.c:118
int su_root_deregister(su_root_t *, int)
Remove a su_wait_t registration.
Definition: su_root.c:786
int su_msg_deinitializer(su_msg_r msg, su_msg_deinit_function *)
Add a deinitializer function to a message.
Definition: su_root.c:1143
_su_task_t su_task_r[1]
Task reference type.
Definition: su_wait.h:360
void su_msg_save(su_msg_r msg, su_msg_r msg0)
Save a message.
Definition: su_root.c:1208
void(* su_root_deinit_f)(su_root_t *, su_root_magic_t *)
Clone finalization function type.
Definition: su_wait.h:425
su_duration_t su_root_get_max_defer(su_root_t const *self)
Get maximum defer time.
Definition: su_root.c:723
su_msg_t * su_msg_r[1]
Message reference type.
Definition: su_wait.h:385
Time in seconds and microsecondcs.
Definition: su_time.h:57
SU_ROOT_MAGIC_T su_root_magic_t
Root context pointer type.
Definition: su_wait.h:236
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:1165
su_timer_t * su_timer_create(su_task_r const, su_duration_t msec))
Create a timer.
Definition: su_timer.c:297
struct _GSource * su_root_gsource(su_root_t *self)
Get a GSource.
Definition: su_root.c:616
#define SU_TIMER_ARG_T
Default type of timer expiration callback function argument type.
Definition: su_wait.h:330
int su_timer_reset(su_timer_t *)
Reset the timer.
Definition: su_timer.c:498
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_TIMER_ARG_T su_timer_arg_t
Timer callback argument type.
Definition: su_wait.h:337
int su_root_set_max_defer(su_root_t *, su_duration_t max_defer)
Set maximum defer time.
Definition: su_root.c:703
su_root_magic_t * su_root_magic(su_root_t *root)
Get context pointer.
Definition: su_root.c:607
su_root_t * su_timer_root(su_timer_t const *)
Get the root object owning the timer.
Definition: su_timer.c:650
int su_root_threading(su_root_t *self, int enable)
Set threading option.
Definition: su_root.c:585
su_task_r su_clone_task(su_clone_r)
Get reference to a clone task.
Definition: su_port.c:323
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_timer_set_for_ever(su_timer_t *, su_timer_f, su_timer_arg_t *)
Set the timer for regular intervals.
Definition: su_timer.c:475
void su_clone_stop(su_clone_r)
Stop the clone.
Definition: su_port.c:348
#define SU_INLINE
Define as suitable declarator inline functions.
Definition: su_configure.h:88
su_task_r su_root_parent(su_root_t const *root)
Get parent task reference.
Definition: su_root.c:975
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
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:916
su_time_t su_timer_latest(su_timer_t const *t)
Return when the timer has been last expired.
Definition: su_timer.c:356
su_root_t * su_root_create(su_root_magic_t *magic))
Create a reactor object.
Definition: su_root.c:407
void su_msg_destroy(su_msg_r msg)
Destroys an unsent message.
Definition: su_root.c:1225
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_wait_create(su_wait_t *dst, su_socket_t s, int events)
Create a wait object.
Definition: su_wait.c:132
su_task_r su_msg_from(su_msg_cr msg)
Get sending task.
Definition: su_root.c:1279
void su_timer_destroy(su_timer_t *)
Destroy a timer.
Definition: su_timer.c:322
struct pollfd su_wait_t
Wait object.
Definition: su_wait.h:184
struct su_root_t su_root_t
Root object type.
Definition: su_wait.h:210
Socket and network address interface.
void su_prepoll_f(su_prepoll_magic_t *, su_root_t *)
Pre-poll callback function prototype.
Definition: su_wait.h:317
int su_root_eventmask(su_root_t *, int index, int socket, int events)
Set mask for a registered event.
Definition: su_root.c:810
void su_root_destroy(su_root_t *)
Destroy a root object.
Definition: su_root.c:501
#define SU_ROOT_MAGIC_T
Default type of application context for su_root_t.
Definition: su_wait.h:223
int su_timer_is_set(su_timer_t const *t)
Check if the timer has been set.
Definition: su_timer.c:339
SU_CLONE_T * su_clone_r[1]
Clone reference.
Definition: su_wait.h:416
Time types and functions.
su_task_r su_msg_to(su_msg_cr msg)
Get destination task.
Definition: su_root.c:1296
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:396
int su_clone_resume(su_clone_r)
Resume a clone.
Definition: su_port.c:413
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:644
void su_task_move(su_task_r dst, su_task_r src)
Moves a task handle.
Definition: su_root.c:223
void su_root_run(su_root_t *root)
Run event and message loop.
Definition: su_root.c:856
void su_root_break(su_root_t *root)
Terminate event loop.
Definition: su_root.c:872

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