| config_site_sample.h | | config_site_sample.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| # define PJMEDIA_HAS_SMALL_FILTER 1 | | # define PJMEDIA_HAS_SMALL_FILTER 1 | |
| # define PJMEDIA_HAS_LARGE_FILTER 0 | | # define PJMEDIA_HAS_LARGE_FILTER 0 | |
| # define PJMEDIA_HAS_L16_CODEC 0 | | # define PJMEDIA_HAS_L16_CODEC 0 | |
| /*# define PJMEDIA_HAS_GSM_CODEC 0*/ | | /*# define PJMEDIA_HAS_GSM_CODEC 0*/ | |
| /*# define PJMEDIA_HAS_ILBC_CODEC 0*/ | | /*# define PJMEDIA_HAS_ILBC_CODEC 0*/ | |
| /*# define PJMEDIA_HAS_SPEEX_CODEC 0*/ | | /*# define PJMEDIA_HAS_SPEEX_CODEC 0*/ | |
| # define PJMEDIA_HAS_SPEEX_AEC 0 | | # define PJMEDIA_HAS_SPEEX_AEC 0 | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
|
| | | * Typical configuration for Symbian OS target | |
| | | */ | |
| | | #if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 | |
| | | | |
| | | /* We don't want to use float, for now */ | |
| | | # undef PJ_HAS_FLOATING_POINT | |
| | | # define PJ_HAS_FLOATING_POINT 0 | |
| | | | |
| | | # define PJMEDIA_SOUND_IMPLEMENTATION PJMEDIA_SOUND_NULL_SOUND | |
| | | | |
| | | /* Disable these */ | |
| | | # define PJMEDIA_HAS_LIBRESAMPLE 0 | |
| | | # define PJMEDIA_HAS_SPEEX_AEC 0 | |
| | | | |
| | | /* Disable all codecs but G.711, for now */ | |
| | | # define PJMEDIA_HAS_L16_CODEC 0 | |
| | | # define PJMEDIA_HAS_GSM_CODEC 0 | |
| | | # define PJMEDIA_HAS_ILBC_CODEC 0 | |
| | | # define PJMEDIA_HAS_SPEEX_CODEC 0 | |
| | | | |
| | | /* Disable safe module access */ | |
| | | # define PJSIP_SAFE_MODULE 0 | |
| | | | |
| | | # define PJSIP_MAX_PKT_LEN 2000 | |
| | | | |
| | | /* Since we don't have threads, log buffer can use static buffer */ | |
| | | # define PJ_LOG_USE_STACK_BUFFER 0 | |
| | | | |
| | | /* Symbian has problem with too many large blocks */ | |
| | | # define PJSIP_POOL_LEN_ENDPT 1000 | |
| | | # define PJSIP_POOL_INC_ENDPT 1000 | |
| | | # define PJSIP_POOL_RDATA_LEN 2000 | |
| | | # define PJSIP_POOL_RDATA_INC 2000 | |
| | | # define PJSIP_POOL_LEN_TDATA 2000 | |
| | | # define PJSIP_POOL_INC_TDATA 512 | |
| | | # define PJSIP_POOL_LEN_UA 2000 | |
| | | # define PJSIP_POOL_INC_UA 1000 | |
| | | # define PJSIP_POOL_TSX_LAYER_LEN 256 | |
| | | # define PJSIP_POOL_TSX_LAYER_INC 256 | |
| | | # define PJSIP_POOL_TSX_LEN 512 | |
| | | # define PJSIP_POOL_TSX_INC 128 | |
| | | | |
| | | /* Set maximum number of dialog/transaction/calls to minimum */ | |
| | | # define PJSIP_MAX_TSX_COUNT 31 | |
| | | # define PJSIP_MAX_DIALOG_COUNT 31 | |
| | | # define PJSUA_MAX_CALLS 31 | |
| | | | |
| | | #endif | |
| | | | |
| | | /* | |
| * Minimum size | | * Minimum size | |
| */ | | */ | |
| #ifdef PJ_CONFIG_MINIMAL_SIZE | | #ifdef PJ_CONFIG_MINIMAL_SIZE | |
| | | | |
| # undef PJ_OS_HAS_CHECK_STACK | | # undef PJ_OS_HAS_CHECK_STACK | |
| # define PJ_OS_HAS_CHECK_STACK 0 | | # define PJ_OS_HAS_CHECK_STACK 0 | |
| # define PJ_LOG_MAX_LEVEL 0 | | # define PJ_LOG_MAX_LEVEL 0 | |
| # define PJ_ENABLE_EXTRA_CHECK 0 | | # define PJ_ENABLE_EXTRA_CHECK 0 | |
| # define PJ_HAS_ERROR_STRING 0 | | # define PJ_HAS_ERROR_STRING 0 | |
| # undef PJ_IOQUEUE_MAX_HANDLES | | # undef PJ_IOQUEUE_MAX_HANDLES | |
| # define PJ_IOQUEUE_MAX_HANDLES 16 | | # define PJ_IOQUEUE_MAX_HANDLES 16 | |
| # define PJ_IOQUEUE_HAS_SAFE_UNREG 0 | | # define PJ_IOQUEUE_HAS_SAFE_UNREG 0 | |
| # define PJSIP_MAX_TSX_COUNT 15 | | # define PJSIP_MAX_TSX_COUNT 15 | |
| # define PJSIP_MAX_DIALOG_COUNT 15 | | # define PJSIP_MAX_DIALOG_COUNT 15 | |
| # define PJSIP_UDP_SO_SNDBUF_SIZE 4000 | | # define PJSIP_UDP_SO_SNDBUF_SIZE 4000 | |
| # define PJSIP_UDP_SO_RCVBUF_SIZE 4000 | | # define PJSIP_UDP_SO_RCVBUF_SIZE 4000 | |
|
| # define PJSIP_AUTH_HEADER_CACHING 0 | | | |
| # define PJSIP_AUTH_AUTO_SEND_NEXT 0 | | | |
| # define PJSIP_AUTH_QOP_SUPPORT 0 | | | |
| # define PJMEDIA_HAS_LARGE_FILTER 0 | | # define PJMEDIA_HAS_LARGE_FILTER 0 | |
| # define PJMEDIA_HAS_SMALL_FILTER 0 | | # define PJMEDIA_HAS_SMALL_FILTER 0 | |
| | | | |
| #elif defined(PJ_CONFIG_MAXIMUM_SPEED) | | #elif defined(PJ_CONFIG_MAXIMUM_SPEED) | |
| # define PJ_SCANNER_USE_BITWISE 0 | | # define PJ_SCANNER_USE_BITWISE 0 | |
| # undef PJ_OS_HAS_CHECK_STACK | | # undef PJ_OS_HAS_CHECK_STACK | |
| # define PJ_OS_HAS_CHECK_STACK 0 | | # define PJ_OS_HAS_CHECK_STACK 0 | |
| # define PJ_LOG_MAX_LEVEL 3 | | # define PJ_LOG_MAX_LEVEL 3 | |
| # define PJ_ENABLE_EXTRA_CHECK 0 | | # define PJ_ENABLE_EXTRA_CHECK 0 | |
| # define PJ_IOQUEUE_MAX_HANDLES 5000 | | # define PJ_IOQUEUE_MAX_HANDLES 5000 | |
| # define PJSIP_MAX_TSX_COUNT ((640*1024)-1) | | # define PJSIP_MAX_TSX_COUNT ((640*1024)-1) | |
| # define PJSIP_MAX_DIALOG_COUNT ((640*1024)-1) | | # define PJSIP_MAX_DIALOG_COUNT ((640*1024)-1) | |
| # define PJSIP_UDP_SO_SNDBUF_SIZE (24*1024*1024) | | # define PJSIP_UDP_SO_SNDBUF_SIZE (24*1024*1024) | |
| # define PJSIP_UDP_SO_RCVBUF_SIZE (24*1024*1024) | | # define PJSIP_UDP_SO_RCVBUF_SIZE (24*1024*1024) | |
| # define PJ_DEBUG 0 | | # define PJ_DEBUG 0 | |
| # define PJSIP_SAFE_MODULE 0 | | # define PJSIP_SAFE_MODULE 0 | |
|
| # define PJ_HAS_STRICMP_ALNUM 1 | | # define PJ_HAS_STRICMP_ALNUM 0 | |
| # define PJ_HASH_USE_OWN_TOLOWER 1 | | # define PJ_HASH_USE_OWN_TOLOWER 1 | |
| # define PJSIP_UNESCAPE_IN_PLACE 1 | | # define PJSIP_UNESCAPE_IN_PLACE 1 | |
| | | | |
| # ifdef PJ_WIN32 | | # ifdef PJ_WIN32 | |
| # define PJSIP_MAX_NET_EVENTS 10 | | # define PJSIP_MAX_NET_EVENTS 10 | |
| # endif | | # endif | |
| | | | |
| # define PJSUA_MAX_CALLS 512 | | # define PJSUA_MAX_CALLS 512 | |
|
| # define PJSIP_AUTH_HEADER_CACHING 1 | | | |
| # define PJSIP_AUTH_AUTO_SEND_NEXT 1 | | | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 6 lines changed or deleted | | 51 lines changed or added | |
|
| errno.h | | errno.h | |
|
| /* $Id: errno.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: errno.h 1269 2007-05-12 15:03:23Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 113 | |
| * @param statcode The error code. | | * @param statcode The error code. | |
| * @param buf Buffer to hold the error message string. | | * @param buf Buffer to hold the error message string. | |
| * @param bufsize Size of the buffer. | | * @param bufsize Size of the buffer. | |
| * | | * | |
| * @return The error message as NULL terminated string, | | * @return The error message as NULL terminated string, | |
| * wrapped with pj_str_t. | | * wrapped with pj_str_t. | |
| */ | | */ | |
| PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode, | | PJ_DECL(pj_str_t) pj_strerror( pj_status_t statcode, | |
| char *buf, pj_size_t bufsize); | | char *buf, pj_size_t bufsize); | |
| | | | |
|
| | | typedef pj_str_t (*pjsip_error_callback)(pj_status_t, char*, pj_size_t); | |
| /** | | /** | |
| * Register strerror message handler for the specified error space. | | * Register strerror message handler for the specified error space. | |
| * Application can register its own handler to supply the error message | | * Application can register its own handler to supply the error message | |
| * for the specified error code range. This handler will be called | | * for the specified error code range. This handler will be called | |
| * by #pj_strerror(). | | * by #pj_strerror(). | |
| * | | * | |
| * @param start_code The starting error code where the handler should | | * @param start_code The starting error code where the handler should | |
| * be called to retrieve the error message. | | * be called to retrieve the error message. | |
| * @param err_space The size of error space. The error code range then | | * @param err_space The size of error space. The error code range then | |
| * will fall in start_code to start_code+err_space-1 | | * will fall in start_code to start_code+err_space-1 | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 135 | |
| * @param f The handler to be called when #pj_strerror() is | | * @param f The handler to be called when #pj_strerror() is | |
| * supplied with error code that falls into this range. | | * supplied with error code that falls into this range. | |
| * | | * | |
| * @return PJ_SUCCESS or the specified error code. The | | * @return PJ_SUCCESS or the specified error code. The | |
| * registration may fail when the error space has been | | * registration may fail when the error space has been | |
| * occupied by other handler, or when there are too man
y | | * occupied by other handler, or when there are too man
y | |
| * handlers registered to PJLIB. | | * handlers registered to PJLIB. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code, | | PJ_DECL(pj_status_t) pj_register_strerror(pj_status_t start_code, | |
| pj_status_t err_space, | | pj_status_t err_space, | |
|
| pj_str_t (*f)(pj_status_t,char*, | | pjsip_error_callback f); | |
| pj_size_t)); | | | |
| | | | |
| /** | | /** | |
| * @hideinitializer | | * @hideinitializer | |
| * Return platform os error code folded into pj_status_t code. This is | | * Return platform os error code folded into pj_status_t code. This is | |
| * the macro that is used throughout the library for all PJLIB's functions | | * the macro that is used throughout the library for all PJLIB's functions | |
| * that returns error from operating system. Application may override | | * that returns error from operating system. Application may override | |
| * this macro to reduce size (e.g. by defining it to always return | | * this macro to reduce size (e.g. by defining it to always return | |
| * #PJ_EUNKNOWN). | | * #PJ_EUNKNOWN). | |
| * | | * | |
| * Note: | | * Note: | |
| | | | |
| skipping to change at line 168 | | skipping to change at line 168 | |
| | | | |
| /** | | /** | |
| * @hideinitializer | | * @hideinitializer | |
| * Fold a platform specific error into an pj_status_t code. | | * Fold a platform specific error into an pj_status_t code. | |
| * | | * | |
| * @param e The platform os error code. | | * @param e The platform os error code. | |
| * @return pj_status_t | | * @return pj_status_t | |
| * @warning Macro implementation; the syserr argument may be evaluated | | * @warning Macro implementation; the syserr argument may be evaluated | |
| * multiple times. | | * multiple times. | |
| */ | | */ | |
|
| #define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_SYS) | | #if PJ_NATIVE_ERR_POSITIVE | |
| | | # define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : e + PJ_ERRNO_START_S | |
| | | YS) | |
| | | #else | |
| | | # define PJ_STATUS_FROM_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - | |
| | | e) | |
| | | #endif | |
| | | | |
| /** | | /** | |
| * @hideinitializer | | * @hideinitializer | |
| * Fold an pj_status_t code back to the native platform defined error. | | * Fold an pj_status_t code back to the native platform defined error. | |
| * | | * | |
| * @param e The pj_status_t folded platform os error code. | | * @param e The pj_status_t folded platform os error code. | |
| * @return pj_os_err_type | | * @return pj_os_err_type | |
| * @warning macro implementation; the statcode argument may be evaluated | | * @warning macro implementation; the statcode argument may be evaluated | |
| * multiple times. If the statcode was not created by | | * multiple times. If the statcode was not created by | |
| * pj_get_os_error or PJ_STATUS_FROM_OS, the results are undefi
ned. | | * pj_get_os_error or PJ_STATUS_FROM_OS, the results are undefi
ned. | |
| */ | | */ | |
|
| #define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS) | | #if PJ_NATIVE_ERR_POSITIVE | |
| | | # define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : e - PJ_ERRNO_START_SYS | |
| | | ) | |
| | | #else | |
| | | # define PJ_STATUS_TO_OS(e) (e == 0 ? PJ_SUCCESS : PJ_ERRNO_START_SYS - e | |
| | | ) | |
| | | #endif | |
| | | | |
| /** | | /** | |
| * @defgroup pj_errnum PJLIB's Own Error Codes | | * @defgroup pj_errnum PJLIB's Own Error Codes | |
| * @ingroup pj_errno | | * @ingroup pj_errno | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * Use this macro to generate error message text for your error code, | | * Use this macro to generate error message text for your error code, | |
| * so that they look uniformly as the rest of the libraries. | | * so that they look uniformly as the rest of the libraries. | |
| | | | |
| skipping to change at line 337 | | skipping to change at line 345 | |
| * Effectively the error in this class would be 170000 - 219000. | | * Effectively the error in this class would be 170000 - 219000. | |
| */ | | */ | |
| #define PJ_ERRNO_START_USER (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE) | | #define PJ_ERRNO_START_USER (PJ_ERRNO_START_SYS + PJ_ERRNO_SPACE_SIZE) | |
| | | | |
| /* | | /* | |
| * Below are list of error spaces that have been taken so far: | | * Below are list of error spaces that have been taken so far: | |
| * - PJSIP_ERRNO_START (PJ_ERRNO_START_USER) | | * - PJSIP_ERRNO_START (PJ_ERRNO_START_USER) | |
| * - PJMEDIA_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE) | | * - PJMEDIA_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE) | |
| * - PJSIP_SIMPLE_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*2
) | | * - PJSIP_SIMPLE_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*2
) | |
| * - PJLIB_UTIL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3
) | | * - PJLIB_UTIL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3
) | |
|
| | | * - PJNATH_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*4
) | |
| */ | | */ | |
| | | | |
| PJ_END_DECL | | PJ_END_DECL | |
| | | | |
| /* Internal */ | | /* Internal */ | |
| void pj_errno_clear_handlers(void); | | void pj_errno_clear_handlers(void); | |
| | | | |
| #endif /* __PJ_ERRNO_H__ */ | | #endif /* __PJ_ERRNO_H__ */ | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 18 lines changed or added | |
|
| hash.h | | hash.h | |
|
| /* $Id: hash.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: hash.h 1307 2007-05-28 11:49:46Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| | | | |
| /** | | /** | |
| * If this constant is used as keylen, then the key is interpreted as | | * If this constant is used as keylen, then the key is interpreted as | |
| * NULL terminated string. | | * NULL terminated string. | |
| */ | | */ | |
| #define PJ_HASH_KEY_STRING ((unsigned)-1) | | #define PJ_HASH_KEY_STRING ((unsigned)-1) | |
| | | | |
| /** | | /** | |
| * This indicates the size of of each hash entry. | | * This indicates the size of of each hash entry. | |
| */ | | */ | |
|
| #define PJ_HASH_ENTRY_SIZE (3*sizeof(void*) + 2*sizeof(pj_uint32_t)) | | #define PJ_HASH_ENTRY_BUF_SIZE (3*sizeof(void*) + 2*sizeof(pj_uint32_t)) | |
| | | | |
| | | /** | |
| | | * Type declaration for entry buffer, used by #pj_hash_set_np() | |
| | | */ | |
| | | typedef void *pj_hash_entry_buf[(PJ_HASH_ENTRY_BUF_SIZE+sizeof(void*)-1)/(s | |
| | | izeof(void*))]; | |
| | | | |
| /** | | /** | |
| * This is the function that is used by the hash table to calculate hash va
lue | | * This is the function that is used by the hash table to calculate hash va
lue | |
| * of the specified key. | | * of the specified key. | |
| * | | * | |
| * @param hval the initial hash value, or zero. | | * @param hval the initial hash value, or zero. | |
| * @param key the key to calculate. | | * @param key the key to calculate. | |
| * @param keylen the length of the key, or PJ_HASH_KEY_STRING to treat | | * @param keylen the length of the key, or PJ_HASH_KEY_STRING to treat | |
| * the key as null terminated string. | | * the key as null terminated string. | |
| * | | * | |
| | | | |
| skipping to change at line 119 | | skipping to change at line 124 | |
| /** | | /** | |
| * Associate/disassociate a value with the specified key. If value is not | | * Associate/disassociate a value with the specified key. If value is not | |
| * NULL and entry already exists, the entry's value will be overwritten. | | * NULL and entry already exists, the entry's value will be overwritten. | |
| * If value is not NULL and entry does not exist, a new one will be created | | * If value is not NULL and entry does not exist, a new one will be created | |
| * with the specified pool. Otherwise if value is NULL, entry will be | | * with the specified pool. Otherwise if value is NULL, entry will be | |
| * deleted if it exists. | | * deleted if it exists. | |
| * | | * | |
| * @param pool the pool to allocate the new entry if a new entry has to
be | | * @param pool the pool to allocate the new entry if a new entry has to
be | |
| * created. | | * created. | |
| * @param ht the hash table. | | * @param ht the hash table. | |
|
| * @param key the key. | | * @param key the key, which MUST point to buffer that remains valid | |
| | | * for the duration of the entry. | |
| * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | | * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | |
| * string length of the key. | | * string length of the key. | |
| * @param hval if the value is not zero, then the hash table will use | | * @param hval if the value is not zero, then the hash table will use | |
| * this value to search the entry's index, otherwise it wil
l | | * this value to search the entry's index, otherwise it wil
l | |
| * compute the key. This value can be obtained when calling | | * compute the key. This value can be obtained when calling | |
| * #pj_hash_get(). | | * #pj_hash_get(). | |
| * @param value value to be associated, or NULL to delete the en
try with | | * @param value value to be associated, or NULL to delete the en
try with | |
| * the specified key. | | * the specified key. | |
| */ | | */ | |
| PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, | | PJ_DECL(void) pj_hash_set( pj_pool_t *pool, pj_hash_table_t *ht, | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 152 | |
| * pool suffix). If new entry needs to be allocated, it will use the entry_
buf. | | * pool suffix). If new entry needs to be allocated, it will use the entry_
buf. | |
| * | | * | |
| * @param ht the hash table. | | * @param ht the hash table. | |
| * @param key the key. | | * @param key the key. | |
| * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | | * @param keylen the length of the key, or PJ_HASH_KEY_STRING to use the | |
| * string length of the key. | | * string length of the key. | |
| * @param hval if the value is not zero, then the hash table will use | | * @param hval if the value is not zero, then the hash table will use | |
| * this value to search the entry's index, otherwise it wil
l | | * this value to search the entry's index, otherwise it wil
l | |
| * compute the key. This value can be obtained when calling | | * compute the key. This value can be obtained when calling | |
| * #pj_hash_get(). | | * #pj_hash_get(). | |
|
| * @param entry_buf Pointer to buffer which will be used for the new entry, | | * @param entry_buf Buffer which will be used for the new entry, when one n | |
| * when one needs to be created. The buffer must be at leas | | eeds | |
| t | | * to be created. | |
| * PJ_HASH_ENTRY_SIZE long, and the first PJ_HASH_ENTRY_SIZ | | | |
| E | | | |
| * bytes of the buffer will be used by the hash table. | | | |
| * Application may use the remaining portion of the buffer | | | |
| * for its own purpose. | | | |
| * @param value value to be associated, or NULL to delete the en
try with | | * @param value value to be associated, or NULL to delete the en
try with | |
| * the specified key. | | * the specified key. | |
| */ | | */ | |
| PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, | | PJ_DECL(void) pj_hash_set_np(pj_hash_table_t *ht, | |
| const void *key, unsigned keylen, | | const void *key, unsigned keylen, | |
|
| pj_uint32_t hval, void *entry_buf, void *value) | | pj_uint32_t hval, pj_hash_entry_buf entry_buf, | |
| ; | | void *value); | |
| | | | |
| /** | | /** | |
| * Get the total number of entries in the hash table. | | * Get the total number of entries in the hash table. | |
| * | | * | |
| * @param ht the hash table. | | * @param ht the hash table. | |
| * | | * | |
| * @return the number of entries in the hash table. | | * @return the number of entries in the hash table. | |
| */ | | */ | |
| PJ_DECL(unsigned) pj_hash_count( pj_hash_table_t *ht ); | | PJ_DECL(unsigned) pj_hash_count( pj_hash_table_t *ht ); | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 13 lines changed or deleted | | 15 lines changed or added | |
|
| pjsua.h | | pjsua.h | |
|
| /* $Id: pjsua.h 1122 2007-04-02 11:22:49Z bennylp $ */ | | /* $Id: pjsua.h 1285 2007-05-21 13:48:35Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 732 | | skipping to change at line 732 | |
| return | | return | |
| * \endcode | | * \endcode | |
| */ | | */ | |
| void (*on_buddy_state)(pjsua_buddy_id buddy_id); | | void (*on_buddy_state)(pjsua_buddy_id buddy_id); | |
| | | | |
| /** | | /** | |
| * Notify application on incoming pager (i.e. MESSAGE request). | | * Notify application on incoming pager (i.e. MESSAGE request). | |
| * Argument call_id will be -1 if MESSAGE request is not related to an | | * Argument call_id will be -1 if MESSAGE request is not related to an | |
| * existing call. | | * existing call. | |
| * | | * | |
|
| | | * See also \a on_pager2() callback for the version with \a pjsip_rx_da | |
| | | ta | |
| | | * passed as one of the argument. | |
| | | * | |
| * @param call_id Containts the ID of the call where the IM was | | * @param call_id Containts the ID of the call where the IM was | |
| * sent, or PJSUA_INVALID_ID if the IM was sent | | * sent, or PJSUA_INVALID_ID if the IM was sent | |
| * outside call context. | | * outside call context. | |
| * @param from URI of the sender. | | * @param from URI of the sender. | |
| * @param to URI of the destination message. | | * @param to URI of the destination message. | |
| * @param contact The Contact URI of the sender, if present. | | * @param contact The Contact URI of the sender, if present. | |
| * @param mime_type MIME type of the message. | | * @param mime_type MIME type of the message. | |
| * @param body The message content. | | * @param body The message content. | |
| * | | * | |
| * \par Python Syntax: | | * \par Python Syntax: | |
| | | | |
| skipping to change at line 759 | | skipping to change at line 762 | |
| | | | |
| def on_pager(call_id, from, to, contact, mime_type, body): | | def on_pager(call_id, from, to, contact, mime_type, body): | |
| return | | return | |
| * \endcode | | * \endcode | |
| */ | | */ | |
| void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from, | | void (*on_pager)(pjsua_call_id call_id, const pj_str_t *from, | |
| const pj_str_t *to, const pj_str_t *contact, | | const pj_str_t *to, const pj_str_t *contact, | |
| const pj_str_t *mime_type, const pj_str_t *body); | | const pj_str_t *mime_type, const pj_str_t *body); | |
| | | | |
| /** | | /** | |
|
| | | * This is the alternative version of the \a on_pager() callback with | |
| | | * \a pjsip_rx_data argument. | |
| | | * | |
| | | * @param call_id Containts the ID of the call where the IM was | |
| | | * sent, or PJSUA_INVALID_ID if the IM was sent | |
| | | * outside call context. | |
| | | * @param from URI of the sender. | |
| | | * @param to URI of the destination message. | |
| | | * @param contact The Contact URI of the sender, if present. | |
| | | * @param mime_type MIME type of the message. | |
| | | * @param body The message content. | |
| | | * @param rdata The incoming MESSAGE request. | |
| | | */ | |
| | | void (*on_pager2)(pjsua_call_id call_id, const pj_str_t *from, | |
| | | const pj_str_t *to, const pj_str_t *contact, | |
| | | const pj_str_t *mime_type, const pj_str_t *body, | |
| | | pjsip_rx_data *rdata); | |
| | | | |
| | | /** | |
| * Notify application about the delivery status of outgoing pager | | * Notify application about the delivery status of outgoing pager | |
| * request. | | * request. | |
| * | | * | |
| * @param call_id Containts the ID of the call where the IM was | | * @param call_id Containts the ID of the call where the IM was | |
| * sent, or PJSUA_INVALID_ID if the IM was sent | | * sent, or PJSUA_INVALID_ID if the IM was sent | |
| * outside call context. | | * outside call context. | |
| * @param to Destination URI. | | * @param to Destination URI. | |
| * @param body Message body. | | * @param body Message body. | |
| * @param user_data Arbitrary data that was specified when s
ending | | * @param user_data Arbitrary data that was specified when s
ending | |
| * IM message. | | * IM message. | |
| | | | |
| skipping to change at line 884 | | skipping to change at line 906 | |
| /** | | /** | |
| * Specify the URL of outbound proxies to visit for all outgoing reques
ts. | | * Specify the URL of outbound proxies to visit for all outgoing reques
ts. | |
| * The outbound proxies will be used for all accounts, and it will | | * The outbound proxies will be used for all accounts, and it will | |
| * be used to build the route set for outgoing requests. The final | | * be used to build the route set for outgoing requests. The final | |
| * route set for outgoing requests will consists of the outbound proxie
s | | * route set for outgoing requests will consists of the outbound proxie
s | |
| * and the proxy configured in the account. | | * and the proxy configured in the account. | |
| */ | | */ | |
| pj_str_t outbound_proxy[4]; | | pj_str_t outbound_proxy[4]; | |
| | | | |
| /** | | /** | |
|
| | | * Specify domain name to be resolved with DNS SRV resolution to get th | |
| | | e | |
| | | * address of the STUN servers. Alternatively application may specify | |
| | | * \a stun_host and \a stun_relay_host instead. | |
| | | * | |
| | | * If DNS SRV resolution failed for this domain, then DNS A resolution | |
| | | * will be performed only if \a stun_host is specified. | |
| | | */ | |
| | | pj_str_t stun_domain; | |
| | | | |
| | | /** | |
| | | * Specify STUN server to be used, in "HOST[:PORT]" format. If port is | |
| | | * not specified, default port 3478 will be used. | |
| | | */ | |
| | | pj_str_t stun_host; | |
| | | | |
| | | /** | |
| | | * Specify STUN relay server to be used. | |
| | | */ | |
| | | pj_str_t stun_relay_host; | |
| | | | |
| | | /** | |
| * Number of credentials in the credential array. | | * Number of credentials in the credential array. | |
| */ | | */ | |
| unsigned cred_count; | | unsigned cred_count; | |
| | | | |
| /** | | /** | |
| * Array of credentials. These credentials will be used by all accounts
, | | * Array of credentials. These credentials will be used by all accounts
, | |
| * and can be used to authenticate against outbound proxies. If the | | * and can be used to authenticate against outbound proxies. If the | |
| * credential is specific to the account, then application should set | | * credential is specific to the account, then application should set | |
| * the credential in the pjsua_acc_config rather than the credential | | * the credential in the pjsua_acc_config rather than the credential | |
| * here. | | * here. | |
| | | | |
| skipping to change at line 979 | | skipping to change at line 1022 | |
| for (i=0; i<src->outbound_proxy_cnt; ++i) { | | for (i=0; i<src->outbound_proxy_cnt; ++i) { | |
| pj_strdup_with_null(pool, &dst->outbound_proxy[i], | | pj_strdup_with_null(pool, &dst->outbound_proxy[i], | |
| &src->outbound_proxy[i]); | | &src->outbound_proxy[i]); | |
| } | | } | |
| | | | |
| for (i=0; i<src->cred_count; ++i) { | | for (i=0; i<src->cred_count; ++i) { | |
| pjsip_cred_dup(pool, &dst->cred_info[i], &src->cred_info[i]); | | pjsip_cred_dup(pool, &dst->cred_info[i], &src->cred_info[i]); | |
| } | | } | |
| | | | |
| pj_strdup_with_null(pool, &dst->user_agent, &src->user_agent); | | pj_strdup_with_null(pool, &dst->user_agent, &src->user_agent); | |
|
| | | pj_strdup_with_null(pool, &dst->stun_domain, &src->stun_domain); | |
| | | pj_strdup_with_null(pool, &dst->stun_host, &src->stun_host); | |
| | | pj_strdup_with_null(pool, &dst->stun_relay_host, &src->stun_relay_host) | |
| | | ; | |
| } | | } | |
| | | | |
| /** | | /** | |
| * This structure describes additional information to be sent with | | * This structure describes additional information to be sent with | |
| * outgoing SIP message. It can (optionally) be specified for example | | * outgoing SIP message. It can (optionally) be specified for example | |
| * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup()
, | | * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup()
, | |
| * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more. | | * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more. | |
| * | | * | |
| * Application MUST call #pjsua_msg_data_init() to initialize this | | * Application MUST call #pjsua_msg_data_init() to initialize this | |
| * structure before setting its values. | | * structure before setting its values. | |
| | | | |
| skipping to change at line 1266 | | skipping to change at line 1312 | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * \code | | * \code | |
| py_pjsua.perror(sender, title, status) | | py_pjsua.perror(sender, title, status) | |
| * \endcode | | * \endcode | |
| */ | | */ | |
| PJ_DECL(void) pjsua_perror(const char *sender, const char *title, | | PJ_DECL(void) pjsua_perror(const char *sender, const char *title, | |
| pj_status_t status); | | pj_status_t status); | |
| | | | |
| /** | | /** | |
|
| | | * This is a utility function to dump the stack states to log, using | |
| | | * verbosity level 3. | |
| | | * | |
| | | * @param detail Will print detailed output (such as list of | |
| | | * SIP transactions) when non-zero. | |
| | | */ | |
| | | PJ_DECL(void) pjsua_dump(pj_bool_t detail); | |
| | | | |
| | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| * TRANSPORT API | | * TRANSPORT API | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup PJSUA_LIB_TRANSPORT PJSUA-API Signaling Transport | | * @defgroup PJSUA_LIB_TRANSPORT PJSUA-API Signaling Transport | |
| * @ingroup PJSUA_LIB | | * @ingroup PJSUA_LIB | |
| | | | |
| skipping to change at line 1289 | | skipping to change at line 1344 | |
| * PJSUA-API supports creating multiple transport instances, for example UD
P, | | * PJSUA-API supports creating multiple transport instances, for example UD
P, | |
| * TCP, and TLS transport. SIP transport must be created before adding an | | * TCP, and TLS transport. SIP transport must be created before adding an | |
| * account. | | * account. | |
| */ | | */ | |
| | | | |
| /** SIP transport identification. | | /** SIP transport identification. | |
| */ | | */ | |
| typedef int pjsua_transport_id; | | typedef int pjsua_transport_id; | |
| | | | |
| /** | | /** | |
|
| * This structure describes STUN configuration for SIP and media transport, | | | |
| * and is embedded inside pjsua_transport_config structure. | | | |
| */ | | | |
| typedef struct pjsua_stun_config | | | |
| { | | | |
| /** | | | |
| * The first STUN server IP address or hostname. | | | |
| */ | | | |
| pj_str_t stun_srv1; | | | |
| | | | |
| /** | | | |
| * Port number of the first STUN server. | | | |
| * If zero, default STUN port will be used. | | | |
| */ | | | |
| unsigned stun_port1; | | | |
| | | | |
| /** | | | |
| * Optional second STUN server IP address or hostname, for which the | | | |
| * result of the mapping request will be compared to. If the value | | | |
| * is empty, only one STUN server will be used. | | | |
| */ | | | |
| pj_str_t stun_srv2; | | | |
| | | | |
| /** | | | |
| * Port number of the second STUN server. | | | |
| * If zero, default STUN port will be used. | | | |
| */ | | | |
| unsigned stun_port2; | | | |
| | | | |
| } pjsua_stun_config; | | | |
| | | | |
| /** | | | |
| * Call this function to initialize STUN config with default values. | | | |
| * STUN config is normally embedded inside pjsua_transport_config, so | | | |
| * normally there is no need to call this function and rather just | | | |
| * call pjsua_transport_config_default() instead. | | | |
| * | | | |
| * @param cfg The STUN config to be initialized. | | | |
| * | | | |
| * \par Python: | | | |
| * The corresponding Python function creates and initialize the config: | | | |
| * \code | | | |
| stun_cfg = py_pjsua.stun_config_default() | | | |
| * \endcode | | | |
| */ | | | |
| PJ_INLINE(void) pjsua_stun_config_default(pjsua_stun_config *cfg) | | | |
| { | | | |
| pj_bzero(cfg, sizeof(*cfg)); | | | |
| } | | | |
| | | | |
| /** | | | |
| * Transport configuration for creating transports for both SIP | | * Transport configuration for creating transports for both SIP | |
| * and media. Before setting some values to this structure, application | | * and media. Before setting some values to this structure, application | |
| * MUST call #pjsua_transport_config_default() to initialize its | | * MUST call #pjsua_transport_config_default() to initialize its | |
| * values with default settings. | | * values with default settings. | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * The data type in Python is <tt>py_pjsua.Transport_Config</tt>, | | * The data type in Python is <tt>py_pjsua.Transport_Config</tt>, | |
| * although application can just do this to create the instance: | | * although application can just do this to create the instance: | |
| * \code | | * \code | |
| transport_cfg = py_pjsua.transport_config_default() | | transport_cfg = py_pjsua.transport_config_default() | |
| | | | |
| skipping to change at line 1387 | | skipping to change at line 1391 | |
| * published address of a transport (the public_addr field should be | | * published address of a transport (the public_addr field should be | |
| * used for that purpose). | | * used for that purpose). | |
| * | | * | |
| * Note that unlike public_addr field, the address (or hostname) here | | * Note that unlike public_addr field, the address (or hostname) here | |
| * MUST correspond to the actual interface address in the host, since | | * MUST correspond to the actual interface address in the host, since | |
| * this address will be specified as bind() argument. | | * this address will be specified as bind() argument. | |
| */ | | */ | |
| pj_str_t bound_addr; | | pj_str_t bound_addr; | |
| | | | |
| /** | | /** | |
|
| * Flag to indicate whether STUN should be used. | | | |
| */ | | | |
| pj_bool_t use_stun; | | | |
| | | | |
| /** | | | |
| * STUN configuration, must be specified when STUN is used. | | | |
| */ | | | |
| pjsua_stun_config stun_config; | | | |
| | | | |
| /** | | | |
| * This specifies TLS settings for TLS transport. It is only be used | | * This specifies TLS settings for TLS transport. It is only be used | |
| * when this transport config is being used to create a SIP TLS | | * when this transport config is being used to create a SIP TLS | |
| * transport. | | * transport. | |
| */ | | */ | |
| pjsip_tls_setting tls_setting; | | pjsip_tls_setting tls_setting; | |
| | | | |
| } pjsua_transport_config; | | } pjsua_transport_config; | |
| | | | |
| /** | | /** | |
| * Call this function to initialize UDP config with default values. | | * Call this function to initialize UDP config with default values. | |
| | | | |
| skipping to change at line 1419 | | skipping to change at line 1413 | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * The corresponding Python function is rather different: | | * The corresponding Python function is rather different: | |
| * \code | | * \code | |
| transport_cfg = py_pjsua.transport_config_default() | | transport_cfg = py_pjsua.transport_config_default() | |
| * \endcode | | * \endcode | |
| */ | | */ | |
| PJ_INLINE(void) pjsua_transport_config_default(pjsua_transport_config *cfg) | | PJ_INLINE(void) pjsua_transport_config_default(pjsua_transport_config *cfg) | |
| { | | { | |
| pj_bzero(cfg, sizeof(*cfg)); | | pj_bzero(cfg, sizeof(*cfg)); | |
|
| pjsua_stun_config_default(&cfg->stun_config); | | | |
| pjsip_tls_setting_default(&cfg->tls_setting); | | pjsip_tls_setting_default(&cfg->tls_setting); | |
| } | | } | |
| | | | |
| /** | | /** | |
|
| * This is a utility function to normalize STUN config. It's only | | | |
| * used internally by the library. | | | |
| * | | | |
| * @param cfg The STUN config to be initialized. | | | |
| * | | | |
| * \par Python: | | | |
| * \code | | | |
| py_pjsua.normalize_stun_config(cfg) | | | |
| * \code | | | |
| */ | | | |
| PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg ) | | | |
| { | | | |
| if (cfg->stun_srv1.slen) { | | | |
| | | | |
| if (cfg->stun_port1 == 0) | | | |
| cfg->stun_port1 = 3478; | | | |
| | | | |
| if (cfg->stun_srv2.slen == 0) { | | | |
| cfg->stun_srv2 = cfg->stun_srv1; | | | |
| cfg->stun_port2 = cfg->stun_port1; | | | |
| } else { | | | |
| if (cfg->stun_port2 == 0) | | | |
| cfg->stun_port2 = 3478; | | | |
| } | | | |
| | | | |
| } else { | | | |
| cfg->stun_port1 = 0; | | | |
| cfg->stun_srv2.slen = 0; | | | |
| cfg->stun_port2 = 0; | | | |
| } | | | |
| } | | | |
| | | | |
| /** | | | |
| * Duplicate transport config. | | * Duplicate transport config. | |
| * | | * | |
| * @param pool The pool. | | * @param pool The pool. | |
| * @param dst The destination config. | | * @param dst The destination config. | |
| * @param src The source config. | | * @param src The source config. | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * Not applicable. One should be able to just copy one variable instance | | * Not applicable. One should be able to just copy one variable instance | |
| * to another in Python. | | * to another in Python. | |
| */ | | */ | |
| PJ_INLINE(void) pjsua_transport_config_dup(pj_pool_t *pool, | | PJ_INLINE(void) pjsua_transport_config_dup(pj_pool_t *pool, | |
| pjsua_transport_config *dst, | | pjsua_transport_config *dst, | |
| const pjsua_transport_config *src
) | | const pjsua_transport_config *src
) | |
| { | | { | |
|
| | | PJ_UNUSED_ARG(pool); | |
| pj_memcpy(dst, src, sizeof(*src)); | | pj_memcpy(dst, src, sizeof(*src)); | |
|
| | | | |
| if (src->stun_config.stun_srv1.slen) { | | | |
| pj_strdup_with_null(pool, &dst->stun_config.stun_srv1, | | | |
| &src->stun_config.stun_srv1); | | | |
| } | | | |
| | | | |
| if (src->stun_config.stun_srv2.slen) { | | | |
| pj_strdup_with_null(pool, &dst->stun_config.stun_srv2, | | | |
| &src->stun_config.stun_srv2); | | | |
| } | | | |
| | | | |
| pjsua_normalize_stun_config(&dst->stun_config); | | | |
| } | | } | |
| | | | |
| /** | | /** | |
| * This structure describes transport information returned by | | * This structure describes transport information returned by | |
| * #pjsua_transport_get_info() function. | | * #pjsua_transport_get_info() function. | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * The corresponding data type in Python is <tt>py_pjsua.Transport_Info</tt
>. | | * The corresponding data type in Python is <tt>py_pjsua.Transport_Info</tt
>. | |
| */ | | */ | |
| typedef struct pjsua_transport_info | | typedef struct pjsua_transport_info | |
| | | | |
| skipping to change at line 3415 | | skipping to change at line 3364 | |
| */ | | */ | |
| int jb_max_pre; | | int jb_max_pre; | |
| | | | |
| /** | | /** | |
| * Set maximum delay that can be accomodated by the jitter buffer msec. | | * Set maximum delay that can be accomodated by the jitter buffer msec. | |
| * | | * | |
| * Default: -1 (to use default stream settings, currently 360 msec) | | * Default: -1 (to use default stream settings, currently 360 msec) | |
| */ | | */ | |
| int jb_max; | | int jb_max; | |
| | | | |
|
| | | /** | |
| | | * Enable ICE | |
| | | */ | |
| | | pj_bool_t enable_ice; | |
| | | | |
| | | /** | |
| | | * Enable ICE media relay. | |
| | | */ | |
| | | pj_bool_t enable_relay; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Use this function to initialize media config. | | * Use this function to initialize media config. | |
| * | | * | |
| * @param cfg The media config to be initialized. | | * @param cfg The media config to be initialized. | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * \code | | * \code | |
| media_cfg = py_pjsua.media_config_default() | | media_cfg = py_pjsua.media_config_default() | |
| | | | |
| skipping to change at line 3832 | | skipping to change at line 3790 | |
| * \endcode | | * \endcode | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id); | | PJ_DECL(pj_status_t) pjsua_player_destroy(pjsua_player_id id); | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| * File recorder. | | * File recorder. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * Create a file recorder, and automatically connect this recorder to | | * Create a file recorder, and automatically connect this recorder to | |
|
| * the conference bridge. The recorder currently supports recording WAV fil | | * the conference bridge. The recorder currently supports recording WAV fil | |
| e, | | e. | |
| * and on Windows, MP3 file. The type of the recorder to use is determined | | * The type of the recorder to use is determined by the extension of the fi | |
| * by the extension of the file (e.g. ".wav" or ".mp3"). | | le | |
| | | * (e.g. ".wav"). | |
| * | | * | |
| * @param filename Output file name. The function will determine the | | * @param filename Output file name. The function will determine the | |
| * default format to be used based on the file extensio
n. | | * default format to be used based on the file extensio
n. | |
|
| * Currently ".wav" is supported on all platforms, and | | * Currently ".wav" is supported on all platforms. | |
| * also ".mp3" is support on Windows. | | | |
| * @param enc_type Optionally specify the type of encoder to be used to | | * @param enc_type Optionally specify the type of encoder to be used to | |
| * compress the media, if the file can support differen
t | | * compress the media, if the file can support differen
t | |
| * encodings. This value must be zero for now. | | * encodings. This value must be zero for now. | |
| * @param enc_param Optionally specify codec specific parameter to be | | * @param enc_param Optionally specify codec specific parameter to be | |
|
| * passed to the file writer. For .MP3 recorder, this | | * passed to the file writer. | |
| * can point to pjmedia_mp3_encoder_option structure to | | | |
| * specify additional settings for the .mp3 recorder. | | | |
| * For .WAV recorder, this value must be NULL. | | * For .WAV recorder, this value must be NULL. | |
| * @param max_size Maximum file size. Specify zero or -1 to remove size | | * @param max_size Maximum file size. Specify zero or -1 to remove size | |
| * limitation. This value must be zero or -1 for now. | | * limitation. This value must be zero or -1 for now. | |
| * @param options Optional options. | | * @param options Optional options. | |
| * @param p_id Pointer to receive the recorder instance. | | * @param p_id Pointer to receive the recorder instance. | |
| * | | * | |
| * @return PJ_SUCCESS on success, or the appropriate error code
. | | * @return PJ_SUCCESS on success, or the appropriate error code
. | |
| * | | * | |
| * \par Python: | | * \par Python: | |
| * \code | | * \code | |
| | | | |
End of changes. 16 change blocks. |
| 117 lines changed or deleted | | 76 lines changed or added | |
|
| pjsua_internal.h | | pjsua_internal.h | |
|
| /* $Id: pjsua_internal.h 997 2007-02-24 13:16:40Z bennylp $ */ | | /* $Id: pjsua_internal.h 1311 2007-05-29 00:33:09Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| pj_time_val res_time; /**< First response sent/receive
d. */ | | pj_time_val res_time; /**< First response sent/receive
d. */ | |
| pj_time_val conn_time; /**< Connected/confirmed time.
*/ | | pj_time_val conn_time; /**< Connected/confirmed time.
*/ | |
| pj_time_val dis_time; /**< Disconnect time.
*/ | | pj_time_val dis_time; /**< Disconnect time.
*/ | |
| pjsua_acc_id acc_id; /**< Account index being used.
*/ | | pjsua_acc_id acc_id; /**< Account index being used.
*/ | |
| pjsua_call_media_status media_st;/**< Media state.
*/ | | pjsua_call_media_status media_st;/**< Media state.
*/ | |
| pjmedia_dir media_dir; /**< Media direction.
*/ | | pjmedia_dir media_dir; /**< Media direction.
*/ | |
| pjmedia_session *session; /**< The media session.
*/ | | pjmedia_session *session; /**< The media session.
*/ | |
| int conf_slot; /**< Slot # in conference bridge
. */ | | int conf_slot; /**< Slot # in conference bridge
. */ | |
| pjsip_evsub *xfer_sub; /**< Xfer server subscription, i
f this | | pjsip_evsub *xfer_sub; /**< Xfer server subscription, i
f this | |
| call was triggered by xfer.
*/ | | call was triggered by xfer.
*/ | |
|
| pjmedia_sock_info skinfo; /**< Preallocated media sockets.
*/ | | | |
| pjmedia_transport *med_tp; /**< Media transport.
*/ | | pjmedia_transport *med_tp; /**< Media transport.
*/ | |
| pj_timer_entry refresh_tm;/**< Timer to send re-INVITE.
*/ | | pj_timer_entry refresh_tm;/**< Timer to send re-INVITE.
*/ | |
| pj_timer_entry hangup_tm; /**< Timer to hangup call.
*/ | | pj_timer_entry hangup_tm; /**< Timer to hangup call.
*/ | |
| | | | |
| char last_text_buf_[128]; /**< Buffer for last_text.
*/ | | char last_text_buf_[128]; /**< Buffer for last_text.
*/ | |
| | | | |
| } pjsua_call; | | } pjsua_call; | |
| | | | |
| /** | | /** | |
| * Server presence subscription list head. | | * Server presence subscription list head. | |
| | | | |
| skipping to change at line 182 | | skipping to change at line 181 | |
| | | | |
| /* SIP: */ | | /* SIP: */ | |
| pjsip_endpoint *endpt; /**< Global endpoint. */ | | pjsip_endpoint *endpt; /**< Global endpoint. */ | |
| pjsip_module mod; /**< pjsua's PJSIP module. */ | | pjsip_module mod; /**< pjsua's PJSIP module. */ | |
| pjsua_transport_data tpdata[8]; /**< Array of transports. */ | | pjsua_transport_data tpdata[8]; /**< Array of transports. */ | |
| | | | |
| /* Threading: */ | | /* Threading: */ | |
| pj_bool_t thread_quit_flag; /**< Thread quit flag. */ | | pj_bool_t thread_quit_flag; /**< Thread quit flag. */ | |
| pj_thread_t *thread[4]; /**< Array of threads.
*/ | | pj_thread_t *thread[4]; /**< Array of threads.
*/ | |
| | | | |
|
| | | /* STUN and resolver */ | |
| | | pj_stun_config stun_cfg; /**< Global STUN settings. */ | |
| | | pj_sockaddr stun_srv; /**< Resolved STUN server addres | |
| | | s */ | |
| | | pj_status_t stun_status; /**< STUN server status. | |
| | | */ | |
| | | pj_dns_resolver *resolver; /**< DNS resolver. */ | |
| | | | |
| /* Account: */ | | /* Account: */ | |
| unsigned acc_cnt; /**< Number of accounts. */ | | unsigned acc_cnt; /**< Number of accounts. */ | |
| pjsua_acc_id default_acc; /**< Default account ID */ | | pjsua_acc_id default_acc; /**< Default account ID */ | |
| pjsua_acc acc[PJSUA_MAX_ACC]; /**< Account array. */ | | pjsua_acc acc[PJSUA_MAX_ACC]; /**< Account array. */ | |
| pjsua_acc_id acc_ids[PJSUA_MAX_ACC]; /**< Acc sorted by prio*/ | | pjsua_acc_id acc_ids[PJSUA_MAX_ACC]; /**< Acc sorted by prio*/ | |
| | | | |
| /* Calls: */ | | /* Calls: */ | |
| pjsua_config ua_cfg; /**< UA config. */ | | pjsua_config ua_cfg; /**< UA config. */ | |
| unsigned call_cnt; /**< Call counter. */ | | unsigned call_cnt; /**< Call counter. */ | |
| pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */ | | pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */ | |
| | | | |
| /* Buddy; */ | | /* Buddy; */ | |
| unsigned buddy_cnt; /**< Buddy count. */ | | unsigned buddy_cnt; /**< Buddy count. */ | |
| pjsua_buddy buddy[PJSUA_MAX_BUDDIES]; /**< Buddy array
. */ | | pjsua_buddy buddy[PJSUA_MAX_BUDDIES]; /**< Buddy array
. */ | |
| | | | |
|
| | | /* Presence: */ | |
| | | pj_timer_entry pres_timer;/**< Presence refresh timer. */ | |
| | | | |
| /* Media: */ | | /* Media: */ | |
| pjsua_media_config media_cfg; /**< Media config. */ | | pjsua_media_config media_cfg; /**< Media config. */ | |
| pjmedia_endpt *med_endpt; /**< Media endpoint. */ | | pjmedia_endpt *med_endpt; /**< Media endpoint. */ | |
| pjsua_conf_setting mconf_cfg; /**< Additionan conf. bridge. param */ | | pjsua_conf_setting mconf_cfg; /**< Additionan conf. bridge. param */ | |
| pjmedia_conf *mconf; /**< Conference bridge. */ | | pjmedia_conf *mconf; /**< Conference bridge. */ | |
| int cap_dev; /**< Capture device ID.
*/ | | int cap_dev; /**< Capture device ID.
*/ | |
| int play_dev; /**< Playback device ID.
*/ | | int play_dev; /**< Playback device ID.
*/ | |
| pj_bool_t no_snd; /**< No sound (app will manage it) */ | | pj_bool_t no_snd; /**< No sound (app will manage it) */ | |
| pjmedia_snd_port *snd_port; /**< Sound port. */ | | pjmedia_snd_port *snd_port; /**< Sound port. */ | |
| pjmedia_master_port *null_snd; /**< Master port for null sound.
*/ | | pjmedia_master_port *null_snd; /**< Master port for null sound.
*/ | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 269 | |
| #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) | | #define PJSUA_LOCK() pj_mutex_lock(pjsua_var.mutex) | |
| #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) | | #define PJSUA_TRY_LOCK() pj_mutex_trylock(pjsua_var.mutex) | |
| #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) | | #define PJSUA_UNLOCK() pj_mutex_unlock(pjsua_var.mutex) | |
| #else | | #else | |
| #define PJSUA_LOCK() | | #define PJSUA_LOCK() | |
| #define PJSUA_TRY_LOCK() PJ_SUCCESS | | #define PJSUA_TRY_LOCK() PJ_SUCCESS | |
| #define PJSUA_UNLOCK() | | #define PJSUA_UNLOCK() | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| | | * Resolve STUN server. | |
| | | */ | |
| | | pj_status_t pjsua_resolve_stun_server(pj_bool_t wait); | |
| | | | |
| | | /** | |
| * Handle incoming invite request. | | * Handle incoming invite request. | |
| */ | | */ | |
| pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); | | pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata); | |
| | | | |
|
| | | /* | |
| | | * Media channel. | |
| | | */ | |
| | | pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, | |
| | | pjsip_role_e role); | |
| | | pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, | |
| | | pj_pool_t *pool, | |
| | | pjmedia_sdp_session **p_sdp); | |
| | | pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, | |
| | | const pjmedia_sdp_session *local_sdp, | |
| | | const pjmedia_sdp_session *remote_sdp | |
| | | ); | |
| | | pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); | |
| | | | |
| /** | | /** | |
| * Init presence. | | * Init presence. | |
| */ | | */ | |
| pj_status_t pjsua_pres_init(); | | pj_status_t pjsua_pres_init(); | |
| | | | |
| /* | | /* | |
| * Start presence subsystem. | | * Start presence subsystem. | |
| */ | | */ | |
| pj_status_t pjsua_pres_start(void); | | pj_status_t pjsua_pres_start(void); | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 31 lines changed or added | |
|
| pool.h | | pool.h | |
|
| /* $Id: pool.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: pool.h 1040 2007-03-05 00:58:24Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 439 | | skipping to change at line 439 | |
| | | | |
| /** | | /** | |
| * Allocate storage with the specified size from the pool. | | * Allocate storage with the specified size from the pool. | |
| * If there's no storage available in the pool, then the pool can allocate
more | | * If there's no storage available in the pool, then the pool can allocate
more | |
| * blocks if the increment size is larger than the requested size. | | * blocks if the increment size is larger than the requested size. | |
| * | | * | |
| * @param pool the pool. | | * @param pool the pool. | |
| * @param size the requested size. | | * @param size the requested size. | |
| * | | * | |
| * @return pointer to the allocated memory. | | * @return pointer to the allocated memory. | |
|
| | | * | |
| | | * @see PJ_POOL_ALLOC_T | |
| */ | | */ | |
| PJ_IDECL(void*) pj_pool_alloc( pj_pool_t *pool, pj_size_t size); | | PJ_IDECL(void*) pj_pool_alloc( pj_pool_t *pool, pj_size_t size); | |
| | | | |
| /** | | /** | |
| * Allocate storage from the pool, and initialize it to zero. | | * Allocate storage from the pool, and initialize it to zero. | |
| * This function behaves like pj_pool_alloc(), except that the storage will | | * This function behaves like pj_pool_alloc(), except that the storage will | |
| * be initialized to zero. | | * be initialized to zero. | |
| * | | * | |
| * @param pool the pool. | | * @param pool the pool. | |
| * @param count the number of elements in the array. | | * @param count the number of elements in the array. | |
| * @param elem the size of individual element. | | * @param elem the size of individual element. | |
| * | | * | |
| * @return pointer to the allocated memory. | | * @return pointer to the allocated memory. | |
| */ | | */ | |
| PJ_IDECL(void*) pj_pool_calloc( pj_pool_t *pool, pj_size_t count, | | PJ_IDECL(void*) pj_pool_calloc( pj_pool_t *pool, pj_size_t count, | |
| pj_size_t elem); | | pj_size_t elem); | |
| | | | |
| /** | | /** | |
|
| * @def pj_pool_zalloc(pj_pool_t *pool, pj_size_t size) | | | |
| * Allocate storage from the pool and initialize it to zero. | | * Allocate storage from the pool and initialize it to zero. | |
| * | | * | |
| * @param pool The pool. | | * @param pool The pool. | |
| * @param size The size to be allocated. | | * @param size The size to be allocated. | |
| * | | * | |
| * @return Pointer to the allocated memory. | | * @return Pointer to the allocated memory. | |
|
| | | * | |
| | | * @see PJ_POOL_ZALLOC_T | |
| | | */ | |
| | | PJ_INLINE(void*) pj_pool_zalloc(pj_pool_t *pool, pj_size_t size) | |
| | | { | |
| | | return pj_pool_calloc(pool, 1, size); | |
| | | } | |
| | | | |
| | | /** | |
| | | * This macro allocates memory from the pool and returns the instance of | |
| | | * the specified type. It provides a stricker type safety than pj_pool_allo | |
| | | c() | |
| | | * since the return value of this macro will be type-casted to the specifie | |
| | | d | |
| | | * type. | |
| | | * | |
| | | * @param pool The pool | |
| | | * @param type The type of object to be allocated | |
| | | * | |
| | | * @return Memory buffer of the specified type. | |
| | | */ | |
| | | #define PJ_POOL_ALLOC_T(pool,type) \ | |
| | | ((type*)pj_pool_alloc(pool, sizeof(type))) | |
| | | | |
| | | /** | |
| | | * This macro allocates memory from the pool, zeroes the buffer, and | |
| | | * returns the instance of the specified type. It provides a stricker type | |
| | | * safety than pj_pool_zalloc() since the return value of this macro will b | |
| | | e | |
| | | * type-casted to the specified type. | |
| | | * | |
| | | * @param pool The pool | |
| | | * @param type The type of object to be allocated | |
| | | * | |
| | | * @return Memory buffer of the specified type. | |
| */ | | */ | |
|
| #define pj_pool_zalloc(pool, size) pj_pool_calloc(pool, 1, size) | | #define PJ_POOL_ZALLOC_T(pool,type) \ | |
| | | ((type*)pj_pool_zalloc(pool, sizeof(type))) | |
| | | | |
| /** | | /** | |
| * @} // PJ_POOL | | * @} // PJ_POOL | |
| */ | | */ | |
| | | | |
| /* ************************************************************************
**/ | | /* ************************************************************************
**/ | |
| /** | | /** | |
| * @defgroup PJ_POOL_FACTORY Pool Factory and Policy | | * @defgroup PJ_POOL_FACTORY Pool Factory and Policy | |
| * @ingroup PJ_POOL_GROUP | | * @ingroup PJ_POOL_GROUP | |
| * @brief | | * @brief | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 40 lines changed or added | |
|
| resample.h | | resample.h | |
|
| /* $Id: resample.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: resample.h 1171 2007-04-07 16:01:41Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| typedef struct pjmedia_resample pjmedia_resample; | | typedef struct pjmedia_resample pjmedia_resample; | |
| | | | |
| /** | | /** | |
| * Create a frame based resample session. | | * Create a frame based resample session. | |
| * | | * | |
| * @param pool Pool to allocate the structure and buffers. | | * @param pool Pool to allocate the structure and buffers. | |
| * @param high_quality If true, then high quality conversion will b
e | | * @param high_quality If true, then high quality conversion will b
e | |
| * used, at the expense of more CPU and memory, | | * used, at the expense of more CPU and memory, | |
| * because temporary buffer needs to be created
. | | * because temporary buffer needs to be created
. | |
| * @param large_filter If true, large filter size will be used. | | * @param large_filter If true, large filter size will be used. | |
|
| | | * @param channel_count Number of channels. | |
| * @param rate_in Clock rate of the input samples. | | * @param rate_in Clock rate of the input samples. | |
| * @param rate_out Clock rate of the output samples. | | * @param rate_out Clock rate of the output samples. | |
| * @param samples_per_frame Number of samples per frame in the input. | | * @param samples_per_frame Number of samples per frame in the input. | |
| * @param p_resample Pointer to receive the resample session. | | * @param p_resample Pointer to receive the resample session. | |
| * | | * | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_resample_create(pj_pool_t *pool, | | PJ_DECL(pj_status_t) pjmedia_resample_create(pj_pool_t *pool, | |
| pj_bool_t high_quality, | | pj_bool_t high_quality, | |
| pj_bool_t large_filter, | | pj_bool_t large_filter, | |
|
| | | unsigned channel_count, | |
| unsigned rate_in, | | unsigned rate_in, | |
| unsigned rate_out, | | unsigned rate_out, | |
| unsigned samples_per_frame, | | unsigned samples_per_frame, | |
| pjmedia_resample **p_resample); | | pjmedia_resample **p_resample); | |
| | | | |
| /** | | /** | |
| * Use the resample session to resample a frame. The frame must have the | | * Use the resample session to resample a frame. The frame must have the | |
| * same size and settings as the resample session, or otherwise the | | * same size and settings as the resample session, or otherwise the | |
| * behavior is undefined. | | * behavior is undefined. | |
| * | | * | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 106 | |
| /** | | /** | |
| * Get the input frame size of a resample session. | | * Get the input frame size of a resample session. | |
| * | | * | |
| * @param resample The resample session. | | * @param resample The resample session. | |
| * | | * | |
| * @return The frame size, in number of samples. | | * @return The frame size, in number of samples. | |
| */ | | */ | |
| PJ_DECL(unsigned) pjmedia_resample_get_input_size(pjmedia_resample *resampl
e); | | PJ_DECL(unsigned) pjmedia_resample_get_input_size(pjmedia_resample *resampl
e); | |
| | | | |
| /** | | /** | |
|
| | | * Destroy the resample. | |
| | | * | |
| | | * @param resample The resample session. | |
| | | */ | |
| | | PJ_DECL(void) pjmedia_resample_destroy(pjmedia_resample *resample); | |
| | | | |
| | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_RESAMPLE_PORT Resample Port | | * @defgroup PJMEDIA_RESAMPLE_PORT Resample Port | |
| * @ingroup PJMEDIA_PORT | | * @ingroup PJMEDIA_PORT | |
| * @brief Media port interface to change media stream's sampling rate. | | * @brief Media port interface to change media stream's sampling rate. | |
| * @{ | | * @{ | |
| * This section describes media port abstractoin for @ref PJMEDIA_RESAMPLE. | | * This section describes media port abstractoin for @ref PJMEDIA_RESAMPLE. | |
| */ | | */ | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 10 lines changed or added | |
|
| rtp.h | | rtp.h | |
|
| /* $Id: rtp.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: rtp.h 1114 2007-03-29 21:54:21Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| * is guaranteed to point the payload to the correct position regardless of | | * is guaranteed to point the payload to the correct position regardless of | |
| * any options present in the RTP packet. | | * any options present in the RTP packet. | |
| * | | * | |
| */ | | */ | |
| | | | |
| #ifdef _MSC_VER | | #ifdef _MSC_VER | |
| # pragma warning(disable:4214) // bit field types other than int | | # pragma warning(disable:4214) // bit field types other than int | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| * RTP packet header. | | * RTP packet header. Note that all RTP functions here will work with this | |
| | | * header in network byte order. | |
| */ | | */ | |
| #pragma pack(1) | | #pragma pack(1) | |
| struct pjmedia_rtp_hdr | | struct pjmedia_rtp_hdr | |
| { | | { | |
| #if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0) | | #if defined(PJ_IS_BIG_ENDIAN) && (PJ_IS_BIG_ENDIAN!=0) | |
| pj_uint16_t v:2; /**< packet type/version */ | | pj_uint16_t v:2; /**< packet type/version */ | |
| pj_uint16_t p:1; /**< padding flag */ | | pj_uint16_t p:1; /**< padding flag */ | |
| pj_uint16_t x:1; /**< extension flag */ | | pj_uint16_t x:1; /**< extension flag */ | |
| pj_uint16_t cc:4; /**< CSRC count */ | | pj_uint16_t cc:4; /**< CSRC count */ | |
| pj_uint16_t m:1; /**< marker bit */ | | pj_uint16_t m:1; /**< marker bit */ | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 223 | |
| /** | | /** | |
| * @see pjmedia_rtp_status | | * @see pjmedia_rtp_status | |
| */ | | */ | |
| typedef struct pjmedia_rtp_status pjmedia_rtp_status; | | typedef struct pjmedia_rtp_status pjmedia_rtp_status; | |
| | | | |
| /** | | /** | |
| * This function will initialize the RTP session according to given paramet
ers. | | * This function will initialize the RTP session according to given paramet
ers. | |
| * | | * | |
| * @param ses The session. | | * @param ses The session. | |
| * @param default_pt Default payload type. | | * @param default_pt Default payload type. | |
|
| * @param sender_ssrc SSRC used for outgoing packets. | | * @param sender_ssrc SSRC used for outgoing packets, in host byte order. | |
| * | | * | |
| * @return PJ_SUCCESS if successfull. | | * @return PJ_SUCCESS if successfull. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_rtp_session_init( pjmedia_rtp_session *ses, | | PJ_DECL(pj_status_t) pjmedia_rtp_session_init( pjmedia_rtp_session *ses, | |
| int default_pt, | | int default_pt, | |
| pj_uint32_t sender_ssrc ); | | pj_uint32_t sender_ssrc ); | |
| | | | |
| /** | | /** | |
| * Create the RTP header based on arguments and current state of the RTP | | * Create the RTP header based on arguments and current state of the RTP | |
| * session. | | * session. | |
| | | | |
| skipping to change at line 255 | | skipping to change at line 256 | |
| int pt, int m, | | int pt, int m, | |
| int payload_len, int ts_len, | | int payload_len, int ts_len, | |
| const void **rtphdr, | | const void **rtphdr, | |
| int *hdrlen ); | | int *hdrlen ); | |
| | | | |
| /** | | /** | |
| * This function decodes incoming packet into RTP header and payload. | | * This function decodes incoming packet into RTP header and payload. | |
| * The decode function is guaranteed to point the payload to the correct | | * The decode function is guaranteed to point the payload to the correct | |
| * position regardless of any options present in the RTP packet. | | * position regardless of any options present in the RTP packet. | |
| * | | * | |
|
| | | * Note that this function does not modify the returned RTP header to | |
| | | * host byte order. | |
| | | * | |
| * @param ses The session. | | * @param ses The session. | |
| * @param pkt The received RTP packet. | | * @param pkt The received RTP packet. | |
| * @param pkt_len The length of the packet. | | * @param pkt_len The length of the packet. | |
|
| * @param hdr Upon return will point to the location of the RTP he | | * @param hdr Upon return will point to the location of the RTP | |
| ader | | * header inside the packet. Note that the RTP header | |
| * inside the packet. | | * will be given back as is, meaning that the fields | |
| | | * will be in network byte order. | |
| * @param payload Upon return will point to the location of the | | * @param payload Upon return will point to the location of the | |
| * payload inside the packet. | | * payload inside the packet. | |
| * @param payloadlen Upon return will indicate the size of the payload. | | * @param payloadlen Upon return will indicate the size of the payload. | |
| * | | * | |
| * @return PJ_SUCCESS if successfull. | | * @return PJ_SUCCESS if successfull. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjmedia_rtp_decode_rtp( pjmedia_rtp_session *ses, | | PJ_DECL(pj_status_t) pjmedia_rtp_decode_rtp( pjmedia_rtp_session *ses, | |
| const void *pkt, int pkt_len, | | const void *pkt, int pkt_len, | |
| const pjmedia_rtp_hdr **hdr, | | const pjmedia_rtp_hdr **hdr, | |
| const void **payload, | | const void **payload, | |
| unsigned *payloadlen); | | unsigned *payloadlen); | |
| | | | |
| /** | | /** | |
| * Call this function everytime an RTP packet is received to check whether | | * Call this function everytime an RTP packet is received to check whether | |
| * the packet can be received and to let the RTP session performs its inter
nal | | * the packet can be received and to let the RTP session performs its inter
nal | |
| * calculations. | | * calculations. | |
| * | | * | |
| * @param ses The session. | | * @param ses The session. | |
|
| * @param hdr The RTP header of the incoming packet. | | * @param hdr The RTP header of the incoming packet. The header must | |
| | | * be given with fields in network byte order. | |
| * @param seq_st Optional structure to receive the status of the RTP pac
ket | | * @param seq_st Optional structure to receive the status of the RTP pac
ket | |
| * processing. | | * processing. | |
| */ | | */ | |
| PJ_DECL(void) pjmedia_rtp_session_update( pjmedia_rtp_session *ses, | | PJ_DECL(void) pjmedia_rtp_session_update( pjmedia_rtp_session *ses, | |
| const pjmedia_rtp_hdr *hdr, | | const pjmedia_rtp_hdr *hdr, | |
| pjmedia_rtp_status *seq_st); | | pjmedia_rtp_status *seq_st); | |
| | | | |
| /* | | /* | |
| * INTERNAL: | | * INTERNAL: | |
| */ | | */ | |
| | | | |
End of changes. 6 change blocks. |
| 7 lines changed or deleted | | 13 lines changed or added | |
|
| sip_config.h | | sip_config.h | |
|
| /* $Id: sip_config.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: sip_config.h 1244 2007-05-02 18:54:19Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 268 | |
| * Default: 5 | | * Default: 5 | |
| * | | * | |
| * @see PJSIP_TCP_TRANSPORT_BACKLOG | | * @see PJSIP_TCP_TRANSPORT_BACKLOG | |
| */ | | */ | |
| #ifndef PJSIP_TLS_TRANSPORT_BACKLOG | | #ifndef PJSIP_TLS_TRANSPORT_BACKLOG | |
| # define PJSIP_TLS_TRANSPORT_BACKLOG 5 | | # define PJSIP_TLS_TRANSPORT_BACKLOG 5 | |
| #endif | | #endif | |
| | | | |
| /* Endpoint. */ | | /* Endpoint. */ | |
| #define PJSIP_MAX_TIMER_COUNT (2*PJSIP_MAX_TSX_COUNT + 2*PJSIP_MAX
_DIALOG_COUNT) | | #define PJSIP_MAX_TIMER_COUNT (2*PJSIP_MAX_TSX_COUNT + 2*PJSIP_MAX
_DIALOG_COUNT) | |
|
| #define PJSIP_POOL_LEN_ENDPT (4000) | | | |
| #define PJSIP_POOL_INC_ENDPT (4000) | | /** | |
| | | * Initial memory block for the endpoint. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_LEN_ENDPT | |
| | | # define PJSIP_POOL_LEN_ENDPT (4000) | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for endpoint. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_INC_ENDPT | |
| | | # define PJSIP_POOL_INC_ENDPT (4000) | |
| | | #endif | |
| | | | |
| /* Transport related constants. */ | | /* Transport related constants. */ | |
| | | | |
|
| #define PJSIP_POOL_RDATA_LEN 4000 | | /** | |
| #define PJSIP_POOL_RDATA_INC 4000 | | * Initial memory block for rdata. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_RDATA_LEN | |
| | | # define PJSIP_POOL_RDATA_LEN 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for rdata. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_RDATA_INC | |
| | | # define PJSIP_POOL_RDATA_INC 4000 | |
| | | #endif | |
| | | | |
| #define PJSIP_POOL_LEN_TRANSPORT 512 | | #define PJSIP_POOL_LEN_TRANSPORT 512 | |
| #define PJSIP_POOL_INC_TRANSPORT 512 | | #define PJSIP_POOL_INC_TRANSPORT 512 | |
|
| #define PJSIP_POOL_LEN_TDATA 4000 | | | |
| #define PJSIP_POOL_INC_TDATA 4000 | | /** | |
| #define PJSIP_POOL_LEN_UA 4000 | | * Initial memory block size for tdata. | |
| #define PJSIP_POOL_INC_UA 4000 | | */ | |
| | | #ifndef PJSIP_POOL_LEN_TDATA | |
| | | # define PJSIP_POOL_LEN_TDATA 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for tdata. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_INC_TDATA | |
| | | # define PJSIP_POOL_INC_TDATA 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Initial memory size for UA layer | |
| | | */ | |
| | | #ifndef PJSIP_POOL_LEN_UA | |
| | | # define PJSIP_POOL_LEN_UA 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for UA layer. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_INC_UA | |
| | | # define PJSIP_POOL_INC_UA 4000 | |
| | | #endif | |
| | | | |
| #define PJSIP_MAX_FORWARDS_VALUE 70 | | #define PJSIP_MAX_FORWARDS_VALUE 70 | |
| | | | |
| #define PJSIP_RFC3261_BRANCH_ID "z9hG4bK" | | #define PJSIP_RFC3261_BRANCH_ID "z9hG4bK" | |
| #define PJSIP_RFC3261_BRANCH_LEN 7 | | #define PJSIP_RFC3261_BRANCH_LEN 7 | |
| | | | |
| /* Transaction related constants. */ | | /* Transaction related constants. */ | |
|
| #define PJSIP_POOL_TSX_LAYER_LEN 4000 | | | |
| #define PJSIP_POOL_TSX_LAYER_INC 4000 | | /** | |
| #define PJSIP_POOL_TSX_LEN 1536 /* 768 */ | | * Initial memory size for transaction layer | |
| #define PJSIP_POOL_TSX_INC 256 | | */ | |
| | | #ifndef PJSIP_POOL_TSX_LAYER_LEN | |
| | | # define PJSIP_POOL_TSX_LAYER_LEN 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for transaction layer. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_TSX_LAYER_INC | |
| | | # define PJSIP_POOL_TSX_LAYER_INC 4000 | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Initial memory size for a SIP transaction object. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_TSX_LEN | |
| | | # define PJSIP_POOL_TSX_LEN 1536 /* 768 */ | |
| | | #endif | |
| | | | |
| | | /** | |
| | | * Memory increment for transaction object. | |
| | | */ | |
| | | #ifndef PJSIP_POOL_TSX_INC | |
| | | # define PJSIP_POOL_TSX_INC 256 | |
| | | #endif | |
| | | | |
| #define PJSIP_MAX_TSX_KEY_LEN (PJSIP_MAX_URL_SIZE*2) | | #define PJSIP_MAX_TSX_KEY_LEN (PJSIP_MAX_URL_SIZE*2) | |
| | | | |
| /* User agent. */ | | /* User agent. */ | |
| #define PJSIP_POOL_LEN_USER_AGENT 1024 | | #define PJSIP_POOL_LEN_USER_AGENT 1024 | |
| #define PJSIP_POOL_INC_USER_AGENT 1024 | | #define PJSIP_POOL_INC_USER_AGENT 1024 | |
| | | | |
| /* Message/URL related constants. */ | | /* Message/URL related constants. */ | |
| #define PJSIP_MAX_CALL_ID_LEN PJ_GUID_STRING_LENGTH | | #define PJSIP_MAX_CALL_ID_LEN PJ_GUID_STRING_LENGTH | |
| #define PJSIP_MAX_TAG_LEN PJ_GUID_STRING_LENGTH | | #define PJSIP_MAX_TAG_LEN PJ_GUID_STRING_LENGTH | |
| #define PJSIP_MAX_BRANCH_LEN (PJSIP_RFC3261_BRANCH_LEN + PJ_GUID_
STRING_LENGTH + 2) | | #define PJSIP_MAX_BRANCH_LEN (PJSIP_RFC3261_BRANCH_LEN + PJ_GUID_
STRING_LENGTH + 2) | |
| | | | |
End of changes. 5 change blocks. |
| 13 lines changed or deleted | | 86 lines changed or added | |
|
| sip_transport.h | | sip_transport.h | |
|
| /* $Id: sip_transport.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: sip_transport.h 1310 2007-05-28 12:58:57Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 592 | | skipping to change at line 592 | |
| * @return PJ_SUCCESS on success. | | * @return PJ_SUCCESS on success. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata, | | PJ_DECL(pj_status_t) pjsip_tx_data_set_transport(pjsip_tx_data *tdata, | |
| const pjsip_tpselector *sel
); | | const pjsip_tpselector *sel
); | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| * | | * | |
| * TRANSPORT | | * TRANSPORT | |
| * | | * | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
|
| | | /** | |
| | | * Type of callback to receive transport operation status. | |
| | | */ | |
| | | typedef void (*pjsip_transport_callback)(pjsip_transport *tp, void *token, | |
| | | pj_ssize_t sent_bytes); | |
| | | | |
| | | /** | |
| | | * This structure describes transport key to be registered to hash table. | |
| | | */ | |
| | | typedef struct pjsip_transport_key | |
| | | { | |
| | | /** | |
| | | * Transport type. | |
| | | */ | |
| | | long type; | |
| | | | |
| | | /** | |
| | | * Destination address. | |
| | | */ | |
| | | pj_sockaddr rem_addr; | |
| | | | |
| | | } pjsip_transport_key; | |
| | | | |
| /** | | /** | |
| * This structure represent the "public" interface of a SIP transport. | | * This structure represent the "public" interface of a SIP transport. | |
| * Applications normally extend this structure to include transport | | * Applications normally extend this structure to include transport | |
| * specific members. | | * specific members. | |
| */ | | */ | |
| struct pjsip_transport | | struct pjsip_transport | |
| { | | { | |
| char obj_name[PJ_MAX_OBJ_NAME]; /**< Name. */ | | char obj_name[PJ_MAX_OBJ_NAME]; /**< Name. */ | |
| | | | |
| pj_pool_t *pool; /**< Pool used by transport.
*/ | | pj_pool_t *pool; /**< Pool used by transport.
*/ | |
| pj_atomic_t *ref_cnt; /**< Reference counter.
*/ | | pj_atomic_t *ref_cnt; /**< Reference counter.
*/ | |
| pj_lock_t *lock; /**< Lock object.
*/ | | pj_lock_t *lock; /**< Lock object.
*/ | |
| pj_bool_t tracing; /**< Tracing enabled?
*/ | | pj_bool_t tracing; /**< Tracing enabled?
*/ | |
| pj_bool_t is_shutdown; /**< Being shutdown?
*/ | | pj_bool_t is_shutdown; /**< Being shutdown?
*/ | |
| | | | |
| /** Key for indexing this transport in hash table. */ | | /** Key for indexing this transport in hash table. */ | |
|
| struct { | | pjsip_transport_key key; | |
| pjsip_transport_type_e type; /**< Transport type. | | | |
| */ | | | |
| pj_sockaddr rem_addr; /**< Remote addr (zero for UDP) | | | |
| */ | | | |
| } key; | | | |
| | | | |
| char *type_name; /**< Type name.
*/ | | char *type_name; /**< Type name.
*/ | |
| unsigned flag; /**< #pjsip_transport_flags_e
*/ | | unsigned flag; /**< #pjsip_transport_flags_e
*/ | |
| char *info; /**< Transport info/description.
*/ | | char *info; /**< Transport info/description.
*/ | |
| | | | |
| int addr_len; /**< Length of addresses
. */ | | int addr_len; /**< Length of addresses
. */ | |
| pj_sockaddr local_addr; /**< Bound address.
*/ | | pj_sockaddr local_addr; /**< Bound address.
*/ | |
| pjsip_host_port local_name; /**< Published name (eg. STUN).
*/ | | pjsip_host_port local_name; /**< Published name (eg. STUN).
*/ | |
| pjsip_host_port remote_name; /**< Remote address name.
*/ | | pjsip_host_port remote_name; /**< Remote address name.
*/ | |
| | | | |
| | | | |
| skipping to change at line 658 | | skipping to change at line 677 | |
| * this case caller doesn't have to do anything | | * this case caller doesn't have to do anything | |
| * except wait the calback to be called, if it | | * except wait the calback to be called, if it | |
| * supplies one. | | * supplies one. | |
| * Other return values indicate the error code. | | * Other return values indicate the error code. | |
| */ | | */ | |
| pj_status_t (*send_msg)(pjsip_transport *transport, | | pj_status_t (*send_msg)(pjsip_transport *transport, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| const pj_sockaddr_t *rem_addr, | | const pj_sockaddr_t *rem_addr, | |
| int addr_len, | | int addr_len, | |
| void *token, | | void *token, | |
|
| void (*callback)(pjsip_transport *transport, | | pjsip_transport_callback callback); | |
| void *token, | | | |
| pj_ssize_t sent_bytes)); | | | |
| | | | |
| /** | | /** | |
| * Instruct the transport to initiate graceful shutdown procedure. | | * Instruct the transport to initiate graceful shutdown procedure. | |
| * After all objects release their reference to this transport, | | * After all objects release their reference to this transport, | |
| * the transport will be deleted. | | * the transport will be deleted. | |
| * | | * | |
| * Note that application MUST use #pjsip_transport_shutdown() instead. | | * Note that application MUST use #pjsip_transport_shutdown() instead. | |
| * | | * | |
| * @param transport The transport. | | * @param transport The transport. | |
| * | | * | |
| | | | |
| skipping to change at line 863 | | skipping to change at line 880 | |
| * @return PJ_SUCCESS is sucessfully unregistered. | | * @return PJ_SUCCESS is sucessfully unregistered. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tpmgr_unregister_tpfactory(pjsip_tpmgr *mgr, | | PJ_DECL(pj_status_t) pjsip_tpmgr_unregister_tpfactory(pjsip_tpmgr *mgr, | |
| pjsip_tpfactory *tpf); | | pjsip_tpfactory *tpf); | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| * | | * | |
| * TRANSPORT MANAGER | | * TRANSPORT MANAGER | |
| * | | * | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
|
| | | typedef void (*pjsip_rx_callback)(pjsip_endpoint*, pj_status_t, pjsip_rx_da | |
| | | ta *); | |
| | | typedef pj_status_t (*pjsip_tx_callback)(pjsip_endpoint*, pjsip_tx_data*); | |
| /** | | /** | |
| * Create a new transport manager. | | * Create a new transport manager. | |
| * | | * | |
| * @param pool Pool. | | * @param pool Pool. | |
| * @param endpt Endpoint instance. | | * @param endpt Endpoint instance. | |
| * @param rx_cb Callback to receive incoming message. | | * @param rx_cb Callback to receive incoming message. | |
| * @param tx_cb Callback to be called before transport manager i
s sending | | * @param tx_cb Callback to be called before transport manager i
s sending | |
| * outgoing message. | | * outgoing message. | |
| * @param p_mgr Pointer to receive the new transport manager. | | * @param p_mgr Pointer to receive the new transport manager. | |
| * | | * | |
| * @return PJ_SUCCESS or the appropriate error code on error. | | * @return PJ_SUCCESS or the appropriate error code on error. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool, | | PJ_DECL(pj_status_t) pjsip_tpmgr_create( pj_pool_t *pool, | |
| pjsip_endpoint * endpt, | | pjsip_endpoint * endpt, | |
|
| void (*rx_cb)(pjsip_endpoint*, | | pjsip_rx_callback rx_cb, | |
| pj_status_t, | | pjsip_tx_callback tx_cb, | |
| pjsip_rx_data *), | | | |
| pj_status_t (*tx_cb)(pjsip_endpoint | | | |
| *, | | | |
| pjsip_tx_data* | | | |
| ), | | | |
| pjsip_tpmgr **p_mgr); | | pjsip_tpmgr **p_mgr); | |
| | | | |
| /** | | /** | |
| * Find out the appropriate local address info (IP address and port) to | | * Find out the appropriate local address info (IP address and port) to | |
| * advertise in Contact header based on the remote address to be | | * advertise in Contact header based on the remote address to be | |
| * contacted. The local address info would be the address name of the | | * contacted. The local address info would be the address name of the | |
| * transport or listener which will be used to send the request. | | * transport or listener which will be used to send the request. | |
| * | | * | |
| * In this implementation, it will only select the transport based on | | * In this implementation, it will only select the transport based on | |
| * the transport type in the request. | | * the transport type in the request. | |
| | | | |
| skipping to change at line 911 | | skipping to change at line 926 | |
| * @return PJ_SUCCESS, or the appropriate error code. | | * @return PJ_SUCCESS, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr( pjsip_tpmgr *tpmgr, | | PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr( pjsip_tpmgr *tpmgr, | |
| pj_pool_t *pool, | | pj_pool_t *pool, | |
| pjsip_transport_type_e typ
e, | | pjsip_transport_type_e typ
e, | |
| const pjsip_tpselector *se
l, | | const pjsip_tpselector *se
l, | |
| pj_str_t *ip_addr, | | pj_str_t *ip_addr, | |
| int *port); | | int *port); | |
| | | | |
| /** | | /** | |
|
| | | * Return number of transports currently registered to the transport | |
| | | * manager. | |
| | | * | |
| | | * @param mgr The transport manager. | |
| | | * | |
| | | * @return Number of transports. | |
| | | */ | |
| | | PJ_DECL(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr); | |
| | | | |
| | | /** | |
| * Destroy transport manager. | | * Destroy transport manager. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tpmgr_destroy(pjsip_tpmgr *mgr); | | PJ_DECL(pj_status_t) pjsip_tpmgr_destroy(pjsip_tpmgr *mgr); | |
| | | | |
| /** | | /** | |
| * Dump transport info. | | * Dump transport info. | |
| */ | | */ | |
| PJ_DECL(void) pjsip_tpmgr_dump_transports(pjsip_tpmgr *mgr); | | PJ_DECL(void) pjsip_tpmgr_dump_transports(pjsip_tpmgr *mgr); | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| | | | |
| skipping to change at line 951 | | skipping to change at line 976 | |
| * | | * | |
| * @return PJ_SUCCESS on success, or the appropriate error code. | | * @return PJ_SUCCESS on success, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_tpmgr_acquire_transport(pjsip_tpmgr *mgr, | | PJ_DECL(pj_status_t) pjsip_tpmgr_acquire_transport(pjsip_tpmgr *mgr, | |
| pjsip_transport_type_e ty
pe, | | pjsip_transport_type_e ty
pe, | |
| const pj_sockaddr_t *remo
te, | | const pj_sockaddr_t *remo
te, | |
| int addr_len, | | int addr_len, | |
| const pjsip_tpselector *s
el, | | const pjsip_tpselector *s
el, | |
| pjsip_transport **tp); | | pjsip_transport **tp); | |
| | | | |
|
| | | typedef void (*pjsip_tp_send_callback)(void *token, pjsip_tx_data *tdata, | |
| | | p | |
| | | j_ssize_t bytes_sent); | |
| /** | | /** | |
| * Send a SIP message using the specified transport. | | * Send a SIP message using the specified transport. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_transport_send( pjsip_transport *tr, | | PJ_DECL(pj_status_t) pjsip_transport_send( pjsip_transport *tr, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| const pj_sockaddr_t *addr, | | const pj_sockaddr_t *addr, | |
| int addr_len, | | int addr_len, | |
| void *token, | | void *token, | |
|
| void (*cb)(void *token, | | pjsip_tp_send_callback cb); | |
| pjsip_tx_data *tdata, | | | |
| pj_ssize_t bytes_sent) | | | |
| ); | | | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| PJ_END_DECL | | PJ_END_DECL | |
| | | | |
| #endif /* __PJSIP_SIP_TRANSPORT_H__ */ | | #endif /* __PJSIP_SIP_TRANSPORT_H__ */ | |
| | | | |
End of changes. 9 change blocks. |
| 22 lines changed or deleted | | 44 lines changed or added | |
|
| sip_util.h | | sip_util.h | |
|
| /* $Id: sip_util.h 1121 2007-04-01 22:58:47Z bennylp $ */ | | /* $Id: sip_util.h 1269 2007-05-12 15:03:23Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 257 | | skipping to change at line 257 | |
| pjsip_transport *cur_transport; | | pjsip_transport *cur_transport; | |
| | | | |
| /** The application callback which was specified when the function | | /** The application callback which was specified when the function | |
| * #pjsip_endpt_send_request_stateless() was called. | | * #pjsip_endpt_send_request_stateless() was called. | |
| */ | | */ | |
| void (*app_cb)(struct pjsip_send_state*, | | void (*app_cb)(struct pjsip_send_state*, | |
| pj_ssize_t sent, | | pj_ssize_t sent, | |
| pj_bool_t *cont); | | pj_bool_t *cont); | |
| } pjsip_send_state; | | } pjsip_send_state; | |
| | | | |
|
| | | typedef void (*pjsip_endpt_callback)(pjsip_send_state*, pj_ssize_t sent, | |
| | | pj_ | |
| | | bool_t *cont); | |
| /** | | /** | |
| * Send outgoing request statelessly The function will take care of which | | * Send outgoing request statelessly The function will take care of which | |
| * destination and transport to use based on the information in the message
, | | * destination and transport to use based on the information in the message
, | |
| * taking care of URI in the request line and Route header. | | * taking care of URI in the request line and Route header. | |
| * | | * | |
| * This function is different than #pjsip_transport_send() in that this | | * This function is different than #pjsip_transport_send() in that this | |
| * function adds/modify the Via header as necessary. | | * function adds/modify the Via header as necessary. | |
| * | | * | |
| * @param endpt The endpoint instance. | | * @param endpt The endpoint instance. | |
| * @param tdata The transmit data to be sent. | | * @param tdata The transmit data to be sent. | |
| | | | |
| skipping to change at line 278 | | skipping to change at line 280 | |
| * @param cb Optional callback to notify transmission status (also | | * @param cb Optional callback to notify transmission status (also | |
| * gives chance for application to discontinue retrying | | * gives chance for application to discontinue retrying | |
| * sending to alternate address). | | * sending to alternate address). | |
| * | | * | |
| * @return PJ_SUCCESS, or the appropriate error code. | | * @return PJ_SUCCESS, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) | | PJ_DECL(pj_status_t) | |
| pjsip_endpt_send_request_stateless( pjsip_endpoint *endpt, | | pjsip_endpt_send_request_stateless( pjsip_endpoint *endpt, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| void *token, | | void *token, | |
|
| void (*cb)(pjsip_send_state*, | | pjsip_endpt_callback cb); | |
| pj_ssize_t sent, | | | |
| pj_bool_t *cont)); | | | |
| | | | |
| /** | | /** | |
| * This structure describes destination information to send response. | | * This structure describes destination information to send response. | |
| * It is initialized by calling #pjsip_get_response_addr(). | | * It is initialized by calling #pjsip_get_response_addr(). | |
| * | | * | |
| * If the response message should be sent using transport from which | | * If the response message should be sent using transport from which | |
| * the request was received, then transport, addr, and addr_len fields | | * the request was received, then transport, addr, and addr_len fields | |
| * are initialized. | | * are initialized. | |
| * | | * | |
| * The dst_host field is also initialized. It should be used when server | | * The dst_host field is also initialized. It should be used when server | |
| | | | |
| skipping to change at line 356 | | skipping to change at line 356 | |
| * | | * | |
| * @return PJ_SUCCESS if response has been successfully created and | | * @return PJ_SUCCESS if response has been successfully created and | |
| * sent to transport layer, or a non-zero error code. | | * sent to transport layer, or a non-zero error code. | |
| * However, even when it returns PJ_SUCCESS, there is no | | * However, even when it returns PJ_SUCCESS, there is no | |
| * guarantee that the response has been successfully sent. | | * guarantee that the response has been successfully sent. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_endpt_send_response( pjsip_endpoint *endpt, | | PJ_DECL(pj_status_t) pjsip_endpt_send_response( pjsip_endpoint *endpt, | |
| pjsip_response_addr *res_add
r, | | pjsip_response_addr *res_add
r, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| void *token, | | void *token, | |
|
| void (*cb)(pjsip_send_state* | | pjsip_endpt_callback cb); | |
| , | | | |
| pj_ssize_t sent, | | | |
| pj_bool_t *cont)) | | | |
| ; | | | |
| | | | |
| /** | | /** | |
| * This is a convenient function which wraps #pjsip_get_response_addr() and | | * This is a convenient function which wraps #pjsip_get_response_addr() and | |
| * #pjsip_endpt_send_response() in a single function. | | * #pjsip_endpt_send_response() in a single function. | |
| * | | * | |
| * @param endpt The endpoint instance. | | * @param endpt The endpoint instance. | |
| * @param rdata The original request to be responded. | | * @param rdata The original request to be responded. | |
| * @param tdata The response message to be sent. | | * @param tdata The response message to be sent. | |
| * @param token Token to be passed back when the callback is cal
led. | | * @param token Token to be passed back when the callback is cal
led. | |
| * @param cb Optional callback to notify the transmission status | | * @param cb Optional callback to notify the transmission status | |
| | | | |
| skipping to change at line 381 | | skipping to change at line 379 | |
| * | | * | |
| * @return PJ_SUCCESS if response has been successfully created and | | * @return PJ_SUCCESS if response has been successfully created and | |
| * sent to transport layer, or a non-zero error code. | | * sent to transport layer, or a non-zero error code. | |
| * However, even when it returns PJ_SUCCESS, there is no | | * However, even when it returns PJ_SUCCESS, there is no | |
| * guarantee that the response has been successfully sent. | | * guarantee that the response has been successfully sent. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_endpt_send_response2(pjsip_endpoint *endpt, | | PJ_DECL(pj_status_t) pjsip_endpt_send_response2(pjsip_endpoint *endpt, | |
| pjsip_rx_data *rdata, | | pjsip_rx_data *rdata, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| void *token, | | void *token, | |
|
| void (*cb)(pjsip_send_state* | | pjsip_endpt_callback cb); | |
| , | | | |
| pj_ssize_t sent, | | | |
| pj_bool_t *cont)) | | | |
| ; | | | |
| | | | |
| /** | | /** | |
| * This composite function sends response message statelessly to an incomin
g | | * This composite function sends response message statelessly to an incomin
g | |
| * request message. Internally it calls #pjsip_endpt_create_response() and | | * request message. Internally it calls #pjsip_endpt_create_response() and | |
| * #pjsip_endpt_send_response(). | | * #pjsip_endpt_send_response(). | |
| * | | * | |
| * @param endpt The endpoint instance. | | * @param endpt The endpoint instance. | |
| * @param rdata The incoming request message. | | * @param rdata The incoming request message. | |
| * @param st_code Status code of the response. | | * @param st_code Status code of the response. | |
| * @param st_text Optional status text of the response. | | * @param st_text Optional status text of the response. | |
| | | | |
| skipping to change at line 444 | | skipping to change at line 440 | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_endpt_respond( pjsip_endpoint *endpt, | | PJ_DECL(pj_status_t) pjsip_endpt_respond( pjsip_endpoint *endpt, | |
| pjsip_module *tsx_user, | | pjsip_module *tsx_user, | |
| pjsip_rx_data *rdata, | | pjsip_rx_data *rdata, | |
| int st_code, | | int st_code, | |
| const pj_str_t *st_text, | | const pj_str_t *st_text, | |
| const pjsip_hdr *hdr_list, | | const pjsip_hdr *hdr_list, | |
| const pjsip_msg_body *body, | | const pjsip_msg_body *body, | |
| pjsip_transaction **p_tsx ); | | pjsip_transaction **p_tsx ); | |
| | | | |
|
| | | typedef void (*pjsip_endpt_send_callback)(void*, pjsip_event*); | |
| /** | | /** | |
| * Send outgoing request and initiate UAC transaction for the request. | | * Send outgoing request and initiate UAC transaction for the request. | |
| * This is an auxiliary function to be used by application to send arbitrar
y | | * This is an auxiliary function to be used by application to send arbitrar
y | |
| * requests outside a dialog. To send a request within a dialog, applicatio
n | | * requests outside a dialog. To send a request within a dialog, applicatio
n | |
| * should use #pjsip_dlg_send_request instead. | | * should use #pjsip_dlg_send_request instead. | |
| * | | * | |
| * @param endpt The endpoint instance. | | * @param endpt The endpoint instance. | |
| * @param tdata The transmit data to be sent. | | * @param tdata The transmit data to be sent. | |
| * @param timeout Optional timeout for final response to be received, or
-1 | | * @param timeout Optional timeout for final response to be received, or
-1 | |
| * if the transaction should not have a timeout restriction
. | | * if the transaction should not have a timeout restriction
. | |
| | | | |
| skipping to change at line 468 | | skipping to change at line 465 | |
| * received a final response. The callback will be called w
ith | | * received a final response. The callback will be called w
ith | |
| * the previously registered token and the event that trigg
ers | | * the previously registered token and the event that trigg
ers | |
| * the completion of the transaction. | | * the completion of the transaction. | |
| * | | * | |
| * @return PJ_SUCCESS, or the appropriate error code. | | * @return PJ_SUCCESS, or the appropriate error code. | |
| */ | | */ | |
| PJ_DECL(pj_status_t) pjsip_endpt_send_request( pjsip_endpoint *endpt, | | PJ_DECL(pj_status_t) pjsip_endpt_send_request( pjsip_endpoint *endpt, | |
| pjsip_tx_data *tdata, | | pjsip_tx_data *tdata, | |
| pj_int32_t timeout, | | pj_int32_t timeout, | |
| void *token, | | void *token, | |
|
| void (*cb)(void*,pjsip_event*
)); | | pjsip_endpt_send_callback cb)
; | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup PJSIP_PROXY_CORE Core Proxy Layer | | * @defgroup PJSIP_PROXY_CORE Core Proxy Layer | |
| * @ingroup PJSIP | | * @ingroup PJSIP | |
| * @brief Core proxy operations | | * @brief Core proxy operations | |
| * @{ | | * @{ | |
| | | | |
End of changes. 7 change blocks. |
| 15 lines changed or deleted | | 9 lines changed or added | |
|
| sock.h | | sock.h | |
|
| /* $Id: sock.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: sock.h 1104 2007-03-25 18:44:51Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 165 | |
| #if !defined(PJ_SOMAXCONN) | | #if !defined(PJ_SOMAXCONN) | |
| # define PJ_SOMAXCONN 5 | | # define PJ_SOMAXCONN 5 | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Constant for invalid socket returned by #pj_sock_socket() and | | * Constant for invalid socket returned by #pj_sock_socket() and | |
| * #pj_sock_accept(). | | * #pj_sock_accept(). | |
| */ | | */ | |
| #define PJ_INVALID_SOCKET (-1) | | #define PJ_INVALID_SOCKET (-1) | |
| | | | |
|
| /** | | | |
| * Structure describing a generic socket address. | | | |
| * If PJ_SOCKADDR_HAS_LEN is not zero, then sa_zero_len member is added | | | |
| * to this struct. As far the application is concerned, the value of | | | |
| * this member will always be zero. Internally, PJLIB may modify the value | | | |
| * before calling OS socket API, and reset the value back to zero before | | | |
| * returning the struct to application. | | | |
| */ | | | |
| typedef struct pj_sockaddr | | | |
| { | | | |
| #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 | | | |
| pj_uint8_t sa_zero_len; | | | |
| pj_uint8_t sa_family; | | | |
| #else | | | |
| pj_uint16_t sa_family; /**< Common data: address family. | | | |
| */ | | | |
| #endif | | | |
| char sa_data[14]; /**< Address data. */ | | | |
| } pj_sockaddr; | | | |
| | | | |
| #undef s_addr | | #undef s_addr | |
| | | | |
| /** | | /** | |
| * This structure describes Internet address. | | * This structure describes Internet address. | |
| */ | | */ | |
| typedef struct pj_in_addr | | typedef struct pj_in_addr | |
| { | | { | |
| pj_uint32_t s_addr; /**< The 32bit IP address.
*/ | | pj_uint32_t s_addr; /**< The 32bit IP address.
*/ | |
| } pj_in_addr; | | } pj_in_addr; | |
| | | | |
| | | | |
| skipping to change at line 215 | | skipping to change at line 196 | |
| pj_uint8_t sin_zero_len; /**< Just ignore this. */ | | pj_uint8_t sin_zero_len; /**< Just ignore this. */ | |
| pj_uint8_t sin_family; /**< Address family. */ | | pj_uint8_t sin_family; /**< Address family. */ | |
| #else | | #else | |
| pj_uint16_t sin_family; /**< Address family.
*/ | | pj_uint16_t sin_family; /**< Address family.
*/ | |
| #endif | | #endif | |
| pj_uint16_t sin_port; /**< Transport layer port number.
*/ | | pj_uint16_t sin_port; /**< Transport layer port number.
*/ | |
| pj_in_addr sin_addr; /**< IP address. */ | | pj_in_addr sin_addr; /**< IP address. */ | |
| char sin_zero[8]; /**< Padding. */ | | char sin_zero[8]; /**< Padding. */ | |
| }; | | }; | |
| | | | |
|
| | | #undef s6_addr | |
| | | | |
| /** | | /** | |
| * This structure describes IPv6 address. | | * This structure describes IPv6 address. | |
| */ | | */ | |
| typedef struct pj_in6_addr | | typedef struct pj_in6_addr | |
| { | | { | |
| /** Union of address formats. */ | | /** Union of address formats. */ | |
| union { | | union { | |
| pj_uint8_t u6_addr8[16]; /**< u6_addr8 */ | | pj_uint8_t u6_addr8[16]; /**< u6_addr8 */ | |
| pj_uint16_t u6_addr16[8]; /**< u6_addr16 */ | | pj_uint16_t u6_addr16[8]; /**< u6_addr16 */ | |
| pj_uint32_t u6_addr32[4]; /**< u6_addr32 */ | | pj_uint32_t u6_addr32[4]; /**< u6_addr32 */ | |
| | | | |
| skipping to change at line 262 | | skipping to change at line 245 | |
| pj_uint8_t sin_family; /**< Address family. */ | | pj_uint8_t sin_family; /**< Address family. */ | |
| #else | | #else | |
| pj_uint16_t sin6_family; /**< Address family
*/ | | pj_uint16_t sin6_family; /**< Address family
*/ | |
| #endif | | #endif | |
| pj_uint16_t sin6_port; /**< Transport layer port number
. */ | | pj_uint16_t sin6_port; /**< Transport layer port number
. */ | |
| pj_uint32_t sin6_flowinfo; /**< IPv6 flow information
*/ | | pj_uint32_t sin6_flowinfo; /**< IPv6 flow information
*/ | |
| pj_in6_addr sin6_addr; /**< IPv6 address. */ | | pj_in6_addr sin6_addr; /**< IPv6 address. */ | |
| pj_uint32_t sin6_scope_id; /**< IPv6 scope-id */ | | pj_uint32_t sin6_scope_id; /**< IPv6 scope-id */ | |
| } pj_sockaddr_in6; | | } pj_sockaddr_in6; | |
| | | | |
|
| | | /** | |
| | | * This structure describes common attributes found in transport addresses. | |
| | | * If PJ_SOCKADDR_HAS_LEN is not zero, then sa_zero_len member is added | |
| | | * to this struct. As far the application is concerned, the value of | |
| | | * this member will always be zero. Internally, PJLIB may modify the value | |
| | | * before calling OS socket API, and reset the value back to zero before | |
| | | * returning the struct to application. | |
| | | */ | |
| | | typedef struct pj_addr_hdr | |
| | | { | |
| | | #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 | |
| | | pj_uint8_t sa_zero_len; | |
| | | pj_uint8_t sa_family; | |
| | | #else | |
| | | pj_uint16_t sa_family; /**< Common data: address family. | |
| | | */ | |
| | | #endif | |
| | | } pj_addr_hdr; | |
| | | | |
| | | /** | |
| | | * This union describes a generic socket address. | |
| | | */ | |
| | | typedef union pj_sockaddr | |
| | | { | |
| | | pj_addr_hdr addr; /**< Generic transport address. | |
| | | */ | |
| | | pj_sockaddr_in ipv4; /**< IPv4 transport address. */ | |
| | | pj_sockaddr_in6 ipv6; /**< IPv6 transport address. */ | |
| | | } pj_sockaddr; | |
| | | | |
| /**************************************************************************
*** | | /**************************************************************************
*** | |
| * | | * | |
| * SOCKET ADDRESS MANIPULATION. | | * SOCKET ADDRESS MANIPULATION. | |
| * | | * | |
| **************************************************************************
*** | | **************************************************************************
*** | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * Convert 16-bit value from network byte order to host byte order. | | * Convert 16-bit value from network byte order to host byte order. | |
| * | | * | |
| | | | |
End of changes. 4 change blocks. |
| 21 lines changed or deleted | | 33 lines changed or added | |
|
| speex.h | | speex.h | |
|
| /* $Id: speex.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* Copyright (C) 2002-2006 Jean-Marc Valin*/ | |
| | | /** | |
| | | @file speex.h | |
| | | @brief Describes the different modes of the codec | |
| | | */ | |
| /* | | /* | |
|
| * Copyright (C)2003-2007 Benny Prijono <benny@prijono.org> | | Redistribution and use in source and binary forms, with or without | |
| * | | modification, are permitted provided that the following conditions | |
| * This program is free software; you can redistribute it and/or modify | | are met: | |
| * it under the terms of the GNU General Public License as published by | | | |
| * the Free Software Foundation; either version 2 of the License, or | | - Redistributions of source code must retain the above copyright | |
| * (at your option) any later version. | | notice, this list of conditions and the following disclaimer. | |
| * | | | |
| * This program is distributed in the hope that it will be useful, | | - Redistributions in binary form must reproduce the above copyright | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | notice, this list of conditions and the following disclaimer in the | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | documentation and/or other materials provided with the distribution. | |
| * GNU General Public License for more details. | | | |
| * | | - Neither the name of the Xiph.org Foundation nor the names of its | |
| * You should have received a copy of the GNU General Public License | | contributors may be used to endorse or promote products derived from | |
| * along with this program; if not, write to the Free Software | | this software without specific prior written permission. | |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US | | | |
| A | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| | | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION O | |
| | | R | |
| | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| | | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| | | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| | | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| | | | |
| | | */ | |
| | | | |
| | | #ifndef SPEEX_H | |
| | | #define SPEEX_H | |
| | | /** @defgroup Codec Speex encoder and decoder | |
| | | * This is the Speex codec itself. | |
| | | * @{ | |
| */ | | */ | |
|
| #ifndef __PJMEDIA_CODEC_SPEEX_H__ | | | |
| #define __PJMEDIA_CODEC_SPEEX_H__ | | #include "speex/speex_bits.h" | |
| | | #include "speex/speex_types.h" | |
| | | | |
| | | #ifdef __cplusplus | |
| | | extern "C" { | |
| | | #endif | |
| | | | |
| | | /* Values allowed for *ctl() requests */ | |
| | | | |
| | | /** Set enhancement on/off (decoder only) */ | |
| | | #define SPEEX_SET_ENH 0 | |
| | | /** Get enhancement state (decoder only) */ | |
| | | #define SPEEX_GET_ENH 1 | |
| | | | |
| | | /*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/ | |
| | | /** Obtain frame size used by encoder/decoder */ | |
| | | #define SPEEX_GET_FRAME_SIZE 3 | |
| | | | |
| | | /** Set quality value */ | |
| | | #define SPEEX_SET_QUALITY 4 | |
| | | /** Get current quality setting */ | |
| | | /* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */ | |
| | | | |
| | | /** Set sub-mode to use */ | |
| | | #define SPEEX_SET_MODE 6 | |
| | | /** Get current sub-mode in use */ | |
| | | #define SPEEX_GET_MODE 7 | |
| | | | |
| | | /** Set low-band sub-mode to use (wideband only)*/ | |
| | | #define SPEEX_SET_LOW_MODE 8 | |
| | | /** Get current low-band mode in use (wideband only)*/ | |
| | | #define SPEEX_GET_LOW_MODE 9 | |
| | | | |
| | | /** Set high-band sub-mode to use (wideband only)*/ | |
| | | #define SPEEX_SET_HIGH_MODE 10 | |
| | | /** Get current high-band mode in use (wideband only)*/ | |
| | | #define SPEEX_GET_HIGH_MODE 11 | |
| | | | |
| | | /** Set VBR on (1) or off (0) */ | |
| | | #define SPEEX_SET_VBR 12 | |
| | | /** Get VBR status (1 for on, 0 for off) */ | |
| | | #define SPEEX_GET_VBR 13 | |
| | | | |
| | | /** Set quality value for VBR encoding (0-10) */ | |
| | | #define SPEEX_SET_VBR_QUALITY 14 | |
| | | /** Get current quality value for VBR encoding (0-10) */ | |
| | | #define SPEEX_GET_VBR_QUALITY 15 | |
| | | | |
| | | /** Set complexity of the encoder (0-10) */ | |
| | | #define SPEEX_SET_COMPLEXITY 16 | |
| | | /** Get current complexity of the encoder (0-10) */ | |
| | | #define SPEEX_GET_COMPLEXITY 17 | |
| | | | |
| | | /** Set bit-rate used by the encoder (or lower) */ | |
| | | #define SPEEX_SET_BITRATE 18 | |
| | | /** Get current bit-rate used by the encoder or decoder */ | |
| | | #define SPEEX_GET_BITRATE 19 | |
| | | | |
| | | /** Define a handler function for in-band Speex request*/ | |
| | | #define SPEEX_SET_HANDLER 20 | |
| | | | |
| | | /** Define a handler function for in-band user-defined request*/ | |
| | | #define SPEEX_SET_USER_HANDLER 22 | |
| | | | |
| | | /** Set sampling rate used in bit-rate computation */ | |
| | | #define SPEEX_SET_SAMPLING_RATE 24 | |
| | | /** Get sampling rate used in bit-rate computation */ | |
| | | #define SPEEX_GET_SAMPLING_RATE 25 | |
| | | | |
| | | /** Reset the encoder/decoder memories to zero*/ | |
| | | #define SPEEX_RESET_STATE 26 | |
| | | | |
| | | /** Get VBR info (mostly used internally) */ | |
| | | #define SPEEX_GET_RELATIVE_QUALITY 29 | |
| | | | |
| | | /** Set VAD status (1 for on, 0 for off) */ | |
| | | #define SPEEX_SET_VAD 30 | |
| | | | |
| | | /** Get VAD status (1 for on, 0 for off) */ | |
| | | #define SPEEX_GET_VAD 31 | |
| | | | |
| | | /** Set Average Bit-Rate (ABR) to n bits per seconds */ | |
| | | #define SPEEX_SET_ABR 32 | |
| | | /** Get Average Bit-Rate (ABR) setting (in bps) */ | |
| | | #define SPEEX_GET_ABR 33 | |
| | | | |
| | | /** Set DTX status (1 for on, 0 for off) */ | |
| | | #define SPEEX_SET_DTX 34 | |
| | | /** Get DTX status (1 for on, 0 for off) */ | |
| | | #define SPEEX_GET_DTX 35 | |
| | | | |
| | | /** Set submode encoding in each frame (1 for yes, 0 for no, setting to no | |
| | | breaks the standard) */ | |
| | | #define SPEEX_SET_SUBMODE_ENCODING 36 | |
| | | /** Get submode encoding in each frame */ | |
| | | #define SPEEX_GET_SUBMODE_ENCODING 37 | |
| | | | |
| | | /*#define SPEEX_SET_LOOKAHEAD 38*/ | |
| | | /** Returns the lookahead used by Speex */ | |
| | | #define SPEEX_GET_LOOKAHEAD 39 | |
| | | | |
| | | /** Sets tuning for packet-loss concealment (expected loss rate) */ | |
| | | #define SPEEX_SET_PLC_TUNING 40 | |
| | | /** Gets tuning for PLC */ | |
| | | #define SPEEX_GET_PLC_TUNING 41 | |
| | | | |
| | | /** Sets the max bit-rate allowed in VBR mode */ | |
| | | #define SPEEX_SET_VBR_MAX_BITRATE 42 | |
| | | /** Gets the max bit-rate allowed in VBR mode */ | |
| | | #define SPEEX_GET_VBR_MAX_BITRATE 43 | |
| | | | |
| | | /** Turn on/off input/output high-pass filtering */ | |
| | | #define SPEEX_SET_HIGHPASS 44 | |
| | | /** Get status of input/output high-pass filtering */ | |
| | | #define SPEEX_GET_HIGHPASS 45 | |
| | | | |
| | | /* Preserving compatibility:*/ | |
| | | /** Equivalent to SPEEX_SET_ENH */ | |
| | | #define SPEEX_SET_PF 0 | |
| | | /** Equivalent to SPEEX_GET_ENH */ | |
| | | #define SPEEX_GET_PF 1 | |
| | | | |
| | | /* Values allowed for mode queries */ | |
| | | /** Query the frame size of a mode */ | |
| | | #define SPEEX_MODE_FRAME_SIZE 0 | |
| | | | |
| | | /** Query the size of an encoded frame for a particular sub-mode */ | |
| | | #define SPEEX_SUBMODE_BITS_PER_FRAME 1 | |
| | | | |
| | | /** Get major Speex version */ | |
| | | #define SPEEX_LIB_GET_MAJOR_VERSION 1 | |
| | | /** Get minor Speex version */ | |
| | | #define SPEEX_LIB_GET_MINOR_VERSION 3 | |
| | | /** Get micro Speex version */ | |
| | | #define SPEEX_LIB_GET_MICRO_VERSION 5 | |
| | | /** Get extra Speex version */ | |
| | | #define SPEEX_LIB_GET_EXTRA_VERSION 7 | |
| | | /** Get Speex version string */ | |
| | | #define SPEEX_LIB_GET_VERSION_STRING 9 | |
| | | | |
| | | /*#define SPEEX_LIB_SET_ALLOC_FUNC 10 | |
| | | #define SPEEX_LIB_GET_ALLOC_FUNC 11 | |
| | | #define SPEEX_LIB_SET_FREE_FUNC 12 | |
| | | #define SPEEX_LIB_GET_FREE_FUNC 13 | |
| | | | |
| | | #define SPEEX_LIB_SET_WARNING_FUNC 14 | |
| | | #define SPEEX_LIB_GET_WARNING_FUNC 15 | |
| | | #define SPEEX_LIB_SET_ERROR_FUNC 16 | |
| | | #define SPEEX_LIB_GET_ERROR_FUNC 17 | |
| | | */ | |
| | | | |
| | | /** Number of defined modes in Speex */ | |
| | | #define SPEEX_NB_MODES 3 | |
| | | | |
| | | /** modeID for the defined narrowband mode */ | |
| | | #define SPEEX_MODEID_NB 0 | |
| | | | |
| | | /** modeID for the defined wideband mode */ | |
| | | #define SPEEX_MODEID_WB 1 | |
| | | | |
| | | /** modeID for the defined ultra-wideband mode */ | |
| | | #define SPEEX_MODEID_UWB 2 | |
| | | | |
| | | #ifdef EPIC_48K | |
| | | /** modeID for the Epic 48K mode */ | |
| | | #define SPEEX_MODEID_NB_48K 1000 | |
| | | #endif | |
| | | | |
| | | struct SpeexMode; | |
| | | | |
| | | /* Prototypes for mode function pointers */ | |
| | | | |
| | | /** Encoder state initialization function */ | |
| | | typedef void *(*encoder_init_func)(const struct SpeexMode *mode); | |
| | | | |
| | | /** Encoder state destruction function */ | |
| | | typedef void (*encoder_destroy_func)(void *st); | |
| | | | |
| | | /** Main encoding function */ | |
| | | typedef int (*encode_func)(void *state, void *in, SpeexBits *bits); | |
| | | | |
| | | /** Function for controlling the encoder options */ | |
| | | typedef int (*encoder_ctl_func)(void *state, int request, void *ptr); | |
| | | | |
| | | /** Decoder state initialization function */ | |
| | | typedef void *(*decoder_init_func)(const struct SpeexMode *mode); | |
| | | | |
| | | /** Decoder state destruction function */ | |
| | | typedef void (*decoder_destroy_func)(void *st); | |
| | | | |
| | | /** Main decoding function */ | |
| | | typedef int (*decode_func)(void *state, SpeexBits *bits, void *out); | |
| | | | |
| | | /** Function for controlling the decoder options */ | |
| | | typedef int (*decoder_ctl_func)(void *state, int request, void *ptr); | |
| | | | |
| | | /** Query function for a mode */ | |
| | | typedef int (*mode_query_func)(const void *mode, int request, void *ptr); | |
| | | | |
| | | /** Struct defining a Speex mode */ | |
| | | typedef struct SpeexMode { | |
| | | /** Pointer to the low-level mode data */ | |
| | | const void *mode; | |
| | | | |
| | | /** Pointer to the mode query function */ | |
| | | mode_query_func query; | |
| | | | |
| | | /** The name of the mode (you should not rely on this to identify the mo | |
| | | de)*/ | |
| | | const char *modeName; | |
| | | | |
| | | /**ID of the mode*/ | |
| | | int modeID; | |
| | | | |
| | | /**Version number of the bitstream (incremented every time we break | |
| | | bitstream compatibility*/ | |
| | | int bitstream_version; | |
| | | | |
| | | /** Pointer to encoder initialization function */ | |
| | | encoder_init_func enc_init; | |
| | | | |
| | | /** Pointer to encoder destruction function */ | |
| | | encoder_destroy_func enc_destroy; | |
| | | | |
| | | /** Pointer to frame encoding function */ | |
| | | encode_func enc; | |
| | | | |
| | | /** Pointer to decoder initialization function */ | |
| | | decoder_init_func dec_init; | |
| | | | |
| | | /** Pointer to decoder destruction function */ | |
| | | decoder_destroy_func dec_destroy; | |
| | | | |
| | | /** Pointer to frame decoding function */ | |
| | | decode_func dec; | |
| | | | |
| | | /** ioctl-like requests for encoder */ | |
| | | encoder_ctl_func enc_ctl; | |
| | | | |
| | | /** ioctl-like requests for decoder */ | |
| | | decoder_ctl_func dec_ctl; | |
| | | | |
| | | } SpeexMode; | |
| | | | |
| /** | | /** | |
|
| * @file speex.h | | * Returns a handle to a newly created Speex encoder state structure. For n | |
| * @brief Speex codec header. | | ow, | |
| | | * the "mode" argument can be &nb_mode or &wb_mode . In the future, more mo | |
| | | des | |
| | | * may be added. Note that for now if you have more than one channels to | |
| | | * encode, you need one state per channel. | |
| | | * | |
| | | * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) | |
| | | * @return A newly created encoder state or NULL if state allocation fails | |
| */ | | */ | |
|
| | | void *speex_encoder_init(const SpeexMode *mode); | |
| | | | |
|
| #include <pjmedia-codec/types.h> | | /** Frees all resources associated to an existing Speex encoder state. | |
| | | * @param state Encoder state to be destroyed */ | |
| | | void speex_encoder_destroy(void *state); | |
| | | | |
| | | /** Uses an existing encoder state to encode one frame of speech pointed to | |
| | | by | |
| | | "in". The encoded bit-stream is saved in "bits". | |
| | | @param state Encoder state | |
| | | @param in Frame that will be encoded with a +-2^15 range. This data MAY be | |
| | | overwritten by the encoder and should be considered uninitialised | |
| | | after the call. | |
| | | @param bits Bit-stream where the data will be written | |
| | | @return 0 if frame needs not be transmitted (DTX only), 1 otherwise | |
| | | */ | |
| | | int speex_encode(void *state, float *in, SpeexBits *bits); | |
| | | | |
|
| /** | | /** Uses an existing encoder state to encode one frame of speech pointed to | |
| * @defgroup PJMED_SPEEX Speex Codec Family | | by | |
| * @ingroup PJMEDIA_CODEC | | "in". The encoded bit-stream is saved in "bits". | |
| * @brief Implementation of Speex codecs (narrow/wide/ultrawide-band). | | @param state Encoder state | |
| * @{ | | @param in Frame that will be encoded with a +-2^15 range | |
| * This section describes functions to register and register speex codec | | @param bits Bit-stream where the data will be written | |
| * factory to the codec manager. After the codec factory has been registere | | @return 0 if frame needs not be transmitted (DTX only), 1 otherwise | |
| d, | | | |
| * application can use @ref PJMEDIA_CODEC API to manipulate the codec. | | | |
| * | | | |
| * By default, the speex codec factory registers three Speex codecs: | | | |
| * "speex/8000" narrowband codec, "speex/16000" wideband codec, and | | | |
| * "speex/32000" ultra-wideband codec. This behavior can be changed by | | | |
| * specifying #pjmedia_speex_options flags during initialization. | | | |
| */ | | */ | |
|
| | | int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits); | |
| | | | |
|
| PJ_BEGIN_DECL | | /** Used like the ioctl function to control the encoder parameters | |
| | | * | |
| | | * @param state Encoder state | |
| | | * @param request ioctl-type request (one of the SPEEX_* macros) | |
| | | * @param ptr Data exchanged to-from function | |
| | | * @return 0 if no error, -1 if request in unknown, -2 for invalid paramete | |
| | | r | |
| | | */ | |
| | | int speex_encoder_ctl(void *state, int request, void *ptr); | |
| | | | |
|
| /** | | /** Returns a handle to a newly created decoder state structure. For now, | |
| * Bitmask options to be passed during Speex codec factory initialization. | | * the mode argument can be &nb_mode or &wb_mode . In the future, more mode | |
| | | s | |
| | | * may be added. Note that for now if you have more than one channels to | |
| | | * decode, you need one state per channel. | |
| | | * | |
| | | * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode) | |
| | | * @return A newly created decoder state or NULL if state allocation fails | |
| */ | | */ | |
|
| enum pjmedia_speex_options | | void *speex_decoder_init(const SpeexMode *mode); | |
| { | | | |
| PJMEDIA_SPEEX_NO_NB = 1, /**< Disable narrowband mode. | | | |
| */ | | | |
| PJMEDIA_SPEEX_NO_WB = 2, /**< Disable wideband mode. | | | |
| */ | | | |
| PJMEDIA_SPEEX_NO_UWB = 4, /**< Disable ultra-wideband mode. */ | | | |
| }; | | | |
| | | | |
|
| /** | | /** Frees all resources associated to an existing decoder state. | |
| * Initialize and register Speex codec factory to pjmedia endpoint. | | | |
| * | | * | |
|
| * @param endpt The pjmedia endpoint. | | * @param state State to be destroyed | |
| * @param options Bitmask of pjmedia_speex_options (default=0). | | */ | |
| * @param quality Specify encoding quality, or use -1 for default | | void speex_decoder_destroy(void *state); | |
| * (default=8). | | | |
| * @param complexity Specify encoding complexity , or use -1 for default | | | |
| * (default=8). | | | |
| * | | | |
| * @return PJ_SUCCESS on success. | | | |
| */ | | | |
| PJ_DECL(pj_status_t) pjmedia_codec_speex_init( pjmedia_endpt *endpt, | | | |
| unsigned options, | | | |
| int quality, | | | |
| int complexity ); | | | |
| | | | |
|
| /** | | /** Uses an existing decoder state to decode one frame of speech from | |
| * Initialize Speex codec factory using default settings and register to | | * bit-stream bits. The output speech is saved written to out. | |
| * pjmedia endpoint. | | | |
| * | | * | |
|
| * @param endpt The pjmedia endpoint. | | * @param state Decoder state | |
| | | * @param bits Bit-stream from which to decode the frame (NULL if the packe | |
| | | t was lost) | |
| | | * @param out Where to write the decoded frame | |
| | | * @return return status (0 for no error, -1 for end of stream, -2 corrupt | |
| | | stream) | |
| | | */ | |
| | | int speex_decode(void *state, SpeexBits *bits, float *out); | |
| | | | |
| | | /** Uses an existing decoder state to decode one frame of speech from | |
| | | * bit-stream bits. The output speech is saved written to out. | |
| * | | * | |
|
| * @return PJ_SUCCESS on success. | | * @param state Decoder state | |
| | | * @param bits Bit-stream from which to decode the frame (NULL if the packe | |
| | | t was lost) | |
| | | * @param out Where to write the decoded frame | |
| | | * @return return status (0 for no error, -1 for end of stream, -2 corrupt | |
| | | stream) | |
| */ | | */ | |
|
| PJ_DECL(pj_status_t) pjmedia_codec_speex_init_default(pjmedia_endpt *endpt)
; | | int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out); | |
| | | | |
|
| /** | | /** Used like the ioctl function to control the encoder parameters | |
| * Unregister Speex codec factory from pjmedia endpoint and deinitialize | | | |
| * the Speex codec library. | | | |
| * | | * | |
|
| * @return PJ_SUCCESS on success. | | * @param state Decoder state | |
| | | * @param request ioctl-type request (one of the SPEEX_* macros) | |
| | | * @param ptr Data exchanged to-from function | |
| | | * @return 0 if no error, -1 if request in unknown, -2 for invalid paramete | |
| | | r | |
| */ | | */ | |
|
| PJ_DECL(pj_status_t) pjmedia_codec_speex_deinit(void); | | int speex_decoder_ctl(void *state, int request, void *ptr); | |
| | | | |
|
| PJ_END_DECL | | /** Query function for mode information | |
| | | * | |
| | | * @param mode Speex mode | |
| | | * @param request ioctl-type request (one of the SPEEX_* macros) | |
| | | * @param ptr Data exchanged to-from function | |
| | | * @return 0 if no error, -1 if request in unknown, -2 for invalid paramete | |
| | | r | |
| | | */ | |
| | | int speex_mode_query(const SpeexMode *mode, int request, void *ptr); | |
| | | | |
|
| /** | | /** Functions for controlling the behavior of libspeex | |
| * @} | | * @param request ioctl-type request (one of the SPEEX_LIB_* macros) | |
| | | * @param ptr Data exchanged to-from function | |
| | | * @return 0 if no error, -1 if request in unknown, -2 for invalid paramete | |
| | | r | |
| */ | | */ | |
|
| | | int speex_lib_ctl(int request, void *ptr); | |
| | | | |
| | | /** Default narrowband mode */ | |
| | | extern const SpeexMode speex_nb_mode; | |
| | | | |
| | | /** Default wideband mode */ | |
| | | extern const SpeexMode speex_wb_mode; | |
| | | | |
| | | /** Default "ultra-wideband" mode */ | |
| | | extern const SpeexMode speex_uwb_mode; | |
| | | | |
| | | #ifdef EPIC_48K | |
| | | /** 4.8 kbps narrowband mode */ | |
| | | extern const SpeexMode speex_nb_48k_mode; | |
| | | #endif | |
| | | | |
| | | /** List of all modes available */ | |
| | | extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES]; | |
| | | | |
| | | /** Obtain one of the modes available */ | |
| | | const SpeexMode * speex_lib_get_mode (int mode); | |
| | | | |
| | | #ifdef __cplusplus | |
| | | } | |
| | | #endif | |
| | | | |
|
| #endif /* __PJMEDIA_CODEC_SPEEX_H__ */ | | /** @}*/ | |
| | | #endif | |
| | | | |
End of changes. 24 change blocks. |
| 76 lines changed or deleted | | 405 lines changed or added | |
|
| transport.h | | transport.h | |
|
| /* $Id: transport.h 974 2007-02-19 01:13:53Z bennylp $ */ | | /* $Id: transport.h 1098 2007-03-23 16:34:20Z bennylp $ */ | |
| /* | | /* | |
| * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | | * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> | |
| * | | * | |
| * This program is free software; you can redistribute it and/or modify | | * This program is free software; you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | | * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation; either version 2 of the License, or | | * the Free Software Foundation; either version 2 of the License, or | |
| * (at your option) any later version. | | * (at your option) any later version. | |
| * | | * | |
| * This program is distributed in the hope that it will be useful, | | * This program is distributed in the hope that it will be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| */ | | */ | |
| #ifndef __PJMEDIA_TRANSPORT_H__ | | #ifndef __PJMEDIA_TRANSPORT_H__ | |
| #define __PJMEDIA_TRANSPORT_H__ | | #define __PJMEDIA_TRANSPORT_H__ | |
| | | | |
| /** | | /** | |
| * @file transport.h Media Transport Interface | | * @file transport.h Media Transport Interface | |
| * @brief Transport interface. | | * @brief Transport interface. | |
| */ | | */ | |
| | | | |
| #include <pjmedia/types.h> | | #include <pjmedia/types.h> | |
|
| | | #include <pjmedia/errno.h> | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_TRANSPORT Media Transports | | * @defgroup PJMEDIA_TRANSPORT Media Transports | |
| * @ingroup PJMEDIA | | * @ingroup PJMEDIA | |
| * @brief Transports. | | * @brief Transports. | |
| * Transport related components. | | * Transport related components. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup PJMEDIA_TRANSPORT_H Media Network Transport Interface | | * @defgroup PJMEDIA_TRANSPORT_H Media Network Transport Interface | |
| | | | |
| skipping to change at line 178 | | skipping to change at line 179 | |
| * Forward declaration for media transport. | | * Forward declaration for media transport. | |
| */ | | */ | |
| typedef struct pjmedia_transport pjmedia_transport; | | typedef struct pjmedia_transport pjmedia_transport; | |
| | | | |
| /** | | /** | |
| * This structure describes the operations for the stream transport. | | * This structure describes the operations for the stream transport. | |
| */ | | */ | |
| struct pjmedia_transport_op | | struct pjmedia_transport_op | |
| { | | { | |
| /** | | /** | |
|
| | | * Get media socket info from the specified transport. | |
| | | * | |
| | | * Application should call #pjmedia_transport_get_info() instead | |
| | | */ | |
| | | pj_status_t (*get_info)(pjmedia_transport *tp, | |
| | | pjmedia_sock_info *info); | |
| | | | |
| | | /** | |
| * This function is called by the stream when the transport is about | | * This function is called by the stream when the transport is about | |
| * to be used by the stream for the first time, and it tells the transp
ort | | * to be used by the stream for the first time, and it tells the transp
ort | |
| * about remote RTP address to send the packet and some callbacks to be | | * about remote RTP address to send the packet and some callbacks to be | |
| * called for incoming packets. | | * called for incoming packets. | |
| * | | * | |
| * Application should call #pjmedia_transport_attach() instead of | | * Application should call #pjmedia_transport_attach() instead of | |
| * calling this function directly. | | * calling this function directly. | |
| */ | | */ | |
| pj_status_t (*attach)(pjmedia_transport *tp, | | pj_status_t (*attach)(pjmedia_transport *tp, | |
| void *user_data, | | void *user_data, | |
| | | | |
| skipping to change at line 249 | | skipping to change at line 258 | |
| */ | | */ | |
| pj_status_t (*destroy)(pjmedia_transport *tp); | | pj_status_t (*destroy)(pjmedia_transport *tp); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @see pjmedia_transport_op. | | * @see pjmedia_transport_op. | |
| */ | | */ | |
| typedef struct pjmedia_transport_op pjmedia_transport_op; | | typedef struct pjmedia_transport_op pjmedia_transport_op; | |
| | | | |
| /** | | /** | |
|
| | | * Media transport type. | |
| | | */ | |
| | | typedef enum pjmedia_transport_type | |
| | | { | |
| | | /** Media transport using standard UDP */ | |
| | | PJMEDIA_TRANSPORT_TYPE_UDP, | |
| | | | |
| | | /** Media transport using ICE */ | |
| | | PJMEDIA_TRANSPORT_TYPE_ICE | |
| | | | |
| | | } pjmedia_transport_type; | |
| | | | |
| | | /** | |
| * This structure declares stream transport. A stream transport is called | | * This structure declares stream transport. A stream transport is called | |
| * by the stream to transmit a packet, and will notify stream when | | * by the stream to transmit a packet, and will notify stream when | |
| * incoming packet is arrived. | | * incoming packet is arrived. | |
| */ | | */ | |
| struct pjmedia_transport | | struct pjmedia_transport | |
| { | | { | |
| /** Transport name (for logging purpose). */ | | /** Transport name (for logging purpose). */ | |
|
| char name[PJ_MAX_OBJ_NAME]; | | char name[PJ_MAX_OBJ_NAME]; | |
| | | | |
| | | /** Transport type. */ | |
| | | pjmedia_transport_type type; | |
| | | | |
| /** Transport's "virtual" function table. */ | | /** Transport's "virtual" function table. */ | |
|
| pjmedia_transport_op *op; | | pjmedia_transport_op *op; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * Get media socket info from the specified transport. The socket info | |
| | | * contains information about the local address of this transport, and | |
| | | * would be needed for example to fill in the "c=" and "m=" line of local | |
| | | * SDP. | |
| | | * | |
| | | * @param tp The transport. | |
| | | * @param info Media socket info to be initialized. | |
| | | * | |
| | | * @return PJ_SUCCESS on success. | |
| | | */ | |
| | | PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, | |
| | | pjmedia_sock_info *info) | |
| | | { | |
| | | if (tp->op->get_info) | |
| | | return (*tp->op->get_info)(tp, info); | |
| | | else | |
| | | return PJ_ENOTSUP; | |
| | | } | |
| | | | |
| | | /** | |
| * Attach callbacks to be called on receipt of incoming RTP/RTCP packets. | | * Attach callbacks to be called on receipt of incoming RTP/RTCP packets. | |
| * This is just a simple wrapper which calls <tt>attach()</tt> member of | | * This is just a simple wrapper which calls <tt>attach()</tt> member of | |
| * the transport. | | * the transport. | |
| * | | * | |
| * @param tp The media transport. | | * @param tp The media transport. | |
| * @param user_data Arbitrary user data to be set when the callbacks are | | * @param user_data Arbitrary user data to be set when the callbacks are | |
| * called. | | * called. | |
| * @param rem_addr Remote RTP address to send RTP packet to. | | * @param rem_addr Remote RTP address to send RTP packet to. | |
| * @param rem_rtcp Optional remote RTCP address. If the argument is NULL | | * @param rem_rtcp Optional remote RTCP address. If the argument is NULL | |
| * or if the address is zero, the RTCP address will be | | * or if the address is zero, the RTCP address will be | |
| | | | |
End of changes. 7 change blocks. |
| 3 lines changed or deleted | | 48 lines changed or added | |
|