Loading...
Searching...
No Matches
su_wait.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_WAIT_H
#define SU_WAIT_H
/* ---------------------------------------------------------------------- */
/* Includes */
#ifndef SU_H
#include "sofia-sip/su.h"
#endif
#ifndef SU_TIME_H
#include "sofia-sip/su_time.h"
#endif
#if SU_HAVE_POLL
#include <sys/poll.h>
#endif
SOFIA_BEGIN_DECLS
/* ---------------------------------------------------------------------- */
/* Constants */
#if SU_HAVE_KQUEUE
#define SU_WAIT_CMP(x, y) \
(((x).ident - (y).ident) ? ((x).ident - (y).ident) : ((x).flags - (y).flags))
#define SU_WAIT_IN (EVFILT_READ)
#define SU_WAIT_OUT (EVFILT_WRITE)
#define SU_WAIT_CONNECT (EVFILT_WRITE)
#define SU_WAIT_ERR (EV_ERROR)
#define SU_WAIT_HUP (EV_EOF)
#define SU_WAIT_ACCEPT (EVFILT_READ)
#define SU_WAIT_FOREVER (-1)
#define SU_WAIT_TIMEOUT (-2)
#define SU_WAIT_INIT { INVALID_SOCKET, 0, 0, 0, 0, NULL }
#define SU_WAIT_MAX (0x7fffffff)
#elif SU_HAVE_POLL || DOCUMENTATION_ONLY
#define SU_WAIT_CMP(x, y) \
(((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
#define SU_WAIT_IN (POLLIN)
#define SU_WAIT_OUT (POLLOUT)
#define SU_WAIT_CONNECT (POLLOUT)
#define SU_WAIT_ERR (POLLERR)
#define SU_WAIT_HUP (POLLHUP)
#define SU_WAIT_ACCEPT (POLLIN)
#define SU_WAIT_FOREVER (-1)
#define SU_WAIT_TIMEOUT (-2)
#define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
#define SU_WAIT_MAX (0x7fffffff)
#elif SU_HAVE_WINSOCK
#define SU_WAIT_CMP(x, y) ((intptr_t)(x) - (intptr_t)(y))
#define SU_WAIT_IN (FD_READ)
#define SU_WAIT_OUT (FD_WRITE)
#define SU_WAIT_CONNECT (FD_CONNECT)
#define SU_WAIT_ERR (0) /* let's get it on */
#define SU_WAIT_HUP (FD_CLOSE)
#define SU_WAIT_ACCEPT (FD_ACCEPT)
#define SU_WAIT_FOREVER (WSA_INFINITE)
#define SU_WAIT_TIMEOUT (WSA_WAIT_TIMEOUT)
#define SU_WAIT_INIT NULL
#define SU_WAIT_MAX (64)
#else
/* If nothing works, try these */
#define POLLIN 0x001
#define POLLPRI 0x002
#define POLLOUT 0x004
#ifdef __USE_XOPEN
#define POLLRDNORM 0x040
#define POLLRDBAND 0x080
#define POLLWRNORM 0x100
#define POLLWRBAND 0x200
#endif
/* These for pollfd.revents */
#define POLLERR 0x008
#define POLLHUP 0x010
#define POLLNVAL 0x020
#define SU_WAIT_CMP(x, y) \
(((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
#define SU_WAIT_IN POLLIN
#define SU_WAIT_OUT POLLOUT
#define SU_WAIT_CONNECT POLLOUT
#define SU_WAIT_ERR POLLERR
#define SU_WAIT_HUP POLLHUP
#define SU_WAIT_ACCEPT POLLIN
#define SU_WAIT_FOREVER (-1)
#define SU_WAIT_TIMEOUT (-2)
#define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
#define SU_WAIT_MAX (0x7fffffff)
#endif
/* ---------------------------------------------------------------------- */
/* Types */
#if SU_HAVE_KQUEUE
typedef struct kevent su_wait_t;
#elif SU_HAVE_POLL
typedef struct pollfd su_wait_t;
#elif SU_HAVE_WINSOCK
typedef HANDLE su_wait_t;
#else
/* typedef struct os_specific su_wait_t; */
typedef struct pollfd su_wait_t;
struct pollfd {
su_socket_t fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
/* Type used for the number of file descriptors. */
typedef unsigned long int nfds_t;
/* Poll the file descriptors described by the NFDS structures starting at
FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
an event to occur; if TIMEOUT is -1, block until an event occurs.
Returns the number of file descriptors with events, zero if timed out,
or -1 for errors. */
int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
#endif
/* Used by AD */
typedef int su_success_t;
/* ---------------------------------------------------------------------- */
typedef struct su_root_s su_root_t;
#ifndef SU_ROOT_MAGIC_T
#define SU_ROOT_MAGIC_T void
#endif
typedef SU_ROOT_MAGIC_T su_root_magic_t;
#ifndef SU_WAKEUP_ARG_T
#define SU_WAKEUP_ARG_T void
#endif
typedef SU_WAKEUP_ARG_T su_wakeup_arg_t;
typedef int (*su_wakeup_f)(su_root_magic_t *,
su_wait_t *,
su_wakeup_arg_t *arg);
enum {
su_pri_normal,
su_pri_first,
su_pri_realtime
};
struct _GSource;
SOFIAPUBVAR int su_root_size_hint;
/* ---------------------------------------------------------------------- */
/* Pre-poll callback */
#ifndef SU_PREPOLL_MAGIC_T
#define SU_PREPOLL_MAGIC_T void
#endif
typedef SU_PREPOLL_MAGIC_T su_prepoll_magic_t;
typedef void su_prepoll_f(su_prepoll_magic_t *, su_root_t *);
/* ---------------------------------------------------------------------- */
/* Timers */
#ifdef SU_TIMER_T
#error SU_TIMER_T defined
#endif
#ifndef SU_TIMER_ARG_T
#define SU_TIMER_ARG_T void
#endif
typedef struct su_timer_s su_timer_t;
typedef SU_TIMER_ARG_T su_timer_arg_t;
typedef void (*su_timer_f)(su_root_magic_t *magic,
su_timer_t *t,
su_timer_arg_t *arg);
#ifndef SU_TIMER_QUEUE_T
#define SU_TIMER_QUEUE_T su_timer_t *
#endif
typedef SU_TIMER_QUEUE_T su_timer_queue_t;
/* ---------------------------------------------------------------------- */
/* Tasks */
typedef struct su_port_s su_port_t;
typedef struct { su_port_t *sut_port; su_root_t *sut_root; } _su_task_t;
typedef _su_task_t su_task_r[1];
#define SU_TASK_R_INIT {{ NULL, NULL }}
/* This must be used instead of su_task_r as return value type. */
typedef _su_task_t const *_su_task_r;
/* ---------------------------------------------------------------------- */
/* Messages */
#ifndef SU_MSG_ARG_T
#define SU_MSG_ARG_T void
#endif
typedef SU_MSG_ARG_T su_msg_arg_t;
typedef struct su_msg_s su_msg_t;
typedef su_msg_t *su_msg_r[1];
typedef su_msg_t * const su_msg_cr[1];
#define SU_MSG_R_INIT { NULL }
typedef void su_msg_function(su_root_magic_t *magic,
su_msg_r msg,
su_msg_arg_t *arg);
typedef void su_msg_deinit_function(su_msg_arg_t *arg);
typedef su_msg_function *su_msg_f;
/* ---------------------------------------------------------------------- */
/* Clones */
#ifndef SU_CLONE_T
#define SU_CLONE_T struct su_clone_s
#endif
typedef SU_CLONE_T *su_clone_r[1];
#define SU_CLONE_R_INIT {NULL}
typedef int (*su_root_init_f)(su_root_t *, su_root_magic_t *);
typedef void (*su_root_deinit_f)(su_root_t *, su_root_magic_t *);
/* ---------------------------------------------------------------------- */
/* Functions */
/* Wait */
SOFIAPUBFUN void su_wait_init(su_wait_t dst[1]);
SOFIAPUBFUN int su_wait_create(su_wait_t *dst, su_socket_t s, int events);
SOFIAPUBFUN int su_wait_destroy(su_wait_t *dst);
SOFIAPUBFUN int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
SOFIAPUBFUN int su_wait_events(su_wait_t *wait, su_socket_t s);
SOFIAPUBFUN int su_wait_mask(su_wait_t *dst, su_socket_t s, int events);
#if !HAVE_WIN32 && (SU_HAVE_POLL || HAVE_SELECT)
su_inline
su_socket_t su_wait_socket(su_wait_t *wait)
{
#if SU_HAVE_KQUEUE
return wait->ident;
#else
return wait->fd;
#endif
}
#endif
/* Root */
SOFIAPUBFUN su_root_t *su_root_create(su_root_magic_t *magic)
__attribute__((__malloc__));
SOFIAPUBFUN void su_root_destroy(su_root_t*);
SOFIAPUBFUN char const *su_root_name(su_root_t *self);
SOFIAPUBFUN int su_root_set_magic(su_root_t *self, su_root_magic_t *magic);
SOFIAPUBFUN su_root_magic_t *su_root_magic(su_root_t *root);
SOFIAPUBFUN int su_root_register(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t *,
int priority);
/* This is slow. Deprecated. */
SOFIAPUBFUN int su_root_unregister(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t*);
SOFIAPUBFUN int su_root_deregister(su_root_t*, int);
SOFIAPUBFUN int su_root_eventmask(su_root_t *,
int index, int socket, int events);
SOFIAPUBFUN su_duration_t su_root_step(su_root_t *root, su_duration_t timeout);
SOFIAPUBFUN su_duration_t su_root_sleep(su_root_t *root, su_duration_t);
SOFIAPUBFUN int su_root_multishot(su_root_t *root, int multishot);
SOFIAPUBFUN void su_root_run(su_root_t *root);
SOFIAPUBFUN void su_root_break(su_root_t *root);
SOFIAPUBFUN _su_task_r su_root_task(su_root_t const *root);
SOFIAPUBFUN _su_task_r su_root_parent(su_root_t const *root);
SOFIAPUBFUN int su_root_add_prepoll(su_root_t *root,
su_prepoll_f *,
su_prepoll_magic_t *);
SOFIAPUBFUN int su_root_remove_prepoll(su_root_t *root);
SOFIAPUBFUN struct _GSource *su_root_gsource(su_root_t *self);
SOFIAPUBFUN int su_root_yield(su_root_t *root);
SOFIAPUBFUN int su_root_release(su_root_t *root);
SOFIAPUBFUN int su_root_obtain(su_root_t *root);
SOFIAPUBFUN int su_root_has_thread(su_root_t *root);
SOFIAPUBFUN int su_root_set_max_defer(su_root_t *, su_duration_t max_defer);
SOFIAPUBFUN su_duration_t su_root_get_max_defer(su_root_t const *self);
SOFIAPUBFUN su_time64_t su_root_stamp64(su_root_t const *);
SOFIAPUBFUN su_dur64_t su_root_stamp64_offset(su_root_t const *);
SOFIAPUBFUN su_root_t *su_root_clone(su_root_t *root, su_root_magic_t *magic)
__attribute__((__malloc__));
/* Timers */
SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
__attribute__((__malloc__));
SOFIAPUBFUN void su_timer_destroy(su_timer_t *);
SOFIAPUBFUN int su_timer_is_set(su_timer_t const *t); /* 1.12.11 */
SOFIAPUBFUN su_time_t su_timer_latest(su_timer_t const *t);
SOFIAPUBFUN int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *);
SOFIAPUBFUN int su_timer_set_interval(su_timer_t *t, su_timer_f,
su_timer_arg_t *, su_duration_t);
SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
su_timer_arg_t *, su_time_t);
SOFIAPUBFUN int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *);
SOFIAPUBFUN int su_timer_set_for_ever(su_timer_t *, su_timer_f,
su_timer_arg_t *);
SOFIAPUBFUN int su_timer_reset(su_timer_t *);
SOFIAPUBFUN su_root_t *su_timer_root(su_timer_t const *);
SOFIAPUBFUN int su_timer_expire(su_timer_queue_t * const,
su_duration_t *tout,
su_time_t now);
SOFIAPUBFUN int su_timer_deferrable(su_timer_t *t, int value); /* 1.12.11 */
/* Tasks */
SOFIAPUBVAR su_task_r const su_task_null;
SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
SOFIAPUBFUN void su_task_deinit(su_task_r task);
SOFIAPUBFUN void su_task_copy(su_task_r dst, su_task_r const src);
SOFIAPUBFUN void su_task_move(su_task_r dst, su_task_r src);
SOFIAPUBFUN int su_task_cmp(su_task_r const, su_task_r const);
SOFIAPUBFUN int su_task_is_running(su_task_r const);
SOFIAPUBFUN su_root_t *su_task_root(su_task_r const self);
SOFIAPUBFUN su_timer_queue_t *su_task_timers(su_task_r const self);
SOFIAPUBFUN su_timer_queue_t *su_task_deferrable(su_task_r const task);
SOFIAPUBFUN int su_task_wakeup(su_task_r const task);
SOFIAPUBFUN int su_task_execute(su_task_r const task,
int (*function)(void *), void *arg,
int *return_value);
/* Messages */
SOFIAPUBFUN 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);
SOFIAPUBFUN int su_msg_report(su_msg_r msg, su_msg_f report);
SOFIAPUBFUN int su_msg_deinitializer(su_msg_r msg, su_msg_deinit_function *);
SOFIAPUBFUN int su_msg_reply(su_msg_r reply, su_msg_cr msg,
su_msg_f wakeup, isize_t size);
SOFIAPUBFUN void su_msg_destroy(su_msg_r msg);
SOFIAPUBFUN void su_msg_save(su_msg_r msg, su_msg_r msg0);
SOFIAPUBFUN void su_msg_remove_refs(su_msg_cr msg);
SOFIAPUBFUN su_msg_arg_t *su_msg_data(su_msg_cr msg);
SOFIAPUBFUN isize_t su_msg_size(su_msg_cr msg);
SOFIAPUBFUN _su_task_r su_msg_from(su_msg_cr msg);
SOFIAPUBFUN _su_task_r su_msg_to(su_msg_cr msg);
SOFIAPUBFUN int su_msg_send(su_msg_r msg);
SOFIAPUBFUN int su_msg_new(su_msg_r msg, size_t size);
SOFIAPUBFUN int su_msg_send_to(su_msg_r msg,
su_task_r const to,
su_msg_f wakeup);
#if SU_HAVE_INLINE
static SU_INLINE
int su_msg_is_non_null(su_msg_cr msg)
{
return msg && *msg != NULL;
}
#else
#define su_msg_is_non_null(msg) ((msg) && (*(msg)) != NULL)
#endif
/* Clones */
SOFIAPUBFUN int su_root_threading(su_root_t *self, int enable);
SOFIAPUBFUN int su_clone_start(su_root_t *root,
su_clone_r,
su_root_magic_t *magic,
su_root_init_f,
su_root_deinit_f);
SOFIAPUBFUN _su_task_r su_clone_task(su_clone_r);
SOFIAPUBFUN void su_clone_forget(su_clone_r);
SOFIAPUBFUN void su_clone_stop(su_clone_r);
SOFIAPUBFUN void su_clone_wait(su_root_t *root, su_clone_r clone);
SOFIAPUBFUN int su_clone_pause(su_clone_r);
SOFIAPUBFUN int su_clone_resume(su_clone_r);
/* ---------------------------------------------------------------------- */
/* Different su_root_t implementations */
typedef su_port_t *su_port_create_f(void);
typedef int su_clone_start_f(su_root_t *parent,
su_clone_r return_clone,
su_root_magic_t *magic,
su_root_init_f init,
su_root_deinit_f deinit);
SOFIAPUBFUN void su_port_prefer(su_port_create_f *f, su_clone_start_f *);
SOFIAPUBFUN su_port_create_f su_default_port_create;
SOFIAPUBFUN su_port_create_f su_epoll_port_create;
SOFIAPUBFUN su_port_create_f su_poll_port_create;
SOFIAPUBFUN su_port_create_f su_wsaevent_port_create;
SOFIAPUBFUN su_port_create_f su_select_port_create;
SOFIAPUBFUN su_port_create_f su_kqueue_port_create;
SOFIAPUBFUN su_port_create_f su_devpoll_port_create;
SOFIAPUBFUN su_clone_start_f su_default_clone_start;
SOFIAPUBFUN su_clone_start_f su_epoll_clone_start;
SOFIAPUBFUN su_clone_start_f su_poll_clone_start;
SOFIAPUBFUN su_clone_start_f su_wsaevent_clone_start;
SOFIAPUBFUN su_clone_start_f su_select_clone_start;
SOFIAPUBFUN su_clone_start_f su_kqueue_clone_start;
SOFIAPUBFUN su_clone_start_f su_devpoll_clone_start;
SOFIA_END_DECLS
#endif /* SU_WAIT_H */
su_root_size_hint
int su_root_size_hint
Hint for number of registered fds in su_root.
Definition su_root.c:118
su.h
Socket and network address interface.
su_socket_t
int su_socket_t
Socket descriptor type.
Definition su.h:128
SOFIAPUBFUN
#define SOFIAPUBFUN
SOFIAPUBFUN declares an exported function.
Definition su_config.h:66
SOFIAPUBVAR
#define SOFIAPUBVAR
SOFIAPUBVAR declares an exported variable.
Definition su_config.h:68
su_inline
#define su_inline
Define as suitable declarator static inline functions.
Definition su_configure.h:90
SU_INLINE
#define SU_INLINE
Define as suitable declarator inline functions.
Definition su_configure.h:88
su_time.h
Time types and functions.
su_dur64_t
int64_t su_dur64_t
Time offset (duration) in nanoseconds.
Definition su_time.h:50
su_duration_t
long su_duration_t
Time difference in microseconds.
Definition su_time.h:70
su_time_t
struct su_time_s su_time_t
Time in seconds and microsecondcs.
Definition su_time.h:62
su_time64_t
uint64_t su_time64_t
Time in nanoseconds.
Definition su_time.h:44
su_root_task
su_task_r su_root_task(su_root_t const *root)
Get task reference.
Definition su_root.c:958
su_wakeup_arg_t
SU_WAKEUP_ARG_T su_wakeup_arg_t
Wakeup callback argument type.
Definition su_wait.h:261
su_clone_resume
int su_clone_resume(su_clone_r)
Resume a clone.
Definition su_port.c:413
su_msg_save
void su_msg_save(su_msg_r msg, su_msg_r msg0)
Save a message.
Definition su_root.c:1208
su_timer_latest
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_register
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
su_wait_init
void su_wait_init(su_wait_t dst[1])
Initialize a wait object.
Definition su_wait.c:106
su_timer_is_set
int su_timer_is_set(su_timer_t const *t)
Check if the timer has been set.
Definition su_timer.c:339
su_root_deinit_f
void(* su_root_deinit_f)(su_root_t *, su_root_magic_t *)
Clone finalization function type.
Definition su_wait.h:425
su_timer_set_interval
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
su_msg_send
int su_msg_send(su_msg_r msg)
Send a message.
Definition su_root.c:1325
su_wakeup_f
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_root_stamp64
su_time64_t su_root_stamp64(su_root_t const *)
Get cached timestamp.
Definition su_root.c:748
su_msg_from
su_task_r su_msg_from(su_msg_cr msg)
Get sending task.
Definition su_root.c:1279
su_timer_create
su_timer_t * su_timer_create(su_task_r const, su_duration_t msec))
Create a timer.
Definition su_timer.c:297
su_root_multishot
int su_root_multishot(su_root_t *root, int multishot)
Set multishot mode.
Definition su_root.c:836
su_root_parent
su_task_r su_root_parent(su_root_t const *root)
Get parent task reference.
Definition su_root.c:975
su_msg_report
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_root_gsource
struct _GSource * su_root_gsource(su_root_t *self)
Get a GSource.
Definition su_root.c:616
su_root_destroy
void su_root_destroy(su_root_t *)
Destroy a root object.
Definition su_root.c:501
su_root_sleep
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_root_obtain
int su_root_obtain(su_root_t *root)
Obtain the root port from other thread.
Definition su_root.c:1027
SU_MSG_ARG_T
#define SU_MSG_ARG_T
Default type of su_msg_t message data.
Definition su_wait.h:375
su_task_move
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 su_root_magic_t
Root context pointer type.
Definition su_wait.h:236
su_timer_destroy
void su_timer_destroy(su_timer_t *)
Destroy a timer.
Definition su_timer.c:322
su_root_run
void su_root_run(su_root_t *root)
Run event and message loop.
Definition su_root.c:856
su_timer_set
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
su_wait_t
struct pollfd su_wait_t
Wait object.
Definition su_wait.h:184
su_msg_function
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
su_root_init_f
int(* su_root_init_f)(su_root_t *, su_root_magic_t *)
Clone initialization function type.
Definition su_wait.h:422
su_timer_root
su_root_t * su_timer_root(su_timer_t const *)
Get the root object owning the timer.
Definition su_timer.c:650
su_task_r
_su_task_t su_task_r[1]
Task reference type.
Definition su_wait.h:360
su_msg_create
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_msg_remove_refs
void su_msg_remove_refs(su_msg_cr msg)
Remove references to 'from' and 'to' tasks from a message.
Definition su_root.c:1305
SU_ROOT_MAGIC_T
#define SU_ROOT_MAGIC_T
Default type of application context for su_root_t.
Definition su_wait.h:223
su_prepoll_magic_t
SU_PREPOLL_MAGIC_T su_prepoll_magic_t
Root context pointer type.
Definition su_wait.h:310
SU_TIMER_ARG_T
#define SU_TIMER_ARG_T
Default type of timer expiration callback function argument type.
Definition su_wait.h:330
su_root_get_max_defer
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
struct su_msg_s su_msg_t
Message type.
Definition su_wait.h:382
su_root_set_max_defer
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
su_root_magic_t * su_root_magic(su_root_t *root)
Get context pointer.
Definition su_root.c:607
su_root_yield
int su_root_yield(su_root_t *root)
Check wait events in callbacks that take lots of time.
Definition su_root.c:941
su_msg_f
su_msg_function * su_msg_f
Message delivery function pointer type.
Definition su_wait.h:405
su_task_copy
void su_task_copy(su_task_r dst, su_task_r const src)
Duplicates a task handle.
Definition su_root.c:198
su_clone_r
SU_CLONE_T * su_clone_r[1]
Clone reference.
Definition su_wait.h:416
su_root_deregister
int su_root_deregister(su_root_t *, int)
Remove a su_wait_t registration.
Definition su_root.c:786
su_task_execute
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_root_step
su_duration_t su_root_step(su_root_t *root, su_duration_t timeout)
Process events, timers and messages.
Definition su_root.c:896
su_root_threading
int su_root_threading(su_root_t *self, int enable)
Set threading option.
Definition su_root.c:585
su_root_has_thread
int su_root_has_thread(su_root_t *root)
Check if a thread has obtained the root.
Definition su_root.c:1045
su_wait_destroy
int su_wait_destroy(su_wait_t *dst)
Destroy a wait object.
Definition su_wait.c:185
su_clone_wait
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
su_msg_deinitializer
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_root_set_magic
int su_root_set_magic(su_root_t *self, su_root_magic_t *magic)
Set the context pointer.
Definition su_root.c:567
su_msg_to
su_task_r su_msg_to(su_msg_cr msg)
Get destination task.
Definition su_root.c:1296
su_root_eventmask
int su_root_eventmask(su_root_t *, int index, int socket, int events)
Set mask for a registered event.
Definition su_root.c:810
su_root_remove_prepoll
int su_root_remove_prepoll(su_root_t *root)
Remove a pre-poll callback.
Definition su_root.c:996
su_task_null
su_task_r const su_task_null
NULL task.
Definition su_root.c:133
su_msg_cr
su_msg_t *const su_msg_cr[1]
Constant reference to su_msg.
Definition su_wait.h:391
su_timer_f
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
su_msg_reply
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_arg_t
SU_TIMER_ARG_T su_timer_arg_t
Timer callback argument type.
Definition su_wait.h:337
su_port_t
struct su_port_s su_port_t
Port type.
Definition su_wait.h:355
su_clone_stop
void su_clone_stop(su_clone_r)
Stop the clone.
Definition su_port.c:348
su_task_cmp
int su_task_cmp(su_task_r const, su_task_r const)
Compare two tasks with each other.
Definition su_root.c:241
su_wait_events
int su_wait_events(su_wait_t *wait, su_socket_t s)
Get events.
Definition su_wait.c:271
su_root_add_prepoll
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
su_timer_run
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
su_msg_new
int su_msg_new(su_msg_r msg, size_t size)
Allocate a su message of given size.
Definition su_root.c:1069
su_root_release
int su_root_release(su_root_t *root)
Release the root port for other threads.
Definition su_root.c:1009
su_wait_create
int su_wait_create(su_wait_t *dst, su_socket_t s, int events)
Create a wait object.
Definition su_wait.c:132
su_pri_first
@ su_pri_first
Elevated priority.
Definition su_wait.h:274
su_pri_normal
@ su_pri_normal
Normal priority.
Definition su_wait.h:273
su_pri_realtime
@ su_pri_realtime
Real-time priority.
Definition su_wait.h:275
su_clone_start
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_root_clone
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
su_root_unregister
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
su_msg_arg_t
SU_MSG_ARG_T su_msg_arg_t
Message argument type.
Definition su_wait.h:379
su_timer_t
struct su_timer_s su_timer_t
Timer object type.
Definition su_wait.h:334
su_prepoll_f
void su_prepoll_f(su_prepoll_magic_t *, su_root_t *)
Pre-poll callback function prototype.
Definition su_wait.h:317
su_msg_deinit_function
void su_msg_deinit_function(su_msg_arg_t *arg)
Message deinitializer function type.
Definition su_wait.h:402
su_task_wakeup
int su_task_wakeup(su_task_r const task)
Wakeup a task.
Definition su_root.c:356
su_task_root
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_root_stamp64_offset
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
SU_PREPOLL_MAGIC_T
#define SU_PREPOLL_MAGIC_T
Default type of application context for prepoll function.
Definition su_wait.h:297
su_task_timers
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_WAKEUP_ARG_T
#define SU_WAKEUP_ARG_T
Default type of wakeup function argument type .
Definition su_wait.h:249
su_msg_destroy
void su_msg_destroy(su_msg_r msg)
Destroys an unsent message.
Definition su_root.c:1225
su_task_is_running
int su_task_is_running(su_task_r const)
Tests if a task is running.
Definition su_root.c:269
su_root_name
char const * su_root_name(su_root_t *self)
Get instance name.
Definition su_root.c:549
su_timer_deferrable
int su_timer_deferrable(su_timer_t *t, int value)
Change timer as deferrable (or as undeferrable).
Definition su_timer.c:674
su_timer_reset
int su_timer_reset(su_timer_t *)
Reset the timer.
Definition su_timer.c:498
su_wait_mask
int su_wait_mask(su_wait_t *dst, su_socket_t s, int events)
Set event mask.
Definition su_wait.c:299
su_root_break
void su_root_break(su_root_t *root)
Terminate event loop.
Definition su_root.c:872
su_port_prefer
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_msg_size
isize_t su_msg_size(su_msg_cr msg)
Get size of message data area.
Definition su_root.c:1263
su_wait
int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
Wait for multiple events.
Definition su_wait.c:222
su_msg_send_to
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_data
su_msg_arg_t * su_msg_data(su_msg_cr msg)
Gets a pointer to the message data area.
Definition su_root.c:1254
su_clone_pause
int su_clone_pause(su_clone_r)
Pause a clone.
Definition su_port.c:386
su_task_deinit
void su_task_deinit(su_task_r task)
Destroy a task handle.
Definition su_root.c:164
su_task_init
su_task_r su_task_init(su_task_r task)
Initialize a task handle with su_task_null.
Definition su_root.c:151
su_root_create
su_root_t * su_root_create(su_root_magic_t *magic))
Create a reactor object.
Definition su_root.c:407
su_clone_task
su_task_r su_clone_task(su_clone_r)
Get reference to a clone task.
Definition su_port.c:323
su_msg_r
su_msg_t * su_msg_r[1]
Message reference type.
Definition su_wait.h:385
su_task_deferrable
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_clone_forget
void su_clone_forget(su_clone_r)
Forget the clone.
Definition su_port.c:336
su_timer_set_for_ever
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

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