2007-04-15 02:03:41 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the Sofia-SIP package
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Nokia Corporation.
|
|
|
|
*
|
|
|
|
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**@ingroup su_wait
|
|
|
|
* @CFILE su_base_port.c
|
|
|
|
*
|
|
|
|
* OS-Independent Socket Syncronization Interface.
|
|
|
|
*
|
|
|
|
* This looks like nth reincarnation of "reactor". It implements the
|
|
|
|
* poll/select/WaitForMultipleObjects and message passing functionality.
|
|
|
|
*
|
|
|
|
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
|
|
|
* @author Kai Vehmanen <kai.vehmanen@nokia.com>
|
|
|
|
*
|
|
|
|
* @date Created: Tue Sep 14 15:51:04 1999 ppessi
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define su_base_port_s su_port_s
|
2008-12-16 18:05:22 +00:00
|
|
|
#define SU_CLONE_T su_msg_t
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
#include "sofia-sip/su.h"
|
|
|
|
#include "su_port.h"
|
|
|
|
#include "sofia-sip/su_alloc.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
#define PORT_REFCOUNT_DEBUG(x) ((void)0)
|
|
|
|
#else
|
|
|
|
#define PORT_REFCOUNT_DEBUG(x) printf x
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static int su_base_port_execute_msgs(su_msg_t *queue);
|
|
|
|
|
|
|
|
/**@internal
|
|
|
|
*
|
|
|
|
* Initialize a message port.
|
|
|
|
*
|
|
|
|
* @retval 0 when successful
|
|
|
|
* @retval -1 upon an error
|
|
|
|
*/
|
|
|
|
int su_base_port_init(su_port_t *self, su_port_vtable_t const *vtable)
|
|
|
|
{
|
|
|
|
if (self) {
|
|
|
|
self->sup_vtable = vtable;
|
|
|
|
self->sup_tail = &self->sup_head;
|
2009-02-11 17:16:44 +00:00
|
|
|
self->sup_max_defer = 15 * 1000;
|
|
|
|
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
return su_port_obtain(self);
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal Deinit a base implementation of port. */
|
|
|
|
void su_base_port_deinit(su_port_t *self)
|
|
|
|
{
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
if (su_port_own_thread(self))
|
|
|
|
su_port_release(self);
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void su_base_port_lock(su_port_t *self, char const *who)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void su_base_port_unlock(su_port_t *self, char const *who)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
/** @internal Dummy implementation of su_port_thread() method.
|
|
|
|
*
|
|
|
|
* Currently this is only used if SU_HAVE_PTHREADS is 0.
|
|
|
|
*/
|
2008-12-16 18:05:22 +00:00
|
|
|
int su_base_port_thread(su_port_t const *self,
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
enum su_port_thread_op op)
|
2007-04-15 02:03:41 +00:00
|
|
|
{
|
Sync to current darcs tree:
Mon Sep 17 14:50:04 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/sip_util.h: updated documentation
Mon Sep 17 14:50:18 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/tport_tag.h: updated documentation
Mon Sep 17 14:50:28 EDT 2007 Pekka.Pessi@nokia.com
* soa_tag.c: updated documentation
Wed Sep 19 12:50:01 EDT 2007 Pekka.Pessi@nokia.com
* msg: updated documentation
Wed Sep 19 13:29:50 EDT 2007 Pekka.Pessi@nokia.com
* url: updated documentation
Wed Sep 19 13:32:14 EDT 2007 Pekka.Pessi@nokia.com
* nth: updated documentation
Wed Sep 19 13:32:27 EDT 2007 Pekka.Pessi@nokia.com
* nea: updated documentation
Wed Sep 19 13:33:36 EDT 2007 Pekka.Pessi@nokia.com
* http: updated documentation
Wed Sep 19 13:36:58 EDT 2007 Pekka.Pessi@nokia.com
* bnf: updated documentation
Wed Sep 19 13:38:58 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated nua_stack_init_handle() prototype
Wed Sep 19 18:45:56 EDT 2007 Pekka.Pessi@nokia.com
* sip: added sip_name_addr_xtra(), sip_name_addr_dup()
Wed Sep 19 19:00:19 EDT 2007 Pekka.Pessi@nokia.com
* sip_basic.c: cleaned old crud
Thu Sep 20 13:34:04 EDT 2007 Pekka.Pessi@nokia.com
* iptsec: updated documentation
Thu Sep 20 13:36:22 EDT 2007 Pekka.Pessi@nokia.com
* tport: updated documentation
Thu Sep 20 13:36:56 EDT 2007 Pekka.Pessi@nokia.com
* su: updated documentation
Removed internal files from doxygen-generated documentation.
Thu Sep 20 13:38:29 EDT 2007 Pekka.Pessi@nokia.com
* soa: fixed documentation
Thu Sep 20 13:39:56 EDT 2007 Pekka.Pessi@nokia.com
* sdp: updated documentation
Thu Sep 20 13:40:16 EDT 2007 Pekka.Pessi@nokia.com
* ipt: updated documentation
Thu Sep 20 14:24:20 EDT 2007 Pekka.Pessi@nokia.com
* nta: updated documentation
Thu Sep 20 14:41:04 EDT 2007 Pekka.Pessi@nokia.com
* nua: updated documentation
Updated tag documentation.
Moved doxygen doc entries from sofia-sip/nua_tag.h to nua_tag.c.
Removed internal datatypes and files from the generated documents.
Wed Sep 19 13:34:20 EDT 2007 Pekka.Pessi@nokia.com
* docs: updated the generation of documentation. Updated links to header files.
Thu Sep 20 08:45:32 EDT 2007 Pekka.Pessi@nokia.com
* sip/Makefile.am: added tags to <sofia-sip/sip_extra.h>
Added check for extra tags in torture_sip.c.
Thu Sep 20 14:45:22 EDT 2007 Pekka.Pessi@nokia.com
* stun: updated documentation
Wed Jul 4 18:55:20 EDT 2007 Pekka.Pessi@nokia.com
* torture_heap.c: added tests for ##sort() and su_smoothsort()
Wed Jul 4 18:56:59 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am: added smoothsort.c
Fri Jul 13 12:38:44 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: heap_remove() now set()s index to 0 on removed item
Mon Jul 23 11:14:22 EDT 2007 Pekka.Pessi@nokia.com
* sofia-sip/heap.h: fixed bug in heap##remove()
If left kid was in heap but right was not, left kid was ignored.
Wed Jul 4 18:51:08 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Jul 4 18:51:34 EDT 2007 Pekka.Pessi@nokia.com
* heap.h: using su_smoothsort()
Fri Jul 6 10:20:27 EDT 2007 Pekka.Pessi@nokia.com
* smoothsort.c: added
Wed Sep 19 17:40:30 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: generate two parser tables, default and extended
Wed Sep 19 18:39:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: just generate list of extra headers
Allocate extended parser dynamically.
Wed Sep 19 18:59:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: added Remote-Party-ID, P-Asserted-Identity, P-Preferred-Identity
Added functions sip_update_default_mclass() and sip_extend_mclass()
for handling the extended parser. Note that Reply-To and Alert-Info are only
available with the extended parser.
Wed Sep 19 19:05:44 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Thu Sep 20 13:38:59 EDT 2007 Pekka.Pessi@nokia.com
* sip: updated documentation
Thu Sep 20 14:17:28 EDT 2007 Pekka.Pessi@nokia.com
* docs/conformance.docs: updated
Mon Oct 1 10:11:14 EDT 2007 Pekka.Pessi@nokia.com
* tport_tag.c: re-enabled tptag_trusted
Thu Oct 4 09:21:07 EDT 2007 Pekka.Pessi@nokia.com
* su_osx_runloop.c: moved virtual function table after struct definition
Preparing for su_port_vtable_t refactoring.
Thu Oct 4 10:22:03 EDT 2007 Pekka.Pessi@nokia.com
* su_source.c: refactored initialization/deinitialization
Fri Oct 5 04:58:18 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* sip_extra.c: fixed prototypes with isize_t
Fri Oct 5 04:58:45 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nta_api.c: removed warnings about signedness
Fri Oct 5 04:59:02 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* test_nua_params.c: removed warnings about constness
Fri Oct 5 07:20:26 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h, su_root.c: cleaned argument checking
The su_root_*() and su_port_*() functions now check their arguments once
and do not assert() with NULL arguments. The sur_task->sut_port should
always be valid while su_root_t is alive.
Fri Oct 5 07:22:09 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su: added su_root_obtain(), su_root_release() and su_root_has_thread()
When root is created with su_root_create() or cloned with su_clone_start(),
the resulting root is obtained by the calling or created thread,
respectively.
The root can be released with su_root_release() and another thread can
obtain it.
The function su_root_has_thread() can be used to check if a thread has
obtained or released the root.
Implementation upgraded the su_port_own_thread() method as su_port_thread().
Fri Oct 5 07:28:10 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* su_port.h: removed su_port_threadsafe() and su_port_yield() methods
su_port_wait_events() replaces su_port_yield().
Fri Oct 5 13:26:04 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* msg_parser.awk: not extending header structure unless needed.
Removed gawk-ish /* comments */.
Fri Oct 5 14:32:25 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* run_test_su: removed GNUisms
Fri Oct 5 14:32:47 EDT 2007 Pekka Pessi <Pekka.Pessi@nokia.com>
* Makefile.am: removed implicit check target test_urlmap
Fri Oct 5 14:22:32 EDT 2007 Pekka Pessi <first.lastname@nokia.com>
* torture_sresolv.c: use CLOCK_REALTIME if no CLOCK_PROCESS_CPUTIME_ID available
Casting timespec tv_sec to unsigned long.
Fri Oct * nua_s added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 08:15:23 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated.
Mon Oct 8 09:30:36 EDT 2007 Pekka.Pessi@nokia.com
* nua_stack: added handling nua_prack()
Thanks to Fabio Margarido for the patch.
Mon Oct 8 10:24:35 EDT 2007 Pekka.Pessi@nokia.com
* test_nua: added test for sf.net bug #1803686
Mon Oct 8 10:26:31 EDT 2007 Pekka.Pessi@nokia.com
* nua: added test for nua_prack() (sf.net bug #1804248)
Avoid sending nua_i_state after nua_prack() if no SDP O/A is happening, too.
Mon Oct 8 10:32:04 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>
* su_source.c: don t leak the wait arrays
Mon Oct 8 10:37:11 EDT 2007 Pekka.Pessi@nokia.com
* RELEASE: updated
Wed Oct 10 11:55:21 EDT 2007 Pekka.Pessi@nokia.com
* sip_parser.c: silenced warning about extra const in sip_extend_mclass()
Wed Oct 10 11:57:08 EDT 2007 Pekka.Pessi@nokia.com
* nta_tag.c: updated tag documentation
Wed Oct 10 13:16:40 EDT 2007 Pekka.Pessi@nokia.com
* nua: fix logging crash if outbound used with application contact
Silenced warnings.
Wed Oct 10 13:30:45 EDT 2007 Pekka.Pessi@nokia.com
* msg_parser.awk: removed extra "const"
Wed Oct 10 13:31:45 EDT 2007 Pekka.Pessi@nokia.com
* Makefile.am's: fixed distclean of documentation
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5840 d0543943-73ff-0310-b7d9-9358b9ac24b2
2007-10-11 14:16:59 +00:00
|
|
|
switch (op) {
|
|
|
|
|
|
|
|
case su_port_thread_op_is_obtained:
|
|
|
|
return 2; /* Current thread has obtained the port */
|
|
|
|
|
|
|
|
case su_port_thread_op_release:
|
|
|
|
return errno = ENOSYS, -1;
|
|
|
|
|
|
|
|
case su_port_thread_op_obtain:
|
|
|
|
return 0; /* Allow initial obtain */
|
|
|
|
|
|
|
|
default:
|
|
|
|
return errno = ENOSYS, -1;
|
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void su_base_port_incref(su_port_t *self, char const *who)
|
|
|
|
{
|
|
|
|
su_home_ref(self->sup_home);
|
2008-12-16 18:05:22 +00:00
|
|
|
PORT_REFCOUNT_DEBUG(("incref(%p) to %u by %s\n", self,
|
2007-04-15 02:03:41 +00:00
|
|
|
su_home_refcount(self->sup_home), who));
|
|
|
|
}
|
|
|
|
|
|
|
|
int su_base_port_decref(su_port_t *self, int blocking, char const *who)
|
|
|
|
{
|
|
|
|
int zapped = su_home_unref(self->sup_home);
|
|
|
|
|
2008-12-16 18:05:22 +00:00
|
|
|
PORT_REFCOUNT_DEBUG(("%s(%p) to %u%s by %s\n",
|
2007-04-15 02:03:41 +00:00
|
|
|
blocking ? "zapref" : "decref",
|
|
|
|
self, zapped ? 0 : su_home_refcount(self->sup_home),
|
|
|
|
blocking && !zapped ? " FAILED" :"",
|
|
|
|
who));
|
|
|
|
|
|
|
|
/* We should block until all references are destroyed */
|
2008-12-16 18:05:22 +00:00
|
|
|
if (blocking)
|
2007-04-15 02:03:41 +00:00
|
|
|
/* ...but we just abort() */
|
|
|
|
assert(zapped);
|
|
|
|
|
|
|
|
return zapped;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct _GSource *su_base_port_gsource(su_port_t *self)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal Send a message to the port.
|
|
|
|
*
|
|
|
|
* @retval 0 if there are other messages in queue, too
|
|
|
|
* @retval -1 upon an error
|
|
|
|
*/
|
|
|
|
int su_base_port_send(su_port_t *self, su_msg_r rmsg)
|
|
|
|
{
|
|
|
|
if (self) {
|
|
|
|
int wakeup;
|
|
|
|
|
|
|
|
su_port_lock(self, "su_port_send");
|
2008-12-16 18:05:22 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
wakeup = self->sup_head == NULL;
|
|
|
|
|
|
|
|
*self->sup_tail = rmsg[0]; rmsg[0] = NULL;
|
|
|
|
self->sup_tail = &(*self->sup_tail)->sum_next;
|
|
|
|
|
|
|
|
su_port_unlock(self, "su_port_send");
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
if (wakeup > 0)
|
|
|
|
su_port_wakeup(self);
|
|
|
|
|
|
|
|
return 0;
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
su_msg_destroy(rmsg);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal
|
|
|
|
* Execute the messages in the incoming queue.
|
|
|
|
*
|
|
|
|
* @param self - pointer to a port object
|
|
|
|
*
|
|
|
|
* @retval Number of messages executed
|
|
|
|
*/
|
|
|
|
int su_base_port_getmsgs(su_port_t *self)
|
|
|
|
{
|
|
|
|
if (self->sup_head) {
|
|
|
|
su_msg_t *queue;
|
|
|
|
|
|
|
|
su_port_lock(self, "su_base_port_getmsgs");
|
|
|
|
|
|
|
|
queue = self->sup_head;
|
|
|
|
self->sup_tail = &self->sup_head;
|
|
|
|
self->sup_head = NULL;
|
|
|
|
|
|
|
|
su_port_unlock(self, "su_base_port_getmsgs");
|
|
|
|
|
|
|
|
return su_base_port_execute_msgs(queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int su_base_port_getmsgs_from(su_port_t *self, su_port_t *from)
|
|
|
|
{
|
|
|
|
su_msg_t *msg, *selected;
|
|
|
|
su_msg_t **next = &self->sup_head, **tail= &selected;
|
|
|
|
|
|
|
|
if (!*next)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
su_port_lock(self, "su_base_port_getmsgs_from_port");
|
|
|
|
|
|
|
|
while (*next) {
|
|
|
|
msg = *next;
|
|
|
|
|
|
|
|
if (msg->sum_from->sut_port == from) {
|
|
|
|
*tail = msg, *next = msg->sum_next, tail = &msg->sum_next;
|
|
|
|
}
|
|
|
|
else
|
2008-12-16 18:05:22 +00:00
|
|
|
next = &msg->sum_next;
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*tail = NULL, self->sup_tail = next;
|
|
|
|
|
|
|
|
su_port_unlock(self, "su_base_port_getmsgs_from_port");
|
|
|
|
|
|
|
|
return su_base_port_execute_msgs(selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
int su_base_port_getmsgs_of_root(su_port_t *self, su_root_t *root)
|
|
|
|
{
|
|
|
|
su_msg_t *msg, *selected;
|
|
|
|
su_msg_t **next = &self->sup_head, **tail= &selected;
|
|
|
|
|
|
|
|
if (!*next)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
su_port_lock(self, "su_base_port_getmsgs_of_root");
|
|
|
|
|
|
|
|
while (*next) {
|
|
|
|
msg = *next;
|
|
|
|
|
|
|
|
if (msg->sum_from->sut_root == root ||
|
|
|
|
msg->sum_to->sut_root == root) {
|
|
|
|
*tail = msg, *next = msg->sum_next, tail = &msg->sum_next;
|
|
|
|
}
|
|
|
|
else
|
2008-12-16 18:05:22 +00:00
|
|
|
next = &msg->sum_next;
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*tail = NULL, self->sup_tail = next;
|
2008-12-16 18:05:22 +00:00
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
su_port_unlock(self, "su_base_port_getmsgs_of_root");
|
|
|
|
|
|
|
|
return su_base_port_execute_msgs(selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int su_base_port_execute_msgs(su_msg_t *queue)
|
|
|
|
{
|
|
|
|
su_msg_t *msg;
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
for (msg = queue; msg; msg = queue) {
|
|
|
|
su_msg_f f = msg->sum_func;
|
|
|
|
|
|
|
|
queue = msg->sum_next, msg->sum_next = NULL;
|
|
|
|
|
2007-12-06 18:44:14 +00:00
|
|
|
if (f) {
|
|
|
|
su_root_t *root = msg->sum_to->sut_root;
|
|
|
|
|
|
|
|
if (msg->sum_to->sut_port == NULL)
|
|
|
|
msg->sum_to->sut_root = NULL;
|
|
|
|
f(SU_ROOT_MAGIC(root), &msg, msg->sum_data);
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
su_msg_delivery_report(&msg);
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal Enable multishot mode.
|
|
|
|
*
|
|
|
|
* The function su_port_multishot() enables, disables or queries the
|
|
|
|
* multishot mode for the port. The multishot mode determines how the events
|
|
|
|
* are scheduled by port. If multishot mode is enabled, port serves all the
|
|
|
|
* sockets that have received network events. If it is disabled, the
|
|
|
|
* socket events are server one at a time.
|
|
|
|
*
|
|
|
|
* @param self pointer to port object
|
|
|
|
* @param multishot multishot mode (0 => disables, 1 => enables, -1 => query)
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* @retval 0 multishot mode is disabled
|
|
|
|
* @retval 1 multishot mode is enabled
|
|
|
|
* @retval -1 an error occurred
|
|
|
|
*/
|
|
|
|
int su_base_port_multishot(su_port_t *self, int multishot)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @internal Main loop.
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* The function @c su_port_run() waits for wait objects and the timers
|
|
|
|
* associated with the port object. When any wait object is signaled or
|
|
|
|
* timer is expired, it invokes the callbacks, and returns waiting.
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* The function @c su_port_run() runs until @c su_port_break() is called
|
|
|
|
* from a callback.
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* @param self pointer to port object
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
*/
|
|
|
|
void su_base_port_run(su_port_t *self)
|
|
|
|
{
|
2009-02-11 17:16:44 +00:00
|
|
|
su_duration_t tout = 0, tout2 = 0;
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
assert(su_port_own_thread(self));
|
|
|
|
|
|
|
|
for (self->sup_running = 1; self->sup_running;) {
|
2009-02-11 17:16:44 +00:00
|
|
|
tout = self->sup_max_defer;
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
if (self->sup_prepoll)
|
|
|
|
self->sup_prepoll(self->sup_pp_magic, self->sup_pp_root);
|
|
|
|
|
|
|
|
if (self->sup_head)
|
|
|
|
self->sup_vtable->su_port_getmsgs(self);
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
if (self->sup_timers || self->sup_deferrable) {
|
|
|
|
su_time_t now = su_now();
|
|
|
|
su_timer_expire(&self->sup_timers, &tout, now);
|
|
|
|
su_timer_expire(&self->sup_deferrable, &tout2, now);
|
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
if (!self->sup_running)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (self->sup_head) /* if there are messages do a quick wait */
|
|
|
|
tout = 0;
|
|
|
|
|
|
|
|
self->sup_vtable->su_port_wait_events(self, tout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if tuning
|
|
|
|
/* This version can help tuning... */
|
|
|
|
void su_base_port_run_tune(su_port_t *self)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int timers = 0, messages = 0, events = 0;
|
2009-02-11 17:16:44 +00:00
|
|
|
su_duration_t tout = 0, tout2 = 0;
|
2007-04-15 02:03:41 +00:00
|
|
|
su_time_t started = su_now(), woken = started, bedtime = woken;
|
|
|
|
|
|
|
|
assert(su_port_own_thread(self));
|
|
|
|
|
|
|
|
for (self->sup_running = 1; self->sup_running;) {
|
2009-02-11 17:16:44 +00:00
|
|
|
tout = self->sup_max_defer;
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
timers = 0, messages = 0;
|
|
|
|
|
|
|
|
if (self->sup_prepoll)
|
|
|
|
self->sup_prepoll(self->sup_pp_magic, self->sup_pp_root);
|
|
|
|
|
|
|
|
if (self->sup_head)
|
|
|
|
messages = self->sup_vtable->su_port_getmsgs(self);
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
if (self->sup_timers || self->sup_deferrable) {
|
|
|
|
su_time_t now = su_now();
|
|
|
|
timers =
|
|
|
|
su_timer_expire(&self->sup_timers, &tout, now) +
|
|
|
|
su_timer_expire(&self->sup_deferrable, &tout2, now);
|
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
if (!self->sup_running)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (self->sup_head) /* if there are messages do a quick wait */
|
|
|
|
tout = 0;
|
|
|
|
|
|
|
|
bedtime = su_now();
|
|
|
|
|
|
|
|
events = self->sup_vtable->su_port_wait_events(self, tout);
|
|
|
|
|
|
|
|
woken = su_now();
|
|
|
|
|
|
|
|
if (messages || timers || events)
|
|
|
|
SU_DEBUG_1(("su_port_run(%p): %.6f: %u messages %u timers %u "
|
|
|
|
"events slept %.6f/%.3f\n",
|
|
|
|
self, su_time_diff(woken, started), messages, timers, events,
|
|
|
|
su_time_diff(woken, bedtime), tout * 1e-3));
|
|
|
|
|
|
|
|
if (!self->sup_running)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @internal
|
|
|
|
* The function @c su_port_break() is used to terminate execution of @c
|
|
|
|
* su_port_run(). It can be called from a callback function.
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* @param self pointer to port
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
*/
|
|
|
|
void su_base_port_break(su_port_t *self)
|
|
|
|
{
|
2008-12-16 18:05:22 +00:00
|
|
|
self->sup_running = 0;
|
2007-04-15 02:03:41 +00:00
|
|
|
}
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
/** @internal
|
|
|
|
* Check if port is running.
|
|
|
|
*
|
|
|
|
* @param self pointer to port
|
|
|
|
*/
|
|
|
|
int su_base_port_is_running(su_port_t const *self)
|
|
|
|
{
|
|
|
|
return self->sup_running != 0;
|
|
|
|
}
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
/** @internal Block until wait object is signaled or timeout.
|
|
|
|
*
|
2008-12-16 18:05:22 +00:00
|
|
|
* This function waits for wait objects and the timers associated with
|
2007-04-15 02:03:41 +00:00
|
|
|
* the root object. When any wait object is signaled or timer is
|
2008-12-16 18:05:22 +00:00
|
|
|
* expired, it invokes the callbacks.
|
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* This function returns when a callback has been invoked or @c tout
|
2008-12-16 18:05:22 +00:00
|
|
|
* milliseconds is elapsed.
|
2007-04-15 02:03:41 +00:00
|
|
|
*
|
|
|
|
* @param self pointer to port
|
|
|
|
* @param tout timeout in milliseconds
|
2008-12-16 18:05:22 +00:00
|
|
|
*
|
2007-04-15 02:03:41 +00:00
|
|
|
* @return
|
|
|
|
* Milliseconds to the next invocation of timer, or @c SU_WAIT_FOREVER if
|
|
|
|
* there are no active timers.
|
|
|
|
*/
|
|
|
|
su_duration_t su_base_port_step(su_port_t *self, su_duration_t tout)
|
|
|
|
{
|
|
|
|
su_time_t now = su_now();
|
|
|
|
|
|
|
|
assert(su_port_own_thread(self));
|
|
|
|
|
|
|
|
if (self->sup_prepoll)
|
|
|
|
self->sup_prepoll(self->sup_pp_magic, self->sup_pp_root);
|
|
|
|
|
|
|
|
if (self->sup_head)
|
|
|
|
self->sup_vtable->su_port_getmsgs(self);
|
|
|
|
|
|
|
|
if (self->sup_timers)
|
|
|
|
su_timer_expire(&self->sup_timers, &tout, now);
|
|
|
|
|
2009-02-11 17:19:49 +00:00
|
|
|
/* XXX: why isn't the timeout ignored here? */
|
2009-02-11 17:16:44 +00:00
|
|
|
if (self->sup_deferrable)
|
|
|
|
su_timer_expire(&self->sup_deferrable, &tout, now);
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
/* if there are messages do a quick wait */
|
|
|
|
if (self->sup_head)
|
|
|
|
tout = 0;
|
|
|
|
|
|
|
|
if (self->sup_vtable->su_port_wait_events(self, tout))
|
|
|
|
tout = 0;
|
|
|
|
else
|
|
|
|
tout = SU_WAIT_FOREVER;
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
if (self->sup_head) {
|
2007-04-15 02:03:41 +00:00
|
|
|
if (self->sup_vtable->su_port_getmsgs(self)) {
|
|
|
|
/* Check for wait events that may have been generated by messages */
|
|
|
|
if (self->sup_vtable->su_port_wait_events(self, 0))
|
|
|
|
tout = 0;
|
|
|
|
}
|
2009-02-11 17:16:44 +00:00
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
if (self->sup_timers || self->sup_deferrable) {
|
|
|
|
su_duration_t tout2 = SU_WAIT_FOREVER;
|
|
|
|
|
|
|
|
now = su_now();
|
|
|
|
su_timer_expire(&self->sup_timers, &tout, now);
|
|
|
|
su_timer_expire(&self->sup_deferrable, &tout2, now);
|
|
|
|
|
|
|
|
if (tout == SU_WAIT_FOREVER && tout2 != SU_WAIT_FOREVER) {
|
|
|
|
if (tout2 < self->sup_max_defer)
|
|
|
|
tout2 = self->sup_max_defer;
|
|
|
|
tout = tout2;
|
|
|
|
}
|
|
|
|
}
|
2007-04-15 02:03:41 +00:00
|
|
|
|
|
|
|
if (self->sup_head)
|
|
|
|
tout = 0;
|
|
|
|
|
|
|
|
return tout;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* =========================================================================
|
|
|
|
* Pre-poll() callback
|
|
|
|
*/
|
|
|
|
|
|
|
|
int su_base_port_add_prepoll(su_port_t *self,
|
2008-12-16 18:05:22 +00:00
|
|
|
su_root_t *root,
|
|
|
|
su_prepoll_f *callback,
|
2007-04-15 02:03:41 +00:00
|
|
|
su_prepoll_magic_t *magic)
|
|
|
|
{
|
|
|
|
if (self->sup_prepoll)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
self->sup_prepoll = callback;
|
|
|
|
self->sup_pp_magic = magic;
|
|
|
|
self->sup_pp_root = root;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int su_base_port_remove_prepoll(su_port_t *self,
|
|
|
|
su_root_t *root)
|
|
|
|
{
|
|
|
|
if (self->sup_pp_root != root)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
self->sup_prepoll = NULL;
|
|
|
|
self->sup_pp_magic = NULL;
|
|
|
|
self->sup_pp_root = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* =========================================================================
|
|
|
|
* Timers
|
|
|
|
*/
|
|
|
|
|
2007-08-06 19:24:10 +00:00
|
|
|
su_timer_queue_t *su_base_port_timers(su_port_t *self)
|
2007-04-15 02:03:41 +00:00
|
|
|
{
|
|
|
|
return &self->sup_timers;
|
|
|
|
}
|
|
|
|
|
2009-02-11 17:16:44 +00:00
|
|
|
su_timer_queue_t *su_base_port_deferrable(su_port_t *self)
|
|
|
|
{
|
|
|
|
return &self->sup_deferrable;
|
|
|
|
}
|
|
|
|
|
|
|
|
int su_base_port_max_defer(su_port_t *self,
|
|
|
|
su_duration_t *return_duration,
|
|
|
|
su_duration_t *set_duration)
|
|
|
|
{
|
|
|
|
if (set_duration && *set_duration > 0)
|
|
|
|
self->sup_max_defer = *set_duration;
|
|
|
|
if (return_duration)
|
|
|
|
*return_duration = self->sup_max_defer;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-16 18:05:22 +00:00
|
|
|
/* ======================================================================
|
|
|
|
* Clones
|
2007-04-15 02:03:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define SU_TASK_COPY(d, s, by) (void)((d)[0]=(s)[0], \
|
|
|
|
(s)->sut_port?(void)su_port_incref(s->sut_port, #by):(void)0)
|
|
|
|
|
|
|
|
static void su_base_port_clone_break(su_root_magic_t *m,
|
|
|
|
su_msg_r msg,
|
|
|
|
su_msg_arg_t *arg);
|
|
|
|
|
|
|
|
int su_base_port_start_shared(su_root_t *parent,
|
|
|
|
su_clone_r return_clone,
|
|
|
|
su_root_magic_t *magic,
|
|
|
|
su_root_init_f init,
|
|
|
|
su_root_deinit_f deinit)
|
|
|
|
{
|
|
|
|
su_port_t *self = parent->sur_task->sut_port;
|
|
|
|
su_root_t *child;
|
|
|
|
|
|
|
|
child = su_salloc(su_port_home(self), sizeof *child);
|
|
|
|
if (!child)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
child->sur_magic = magic;
|
|
|
|
child->sur_deinit = deinit;
|
|
|
|
child->sur_threading = parent->sur_threading;
|
|
|
|
|
2008-12-16 18:05:22 +00:00
|
|
|
SU_TASK_COPY(child->sur_parent, su_root_task(parent),
|
2007-04-15 02:03:41 +00:00
|
|
|
su_base_port_clone_start);
|
|
|
|
SU_TASK_COPY(child->sur_task, child->sur_parent,
|
|
|
|
su_base_port_clone_start);
|
|
|
|
|
|
|
|
child->sur_task->sut_root = child;
|
|
|
|
|
|
|
|
if (su_msg_create(return_clone,
|
|
|
|
child->sur_task, su_root_task(parent),
|
|
|
|
su_base_port_clone_break,
|
|
|
|
0) == 0 &&
|
|
|
|
init(child, magic) == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
su_msg_destroy(return_clone);
|
|
|
|
su_root_destroy(child);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void su_base_port_clone_break(su_root_magic_t *m,
|
|
|
|
su_msg_r msg,
|
|
|
|
su_msg_arg_t *arg)
|
|
|
|
{
|
|
|
|
_su_task_t const *task = su_msg_to(msg);
|
|
|
|
|
|
|
|
while (su_base_port_getmsgs_of_root(task->sut_port, task->sut_root))
|
|
|
|
;
|
|
|
|
|
|
|
|
su_root_destroy(task->sut_root);
|
|
|
|
}
|
|
|
|
|
2008-05-25 15:10:34 +00:00
|
|
|
/**Wait for the clone to exit.
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* Called by su_port_wait() and su_clone_wait()
|
2008-12-16 18:05:22 +00:00
|
|
|
*/
|
2007-04-15 02:03:41 +00:00
|
|
|
void su_base_port_wait(su_clone_r rclone)
|
|
|
|
{
|
|
|
|
su_port_t *self;
|
|
|
|
su_root_t *root_to_wait;
|
|
|
|
|
2008-05-25 15:10:34 +00:00
|
|
|
assert(*rclone);
|
|
|
|
|
2007-04-15 02:03:41 +00:00
|
|
|
self = su_msg_from(rclone)->sut_port;
|
|
|
|
assert(self == su_msg_to(rclone)->sut_port);
|
|
|
|
root_to_wait = su_msg_to(rclone)->sut_root;
|
|
|
|
|
|
|
|
assert(rclone[0]->sum_func == su_base_port_clone_break);
|
|
|
|
|
|
|
|
while (su_base_port_getmsgs_of_root(self, root_to_wait))
|
|
|
|
;
|
|
|
|
su_root_destroy(root_to_wait);
|
|
|
|
su_msg_destroy(rclone);
|
|
|
|
}
|
|
|
|
|