summaryrefslogtreecommitdiff
path: root/pjlib/include
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/include')
-rw-r--r--pjlib/include/pj/compat/cc_msvc.h4
-rw-r--r--pjlib/include/pj/compat/os_symbian.h14
-rw-r--r--pjlib/include/pj/config.h147
-rw-r--r--pjlib/include/pj/errno.h5
-rw-r--r--pjlib/include/pj/ioqueue.h3
-rw-r--r--pjlib/include/pj/list_i.h44
-rw-r--r--pjlib/include/pj/log.h4
-rw-r--r--pjlib/include/pj/os.h65
-rw-r--r--pjlib/include/pj/pool.h25
-rw-r--r--pjlib/include/pj/pool_i.h1
-rw-r--r--pjlib/include/pj/sock.h64
-rw-r--r--pjlib/include/pj/sock_select.h15
-rw-r--r--pjlib/include/pj/timer.h3
-rw-r--r--pjlib/include/pj/types.h4
14 files changed, 312 insertions, 86 deletions
diff --git a/pjlib/include/pj/compat/cc_msvc.h b/pjlib/include/pj/compat/cc_msvc.h
index 3d6aa803..d028578b 100644
--- a/pjlib/include/pj/compat/cc_msvc.h
+++ b/pjlib/include/pj/compat/cc_msvc.h
@@ -53,6 +53,10 @@
# define PJ_INLINE_SPECIFIER static __inline
#endif
+#define PJ_EXPORT_DECL_SPECIFIER __declspec(dllexport)
+#define PJ_EXPORT_DEF_SPECIFIER __declspec(dllexport)
+#define PJ_IMPORT_DECL_SPECIFIER __declspec(dllimport)
+
#define PJ_THREAD_FUNC
#define PJ_NORETURN __declspec(noreturn)
#define PJ_ATTR_NORETURN
diff --git a/pjlib/include/pj/compat/os_symbian.h b/pjlib/include/pj/compat/os_symbian.h
index f6787b06..fd224ff5 100644
--- a/pjlib/include/pj/compat/os_symbian.h
+++ b/pjlib/include/pj/compat/os_symbian.h
@@ -148,15 +148,11 @@ typedef unsigned int socklen_t;
#include <e32def.h>
#endif
-/*
-#if defined(PJ_EXPORTING)
-# define PJ_EXPORT_IMPORT EXPORT_C
-#elif defined(PJ_IMPORTING)
-# define PJ_EXPORT_IMPORT IMPORT_C
-#else
-# error "Must define either PJ_EXPORTING or PJ_IMPORTING"
-#endif
-*/
+#define PJ_EXPORT_DECL_SPECIFIER IMPORT_C
+//#define PJ_EXPORT_DECL_SPECIFIER
+#define PJ_EXPORT_DEF_SPECIFIER EXPORT_C
+#define PJ_IMPORT_DECL_SPECIFIER IMPORT_C
+
#endif /* __PJ_COMPAT_OS_SYMBIAN_H__ */
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index cbdc0aa4..db557c9d 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -657,6 +657,37 @@
*/
/**
+ * Guide for building dynamic link libraries (DLL).
+ *
+ * The libraries support generation of dynamic link libraries for
+ * Symbian ABIv2 target (.dso files, in S60 3rd Edition). Similar
+ * procedures may be applied for Win32 DLL too, with some modification.
+ *
+ * Macros related for building DLL/DSO files:
+ * - For platforms that supports dynamic link libraries generation,
+ * it must declare PJ_EXPORT_SPECIFIER macro which value contains
+ * the prefix to be added to symbol definition, to export this
+ * symbol in the DLL/DSO. For example, on Win32/Visual Studio, the
+ * value of this macro is "__declspec(dllexport)", and for ARM
+ * ABIv2/Symbian, the value is \a EXPORT_C.
+ * - For platforms that supports linking with dynamic link libraries,
+ * it must declare PJ_IMPORT_SPECIFIER macro which value contains
+ * the prefix to be added to symbol declaration, to import this
+ * symbol from a DLL/DSO. For example, on Win32/Visual Studio, the
+ * value of this macro is "__declspec(dllimport)", and for ARM
+ * ABIv2/Symbian, the value is \a IMPORT_C.
+ * - When PJLIB is built as DLL/DSO, both \a PJ_DLL and \a PJ_EXPORTING
+ * macros must be declared, so that PJ_EXPORT_SPECIFIER prefix will be
+ * added into function definition.
+ * - When application wants to link dynamically with PJLIB, then it
+ * must declare \a PJ_DLL macro when using/including PJLIB header,
+ * so that PJ_IMPORT_SPECIFIER is properly added into symbol
+ * declarations.
+ *
+ * When \a PJ_DLL macro is not declared, static linking is assumed.
+ */
+
+/**
* @def PJ_INLINE(type)
* @param type The return type of the function.
* Expand the function as inline.
@@ -664,11 +695,6 @@
#define PJ_INLINE(type) PJ_INLINE_SPECIFIER type
/**
- * @def PJ_DECL(type)
- * @param type The return type of the function.
- * Declare a function.
- */
-/**
* @def PJ_DECL_NO_RETURN(type)
* @param type The return type of the function.
* Declare a function that will not return.
@@ -682,38 +708,124 @@
* Mark end of declaration section in a header file.
*/
#ifdef __cplusplus
-# define PJ_DECL(type) type
# define PJ_DECL_NO_RETURN(type) type PJ_NORETURN
# define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN
# define PJ_BEGIN_DECL extern "C" {
# define PJ_END_DECL }
#else
-# define PJ_DECL(type) extern type
# define PJ_DECL_NO_RETURN(type) PJ_NORETURN type
# define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type)
# define PJ_BEGIN_DECL
# define PJ_END_DECL
#endif
+
+/**
+ * This macro declares platform/compiler specific specifier prefix
+ * to be added to symbol declaration to export the symbol when PJLIB
+ * is built as dynamic library.
+ *
+ * This macro should have been added by platform specific headers,
+ * if the platform supports building dynamic library target.
+ */
+#ifndef PJ_EXPORT_DECL_SPECIFIER
+# define PJ_EXPORT_DECL_SPECIFIER
+#endif
+
+
+/**
+ * This macro declares platform/compiler specific specifier prefix
+ * to be added to symbol definition to export the symbol when PJLIB
+ * is built as dynamic library.
+ *
+ * This macro should have been added by platform specific headers,
+ * if the platform supports building dynamic library target.
+ */
+#ifndef PJ_EXPORT_DEF_SPECIFIER
+# define PJ_EXPORT_DEF_SPECIFIER
+#endif
+
+
+/**
+ * This macro declares platform/compiler specific specifier prefix
+ * to be added to symbol declaration to import the symbol.
+ *
+ * This macro should have been added by platform specific headers,
+ * if the platform supports building dynamic library target.
+ */
+#ifndef PJ_IMPORT_DECL_SPECIFIER
+# define PJ_IMPORT_DECL_SPECIFIER
+#endif
+
+
+/**
+ * This macro has been deprecated. It will evaluate to nothing.
+ */
+#ifndef PJ_EXPORT_SYMBOL
+# define PJ_EXPORT_SYMBOL(x)
+#endif
+
+
+/**
+ * @def PJ_DECL(type)
+ * @param type The return type of the function.
+ * Declare a function.
+ */
+#if defined(PJ_DLL)
+# if defined(PJ_EXPORTING)
+# define PJ_DECL(type) PJ_EXPORT_DECL_SPECIFIER type
+# else
+# define PJ_DECL(type) PJ_IMPORT_DECL_SPECIFIER type
+# endif
+#elif !defined(PJ_DECL)
+# if defined(__cplusplus)
+# define PJ_DECL(type) type
+# else
+# define PJ_DECL(type) extern type
+# endif
+#endif
+
+
/**
* @def PJ_DEF(type)
* @param type The return type of the function.
* Define a function.
*/
-#define PJ_DEF(type) type
+#if defined(PJ_DLL) && defined(PJ_EXPORTING)
+# define PJ_DEF(type) PJ_EXPORT_DEF_SPECIFIER type
+#elif !defined(PJ_DEF)
+# define PJ_DEF(type) type
+#endif
+
/**
- * @def PJ_EXPORT_SYMBOL(sym)
- * @param sym The symbol to export.
- * Export the specified symbol in compilation type that requires export
- * (e.g. Linux kernel).
- */
-#ifdef __PJ_EXPORT_SYMBOL
-# define PJ_EXPORT_SYMBOL(sym) __PJ_EXPORT_SYMBOL(sym)
-#else
-# define PJ_EXPORT_SYMBOL(sym)
+ * @def PJ_DECL_DATA(type)
+ * @param type The data type.
+ * Declare a global data.
+ */
+#if defined(PJ_DLL)
+# if defined(PJ_EXPORTING)
+# define PJ_DECL_DATA(type) PJ_EXPORT_DECL_SPECIFIER extern type
+# else
+# define PJ_DECL_DATA(type) PJ_IMPORT_DECL_SPECIFIER extern type
+# endif
+#elif !defined(PJ_DECL_DATA)
+# define PJ_DECL_DATA(type) extern type
#endif
+
+/**
+ * @def PJ_DEF_DATA(type)
+ * @param type The data type.
+ * Define a global data.
+ */
+#if defined(PJ_DLL) && defined(PJ_EXPORTING)
+# define PJ_DEF_DATA(type) PJ_EXPORT_DEF_SPECIFIER type
+#elif !defined(PJ_DEF_DATA)
+# define PJ_DEF_DATA(type) type
+#endif
+
+
/**
* @def PJ_IDECL(type)
* @param type The function's return type.
@@ -733,6 +845,7 @@
# define PJ_IDEF(type) PJ_DEF(type)
#endif
+
/**
* @def PJ_UNUSED_ARG(arg)
* @param arg The argument name.
diff --git a/pjlib/include/pj/errno.h b/pjlib/include/pj/errno.h
index df6c1b02..9d2c504f 100644
--- a/pjlib/include/pj/errno.h
+++ b/pjlib/include/pj/errno.h
@@ -352,11 +352,10 @@ PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code,
* - PJNATH_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4)
*/
-
-PJ_END_DECL
-
/* Internal */
void pj_errno_clear_handlers(void);
+PJ_END_DECL
+
#endif /* __PJ_ERRNO_H__ */
diff --git a/pjlib/include/pj/ioqueue.h b/pjlib/include/pj/ioqueue.h
index bc93e2d8..616ccc15 100644
--- a/pjlib/include/pj/ioqueue.h
+++ b/pjlib/include/pj/ioqueue.h
@@ -478,6 +478,9 @@ PJ_DECL(pj_status_t) pj_ioqueue_connect( pj_ioqueue_key_t *key,
/**
* Poll the I/O Queue for completed events.
*
+ * Note: polling the ioqueue is not necessary in Symbian. Please see
+ * @ref PJ_SYMBIAN_OS for more info.
+ *
* @param ioque the I/O Queue.
* @param timeout polling timeout, or NULL if the thread wishes to wait
* indefinetely for the event.
diff --git a/pjlib/include/pj/list_i.h b/pjlib/include/pj/list_i.h
index f0a628e1..b604d790 100644
--- a/pjlib/include/pj/list_i.h
+++ b/pjlib/include/pj/list_i.h
@@ -19,27 +19,13 @@
/* Internal */
-PJ_IDEF(void) pj_link_node(pj_list_type *prev, pj_list_type *next)
+PJ_INLINE(void) pj_link_node(pj_list_type *prev, pj_list_type *next)
{
((pj_list*)prev)->next = next;
((pj_list*)next)->prev = prev;
}
-/*
-PJ_IDEF(void)
-pj_list_init(pj_list_type * node)
-{
- ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
-}
-
-PJ_IDEF(int) pj_list_empty(const pj_list_type * node)
-{
- return ((pj_list*)node)->next == node;
-}
-*/
-
-PJ_IDEF(void)
-pj_list_insert_after(pj_list_type *pos, pj_list_type *node)
+PJ_IDEF(void) pj_list_insert_after(pj_list_type *pos, pj_list_type *node)
{
((pj_list*)node)->prev = pos;
((pj_list*)node)->next = ((pj_list*)pos)->next;
@@ -48,15 +34,13 @@ pj_list_insert_after(pj_list_type *pos, pj_list_type *node)
}
-PJ_IDEF(void)
-pj_list_insert_before(pj_list_type *pos, pj_list_type *node)
+PJ_IDEF(void) pj_list_insert_before(pj_list_type *pos, pj_list_type *node)
{
pj_list_insert_after(((pj_list*)pos)->prev, node);
}
-PJ_IDEF(void)
-pj_list_insert_nodes_after(pj_list_type *pos, pj_list_type *lst)
+PJ_IDEF(void) pj_list_insert_nodes_after(pj_list_type *pos, pj_list_type *lst)
{
pj_list *lst_last = (pj_list *) ((pj_list*)lst)->prev;
pj_list *pos_next = (pj_list *) ((pj_list*)pos)->next;
@@ -65,14 +49,12 @@ pj_list_insert_nodes_after(pj_list_type *pos, pj_list_type *lst)
pj_link_node(lst_last, pos_next);
}
-PJ_IDEF(void)
-pj_list_insert_nodes_before(pj_list_type *pos, pj_list_type *lst)
+PJ_IDEF(void) pj_list_insert_nodes_before(pj_list_type *pos, pj_list_type *lst)
{
pj_list_insert_nodes_after(((pj_list*)pos)->prev, lst);
}
-PJ_IDEF(void)
-pj_list_merge_last(pj_list_type *lst1, pj_list_type *lst2)
+PJ_IDEF(void) pj_list_merge_last(pj_list_type *lst1, pj_list_type *lst2)
{
if (!pj_list_empty(lst2)) {
pj_link_node(((pj_list*)lst1)->prev, ((pj_list*)lst2)->next);
@@ -81,8 +63,7 @@ pj_list_merge_last(pj_list_type *lst1, pj_list_type *lst2)
}
}
-PJ_IDEF(void)
-pj_list_merge_first(pj_list_type *lst1, pj_list_type *lst2)
+PJ_IDEF(void) pj_list_merge_first(pj_list_type *lst1, pj_list_type *lst2)
{
if (!pj_list_empty(lst2)) {
pj_link_node(((pj_list*)lst2)->prev, ((pj_list*)lst1)->next);
@@ -91,15 +72,13 @@ pj_list_merge_first(pj_list_type *lst1, pj_list_type *lst2)
}
}
-PJ_IDEF(void)
-pj_list_erase(pj_list_type *node)
+PJ_IDEF(void) pj_list_erase(pj_list_type *node)
{
pj_link_node( ((pj_list*)node)->prev, ((pj_list*)node)->next);
}
-PJ_IDEF(pj_list_type*)
-pj_list_find_node(pj_list_type *list, pj_list_type *node)
+PJ_IDEF(pj_list_type*) pj_list_find_node(pj_list_type *list, pj_list_type *node)
{
pj_list *p = (pj_list *) ((pj_list*)list)->next;
while (p != list && p != node)
@@ -109,9 +88,8 @@ pj_list_find_node(pj_list_type *list, pj_list_type *node)
}
-PJ_IDEF(pj_list_type*)
-pj_list_search(pj_list_type *list, void *value,
- int (*comp)(void *value, const pj_list_type *node))
+PJ_IDEF(pj_list_type*) pj_list_search(pj_list_type *list, void *value,
+ int (*comp)(void *value, const pj_list_type *node))
{
pj_list *p = (pj_list *) ((pj_list*)list)->next;
while (p != list && (*comp)(value, p) != 0)
diff --git a/pjlib/include/pj/log.h b/pjlib/include/pj/log.h
index 3b9e3afe..c04a3adb 100644
--- a/pjlib/include/pj/log.h
+++ b/pjlib/include/pj/log.h
@@ -174,10 +174,10 @@ PJ_DECL(void) pj_log_set_level(int level);
*
* @return Current log maximum level.
*/
-#if 0
+#if 1
PJ_DECL(int) pj_log_get_level(void);
#else
-extern int pj_log_max_level;
+PJ_DECL_DATA(int) pj_log_max_level;
#define pj_log_get_level() pj_log_max_level
#endif
diff --git a/pjlib/include/pj/os.h b/pjlib/include/pj/os.h
index c1a570f6..10cc5520 100644
--- a/pjlib/include/pj/os.h
+++ b/pjlib/include/pj/os.h
@@ -236,6 +236,69 @@ PJ_DECL(pj_status_t) pj_thread_get_stack_info(pj_thread_t *thread,
/* **************************************************************************/
/**
+ * @defgroup PJ_SYMBIAN_OS Symbian OS Specific
+ * @ingroup PJ_OS
+ * @{
+ * Functionalities specific to Symbian OS.
+ *
+ * Symbian OS strongly discourages the use of polling since this wastes
+ * CPU power, and instead provides Active Object and Active Scheduler
+ * pattern to allow application (in this case, PJLIB) to register asynchronous
+ * tasks. PJLIB port for Symbian complies to this recommended behavior.
+ * As the result, few things have been changed in PJLIB for Symbian:
+ * - the timer heap (see @ref PJ_TIMER) is implemented with active
+ * object framework, and each timer entry registered to the timer
+ * heap will register an Active Object to the Active Scheduler.
+ * Because of this, polling the timer heap with pj_timer_heap_poll()
+ * is no longer necessary, and this function will just evaluate
+ * to nothing.
+ * - the ioqueue (see @ref PJ_IOQUEUE) is also implemented with
+ * active object framework, with each asynchronous operation will
+ * register an Active Object to the Active Scheduler. Because of
+ * this, polling the ioqueue with pj_ioqueue_poll() is no longer
+ * necessary, and this function will just evaluate to nothing.
+ *
+ * Since timer heap and ioqueue polling are no longer necessary, Symbian
+ * application can now poll for all events by calling
+ * \a User::WaitForAnyRequest() and \a CActiveScheduler::RunIfReady().
+ * PJLIB provides a thin wrapper which calls these two functions,
+ * called pj_symbianos_poll().
+ */
+
+/**
+ * Wait the completion of any Symbian active objects. When the timeout
+ * value is not specified (the \a ms_timeout argument is -1), this
+ * function is a thin wrapper which calls \a User::WaitForAnyRequest()
+ * and \a CActiveScheduler::RunIfReady(). If the timeout value is
+ * specified, this function will schedule a timer entry to the timer
+ * heap (which is an Active Object), to limit the wait time for event
+ * occurences. Scheduling a timer entry is an expensive operation,
+ * therefore application should only specify a timeout value when it's
+ * really necessary (for example, when it's not sure there are other
+ * Active Objects currently running in the application).
+ *
+ * @param priority The minimum priority of the Active Objects to
+ * poll, which values are from CActive::TPriority
+ * constants. If -1 is given, CActive::EPriorityStandard.
+ * priority will be used.
+ * @param ms_timeout Optional timeout to wait. Application should
+ * specify -1 to let the function wait indefinitely
+ * for any events.
+ *
+ * @return PJ_TRUE if there have been any events executed
+ * during the polling. This function will only return
+ * PJ_FALSE if \a ms_timeout argument is specified
+ * (i.e. the value is not -1) and there was no event
+ * executed when the timeout timer elapsed.
+ */
+PJ_DECL(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout);
+
+/**
+ * @}
+ */
+
+/* **************************************************************************/
+/**
* @defgroup PJ_TLS Thread Local Storage.
* @ingroup PJ_OS
* @{
@@ -405,7 +468,7 @@ PJ_DECL(pj_atomic_value_t) pj_atomic_add_and_get( pj_atomic_t *atomic_var,
* Mutex types:
* - PJ_MUTEX_DEFAULT: default mutex type, which is system dependent.
* - PJ_MUTEX_SIMPLE: non-recursive mutex.
- * - PJ_MUTEX_RECURSIVE: recursive mutex.
+ * - PJ_MUTEX_RECURSE: recursive mutex.
*/
typedef enum pj_mutex_type_e
{
diff --git a/pjlib/include/pj/pool.h b/pjlib/include/pj/pool.h
index 06cdd037..5cb6aaf8 100644
--- a/pjlib/include/pj/pool.h
+++ b/pjlib/include/pj/pool.h
@@ -227,9 +227,9 @@ PJ_BEGIN_DECL
return 1;
}
- // Create the pool factory, in this case, a caching pool.
- pj_caching_pool_init(&cp, &pj_pool_factory_default_policy,
- 1024*1024 );
+ // Create the pool factory, in this case, a caching pool,
+ // using default pool policy.
+ pj_caching_pool_init(&cp, NULL, 1024*1024 );
// Do a demo
pool_demo_1(&cp.factory);
@@ -505,8 +505,14 @@ PJ_INLINE(void*) pj_pool_zalloc(pj_pool_t *pool, pj_size_t size)
#define PJ_POOL_ZALLOC_T(pool,type) \
((type*)pj_pool_zalloc(pool, sizeof(type)))
+/*
+ * Internal functions
+ */
+PJ_IDECL(void*) pj_pool_alloc_from_block(pj_pool_block *block, pj_size_t size);
+PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, unsigned size);
+
/**
* @} // PJ_POOL
*/
@@ -617,8 +623,19 @@ extern int PJ_NO_MEMORY_EXCEPTION;
* - block allocation and deallocation use malloc() and free().
* - callback will raise PJ_NO_MEMORY_EXCEPTION exception.
* - access to pool factory is not serialized (i.e. not thread safe).
+ *
+ * @see pj_pool_factory_get_default_policy
+ */
+PJ_DECL_DATA(pj_pool_factory_policy) pj_pool_factory_default_policy;
+
+
+/**
+ * Get the default pool factory policy.
+ *
+ * @return the pool policy.
*/
-extern pj_pool_factory_policy pj_pool_factory_default_policy;
+PJ_DECL(const pj_pool_factory_policy*) pj_pool_factory_get_default_policy(void);
+
/**
* This structure contains the declaration for pool factory interface.
diff --git a/pjlib/include/pj/pool_i.h b/pjlib/include/pj/pool_i.h
index 1a9b6267..a3a96ad3 100644
--- a/pjlib/include/pj/pool_i.h
+++ b/pjlib/include/pj/pool_i.h
@@ -20,7 +20,6 @@
#include <pj/string.h>
-PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, unsigned size);
PJ_IDEF(pj_size_t) pj_pool_get_capacity( pj_pool_t *pool )
{
diff --git a/pjlib/include/pj/sock.h b/pjlib/include/pj/sock.h
index 0be02589..fe97c106 100644
--- a/pjlib/include/pj/sock.h
+++ b/pjlib/include/pj/sock.h
@@ -59,12 +59,18 @@ PJ_BEGIN_DECL
* APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL AF_*, BECAUSE
* THE LIBRARY WILL DO TRANSLATION TO THE NATIVE VALUE.
*/
-extern const pj_uint16_t PJ_AF_UNIX; /**< Unix domain socket. */
-#define PJ_AF_LOCAL PJ_AF_UNIX; /**< POSIX name for AF_UNIX */
-extern const pj_uint16_t PJ_AF_INET; /**< Internet IP protocol. */
-extern const pj_uint16_t PJ_AF_INET6; /**< IP version 6. */
-extern const pj_uint16_t PJ_AF_PACKET; /**< Packet family. */
-extern const pj_uint16_t PJ_AF_IRDA; /**< IRDA sockets. */
+extern const pj_uint16_t PJ_AF_UNIX; /**< Unix domain socket. */
+#define PJ_AF_LOCAL PJ_AF_UNIX; /**< POSIX name for AF_UNIX */
+extern const pj_uint16_t PJ_AF_INET; /**< Internet IP protocol. */
+extern const pj_uint16_t PJ_AF_INET6;/**< IP version 6. */
+extern const pj_uint16_t PJ_AF_PACKET;/**< Packet family. */
+extern const pj_uint16_t PJ_AF_IRDA; /**< IRDA sockets. */
+
+PJ_DECL(pj_uint16_t) pj_AF_UNIX(void);
+PJ_DECL(pj_uint16_t) pj_AF_INET(void);
+PJ_DECL(pj_uint16_t) pj_AF_INET6(void);
+PJ_DECL(pj_uint16_t) pj_AF_PACKET(void);
+PJ_DECL(pj_uint16_t) pj_AF_IRDA(void);
/**
@@ -74,14 +80,20 @@ extern const pj_uint16_t PJ_AF_IRDA; /**< IRDA sockets. */
*/
extern const pj_uint16_t PJ_SOCK_STREAM; /**< Sequenced, reliable, connection-
- based byte streams. */
+ based byte streams. */
extern const pj_uint16_t PJ_SOCK_DGRAM; /**< Connectionless, unreliable
- datagrams of fixed maximum
- lengths. */
+ datagrams of fixed maximum
+ lengths. */
extern const pj_uint16_t PJ_SOCK_RAW; /**< Raw protocol interface. */
extern const pj_uint16_t PJ_SOCK_RDM; /**< Reliably-delivered messages. */
+PJ_DECL(int) pj_SOCK_STREAM(void);
+PJ_DECL(int) pj_SOCK_DGRAM(void);
+PJ_DECL(int) pj_SOCK_RAW(void);
+PJ_DECL(int) pj_SOCK_RDM(void);
+
+
/**
* Socket level specified in #pj_sock_setsockopt() or #pj_sock_getsockopt().
* APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOL_*, BECAUSE
@@ -93,6 +105,12 @@ extern const pj_uint16_t PJ_SOL_TCP; /**< TCP level. */
extern const pj_uint16_t PJ_SOL_UDP; /**< UDP level. */
extern const pj_uint16_t PJ_SOL_IPV6; /**< IP version 6 */
+PJ_DECL(pj_uint16_t) pj_SOL_SOCKET(void);
+PJ_DECL(pj_uint16_t) pj_SOL_IP(void);
+PJ_DECL(pj_uint16_t) pj_SOL_TCP(void);
+PJ_DECL(pj_uint16_t) pj_SOL_UDP(void);
+PJ_DECL(pj_uint16_t) pj_SOL_IPV6(void);
+
/* IP_TOS
*
@@ -102,6 +120,7 @@ extern const pj_uint16_t PJ_SOL_IPV6; /**< IP version 6 */
*/
extern const pj_uint16_t PJ_IP_TOS; /**< IP_TOS optname in setsockopt() */
+PJ_DECL(int) pj_IP_TOS(void);
/*
* IP TOS related constats.
@@ -114,24 +133,37 @@ extern const pj_uint16_t PJ_IPTOS_LOWDELAY; /**< Minimize delays */
extern const pj_uint16_t PJ_IPTOS_THROUGHPUT; /**< Optimize throughput */
extern const pj_uint16_t PJ_IPTOS_RELIABILITY; /**< Optimize for reliability*/
extern const pj_uint16_t PJ_IPTOS_MINCOST; /**< "filler data" where slow
- transmission does't matter */
+ transmission does't matter */
+
+PJ_DECL(int) pj_IPTOS_LOWDELAY(void);
+PJ_DECL(int) pj_IPTOS_THROUGHPUT(void);
+PJ_DECL(int) pj_IPTOS_RELIABILITY(void);
+PJ_DECL(int) pj_IPTOS_MINCOST(void);
/**
* Values to be specified as \c optname when calling #pj_sock_setsockopt()
* or #pj_sock_getsockopt().
*/
-extern const pj_uint16_t PJ_SO_TYPE; /**< Socket type. */
-extern const pj_uint16_t PJ_SO_RCVBUF; /**< Buffer size for receive. */
-extern const pj_uint16_t PJ_SO_SNDBUF; /**< Buffer size for send. */
+extern const pj_uint16_t PJ_SO_TYPE; /**< Socket type. */
+extern const pj_uint16_t PJ_SO_RCVBUF;/**< Buffer size for receive. */
+extern const pj_uint16_t PJ_SO_SNDBUF;/**< Buffer size for send. */
+
+PJ_DECL(pj_uint16_t) pj_SO_TYPE(void);
+PJ_DECL(pj_uint16_t) pj_SO_RCVBUF(void);
+PJ_DECL(pj_uint16_t) pj_SO_SNDBUF(void);
/*
* Flags to be specified in #pj_sock_recv, #pj_sock_send, etc.
*/
-extern const int PJ_MSG_OOB; /**< Out-of-band messages. */
-extern const int PJ_MSG_PEEK; /**< Peek, don't remove from buffer. */
-extern const int PJ_MSG_DONTROUTE; /**< Don't route. */
+extern const int PJ_MSG_OOB; /**< Out-of-band messages. */
+extern const int PJ_MSG_PEEK; /**< Peek, don't remove from buffer*/
+extern const int PJ_MSG_DONTROUTE;/**< Don't route. */
+
+PJ_DECL(int) pj_MSG_OOB(void);
+PJ_DECL(int) pj_MSG_PEEK(void);
+PJ_DECL(int) pj_MSG_DONTROUTE(void);
/**
diff --git a/pjlib/include/pj/sock_select.h b/pjlib/include/pj/sock_select.h
index d0ef5d9d..8ce7a65b 100644
--- a/pjlib/include/pj/sock_select.h
+++ b/pjlib/include/pj/sock_select.h
@@ -67,6 +67,21 @@ PJ_DECL(void) PJ_FD_ZERO(pj_fd_set_t *fdsetp);
/**
+ * This is an internal function, application shouldn't use this.
+ *
+ * Get the number of descriptors in the set. This is defined in sock_select.c
+ * This function will only return the number of sockets set from PJ_FD_SET
+ * operation. When the set is modified by other means (such as by select()),
+ * the count will not be reflected here.
+ *
+ * @param fdsetp The descriptor set.
+ *
+ * @return Number of descriptors in the set.
+ */
+PJ_DECL(pj_size_t) PJ_FD_COUNT(const pj_fd_set_t *fdsetp);
+
+
+/**
* Add the file descriptor fd to the set pointed to by fdsetp.
* If the file descriptor fd is already in this set, there shall be no effect
* on the set, nor will an error be returned.
diff --git a/pjlib/include/pj/timer.h b/pjlib/include/pj/timer.h
index 6e4839c2..a8b3eb6e 100644
--- a/pjlib/include/pj/timer.h
+++ b/pjlib/include/pj/timer.h
@@ -253,6 +253,9 @@ PJ_DECL(pj_status_t) pj_timer_heap_earliest_time( pj_timer_heap_t *ht,
* Poll the timer heap, check for expired timers and call the callback for
* each of the expired timers.
*
+ * Note: polling the timer heap is not necessary in Symbian. Please see
+ * @ref PJ_SYMBIAN_OS for more info.
+ *
* @param ht The timer heap.
* @param next_delay If this parameter is not NULL, it will be filled up with
* the time delay until the next timer elapsed, or -1 in
diff --git a/pjlib/include/pj/types.h b/pjlib/include/pj/types.h
index e9095524..4ea5b79b 100644
--- a/pjlib/include/pj/types.h
+++ b/pjlib/include/pj/types.h
@@ -302,7 +302,11 @@ PJ_DECL(pj_status_t) pj_init(void);
*/
PJ_DECL(void) pj_shutdown(void);
+/**
+ * Type of callback to register to pj_atexit().
+ */
typedef void (*pj_exit_callback)(void);
+
/**
* Register cleanup function to be called by PJLIB when pj_shutdown() is
* called.