activesock.h | activesock.h | |||
---|---|---|---|---|
/* $Id: activesock.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: activesock.h 4359 2013-02-21 11:18:36Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 175 | skipping to change at line 175 | |||
} pj_activesock_cb; | } pj_activesock_cb; | |||
/** | /** | |||
* Settings that can be given during active socket creation. Application | * Settings that can be given during active socket creation. Application | |||
* must initialize this structure with #pj_activesock_cfg_default(). | * must initialize this structure with #pj_activesock_cfg_default(). | |||
*/ | */ | |||
typedef struct pj_activesock_cfg | typedef struct pj_activesock_cfg | |||
{ | { | |||
/** | /** | |||
* Optional group lock to be assigned to the ioqueue key. | ||||
*/ | ||||
pj_grp_lock_t *grp_lock; | ||||
/** | ||||
* Number of concurrent asynchronous operations that is to be supported | * Number of concurrent asynchronous operations that is to be supported | |||
* by the active socket. This value only affects socket receive and | * by the active socket. This value only affects socket receive and | |||
* accept operations -- the active socket will issue one or more | * accept operations -- the active socket will issue one or more | |||
* asynchronous read and accept operations based on the value of this | * asynchronous read and accept operations based on the value of this | |||
* field. Setting this field to more than one will allow more than one | * field. Setting this field to more than one will allow more than one | |||
* incoming data or incoming connections to be processed simultaneously | * incoming data or incoming connections to be processed simultaneously | |||
* on multiprocessor systems, when the ioqueue is polled by more than | * on multiprocessor systems, when the ioqueue is polled by more than | |||
* one threads. | * one threads. | |||
* | * | |||
* The default value is 1. | * The default value is 1. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
addr_resolv.h | addr_resolv.h | |||
---|---|---|---|---|
/* $Id: addr_resolv.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: addr_resolv.h 4218 2012-08-07 02:18:15Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 117 | skipping to change at line 117 | |||
* @param addr On successful resolution, the address family and addres s | * @param addr On successful resolution, the address family and addres s | |||
* part of this socket address will be filled up with the h ost | * part of this socket address will be filled up with the h ost | |||
* IP address, in network byte order. Other parts of the so cket | * IP address, in network byte order. Other parts of the so cket | |||
* address are untouched. | * address are untouched. | |||
* | * | |||
* @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) pj_gethostip(int af, pj_sockaddr *addr); | PJ_DECL(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr); | |||
/** | /** | |||
* Get the interface IP address to send data to the specified destination. | ||||
* | ||||
* @param af The desired address family to query. Valid values | ||||
* are pj_AF_INET() or pj_AF_INET6(). | ||||
* @param dst The destination host. | ||||
* @param itf_addr On successful resolution, the address family and addres | ||||
s | ||||
* part of this socket address will be filled up with the h | ||||
ost | ||||
* IP address, in network byte order. Other parts of the so | ||||
cket | ||||
* address should be ignored. | ||||
* @param allow_resolve If \a dst may contain hostname (instead of IP | ||||
* address), specify whether hostname resolution should | ||||
* be performed. If not, default interface address will | ||||
* be returned. | ||||
* @param p_dst_addr If not NULL, it will be filled with the IP address of | ||||
* the destination host. | ||||
* | ||||
* @return PJ_SUCCESS on success, or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_getipinterface(int af, | ||||
const pj_str_t *dst, | ||||
pj_sockaddr *itf_addr, | ||||
pj_bool_t allow_resolve, | ||||
pj_sockaddr *p_dst_addr); | ||||
/** | ||||
* Get the IP address of the default interface. Default interface is the | * Get the IP address of the default interface. Default interface is the | |||
* interface of the default route. | * interface of the default route. | |||
* | * | |||
* @param af The desired address family to query. Valid values | * @param af The desired address family to query. Valid values | |||
* are pj_AF_INET() or pj_AF_INET6(). | * are pj_AF_INET() or pj_AF_INET6(). | |||
* @param addr On successful resolution, the address family and addres s | * @param addr On successful resolution, the address family and addres s | |||
* part of this socket address will be filled up with the h ost | * part of this socket address will be filled up with the h ost | |||
* IP address, in network byte order. Other parts of the so cket | * IP address, in network byte order. Other parts of the so cket | |||
* address are untouched. | * address are untouched. | |||
* | * | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 29 lines changed or added | |||
audiodev.h | audiodev.h | |||
---|---|---|---|---|
/* $Id: audiodev.h 3664 2011-07-19 03:42:28Z nanang $ */ | /* $Id: audiodev.h 4243 2012-08-31 11:42:17Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 421 | skipping to change at line 421 | |||
* if PJMEDIA_AUD_DEV_CAP_PLC is set in the flags. | * if PJMEDIA_AUD_DEV_CAP_PLC is set in the flags. | |||
*/ | */ | |||
pj_bool_t plc_enabled; | pj_bool_t plc_enabled; | |||
/** | /** | |||
* Enable/disable CNG. This setting is optional, and will only be used | * Enable/disable CNG. This setting is optional, and will only be used | |||
* if PJMEDIA_AUD_DEV_CAP_CNG is set in the flags. | * if PJMEDIA_AUD_DEV_CAP_CNG is set in the flags. | |||
*/ | */ | |||
pj_bool_t cng_enabled; | pj_bool_t cng_enabled; | |||
/** | ||||
* Enable/disable VAD. This setting is optional, and will only be used | ||||
* if PJMEDIA_AUD_DEV_CAP_VAD is set in the flags. | ||||
*/ | ||||
pj_bool_t vad_enabled; | ||||
} pjmedia_aud_param; | } pjmedia_aud_param; | |||
/** Forward declaration for pjmedia_aud_stream */ | /** Forward declaration for pjmedia_aud_stream */ | |||
typedef struct pjmedia_aud_stream pjmedia_aud_stream; | typedef struct pjmedia_aud_stream pjmedia_aud_stream; | |||
/** Forward declaration for audio device factory */ | /** Forward declaration for audio device factory */ | |||
typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory; | typedef struct pjmedia_aud_dev_factory pjmedia_aud_dev_factory; | |||
/* typedef for factory creation function */ | /* typedef for factory creation function */ | |||
typedef pjmedia_aud_dev_factory* | typedef pjmedia_aud_dev_factory* | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
codec.h | codec.h | |||
---|---|---|---|---|
/* $Id: codec.h 3664 2011-07-19 03:42:28Z nanang $ */ | /* $Id: codec.h 4278 2012-10-05 10:04:54Z ming $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 275 | skipping to change at line 275 | |||
{ | { | |||
/** | /** | |||
* The "info" part of codec param describes the capability of the codec , | * The "info" part of codec param describes the capability of the codec , | |||
* and the value should NOT be changed by application. | * and the value should NOT be changed by application. | |||
*/ | */ | |||
struct { | struct { | |||
unsigned clock_rate; /**< Sampling rate in Hz */ | unsigned clock_rate; /**< Sampling rate in Hz */ | |||
unsigned channel_cnt; /**< Channel count. */ | unsigned channel_cnt; /**< Channel count. */ | |||
pj_uint32_t avg_bps; /**< Average bandwidth in bits/sec */ | pj_uint32_t avg_bps; /**< Average bandwidth in bits/sec */ | |||
pj_uint32_t max_bps; /**< Maximum bandwidth in bits/sec */ | pj_uint32_t max_bps; /**< Maximum bandwidth in bits/sec */ | |||
unsigned max_rx_frame_size; /**< Maximum frame size */ | ||||
pj_uint16_t frm_ptime; /**< Decoder frame ptime in msec. */ | pj_uint16_t frm_ptime; /**< Decoder frame ptime in msec. */ | |||
pj_uint16_t enc_ptime; /**< Encoder ptime, or zero if it's | pj_uint16_t enc_ptime; /**< Encoder ptime, or zero if it's | |||
equal to decoder ptime. */ | equal to decoder ptime. */ | |||
pj_uint8_t pcm_bits_per_sample; /**< Bits/sample in the PCM side */ | pj_uint8_t pcm_bits_per_sample; /**< Bits/sample in the PCM side */ | |||
pj_uint8_t pt; /**< Payload type. */ | pj_uint8_t pt; /**< Payload type. */ | |||
pjmedia_format_id fmt_id; /**< Source format, it's format of | pjmedia_format_id fmt_id; /**< Source format, it's format of | |||
encoder input and decoder | encoder input and decoder | |||
output. */ | output. */ | |||
} info; | } info; | |||
skipping to change at line 306 | skipping to change at line 307 | |||
unsigned vad:1; /**< Voice Activity Detector. */ | unsigned vad:1; /**< Voice Activity Detector. */ | |||
unsigned cng:1; /**< Comfort Noise Generator. */ | unsigned cng:1; /**< Comfort Noise Generator. */ | |||
unsigned penh:1; /**< Perceptual Enhancement */ | unsigned penh:1; /**< Perceptual Enhancement */ | |||
unsigned plc:1; /**< Packet loss concealment */ | unsigned plc:1; /**< Packet loss concealment */ | |||
unsigned reserved:1; /**< Reserved, must be zero. */ | unsigned reserved:1; /**< Reserved, must be zero. */ | |||
pjmedia_codec_fmtp enc_fmtp;/**< Encoder's fmtp params. */ | pjmedia_codec_fmtp enc_fmtp;/**< Encoder's fmtp params. */ | |||
pjmedia_codec_fmtp dec_fmtp;/**< Decoder's fmtp params. */ | pjmedia_codec_fmtp dec_fmtp;/**< Decoder's fmtp params. */ | |||
} setting; | } setting; | |||
} pjmedia_codec_param; | } pjmedia_codec_param; | |||
/** | ||||
* Duplicate codec parameter. | ||||
* | ||||
* @param pool The pool. | ||||
* @param src The codec parameter to be duplicated. | ||||
* | ||||
* @return Duplicated codec parameter. | ||||
*/ | ||||
PJ_DECL(pjmedia_codec_param*) pjmedia_codec_param_clone( | ||||
pj_pool_t *pool, | ||||
const pjmedia_codec_param *src); | ||||
/* | /* | |||
* Forward declaration for pjmedia_codec. | * Forward declaration for pjmedia_codec. | |||
*/ | */ | |||
typedef struct pjmedia_codec pjmedia_codec; | typedef struct pjmedia_codec pjmedia_codec; | |||
/** | /** | |||
* This structure describes codec operations. Each codec MUST implement | * This structure describes codec operations. Each codec MUST implement | |||
* all of these functions. | * all of these functions. | |||
*/ | */ | |||
typedef struct pjmedia_codec_op | typedef struct pjmedia_codec_op | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 14 lines changed or added | |||
config.h | config.h | |||
---|---|---|---|---|
/* $Id: config.h 4189 2012-07-03 03:11:24Z ming $ */ | /* $Id: config.h 4415 2013-03-05 08:34:45Z ming $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 481 | skipping to change at line 481 | |||
* along with the source location where the timer entries were scheduled. | * along with the source location where the timer entries were scheduled. | |||
* See https://trac.pjsip.org/repos/ticket/1527 for more info. | * See https://trac.pjsip.org/repos/ticket/1527 for more info. | |||
* | * | |||
* Default: 0 | * Default: 0 | |||
*/ | */ | |||
#ifndef PJ_TIMER_DEBUG | #ifndef PJ_TIMER_DEBUG | |||
# define PJ_TIMER_DEBUG 0 | # define PJ_TIMER_DEBUG 0 | |||
#endif | #endif | |||
/** | /** | |||
* Set this to 1 to enable debugging on the group lock. Default: 0 | ||||
*/ | ||||
#ifndef PJ_GRP_LOCK_DEBUG | ||||
# define PJ_GRP_LOCK_DEBUG 0 | ||||
#endif | ||||
/** | ||||
* Specify this as \a stack_size argument in #pj_thread_create() to specify | * Specify this as \a stack_size argument in #pj_thread_create() to specify | |||
* that thread should use default stack size for the current platform. | * that thread should use default stack size for the current platform. | |||
* | * | |||
* Default: 8192 | * Default: 8192 | |||
*/ | */ | |||
#ifndef PJ_THREAD_DEFAULT_STACK_SIZE | #ifndef PJ_THREAD_DEFAULT_STACK_SIZE | |||
# define PJ_THREAD_DEFAULT_STACK_SIZE 8192 | # define PJ_THREAD_DEFAULT_STACK_SIZE 8192 | |||
#endif | #endif | |||
/** | /** | |||
skipping to change at line 1086 | skipping to change at line 1093 | |||
* @def PJ_TODO(id) | * @def PJ_TODO(id) | |||
* @param id Any identifier that will be printed as TODO message. | * @param id Any identifier that will be printed as TODO message. | |||
* PJ_TODO macro will display TODO message as warning during compilation. | * PJ_TODO macro will display TODO message as warning during compilation. | |||
* Example: PJ_TODO(CLEAN_UP_ERROR); | * Example: PJ_TODO(CLEAN_UP_ERROR); | |||
*/ | */ | |||
#ifndef PJ_TODO | #ifndef PJ_TODO | |||
# define PJ_TODO(id) TODO___##id: | # define PJ_TODO(id) TODO___##id: | |||
#endif | #endif | |||
/** | /** | |||
* Simulate race condition by sleeping the thread in strategic locations. | ||||
* Default: no! | ||||
*/ | ||||
#ifndef PJ_RACE_ME | ||||
# define PJ_RACE_ME(x) | ||||
#endif | ||||
/** | ||||
* Function attributes to inform that the function may throw exception. | * Function attributes to inform that the function may throw exception. | |||
* | * | |||
* @param x The exception list, enclosed in parenthesis. | * @param x The exception list, enclosed in parenthesis. | |||
*/ | */ | |||
#define __pj_throw__(x) | #define __pj_throw__(x) | |||
/** @} */ | /** @} */ | |||
/******************************************************************** | /******************************************************************** | |||
* Sanity Checks | * Sanity Checks | |||
skipping to change at line 1131 | skipping to change at line 1146 | |||
#if !defined(PJ_THREAD_ALLOCATE_STACK) | #if !defined(PJ_THREAD_ALLOCATE_STACK) | |||
# error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h" | # error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h" | |||
#endif | #endif | |||
PJ_BEGIN_DECL | PJ_BEGIN_DECL | |||
/** PJLIB version major number. */ | /** PJLIB version major number. */ | |||
#define PJ_VERSION_NUM_MAJOR 2 | #define PJ_VERSION_NUM_MAJOR 2 | |||
/** PJLIB version minor number. */ | /** PJLIB version minor number. */ | |||
#define PJ_VERSION_NUM_MINOR 0 | #define PJ_VERSION_NUM_MINOR 1 | |||
/** PJLIB version revision number. */ | /** PJLIB version revision number. */ | |||
#define PJ_VERSION_NUM_REV 1 | #define PJ_VERSION_NUM_REV 0 | |||
/** | /** | |||
* Extra suffix for the version (e.g. "-trunk"), or empty for | * Extra suffix for the version (e.g. "-trunk"), or empty for | |||
* web release version. | * web release version. | |||
*/ | */ | |||
#define PJ_VERSION_NUM_EXTRA "" | #define PJ_VERSION_NUM_EXTRA "" | |||
/** | /** | |||
* PJLIB version number consists of three bytes with the following format: | * PJLIB version number consists of three bytes with the following format: | |||
* 0xMMIIRR00, where MM: major number, II: minor number, RR: revision | * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 18 lines changed or added | |||
config_site_sample.h | config_site_sample.h | |||
---|---|---|---|---|
skipping to change at line 299 | skipping to change at line 299 | |||
#endif | #endif | |||
/* | /* | |||
* iPhone sample settings. | * iPhone sample settings. | |||
*/ | */ | |||
#if PJ_CONFIG_IPHONE | #if PJ_CONFIG_IPHONE | |||
/* | /* | |||
* PJLIB settings. | * PJLIB settings. | |||
*/ | */ | |||
/* Disable floating point support */ | /* Both armv6 and armv7 has FP hardware support. | |||
#define PJ_HAS_FLOATING_POINT 0 | * See https://trac.pjsip.org/repos/ticket/1589 for more info | |||
*/ | ||||
#define PJ_HAS_FLOATING_POINT 1 | ||||
/* | /* | |||
* PJMEDIA settings | * PJMEDIA settings | |||
*/ | */ | |||
/* We have our own native CoreAudio backend */ | /* We have our own native CoreAudio backend */ | |||
#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 | #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 | |||
#define PJMEDIA_AUDIO_DEV_HAS_WMME 0 | #define PJMEDIA_AUDIO_DEV_HAS_WMME 0 | |||
#define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 1 | #define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 1 | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added | |||
errno.h | errno.h | |||
---|---|---|---|---|
/* $Id: errno.h 3664 2011-07-19 03:42:28Z nanang $ */ | /* $Id: errno.h 4359 2013-02-21 11:18:36Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 418 | skipping to change at line 418 | |||
/** | /** | |||
* @hideinitializer | * @hideinitializer | |||
* IPv6 is not supported | * IPv6 is not supported | |||
*/ | */ | |||
#define PJ_EIPV6NOTSUP (PJ_ERRNO_START_STATUS + 21)/* 70021 */ | #define PJ_EIPV6NOTSUP (PJ_ERRNO_START_STATUS + 21)/* 70021 */ | |||
/** | /** | |||
* @hideinitializer | * @hideinitializer | |||
* Unsupported address family | * Unsupported address family | |||
*/ | */ | |||
#define PJ_EAFNOTSUP (PJ_ERRNO_START_STATUS + 22)/* 70022 */ | #define PJ_EAFNOTSUP (PJ_ERRNO_START_STATUS + 22)/* 70022 */ | |||
/** | ||||
* @hideinitializer | ||||
* Object no longer exists | ||||
*/ | ||||
#define PJ_EGONE (PJ_ERRNO_START_STATUS + 23)/* 70023 */ | ||||
/** @} */ /* pj_errnum */ | /** @} */ /* pj_errnum */ | |||
/** @} */ /* pj_errno */ | /** @} */ /* pj_errno */ | |||
/** | /** | |||
* PJ_ERRNO_START is where PJLIB specific error values start. | * PJ_ERRNO_START is where PJLIB specific error values start. | |||
*/ | */ | |||
#define PJ_ERRNO_START 20000 | #define PJ_ERRNO_START 20000 | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
guid.h | guid.h | |||
---|---|---|---|---|
/* $Id: guid.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: guid.h 4208 2012-07-18 07:52:33Z ming $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 82 | skipping to change at line 82 | |||
* characters. Caller is responsible for preallocating the storage used | * characters. Caller is responsible for preallocating the storage used | |||
* in the string. | * in the string. | |||
* | * | |||
* @param str The string to store the result. | * @param str The string to store the result. | |||
* | * | |||
* @return The string. | * @return The string. | |||
*/ | */ | |||
PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str); | PJ_DECL(pj_str_t*) pj_generate_unique_string(pj_str_t *str); | |||
/** | /** | |||
* Create a globally unique string in lowercase, which length is | ||||
* PJ_GUID_STRING_LENGTH characters. Caller is responsible for preallocatin | ||||
g | ||||
* the storage used in the string. | ||||
* | ||||
* @param str The string to store the result. | ||||
* | ||||
* @return The string. | ||||
*/ | ||||
PJ_DECL(pj_str_t*) pj_generate_unique_string_lower(pj_str_t *str); | ||||
/** | ||||
* Generate a unique string. | * Generate a unique string. | |||
* | * | |||
* @param pool Pool to allocate memory from. | * @param pool Pool to allocate memory from. | |||
* @param str The string. | * @param str The string. | |||
*/ | */ | |||
PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str); | PJ_DECL(void) pj_create_unique_string(pj_pool_t *pool, pj_str_t *str); | |||
/** | /** | |||
* Generate a unique string in lowercase. | ||||
* | ||||
* @param pool Pool to allocate memory from. | ||||
* @param str The string. | ||||
*/ | ||||
PJ_DECL(void) pj_create_unique_string_lower(pj_pool_t *pool, pj_str_t *str) | ||||
; | ||||
/** | ||||
* @} | * @} | |||
*/ | */ | |||
PJ_END_DECL | PJ_END_DECL | |||
#endif/* __PJ_GUID_H__ */ | #endif/* __PJ_GUID_H__ */ | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 22 lines changed or added | |||
hash.h | hash.h | |||
---|---|---|---|---|
/* $Id: hash.h 3841 2011-10-24 09:28:13Z ming $ */ | /* $Id: hash.h 4208 2012-07-18 07:52:33Z ming $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 77 | skipping to change at line 77 | |||
* @return the hash value. | * @return the hash value. | |||
*/ | */ | |||
PJ_DECL(pj_uint32_t) pj_hash_calc(pj_uint32_t hval, | PJ_DECL(pj_uint32_t) pj_hash_calc(pj_uint32_t hval, | |||
const void *key, unsigned keylen); | const void *key, unsigned keylen); | |||
/** | /** | |||
* Convert the key to lowercase and calculate the hash value. The resulting | * Convert the key to lowercase and calculate the hash value. The resulting | |||
* string is stored in \c result. | * string is stored in \c result. | |||
* | * | |||
* @param hval The initial hash value, normally zero. | * @param hval The initial hash value, normally zero. | |||
* @param result Buffer to store the result, which must be enough to hol | * @param result Optional. Buffer to store the result, which must be eno | |||
d | ugh | |||
* the string. | * to hold the string. | |||
* @param key The input key to be converted and calculated. | * @param key The input key to be converted and calculated. | |||
* | * | |||
* @return The hash value. | * @return The hash value. | |||
*/ | */ | |||
PJ_DECL(pj_uint32_t) pj_hash_calc_tolower(pj_uint32_t hval, | PJ_DECL(pj_uint32_t) pj_hash_calc_tolower(pj_uint32_t hval, | |||
char *result, | char *result, | |||
const pj_str_t *key); | const pj_str_t *key); | |||
/** | /** | |||
* Create a hash table with the specified 'bucket' size. | * Create a hash table with the specified 'bucket' size. | |||
skipping to change at line 116 | skipping to change at line 116 | |||
* the argument is not NULL and the value is zero, it will | * the argument is not NULL and the value is zero, it will | |||
* be filled with the computed hash upon return. | * be filled with the computed hash upon return. | |||
* | * | |||
* @return the value associated with the key, or NULL if the key is not fou nd. | * @return the value associated with the key, or NULL if the key is not fou nd. | |||
*/ | */ | |||
PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, | PJ_DECL(void *) pj_hash_get( pj_hash_table_t *ht, | |||
const void *key, unsigned keylen, | const void *key, unsigned keylen, | |||
pj_uint32_t *hval ); | pj_uint32_t *hval ); | |||
/** | /** | |||
* Variant of #pj_hash_get() with the key being converted to lowercase when | ||||
* calculating the hash value. | ||||
* | ||||
* @see pj_hash_get() | ||||
*/ | ||||
PJ_DECL(void *) pj_hash_get_lower( pj_hash_table_t *ht, | ||||
const void *key, unsigned keylen, | ||||
pj_uint32_t *hval ); | ||||
/** | ||||
* 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. If pool is not specified, the key MUST point to | * @param key the key. If pool is not specified, the key MUST point to | |||
skipping to change at line 141 | skipping to change at line 151 | |||
* 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, | |||
const void *key, unsigned keylen, pj_uint32_t hva l, | const void *key, unsigned keylen, pj_uint32_t hva l, | |||
void *value ); | void *value ); | |||
/** | /** | |||
* Variant of #pj_hash_set() with the key being converted to lowercase when | ||||
* calculating the hash value. | ||||
* | ||||
* @see pj_hash_set() | ||||
*/ | ||||
PJ_DECL(void) pj_hash_set_lower( pj_pool_t *pool, pj_hash_table_t *ht, | ||||
const void *key, unsigned keylen, | ||||
pj_uint32_t hval, void *value ); | ||||
/** | ||||
* Associate/disassociate a value with the specified key. This function wor ks | * Associate/disassociate a value with the specified key. This function wor ks | |||
* like #pj_hash_set(), except that it doesn't use pool (hence the np -- no | * like #pj_hash_set(), except that it doesn't use pool (hence the np -- no | |||
* 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 | |||
skipping to change at line 164 | skipping to change at line 184 | |||
* to be created. | * to be created. | |||
* @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, pj_hash_entry_buf entry_buf, | pj_uint32_t hval, pj_hash_entry_buf entry_buf, | |||
void *value); | void *value); | |||
/** | /** | |||
* Variant of #pj_hash_set_np() with the key being converted to lowercase | ||||
* when calculating the hash value. | ||||
* | ||||
* @see pj_hash_set_np() | ||||
*/ | ||||
PJ_DECL(void) pj_hash_set_np_lower(pj_hash_table_t *ht, | ||||
const void *key, unsigned keylen, | ||||
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 ); | |||
/** | /** | |||
* Get the iterator to the first element in the hash table. | * Get the iterator to the first element in the hash table. | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 36 lines changed or added | |||
ice_session.h | ice_session.h | |||
---|---|---|---|---|
/* $Id: ice_session.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: ice_session.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 601 | skipping to change at line 601 | |||
* to support only a single media session was chosen for simplicity, | * to support only a single media session was chosen for simplicity, | |||
* while still allowing application to utilize multiple media streams by | * while still allowing application to utilize multiple media streams by | |||
* creating multiple ICE sessions, one for each media stream. | * creating multiple ICE sessions, one for each media stream. | |||
*/ | */ | |||
struct pj_ice_sess | struct pj_ice_sess | |||
{ | { | |||
char obj_name[PJ_MAX_OBJ_NAME]; /**< Object name. */ | char obj_name[PJ_MAX_OBJ_NAME]; /**< Object name. */ | |||
pj_pool_t *pool; /**< Pool instance. */ | pj_pool_t *pool; /**< Pool instance. */ | |||
void *user_data; /**< App. data. */ | void *user_data; /**< App. data. */ | |||
pj_mutex_t *mutex; /**< Mutex. */ | pj_grp_lock_t *grp_lock; /**< Group lock */ | |||
pj_ice_sess_role role; /**< ICE role. */ | pj_ice_sess_role role; /**< ICE role. */ | |||
pj_ice_sess_options opt; /**< Options */ | pj_ice_sess_options opt; /**< Options */ | |||
pj_timestamp tie_breaker; /**< Tie breaker value */ | pj_timestamp tie_breaker; /**< Tie breaker value */ | |||
pj_uint8_t *prefs; /**< Type preference. */ | pj_uint8_t *prefs; /**< Type preference. */ | |||
pj_bool_t is_nominating; /**< Nominating stage */ | pj_bool_t is_nominating; /**< Nominating stage */ | |||
pj_bool_t is_complete; /**< Complete? */ | pj_bool_t is_complete; /**< Complete? */ | |||
pj_bool_t is_destroying; /**< Destroy is called */ | ||||
pj_status_t ice_status; /**< Error statu s. */ | pj_status_t ice_status; /**< Error statu s. */ | |||
pj_timer_entry timer; /**< ICE timer. */ | pj_timer_entry timer; /**< ICE timer. */ | |||
pj_ice_sess_cb cb; /**< Callback. */ | pj_ice_sess_cb cb; /**< Callback. */ | |||
pj_stun_config stun_cfg; /**< STUN settings. */ | pj_stun_config stun_cfg; /**< STUN settings. */ | |||
/* STUN credentials */ | /* STUN credentials */ | |||
pj_str_t tx_ufrag; /**< Remote ufrag. */ | pj_str_t tx_ufrag; /**< Remote ufrag. */ | |||
pj_str_t tx_uname; /**< Uname for TX. */ | pj_str_t tx_uname; /**< Uname for TX. */ | |||
pj_str_t tx_pass; /**< Remote password. */ | pj_str_t tx_pass; /**< Remote password. */ | |||
skipping to change at line 715 | skipping to change at line 716 | |||
* @param name Optional name to identify this ICE instance in | * @param name Optional name to identify this ICE instance in | |||
* the log file. | * the log file. | |||
* @param role ICE role. | * @param role ICE role. | |||
* @param comp_cnt Number of components. | * @param comp_cnt Number of components. | |||
* @param cb ICE callback. | * @param cb ICE callback. | |||
* @param local_ufrag Optional string to be used as local username to | * @param local_ufrag Optional string to be used as local username to | |||
* authenticate incoming STUN binding request. If | * authenticate incoming STUN binding request. If | |||
* the value is NULL, a random string will be | * the value is NULL, a random string will be | |||
* generated. | * generated. | |||
* @param local_passwd Optional string to be used as local password. | * @param local_passwd Optional string to be used as local password. | |||
* @param grp_lock Optional group lock to be used by this session. | ||||
* If NULL, the session will create one itself. | ||||
* @param p_ice Pointer to receive the ICE session instance. | * @param p_ice Pointer to receive the ICE session instance. | |||
* | * | |||
* @return PJ_SUCCESS if ICE session is created successfully. | * @return PJ_SUCCESS if ICE session is created successfully. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg, | PJ_DECL(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg, | |||
const char *name, | const char *name, | |||
pj_ice_sess_role role, | pj_ice_sess_role role, | |||
unsigned comp_cnt, | unsigned comp_cnt, | |||
const pj_ice_sess_cb *cb, | const pj_ice_sess_cb *cb, | |||
const pj_str_t *local_ufrag, | const pj_str_t *local_ufrag, | |||
const pj_str_t *local_passwd, | const pj_str_t *local_passwd, | |||
pj_grp_lock_t *grp_lock, | ||||
pj_ice_sess **p_ice); | pj_ice_sess **p_ice); | |||
/** | /** | |||
* Get the value of various options of the ICE session. | * Get the value of various options of the ICE session. | |||
* | * | |||
* @param ice The ICE session. | * @param ice The ICE session. | |||
* @param opt The options to be initialized with the values | * @param opt The options to be initialized with the values | |||
* from the ICE session. | * from the ICE session. | |||
* | * | |||
* @return PJ_SUCCESS on success, or the appropriate error. | * @return PJ_SUCCESS on success, or the appropriate error. | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added | |||
ioqueue.h | ioqueue.h | |||
---|---|---|---|---|
/* $Id: ioqueue.h 3553 2011-05-05 06:14:19Z nanang $ | /* $Id: ioqueue.h 4359 2013-02-21 11:18:36Z bennylp $ | |||
*/ | */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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. | |||
* | * | |||
skipping to change at line 404 | skipping to change at line 404 | |||
* @return PJ_SUCCESS on success, or the error code. | * @return PJ_SUCCESS on success, or the error code. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool, | PJ_DECL(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool, | |||
pj_ioqueue_t *ioque, | pj_ioqueue_t *ioque, | |||
pj_sock_t sock, | pj_sock_t sock, | |||
void *user_data, | void *user_data, | |||
const pj_ioqueue_callback *cb , | const pj_ioqueue_callback *cb , | |||
pj_ioqueue_key_t **key ); | pj_ioqueue_key_t **key ); | |||
/** | /** | |||
* Variant of pj_ioqueue_register_sock() with additional group lock paramet | ||||
er. | ||||
* If group lock is set for the key, the key will add the reference counter | ||||
* when the socket is registered and decrease it when it is destroyed. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_ioqueue_register_sock2(pj_pool_t *pool, | ||||
pj_ioqueue_t *ioque, | ||||
pj_sock_t sock, | ||||
pj_grp_lock_t *grp_lock, | ||||
void *user_data, | ||||
const pj_ioqueue_callback *cb | ||||
, | ||||
pj_ioqueue_key_t **key ); | ||||
/** | ||||
* Unregister from the I/O Queue framework. Caller must make sure that | * Unregister from the I/O Queue framework. Caller must make sure that | |||
* the key doesn't have any pending operations before calling this function , | * the key doesn't have any pending operations before calling this function , | |||
* by calling #pj_ioqueue_is_pending() for all previously submitted | * by calling #pj_ioqueue_is_pending() for all previously submitted | |||
* operations except asynchronous connect, and if necessary call | * operations except asynchronous connect, and if necessary call | |||
* #pj_ioqueue_post_completion() to cancel the pending operations. | * #pj_ioqueue_post_completion() to cancel the pending operations. | |||
* | * | |||
* Note that asynchronous connect operation will automatically be | * Note that asynchronous connect operation will automatically be | |||
* cancelled during the unregistration. | * cancelled during the unregistration. | |||
* | * | |||
* Also note that when I/O Completion Port backend is used, application | * Also note that when I/O Completion Port backend is used, application | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 16 lines changed or added | |||
lock.h | lock.h | |||
---|---|---|---|---|
/* $Id: lock.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: lock.h 4359 2013-02-21 11:18:36Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 143 | skipping to change at line 143 | |||
* Destroy the lock object. | * Destroy the lock object. | |||
* | * | |||
* @param lock The lock object. | * @param lock The lock object. | |||
* | * | |||
* @return PJ_SUCCESS or the appropriate error code. | * @return PJ_SUCCESS or the appropriate error code. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_lock_destroy( pj_lock_t *lock ); | PJ_DECL(pj_status_t) pj_lock_destroy( pj_lock_t *lock ); | |||
/** @} */ | /** @} */ | |||
/** | ||||
* @defgroup PJ_GRP_LOCK Group Lock | ||||
* @ingroup PJ_LOCK | ||||
* @{ | ||||
* | ||||
* Group lock is a synchronization object to manage concurrency among membe | ||||
rs | ||||
* within the same logical group. Example of such groups are: | ||||
* | ||||
* - dialog, which has members such as the dialog itself, an invite sessi | ||||
on, | ||||
* and several transactions | ||||
* - ICE, which has members such as ICE stream transport, ICE session, ST | ||||
UN | ||||
* socket, TURN socket, and down to ioqueue key | ||||
* | ||||
* Group lock has three functions: | ||||
* | ||||
* - mutual exclusion: to protect resources from being accessed by more t | ||||
han | ||||
* one threads at the same time | ||||
* - session management: to make sure that the resource is not destroyed | ||||
* while others are still using or about to use it. | ||||
* - lock coordinator: to provide uniform lock ordering among more than o | ||||
ne | ||||
* lock objects, which is necessary to avoid deadlock. | ||||
* | ||||
* The requirements of the group lock are: | ||||
* | ||||
* - must satisfy all the functions above | ||||
* - must allow members to join or leave the group (for example, | ||||
* transaction may be added or removed from a dialog) | ||||
* - must be able to synchronize with external lock (for example, a dial | ||||
og | ||||
* lock must be able to sync itself with PJSUA lock) | ||||
* | ||||
* Please see https://trac.pjsip.org/repos/wiki/Group_Lock for more info. | ||||
*/ | ||||
/** | ||||
* Settings for creating the group lock. | ||||
*/ | ||||
typedef struct pj_grp_lock_config | ||||
{ | ||||
/** | ||||
* Creation flags, currently must be zero. | ||||
*/ | ||||
unsigned flags; | ||||
} pj_grp_lock_config; | ||||
/** | ||||
* Initialize the config with the default values. | ||||
* | ||||
* @param cfg The config to be initialized. | ||||
*/ | ||||
PJ_DECL(void) pj_grp_lock_config_default(pj_grp_lock_config *cfg); | ||||
/** | ||||
* Create a group lock object. Initially the group lock will have reference | ||||
* counter of one. | ||||
* | ||||
* @param pool The group lock only uses the pool parameter to get | ||||
* the pool factory, from which it will create its own | ||||
* pool. | ||||
* @param cfg Optional configuration. | ||||
* @param p_grp_lock Pointer to receive the newly created group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_create(pj_pool_t *pool, | ||||
const pj_grp_lock_config *cfg, | ||||
pj_grp_lock_t **p_grp_lock); | ||||
/** | ||||
* Forcibly destroy the group lock, ignoring the reference counter value. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_destroy( pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Move the contents of the old lock to the new lock and destroy the | ||||
* old lock. | ||||
* | ||||
* @param old_lock The old group lock to be destroyed. | ||||
* @param new_lock The new group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_replace(pj_grp_lock_t *old_lock, | ||||
pj_grp_lock_t *new_lock); | ||||
/** | ||||
* Acquire lock on the specified group lock. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_acquire( pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Acquire lock on the specified group lock if it is available, otherwise | ||||
* return immediately wihout waiting. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_tryacquire( pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Release the previously held lock. This may cause the group lock | ||||
* to be destroyed if it is the last one to hold the reference counter. | ||||
* In that case, the function will return PJ_EGONE. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_release( pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Add a destructor handler, to be called by the group lock when it is | ||||
* about to be destroyed. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* @param pool Pool to allocate memory for the handler. | ||||
* @param member A pointer to be passed to the handler. | ||||
* @param handler The destroy handler. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_add_handler(pj_grp_lock_t *grp_lock, | ||||
pj_pool_t *pool, | ||||
void *member, | ||||
void (*handler)(void *member)) | ||||
; | ||||
/** | ||||
* Remove previously registered handler. All parameters must be the same | ||||
* as when the handler was added. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* @param member A pointer to be passed to the handler. | ||||
* @param handler The destroy handler. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_del_handler(pj_grp_lock_t *grp_lock, | ||||
void *member, | ||||
void (*handler)(void *member)) | ||||
; | ||||
/** | ||||
* Increment reference counter to prevent the group lock grom being destroy | ||||
ed. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
#if !PJ_GRP_LOCK_DEBUG | ||||
PJ_DECL(pj_status_t) pj_grp_lock_add_ref(pj_grp_lock_t *grp_lock); | ||||
#define pj_grp_lock_add_ref_dbg(grp_lock, x, y) pj_grp_lock_add_ref(grp_loc | ||||
k) | ||||
#else | ||||
#define pj_grp_lock_add_ref(g) pj_grp_lock_add_ref_dbg(g, __FILE__, __LINE_ | ||||
_) | ||||
PJ_DECL(pj_status_t) pj_grp_lock_add_ref_dbg(pj_grp_lock_t *grp_lock, | ||||
const char *file, | ||||
int line); | ||||
#endif | ||||
/** | ||||
* Decrement the reference counter. When the counter value reaches zero, th | ||||
e | ||||
* group lock will be destroyed and all destructor handlers will be called. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
#if !PJ_GRP_LOCK_DEBUG | ||||
PJ_DECL(pj_status_t) pj_grp_lock_dec_ref(pj_grp_lock_t *grp_lock); | ||||
#define pj_grp_lock_dec_ref_dbg(grp_lock, x, y) pj_grp_lock_dec_ref(grp_loc | ||||
k) | ||||
#else | ||||
#define pj_grp_lock_dec_ref(g) pj_grp_lock_dec_ref_dbg(g, __FILE__, __LINE_ | ||||
_) | ||||
PJ_DECL(pj_status_t) pj_grp_lock_dec_ref_dbg(pj_grp_lock_t *grp_lock, | ||||
const char *file, | ||||
int line); | ||||
#endif | ||||
/** | ||||
* Get current reference count value. This normally is only used for | ||||
* debugging purpose. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return The reference count value. | ||||
*/ | ||||
PJ_DECL(int) pj_grp_lock_get_ref(pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Dump group lock info for debugging purpose. If group lock debugging is | ||||
* enabled (via PJ_GRP_LOCK_DEBUG) macro, this will print the group lock | ||||
* reference counter value along with the source file and line. If | ||||
* debugging is disabled, this will only print the reference counter. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
*/ | ||||
PJ_DECL(void) pj_grp_lock_dump(pj_grp_lock_t *grp_lock); | ||||
/** | ||||
* Synchronize an external lock with the group lock, by adding it to the | ||||
* list of locks to be acquired by the group lock when the group lock is | ||||
* acquired. | ||||
* | ||||
* The ''pos'' argument specifies the lock order and also the relative | ||||
* position with regard to lock ordering against the group lock. Locks with | ||||
* lower ''pos'' value will be locked first, and those with negative value | ||||
* will be locked before the group lock (the group lock's ''pos'' value is | ||||
* zero). | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* @param ext_lock The external lock | ||||
* @param pos The position. | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_chain_lock(pj_grp_lock_t *grp_lock, | ||||
pj_lock_t *ext_lock, | ||||
int pos); | ||||
/** | ||||
* Remove an external lock from group lock's list of synchronized locks. | ||||
* | ||||
* @param grp_lock The group lock. | ||||
* @param ext_lock The external lock | ||||
* | ||||
* @return PJ_SUCCESS or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_grp_lock_unchain_lock(pj_grp_lock_t *grp_lock, | ||||
pj_lock_t *ext_lock); | ||||
/** @} */ | ||||
PJ_END_DECL | PJ_END_DECL | |||
#endif /* __PJ_LOCK_H__ */ | #endif /* __PJ_LOCK_H__ */ | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 261 lines changed or added | |||
pjmedia-codec.h | pjmedia-codec.h | |||
---|---|---|---|---|
/* $Id: pjmedia-codec.h 4049 2012-04-13 06:24:23Z ming $ */ | /* $Id: pjmedia-codec.h 4331 2013-01-23 06:18:18Z ming $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 37 | skipping to change at line 37 | |||
#include <pjmedia-codec/audio_codecs.h> | #include <pjmedia-codec/audio_codecs.h> | |||
#include <pjmedia-codec/l16.h> | #include <pjmedia-codec/l16.h> | |||
#include <pjmedia-codec/ffmpeg_vid_codecs.h> | #include <pjmedia-codec/ffmpeg_vid_codecs.h> | |||
#include <pjmedia-codec/gsm.h> | #include <pjmedia-codec/gsm.h> | |||
#include <pjmedia-codec/speex.h> | #include <pjmedia-codec/speex.h> | |||
#include <pjmedia-codec/ilbc.h> | #include <pjmedia-codec/ilbc.h> | |||
#include <pjmedia-codec/g722.h> | #include <pjmedia-codec/g722.h> | |||
#include <pjmedia-codec/g7221.h> | #include <pjmedia-codec/g7221.h> | |||
#include <pjmedia-codec/ipp_codecs.h> | #include <pjmedia-codec/ipp_codecs.h> | |||
#include <pjmedia-codec/opencore_amr.h> | ||||
#include <pjmedia-codec/passthrough.h> | #include <pjmedia-codec/passthrough.h> | |||
#include <pjmedia-codec/opencore_amrnb.h> | #include <pjmedia-codec/silk.h> | |||
#endif /* __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ */ | #endif /* __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ */ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
pjsua_internal.h | pjsua_internal.h | |||
---|---|---|---|---|
/* $Id: pjsua_internal.h 4175 2012-06-22 08:53:11Z nanang $ */ | /* $Id: pjsua_internal.h 4342 2013-02-06 13:48:45Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 156 | skipping to change at line 156 | |||
pjsua_med_tp_state_cb med_ch_cb;/**< Media channel callback. */ | pjsua_med_tp_state_cb med_ch_cb;/**< Media channel callback. */ | |||
pjsua_med_tp_state_info med_ch_info;/**< Media channel info. */ | pjsua_med_tp_state_info med_ch_info;/**< Media channel info. */ | |||
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. */ | |||
pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint. */ | pj_stun_nat_type rem_nat_type; /**< NAT type of remote endpoint. */ | |||
char last_text_buf_[128]; /**< Buffer for last_text. */ | char last_text_buf_[128]; /**< Buffer for last_text. */ | |||
struct { | struct { | |||
pj_timer_entry reinv_timer;/**< Reinvite retry timer. | ||||
*/ | ||||
pj_uint32_t sdp_ver; /**< SDP version of the bad answer | ||||
*/ | ||||
int retry_cnt; /**< Retry count. */ | int retry_cnt; /**< Retry count. */ | |||
pj_bool_t pending; /**< Pending until CONFIRMED state */ | ||||
} lock_codec; /**< Data for codec locking when answer | } lock_codec; /**< Data for codec locking when answer | |||
contains multiple codecs. */ | contains multiple codecs. */ | |||
struct { | struct { | |||
pjsip_dialog *dlg; /**< Call dialog. */ | pjsip_dialog *dlg; /**< Call dialog. */ | |||
pjmedia_sdp_session *rem_sdp;/**< Remote SDP. */ | pjmedia_sdp_session *rem_sdp;/**< Remote SDP. */ | |||
pj_pool_t *pool_prov;/**< Provisional pool. */ | pj_pool_t *pool_prov;/**< Provisional pool. */ | |||
pj_bool_t med_ch_deinit;/**< Media channel de-init-ed? */ | pj_bool_t med_ch_deinit;/**< Media channel de-init-ed? */ | |||
union { | union { | |||
struct { | struct { | |||
pjsua_msg_data *msg_data;/**< Headers for outgoing INVITE. */ | pjsua_msg_data *msg_data;/**< Headers for outgoing INVITE. */ | |||
pj_bool_t hangup; /**< Call is hangup? */ | ||||
} out_call; | } out_call; | |||
struct { | struct { | |||
call_answer answers;/**< A list of call answers. */ | call_answer answers;/**< A list of call answers. */ | |||
pjsip_dialog *replaced_dlg; /**< Replaced dialog. */ | pjsip_dialog *replaced_dlg; /**< Replaced dialog. */ | |||
} inc_call; | } inc_call; | |||
} call_var; | } call_var; | |||
} async_call; /**< Temporary storage for async | } async_call; /**< Temporary storage for async | |||
outgoing/incoming call. */ | outgoing/incoming call. */ | |||
pj_bool_t rem_offerer; /**< Was remote SDP offerer? */ | pj_bool_t rem_offerer; /**< Was remote SDP offerer? */ | |||
unsigned rem_aud_cnt; /**< No of active audio in last remot e | unsigned rem_aud_cnt; /**< No of active audio in last remot e | |||
offer. */ | offer. */ | |||
unsigned rem_vid_cnt; /**< No of active video in last remot e | unsigned rem_vid_cnt; /**< No of active video in last remot e | |||
offer. */ | offer. */ | |||
pj_timer_entry reinv_timer; /**< Reinvite retry timer. | ||||
*/ | ||||
pj_bool_t reinv_pending;/**< Pending until CONFIRMED state. | ||||
*/ | ||||
pj_bool_t reinv_ice_sent;/**< Has reinvite for ICE upd sent? | ||||
*/ | ||||
}; | }; | |||
/** | /** | |||
* Server presence subscription list head. | * Server presence subscription list head. | |||
*/ | */ | |||
struct pjsua_srv_pres | struct pjsua_srv_pres | |||
{ | { | |||
PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); | PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); | |||
pjsip_evsub *sub; /**< The evsub. */ | pjsip_evsub *sub; /**< The evsub. */ | |||
char *remote; /**< Remote URI. */ | char *remote; /**< Remote URI. */ | |||
skipping to change at line 332 | skipping to change at line 334 | |||
unsigned channel_count; | unsigned channel_count; | |||
unsigned samples_per_frame; | unsigned samples_per_frame; | |||
unsigned bits_per_sample; | unsigned bits_per_sample; | |||
} pjsua_conf_setting; | } pjsua_conf_setting; | |||
typedef struct pjsua_stun_resolve | typedef struct pjsua_stun_resolve | |||
{ | { | |||
PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve); | PJ_DECL_LIST_MEMBER(struct pjsua_stun_resolve); | |||
pj_pool_t *pool; /**< Pool */ | pj_pool_t *pool; /**< Pool */ | |||
int ref_cnt; /**< Reference count */ | ||||
pj_bool_t destroy_flag; /**< To be destroyed */ | ||||
pj_bool_t has_result; | ||||
unsigned count; /**< # of entries */ | unsigned count; /**< # of entries */ | |||
pj_str_t *srv; /**< Array of entries */ | pj_str_t *srv; /**< Array of entries */ | |||
unsigned idx; /**< Current index */ | unsigned idx; /**< Current index */ | |||
void *token; /**< App token */ | void *token; /**< App token */ | |||
pj_stun_resolve_cb cb; /**< App callback */ | pj_stun_resolve_cb cb; /**< App callback */ | |||
pj_bool_t blocking; /**< Blocking? */ | pj_bool_t blocking; /**< Blocking? */ | |||
pj_status_t status; /**< Session status */ | pj_status_t status; /**< Session status */ | |||
pj_sockaddr addr; /**< Result */ | pj_sockaddr addr; /**< Result */ | |||
pj_stun_sock *stun_sock; /**< Testing STUN sock */ | pj_stun_sock *stun_sock; /**< Testing STUN sock */ | |||
} pjsua_stun_resolve; | } pjsua_stun_resolve; | |||
skipping to change at line 572 | skipping to change at line 577 | |||
*/ | */ | |||
/* Resolve the STUN server */ | /* Resolve the STUN server */ | |||
pj_status_t resolve_stun_server(pj_bool_t wait); | pj_status_t resolve_stun_server(pj_bool_t wait); | |||
/** | /** | |||
* Normalize route URI (check for ";lr" and append one if it doesn't | * Normalize route URI (check for ";lr" and append one if it doesn't | |||
* exist and pjsua_config.force_lr is set. | * exist and pjsua_config.force_lr is set. | |||
*/ | */ | |||
pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri); | pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri); | |||
/* acc use stun? */ | ||||
pj_bool_t pjsua_sip_acc_is_using_stun(pjsua_acc_id acc_id); | ||||
/* Get local transport address suitable to be used for Via or Contact addre | ||||
ss | ||||
* to send request to the specified destination URI. | ||||
*/ | ||||
pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id, | ||||
pj_pool_t *pool, | ||||
const pj_str_t *dst_uri, | ||||
pjsip_host_port *addr, | ||||
pjsip_transport_type_e *p_tp_type, | ||||
int *p_secure, | ||||
const void **p_tp); | ||||
/** | /** | |||
* 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. | * Media channel. | |||
*/ | */ | |||
pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, | pj_status_t pjsua_media_channel_init(pjsua_call_id call_id, | |||
pjsip_role_e role, | pjsip_role_e role, | |||
skipping to change at line 783 | skipping to change at line 802 | |||
pjmedia_vid_stream_info *si, | pjmedia_vid_stream_info *si, | |||
const pjmedia_sdp_session *local_sdp, | const pjmedia_sdp_session *local_sdp, | |||
const pjmedia_sdp_session *remote_sdp); | const pjmedia_sdp_session *remote_sdp); | |||
#if PJSUA_HAS_VIDEO | #if PJSUA_HAS_VIDEO | |||
PJ_DECL(void) pjsua_vid_win_reset(pjsua_vid_win_id wid); | PJ_DECL(void) pjsua_vid_win_reset(pjsua_vid_win_id wid); | |||
#else | #else | |||
# define pjsua_vid_win_reset(wid) | # define pjsua_vid_win_reset(wid) | |||
#endif | #endif | |||
/* | ||||
* Schedule check for the need of re-INVITE/UPDATE after media update | ||||
*/ | ||||
void pjsua_call_schedule_reinvite_check(pjsua_call *call, unsigned delay_ms | ||||
); | ||||
PJ_END_DECL | PJ_END_DECL | |||
#endif /* __PJSUA_INTERNAL_H__ */ | #endif /* __PJSUA_INTERNAL_H__ */ | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 33 lines changed or added | |||
pool.h | pool.h | |||
---|---|---|---|---|
/* $Id: pool.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: pool.h 4298 2012-11-22 05:00:01Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 505 | skipping to change at line 505 | |||
* | * | |||
* @return Memory buffer of the specified type. | * @return Memory buffer of the specified type. | |||
*/ | */ | |||
#define PJ_POOL_ZALLOC_T(pool,type) \ | #define PJ_POOL_ZALLOC_T(pool,type) \ | |||
((type*)pj_pool_zalloc(pool, sizeof(type))) | ((type*)pj_pool_zalloc(pool, sizeof(type))) | |||
/* | /* | |||
* Internal functions | * Internal functions | |||
*/ | */ | |||
PJ_IDECL(void*) pj_pool_alloc_from_block(pj_pool_block *block, pj_size_t si ze); | PJ_IDECL(void*) pj_pool_alloc_from_block(pj_pool_block *block, pj_size_t si ze); | |||
PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, unsigned size); | PJ_DECL(void*) pj_pool_allocate_find(pj_pool_t *pool, pj_size_t size); | |||
/** | /** | |||
* @} // 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. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
pool_i.h | pool_i.h | |||
---|---|---|---|---|
/* $Id: pool_i.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: pool_i.h 4298 2012-11-22 05:00:01Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 48 | skipping to change at line 48 | |||
PJ_IDEF(void*) pj_pool_alloc_from_block( pj_pool_block *block, pj_size_t si ze ) | PJ_IDEF(void*) pj_pool_alloc_from_block( pj_pool_block *block, pj_size_t si ze ) | |||
{ | { | |||
/* The operation below is valid for size==0. | /* The operation below is valid for size==0. | |||
* When size==0, the function will return the pointer to the pool | * When size==0, the function will return the pointer to the pool | |||
* memory address, but no memory will be allocated. | * memory address, but no memory will be allocated. | |||
*/ | */ | |||
if (size & (PJ_POOL_ALIGNMENT-1)) { | if (size & (PJ_POOL_ALIGNMENT-1)) { | |||
size = (size + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT-1); | size = (size + PJ_POOL_ALIGNMENT) & ~(PJ_POOL_ALIGNMENT-1); | |||
} | } | |||
if ((unsigned)(block->end - block->cur) >= size) { | if ((pj_size_t)(block->end - block->cur) >= size) { | |||
void *ptr = block->cur; | void *ptr = block->cur; | |||
block->cur += size; | block->cur += size; | |||
return ptr; | return ptr; | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
PJ_IDEF(void*) pj_pool_alloc( pj_pool_t *pool, pj_size_t size) | PJ_IDEF(void*) pj_pool_alloc( pj_pool_t *pool, pj_size_t size) | |||
{ | { | |||
void *ptr = pj_pool_alloc_from_block(pool->block_list.next, size); | void *ptr = pj_pool_alloc_from_block(pool->block_list.next, size); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
sdp.h | sdp.h | |||
---|---|---|---|---|
/* $Id: sdp.h 3945 2012-01-27 09:12:59Z nanang $ */ | /* $Id: sdp.h 4367 2013-02-21 20:49:19Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 654 | skipping to change at line 654 | |||
* the connection line, and verify that \a rtpmap attribute is present | * the connection line, and verify that \a rtpmap attribute is present | |||
* when dynamic payload type is used. | * when dynamic payload type is used. | |||
* | * | |||
* @param sdp The SDP session descriptor to validate. | * @param sdp The SDP session descriptor to validate. | |||
* | * | |||
* @return PJ_SUCCESS on success. | * @return PJ_SUCCESS on success. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pjmedia_sdp_validate(const pjmedia_sdp_session *sdp); | PJ_DECL(pj_status_t) pjmedia_sdp_validate(const pjmedia_sdp_session *sdp); | |||
/** | /** | |||
* Perform semantic validation for the specified SDP session descriptor. | ||||
* This function perform validation beyond just syntactic verification, | ||||
* such as to verify the value of network type and address type, check | ||||
* the connection line, and verify that \a rtpmap attribute is present | ||||
* when dynamic payload type is used. | ||||
* | ||||
* @param sdp The SDP session descriptor to validate. | ||||
* @param strict Flag whether the check should be strict, i.e: allow | ||||
* media without connection line when port is zero. | ||||
* | ||||
* @return PJ_SUCCESS on success. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjmedia_sdp_validate2(const pjmedia_sdp_session *sdp, | ||||
pj_bool_t strict); | ||||
/** | ||||
* Clone SDP session descriptor. | * Clone SDP session descriptor. | |||
* | * | |||
* @param pool The pool used to clone the session. | * @param pool The pool used to clone the session. | |||
* @param sdp The SDP session to clone. | * @param sdp The SDP session to clone. | |||
* | * | |||
* @return New SDP session. | * @return New SDP session. | |||
*/ | */ | |||
PJ_DECL(pjmedia_sdp_session*) | PJ_DECL(pjmedia_sdp_session*) | |||
pjmedia_sdp_session_clone( pj_pool_t *pool, | pjmedia_sdp_session_clone( pj_pool_t *pool, | |||
const pjmedia_sdp_session *sdp); | const pjmedia_sdp_session *sdp); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 17 lines changed or added | |||
sip_auth.h | sip_auth.h | |||
---|---|---|---|---|
/* $Id: sip_auth.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: sip_auth.h 4214 2012-07-25 14:29:28Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 269 | skipping to change at line 269 | |||
* @return The function MUST return PJ_SUCCESS when it found | * @return The function MUST return PJ_SUCCESS when it found | |||
* a correct credential for the specified account and | * a correct credential for the specified account and | |||
* realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUN D | * realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUN D | |||
* or PJSIP_EAUTHACCDISABLED. | * or PJSIP_EAUTHACCDISABLED. | |||
*/ | */ | |||
typedef pj_status_t pjsip_auth_lookup_cred( pj_pool_t *pool, | typedef pj_status_t pjsip_auth_lookup_cred( pj_pool_t *pool, | |||
const pj_str_t *realm, | const pj_str_t *realm, | |||
const pj_str_t *acc_name, | const pj_str_t *acc_name, | |||
pjsip_cred_info *cred_info ); | pjsip_cred_info *cred_info ); | |||
/** | ||||
* This structure describes input param for credential lookup. | ||||
*/ | ||||
typedef struct pjsip_auth_lookup_cred_param | ||||
{ | ||||
pj_str_t realm; /**< Realm to find the account. */ | ||||
pj_str_t acc_name; /**< Account name to look for. */ | ||||
pjsip_rx_data *rdata; /**< Incoming request to be authenticated. */ | ||||
} pjsip_auth_lookup_cred_param; | ||||
/** | ||||
* Type of function to lookup credential for the specified name. | ||||
* | ||||
* @param pool Pool to initialize the credential info. | ||||
* @param param The input param for credential lookup. | ||||
* @param cred_info The structure to put the credential when it's found. | ||||
* | ||||
* @return The function MUST return PJ_SUCCESS when it found | ||||
* a correct credential for the specified account and | ||||
* realm. Otherwise it may return PJSIP_EAUTHACCNOTFOUN | ||||
D | ||||
* or PJSIP_EAUTHACCDISABLED. | ||||
*/ | ||||
typedef pj_status_t pjsip_auth_lookup_cred2( | ||||
pj_pool_t *pool, | ||||
const pjsip_auth_lookup_cred_param *param, | ||||
pjsip_cred_info *cred_info ); | ||||
/** Flag to specify that server is a proxy. */ | /** Flag to specify that server is a proxy. */ | |||
#define PJSIP_AUTH_SRV_IS_PROXY 1 | #define PJSIP_AUTH_SRV_IS_PROXY 1 | |||
/** | /** | |||
* This structure describes server authentication information. | * This structure describes server authentication information. | |||
*/ | */ | |||
typedef struct pjsip_auth_srv | typedef struct pjsip_auth_srv | |||
{ | { | |||
pj_str_t realm; /**< Realm to serve. */ | pj_str_t realm; /**< Realm to serve. */ | |||
pj_bool_t is_proxy; /**< Will issue 407 instead of 401 */ | pj_bool_t is_proxy; /**< Will issue 407 instead of 401 */ | |||
pjsip_auth_lookup_cred *lookup; /**< Lookup function. */ | pjsip_auth_lookup_cred *lookup; /**< Lookup function. */ | |||
pjsip_auth_lookup_cred2 *lookup2; /**< Lookup function with additional | ||||
info in its input param. | ||||
*/ | ||||
} pjsip_auth_srv; | } pjsip_auth_srv; | |||
/** | /** | |||
* Initialize client authentication session data structure, and set the | * Initialize client authentication session data structure, and set the | |||
* session to use pool for its subsequent memory allocation. The argument | * session to use pool for its subsequent memory allocation. The argument | |||
* options should be set to zero for this PJSIP version. | * options should be set to zero for this PJSIP version. | |||
* | * | |||
* @param sess The client authentication session. | * @param sess The client authentication session. | |||
* @param endpt Endpoint where this session belongs. | * @param endpt Endpoint where this session belongs. | |||
* @param pool Pool to use. | * @param pool Pool to use. | |||
skipping to change at line 422 | skipping to change at line 451 | |||
* | * | |||
* @return PJ_SUCCESS on success. | * @return PJ_SUCCESS on success. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pjsip_auth_srv_init( pj_pool_t *pool, | PJ_DECL(pj_status_t) pjsip_auth_srv_init( pj_pool_t *pool, | |||
pjsip_auth_srv *auth_srv, | pjsip_auth_srv *auth_srv, | |||
const pj_str_t *realm, | const pj_str_t *realm, | |||
pjsip_auth_lookup_cred *lookup, | pjsip_auth_lookup_cred *lookup, | |||
unsigned options ); | unsigned options ); | |||
/** | /** | |||
* This structure describes initialization settings of server authorization | ||||
* session. | ||||
*/ | ||||
typedef struct pjsip_auth_srv_init_param | ||||
{ | ||||
/** | ||||
* Realm to be served by the server. | ||||
*/ | ||||
const pj_str_t *realm; | ||||
/** | ||||
* Account lookup function. | ||||
*/ | ||||
pjsip_auth_lookup_cred2 *lookup2; | ||||
/** | ||||
* Options, bitmask of: | ||||
* - PJSIP_AUTH_SRV_IS_PROXY: to specify that the server will authorize | ||||
* clients as a proxy server (instead of as UAS), which means that | ||||
* Proxy-Authenticate will be used instead of WWW-Authenticate. | ||||
*/ | ||||
unsigned options; | ||||
} pjsip_auth_srv_init_param; | ||||
/** | ||||
* Initialize server authorization session data structure to serve the | ||||
* specified realm and to use lookup_func function to look for the credenti | ||||
al | ||||
* info. | ||||
* | ||||
* @param pool Pool used to initialize the authentication server. | ||||
* @param auth_srv The authentication server structure. | ||||
* @param param The initialization param. | ||||
* | ||||
* @return PJ_SUCCESS on success. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_auth_srv_init2( | ||||
pj_pool_t *pool, | ||||
pjsip_auth_srv *auth_srv, | ||||
const pjsip_auth_srv_init_param *param); | ||||
/** | ||||
* Request the authorization server framework to verify the authorization | * Request the authorization server framework to verify the authorization | |||
* information in the specified request in rdata. | * information in the specified request in rdata. | |||
* | * | |||
* @param auth_srv The server authentication structure. | * @param auth_srv The server authentication structure. | |||
* @param rdata Incoming request to be authenticated. | * @param rdata Incoming request to be authenticated. | |||
* @param status_code When not null, it will be filled with suitable | * @param status_code When not null, it will be filled with suitable | |||
* status code to be sent to the client. | * status code to be sent to the client. | |||
* | * | |||
* @return PJ_SUCCESS if request is successfully authenticated. | * @return PJ_SUCCESS if request is successfully authenticated. | |||
* Otherwise the function may return one of the | * Otherwise the function may return one of the | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 76 lines changed or added | |||
sip_config.h | sip_config.h | |||
---|---|---|---|---|
/* $Id: sip_config.h 4172 2012-06-19 14:35:18Z nanang $ */ | /* $Id: sip_config.h 4285 2012-10-19 04:23:57Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 76 | skipping to change at line 76 | |||
* Application may use #pjsip_cfg() function to modify the settings | * Application may use #pjsip_cfg() function to modify the settings | |||
* before creating the stack. | * before creating the stack. | |||
*/ | */ | |||
typedef struct pjsip_cfg_t | typedef struct pjsip_cfg_t | |||
{ | { | |||
/** Global settings. */ | /** Global settings. */ | |||
struct { | struct { | |||
/** | /** | |||
* Specify port number should be allowed to appear in To and From | * Specify port number should be allowed to appear in To and From | |||
* header. Note that RFC 3261 disallow this, see Table 1 in section | * header. Note that RFC 3261 disallow this, see Table 1 in section | |||
* 19.1.1 of the RFC. Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR. | * 19.1.1 of the RFC. | |||
* | ||||
* Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR. | ||||
*/ | */ | |||
pj_bool_t allow_port_in_fromto_hdr; | pj_bool_t allow_port_in_fromto_hdr; | |||
/** | /** | |||
* Accept call replace in early state when invite is not initiated | ||||
* by the user agent. RFC 3891 Section 3 disallows this, however, | ||||
* for better interoperability reason, this might be ignored. | ||||
* | ||||
* Default is PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE. | ||||
*/ | ||||
pj_bool_t accept_replace_in_early_state; | ||||
/** | ||||
* Allow hash character ('#') to appear in outgoing URIs. See | ||||
* https://trac.pjsip.org/repos/ticket/1569. | ||||
* | ||||
* Default is PJ_FALSE. | ||||
*/ | ||||
pj_bool_t allow_tx_hash_in_uri; | ||||
/** | ||||
* Disable rport in request. | * Disable rport in request. | |||
* | ||||
* Default is PJ_FALSE. | ||||
*/ | */ | |||
pj_bool_t disable_rport; | pj_bool_t disable_rport; | |||
/** | /** | |||
* Disable automatic switching from UDP to TCP if outgoing request | * Disable automatic switching from UDP to TCP if outgoing request | |||
* is greater than 1300 bytes. See PJSIP_DONT_SWITCH_TO_TCP. | * is greater than 1300 bytes. | |||
* | ||||
* Default is PJSIP_DONT_SWITCH_TO_TCP. | ||||
*/ | */ | |||
pj_bool_t disable_tcp_switch; | pj_bool_t disable_tcp_switch; | |||
} endpt; | } endpt; | |||
/** Transaction layer settings. */ | /** Transaction layer settings. */ | |||
struct { | struct { | |||
/** Maximum number of transactions. The value is initialized with | /** Maximum number of transactions. The value is initialized with | |||
* PJSIP_MAX_TSX_COUNT | * PJSIP_MAX_TSX_COUNT | |||
skipping to change at line 263 | skipping to change at line 286 | |||
* This option can also be controlled at run-time by the \a disable_tcp_swi tch | * This option can also be controlled at run-time by the \a disable_tcp_swi tch | |||
* setting in pjsip_cfg_t. | * setting in pjsip_cfg_t. | |||
* | * | |||
* Default is 0 (no). | * Default is 0 (no). | |||
*/ | */ | |||
#ifndef PJSIP_DONT_SWITCH_TO_TCP | #ifndef PJSIP_DONT_SWITCH_TO_TCP | |||
# define PJSIP_DONT_SWITCH_TO_TCP 0 | # define PJSIP_DONT_SWITCH_TO_TCP 0 | |||
#endif | #endif | |||
/** | /** | |||
* Accept call replace in early state when invite is not initiated | ||||
* by the user agent. RFC 3891 Section 3 disallows this, however, | ||||
* for better interoperability reason, this might be ignored. | ||||
* | ||||
* This option can also be controlled at run-time by the | ||||
* \a accept_replace_in_early_state setting in pjsip_cfg_t. | ||||
* | ||||
* Default is 0 (no). | ||||
*/ | ||||
#ifndef PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE | ||||
# define PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE 0 | ||||
#endif | ||||
/** | ||||
* This setting controls the threshold of the UDP packet, which if it's | * This setting controls the threshold of the UDP packet, which if it's | |||
* larger than this value the request will be sent with TCP. This setting | * larger than this value the request will be sent with TCP. This setting | |||
* is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0. | * is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0. | |||
* | * | |||
* Default is 1300 bytes. | * Default is 1300 bytes. | |||
*/ | */ | |||
#ifndef PJSIP_UDP_SIZE_THRESHOLD | #ifndef PJSIP_UDP_SIZE_THRESHOLD | |||
# define PJSIP_UDP_SIZE_THRESHOLD 1300 | # define PJSIP_UDP_SIZE_THRESHOLD 1300 | |||
#endif | #endif | |||
skipping to change at line 352 | skipping to change at line 389 | |||
* written to the log, saying something like: | * written to the log, saying something like: | |||
* "Dropping response Response msg 200/INVITE/cseq=608594373 (rdata00A99EF 4) | * "Dropping response Response msg 200/INVITE/cseq=608594373 (rdata00A99EF 4) | |||
* from 1.2.3.4:5060 because sent-by is mismatch" | * from 1.2.3.4:5060 because sent-by is mismatch" | |||
* | * | |||
* The default behavior is yes, but when the UA supports IP address change | * The default behavior is yes, but when the UA supports IP address change | |||
* for the SIP transport, it will need to turn this checking off since | * for the SIP transport, it will need to turn this checking off since | |||
* when the transport address is changed between request is sent and | * when the transport address is changed between request is sent and | |||
* response is received, the response will be discarded since its Via | * response is received, the response will be discarded since its Via | |||
* sent-by now contains address that is different than the transport | * sent-by now contains address that is different than the transport | |||
* address. | * address. | |||
* | ||||
* Update: | ||||
* As of version 2.1, the default value is 0. This change was part of | ||||
* https://trac.pjsip.org/repos/ticket/1412 | ||||
*/ | */ | |||
#ifndef PJSIP_CHECK_VIA_SENT_BY | #ifndef PJSIP_CHECK_VIA_SENT_BY | |||
# define PJSIP_CHECK_VIA_SENT_BY 1 | # define PJSIP_CHECK_VIA_SENT_BY 0 | |||
#endif | #endif | |||
/** | /** | |||
* If non-zero, SIP parser will unescape the escape characters ('%') | * If non-zero, SIP parser will unescape the escape characters ('%') | |||
* in the original message, which means that it will modify the | * in the original message, which means that it will modify the | |||
* original message. Otherwise the parser will create a copy of | * original message. Otherwise the parser will create a copy of | |||
* the string and store the unescaped string to the new location. | * the string and store the unescaped string to the new location. | |||
* | * | |||
* Unescaping in-place is faster, but less elegant (and it may | * Unescaping in-place is faster, but less elegant (and it may | |||
* break certain applications). So normally it's disabled, unless | * break certain applications). So normally it's disabled, unless | |||
End of changes. 8 change blocks. | ||||
4 lines changed or deleted | 45 lines changed or added | |||
sip_endpoint.h | sip_endpoint.h | |||
---|---|---|---|---|
/* $Id: sip_endpoint.h 4154 2012-06-05 10:41:17Z bennylp $ */ | /* $Id: sip_endpoint.h 4275 2012-10-04 06:11:58Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 213 | skipping to change at line 213 | |||
* | * | |||
* @param endpt The endpoint. | * @param endpt The endpoint. | |||
* @param module The module to be registered. | * @param module The module to be registered. | |||
* | * | |||
* @return PJ_SUCCESS on success. | * @return PJ_SUCCESS on success. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pjsip_endpt_unregister_module( pjsip_endpoint *endpt, | PJ_DECL(pj_status_t) pjsip_endpt_unregister_module( pjsip_endpoint *endpt, | |||
pjsip_module *module ); | pjsip_module *module ); | |||
/** | /** | |||
* This describes additional parameters to pjsip_endpt_process_rx_data() | ||||
* function. Application MUST call pjsip_process_rdata_param_default() to | ||||
* initialize this structure. | ||||
*/ | ||||
typedef struct pjsip_process_rdata_param | ||||
{ | ||||
/** | ||||
* Specify the minimum priority number of the modules that are allowed | ||||
* to process the message. Default is zero to allow all modules to | ||||
* process the message. | ||||
*/ | ||||
unsigned start_prio; | ||||
/** | ||||
* Specify the pointer of the module where processing will start. | ||||
* The default is NULL, meaning processing will start from the start | ||||
* of the module list. | ||||
*/ | ||||
void *start_mod; | ||||
/** | ||||
* Set to N, then processing will start at Nth module after start | ||||
* module (where start module can be an explicit module as specified | ||||
* by \a start_mod or the start of module list when \a start_mod is | ||||
* NULL). For example, if set to 1, then processing will start from | ||||
* the next module after start module. Default is zero. | ||||
*/ | ||||
unsigned idx_after_start; | ||||
/** | ||||
* Print nothing to log. Default is PJ_FALSE. | ||||
*/ | ||||
pj_bool_t silent; | ||||
} pjsip_process_rdata_param; | ||||
/** | ||||
* Initialize with default. | ||||
* | ||||
* @param p The param. | ||||
*/ | ||||
PJ_DECL(void) pjsip_process_rdata_param_default(pjsip_process_rdata_param * | ||||
p); | ||||
/** | ||||
* Manually distribute the specified pjsip_rx_data to registered modules. | ||||
* Normally application does not need to call this function because receive | ||||
d | ||||
* messages will be given to endpoint automatically by transports. | ||||
* | ||||
* Application can use this function when it has postponed the processing o | ||||
f | ||||
* an incoming message, for example to perform long operations such as | ||||
* database operation or to consult other servers to decide what to do with | ||||
* the message. In this case, application clones the original rdata, return | ||||
* from the callback, and perform the long operation. Upon completing the | ||||
* long operation, it resumes pjsip's module processing by calling this | ||||
* function, and then free the cloned rdata. | ||||
* | ||||
* @param endpt The endpoint instance. | ||||
* @param rdata The rdata to be distributed. | ||||
* @param p Optional pointer to param to specify from which modu | ||||
le | ||||
* the processing should start. | ||||
* @param p_handled Optional pointer to receive last return value of | ||||
* module's \a on_rx_request() or \a on_rx_response() | ||||
* callback. | ||||
* | ||||
* @return PJ_SUCCESS on success. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_endpt_process_rx_data(pjsip_endpoint *endpt, | ||||
pjsip_rx_data *rdata, | ||||
pjsip_process_rdata_param | ||||
*p, | ||||
pj_bool_t *p_handled); | ||||
/** | ||||
* Create pool from the endpoint. All SIP components should allocate their | * Create pool from the endpoint. All SIP components should allocate their | |||
* memory pool by calling this function, to make sure that the pools are | * memory pool by calling this function, to make sure that the pools are | |||
* allocated from the same pool factory. This function, like all other endp oint | * allocated from the same pool factory. This function, like all other endp oint | |||
* functions, is thread safe. | * functions, is thread safe. | |||
* | * | |||
* @param endpt The SIP endpoint. | * @param endpt The SIP endpoint. | |||
* @param pool_name Name to be assigned to the pool. | * @param pool_name Name to be assigned to the pool. | |||
* @param initial The initial size of the pool. | * @param initial The initial size of the pool. | |||
* @param increment The resize size. | * @param increment The resize size. | |||
* @return Memory pool, or NULL on failure. | * @return Memory pool, or NULL on failure. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 78 lines changed or added | |||
sip_transport.h | sip_transport.h | |||
---|---|---|---|---|
/* $Id: sip_transport.h 4173 2012-06-20 10:39:05Z ming $ */ | /* $Id: sip_transport.h 4275 2012-10-04 06:11:58Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 418 | skipping to change at line 418 | |||
/** | /** | |||
* Get printable information about the message in the rdata. | * Get printable information about the message in the rdata. | |||
* | * | |||
* @param rdata The receive data buffer. | * @param rdata The receive data buffer. | |||
* | * | |||
* @return Printable information. | * @return Printable information. | |||
*/ | */ | |||
PJ_DECL(char*) pjsip_rx_data_get_info(pjsip_rx_data *rdata); | PJ_DECL(char*) pjsip_rx_data_get_info(pjsip_rx_data *rdata); | |||
/** | ||||
* Clone pjsip_rx_data. This will duplicate the contents of | ||||
* pjsip_rx_data and add reference count to the transport. | ||||
* Once application has finished using the cloned pjsip_rx_data, | ||||
* it must release it by calling #pjsip_rx_data_free_cloned(). | ||||
* | ||||
* By default (if flags is set to zero), this function copies the | ||||
* transport pointer in \a tp_info, duplicates the \a pkt_info, | ||||
* perform deep clone of the \a msg_info parts of the rdata, and | ||||
* fills the \a endpt_info (i.e. the \a mod_data) with zeros. | ||||
* | ||||
* @param src The source to be cloned. | ||||
* @param flags Optional flags. Must be zero for now. | ||||
* @param p_rdata Pointer to receive the cloned rdata. | ||||
* | ||||
* @return PJ_SUCCESS on success or the appropriate error. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_rx_data_clone(const pjsip_rx_data *src, | ||||
unsigned flags, | ||||
pjsip_rx_data **p_rdata); | ||||
/** | ||||
* Free cloned pjsip_rx_data. This function must be and must only | ||||
* be called for a cloned pjsip_rx_data. Specifically, it must NOT | ||||
* be called for the original pjsip_rx_data that is returned by | ||||
* transports. | ||||
* | ||||
* This function will free the memory used by the pjsip_rx_data and | ||||
* decrement the transport reference counter. | ||||
* | ||||
* @param rdata The receive data buffer. | ||||
* | ||||
* @return PJ_SUCCESS on success or the appropriate error. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_rx_data_free_cloned(pjsip_rx_data *rdata); | ||||
/************************************************************************** *** | /************************************************************************** *** | |||
* | * | |||
* TRANSMIT DATA BUFFER MANIPULATION. | * TRANSMIT DATA BUFFER MANIPULATION. | |||
* | * | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
/** Customized ioqueue async operation key, used by transport to keep | /** Customized ioqueue async operation key, used by transport to keep | |||
* callback parameters. | * callback parameters. | |||
*/ | */ | |||
typedef struct pjsip_tx_data_op_key | typedef struct pjsip_tx_data_op_key | |||
skipping to change at line 1052 | skipping to change at line 1088 | |||
/** | /** | |||
* 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. | |||
* | * | |||
* @see pjsip_tpmgr_find_local_addr2() | ||||
* | ||||
* @param tpmgr The transport manager. | * @param tpmgr The transport manager. | |||
* @param pool Pool to allocate memory for the IP address. | * @param pool Pool to allocate memory for the IP address. | |||
* @param type Destination address to contact. | * @param type Destination address to contact. | |||
* @param sel Optional pointer to prefered transport, if any. | * @param sel Optional pointer to prefered transport, if any. | |||
* @param ip_addr Pointer to receive the IP address. | * @param ip_addr Pointer to receive the IP address. | |||
* @param port Pointer to receive the port number. | * @param port Pointer to receive the port number. | |||
* | * | |||
* @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); | |||
/** | /** | |||
* Parameter for pjsip_tpmgr_find_local_addr2() function. | ||||
*/ | ||||
typedef struct pjsip_tpmgr_fla2_param | ||||
{ | ||||
/** | ||||
* Specify transport type to use. This must be set. | ||||
*/ | ||||
pjsip_transport_type_e tp_type; | ||||
/** | ||||
* Optional pointer to preferred transport, if any. | ||||
*/ | ||||
const pjsip_tpselector *tp_sel; | ||||
/** | ||||
* Destination host, if known. The destination host is needed | ||||
* if \a local_if field below is set. | ||||
*/ | ||||
pj_str_t dst_host; | ||||
/** | ||||
* Specify if the function should return which local interface | ||||
* to use for the specified destination in \a dst_host. By definition, | ||||
* the returned address will always be local interface address. | ||||
*/ | ||||
pj_bool_t local_if; | ||||
/** | ||||
* The returned address. | ||||
*/ | ||||
pj_str_t ret_addr; | ||||
/** | ||||
* The returned port. | ||||
*/ | ||||
pj_uint16_t ret_port; | ||||
/** | ||||
* Returned pointer to the transport. Only set if local_if is set. | ||||
*/ | ||||
const void *ret_tp; | ||||
} pjsip_tpmgr_fla2_param; | ||||
/** | ||||
* Initialize with default values. | ||||
* | ||||
* @param prm The parameter to be initialized. | ||||
*/ | ||||
PJ_DECL(void) pjsip_tpmgr_fla2_param_default(pjsip_tpmgr_fla2_param *prm); | ||||
/** | ||||
* Find out the appropriate local address info (IP address and port) to | ||||
* advertise in Contact or Via header header based on the remote address | ||||
* to be contacted. The local address info would be the address name of the | ||||
* transport or listener which will be used to send the request. | ||||
* | ||||
* @see pjsip_tpmgr_find_local_addr() | ||||
* | ||||
* @param tpmgr The transport manager. | ||||
* @param pool Pool to allocate memory for the IP address. | ||||
* @param param Function input and output parameters. | ||||
* | ||||
* @return PJ_SUCCESS, or the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr2(pjsip_tpmgr *tpmgr, | ||||
pj_pool_t *pool, | ||||
pjsip_tpmgr_fla2_param *p | ||||
rm); | ||||
/** | ||||
* Return number of transports currently registered to the transport | * Return number of transports currently registered to the transport | |||
* manager. | * manager. | |||
* | * | |||
* @param mgr The transport manager. | * @param mgr The transport manager. | |||
* | * | |||
* @return Number of transports. | * @return Number of transports. | |||
*/ | */ | |||
PJ_DECL(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr); | PJ_DECL(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr); | |||
/** | /** | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 110 lines changed or added | |||
sip_transport_tls.h | sip_transport_tls.h | |||
---|---|---|---|---|
/* $Id: sip_transport_tls.h 3999 2012-03-30 07:10:13Z bennylp $ */ | /* $Id: sip_transport_tls.h 4262 2012-09-20 06:00:23Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 257 | skipping to change at line 257 | |||
dst->ciphers[i] = src->ciphers[i]; | dst->ciphers[i] = src->ciphers[i]; | |||
} | } | |||
} | } | |||
/** | /** | |||
* Register support for SIP TLS transport by creating TLS listener on | * Register support for SIP TLS transport by creating TLS listener on | |||
* the specified address and port. This function will create an | * the specified address and port. This function will create an | |||
* instance of SIP TLS transport factory and register it to the | * instance of SIP TLS transport factory and register it to the | |||
* transport manager. | * transport manager. | |||
* | * | |||
* See also #pjsip_tls_transport_start2() which supports IPv6. | ||||
* | ||||
* @param endpt The SIP endpoint. | * @param endpt The SIP endpoint. | |||
* @param opt Optional TLS settings. | * @param opt Optional TLS settings. | |||
* @param local Optional local address to bind, or specify t he | * @param local Optional local address to bind, or specify t he | |||
* address to bind the server socket to. Both IP | * address to bind the server socket to. Both IP | |||
* interface address and port fields are optional. | * interface address and port fields are optional. | |||
* If IP interface address is not specified, socket | * If IP interface address is not specified, socket | |||
* will be bound to PJ_INADDR_ANY. If port is not | * will be bound to PJ_INADDR_ANY. If port is not | |||
* specified, socket will be bound to any port | * specified, socket will be bound to any port | |||
* selected by the operating system. | * selected by the operating system. | |||
* @param a_name Optional published address, which is the address to be | * @param a_name Optional published address, which is the address to be | |||
skipping to change at line 289 | skipping to change at line 291 | |||
* started and registered to transport manager, or | * started and registered to transport manager, or | |||
* the appropriate error code. | * the appropriate error code. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pjsip_tls_transport_start(pjsip_endpoint *endpt, | PJ_DECL(pj_status_t) pjsip_tls_transport_start(pjsip_endpoint *endpt, | |||
const pjsip_tls_setting *opt, | const pjsip_tls_setting *opt, | |||
const pj_sockaddr_in *local, | const pj_sockaddr_in *local, | |||
const pjsip_host_port *a_name , | const pjsip_host_port *a_name , | |||
unsigned async_cnt, | unsigned async_cnt, | |||
pjsip_tpfactory **p_factory); | pjsip_tpfactory **p_factory); | |||
/** | ||||
* Variant of #pjsip_tls_transport_start() that supports IPv6. To instantia | ||||
te | ||||
* IPv6 listener, set the address family of the "local" argument to IPv6 | ||||
* (the host and port part may be left unspecified if not desired, i.e. by | ||||
* filling them with zeroes). | ||||
* | ||||
* @param endpt The SIP endpoint. | ||||
* @param opt Optional TLS settings. | ||||
* @param local Optional local address to bind, or specify t | ||||
he | ||||
* address to bind the server socket to. Both IP | ||||
* interface address and port fields are optional. | ||||
* If IP interface address is not specified, socket | ||||
* will be bound to any address. If port is not | ||||
* specified, socket will be bound to any port | ||||
* selected by the operating system. | ||||
* @param a_name Optional published address, which is the address to | ||||
be | ||||
* advertised as the address of this SIP transport. | ||||
* If this argument is NULL, then the bound address | ||||
* will be used as the published address. | ||||
* @param async_cnt Number of simultaneous asynchronous accept() | ||||
* operations to be supported. It is recommended that | ||||
* the number here corresponds to the number of | ||||
* processors in the system (or the number of SIP | ||||
* worker threads). | ||||
* @param p_factory Optional pointer to receive the instance of the | ||||
* SIP TLS transport factory just created. | ||||
* | ||||
* @return PJ_SUCCESS when the transport has been successfully | ||||
* started and registered to transport manager, or | ||||
* the appropriate error code. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjsip_tls_transport_start2(pjsip_endpoint *endpt, | ||||
const pjsip_tls_setting *opt | ||||
, | ||||
const pj_sockaddr *local, | ||||
const pjsip_host_port *a_nam | ||||
e, | ||||
unsigned async_cnt, | ||||
pjsip_tpfactory **p_factory) | ||||
; | ||||
PJ_END_DECL | PJ_END_DECL | |||
/** | /** | |||
* @} | * @} | |||
*/ | */ | |||
#endif /* __PJSIP_TRANSPORT_TLS_H__ */ | #endif /* __PJSIP_TRANSPORT_TLS_H__ */ | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 47 lines changed or added | |||
sip_types.h | sip_types.h | |||
---|---|---|---|---|
/* $Id: sip_types.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: sip_types.h 4262 2012-09-20 06:00:23Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 92 | skipping to change at line 92 | |||
/** Start of user defined transport */ | /** Start of user defined transport */ | |||
PJSIP_TRANSPORT_START_OTHER, | PJSIP_TRANSPORT_START_OTHER, | |||
/** Start of IPv6 transports */ | /** Start of IPv6 transports */ | |||
PJSIP_TRANSPORT_IPV6 = 128, | PJSIP_TRANSPORT_IPV6 = 128, | |||
/** UDP over IPv6 */ | /** UDP over IPv6 */ | |||
PJSIP_TRANSPORT_UDP6 = PJSIP_TRANSPORT_UDP + PJSIP_TRANSPORT_IPV6, | PJSIP_TRANSPORT_UDP6 = PJSIP_TRANSPORT_UDP + PJSIP_TRANSPORT_IPV6, | |||
/** TCP over IPv6 */ | /** TCP over IPv6 */ | |||
PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6 | PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6, | |||
/** TLS over IPv6 */ | ||||
PJSIP_TRANSPORT_TLS6 = PJSIP_TRANSPORT_TLS + PJSIP_TRANSPORT_IPV6 | ||||
} pjsip_transport_type_e; | } pjsip_transport_type_e; | |||
/** | /** | |||
* Forward declaration for endpoint (sip_endpoint.h). | * Forward declaration for endpoint (sip_endpoint.h). | |||
*/ | */ | |||
typedef struct pjsip_endpoint pjsip_endpoint; | typedef struct pjsip_endpoint pjsip_endpoint; | |||
/** | /** | |||
* Forward declaration for transactions (sip_transaction.h). | * Forward declaration for transactions (sip_transaction.h). | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 5 lines changed or added | |||
sip_uri.h | sip_uri.h | |||
---|---|---|---|---|
/* $Id: sip_uri.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: sip_uri.h 4370 2013-02-26 05:30:00Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 225 | skipping to change at line 225 | |||
/** | /** | |||
* The declaration of 'base class' for all URI scheme. | * The declaration of 'base class' for all URI scheme. | |||
*/ | */ | |||
struct pjsip_uri | struct pjsip_uri | |||
{ | { | |||
/** All URIs must have URI virtual function table as their first member . */ | /** All URIs must have URI virtual function table as their first member . */ | |||
pjsip_uri_vptr *vptr; | pjsip_uri_vptr *vptr; | |||
}; | }; | |||
/** | /** | |||
* This macro checks that the URL is a "sip:" or "sips:" URL. | * This macro checks that the URL is a "sip:" URL. | |||
* @param url The URL (pointer to) | * @param url The URL (pointer to) | |||
* @return non-zero if TRUE. | * @return non-zero if TRUE. | |||
*/ | */ | |||
#define PJSIP_URI_SCHEME_IS_SIP(url) \ | #define PJSIP_URI_SCHEME_IS_SIP(url) \ | |||
(pj_strnicmp2(pjsip_uri_get_scheme(url), "sip", 3)==0) | (pj_stricmp2(pjsip_uri_get_scheme(url), "sip")==0) | |||
/** | /** | |||
* This macro checks that the URL is a "sips:" URL (not SIP). | * This macro checks that the URL is a "sips:" URL (not SIP). | |||
* @param url The URL (pointer to) | * @param url The URL (pointer to) | |||
* @return non-zero if TRUE. | * @return non-zero if TRUE. | |||
*/ | */ | |||
#define PJSIP_URI_SCHEME_IS_SIPS(url) \ | #define PJSIP_URI_SCHEME_IS_SIPS(url) \ | |||
(pj_strnicmp2(pjsip_uri_get_scheme(url), "sips", 4)==0) | (pj_stricmp2(pjsip_uri_get_scheme(url), "sips")==0) | |||
/** | /** | |||
* This macro checks that the URL is a "tel:" URL. | * This macro checks that the URL is a "tel:" URL. | |||
* @param url The URL (pointer to) | * @param url The URL (pointer to) | |||
* @return non-zero if TRUE. | * @return non-zero if TRUE. | |||
*/ | */ | |||
#define PJSIP_URI_SCHEME_IS_TEL(url) \ | #define PJSIP_URI_SCHEME_IS_TEL(url) \ | |||
(pj_strnicmp2(pjsip_uri_get_scheme(url), "tel", 3)==0) | (pj_stricmp2(pjsip_uri_get_scheme(url), "tel")==0) | |||
/** | /** | |||
* Generic function to get the URI scheme. | * Generic function to get the URI scheme. | |||
* @param uri the URI object. | * @param uri the URI object. | |||
* @return the URI scheme. | * @return the URI scheme. | |||
*/ | */ | |||
PJ_INLINE(const pj_str_t*) pjsip_uri_get_scheme(const void *uri) | PJ_INLINE(const pj_str_t*) pjsip_uri_get_scheme(const void *uri) | |||
{ | { | |||
return (*((pjsip_uri*)uri)->vptr->p_get_scheme)(uri); | return (*((pjsip_uri*)uri)->vptr->p_get_scheme)(uri); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
sip_util.h | sip_util.h | |||
---|---|---|---|---|
/* $Id: sip_util.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: sip_util.h 4347 2013-02-13 10:19:25Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 93 | skipping to change at line 93 | |||
*/ | */ | |||
PJSIP_REDIRECT_REJECT, | PJSIP_REDIRECT_REJECT, | |||
/** | /** | |||
* Accept the redirection to the current target. The INVITE request | * Accept the redirection to the current target. The INVITE request | |||
* will be resent to the current target. | * will be resent to the current target. | |||
*/ | */ | |||
PJSIP_REDIRECT_ACCEPT, | PJSIP_REDIRECT_ACCEPT, | |||
/** | /** | |||
* Accept the redirection to the current target and replace the To | ||||
* header in the INVITE request with the current target. The INVITE | ||||
* request will be resent to the current target. | ||||
*/ | ||||
PJSIP_REDIRECT_ACCEPT_REPLACE, | ||||
/** | ||||
* Defer the redirection decision, for example to request permission | * Defer the redirection decision, for example to request permission | |||
* from the end user. | * from the end user. | |||
*/ | */ | |||
PJSIP_REDIRECT_PENDING, | PJSIP_REDIRECT_PENDING, | |||
/** | /** | |||
* Stop the whole redirection process altogether. This will cause | * Stop the whole redirection process altogether. This will cause | |||
* the invite session to be disconnected. | * the invite session to be disconnected. | |||
*/ | */ | |||
PJSIP_REDIRECT_STOP | PJSIP_REDIRECT_STOP | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 8 lines changed or added | |||
sock.h | sock.h | |||
---|---|---|---|---|
/* $Id: sock.h 3841 2011-10-24 09:28:13Z ming $ */ | /* $Id: sock.h 4343 2013-02-07 09:35:34Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 1144 | skipping to change at line 1144 | |||
* @param sockfd The socket descriptor. | * @param sockfd The socket descriptor. | |||
* @param addr Local address to bind the socket to, in host byte order. | * @param addr Local address to bind the socket to, in host byte order. | |||
* @param port The local port to bind the socket to, in host byte order . | * @param port The local port to bind the socket to, in host byte order . | |||
* | * | |||
* @return Zero on success. | * @return Zero on success. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_sock_bind_in( pj_sock_t sockfd, | PJ_DECL(pj_status_t) pj_sock_bind_in( pj_sock_t sockfd, | |||
pj_uint32_t addr, | pj_uint32_t addr, | |||
pj_uint16_t port); | pj_uint16_t port); | |||
/** | ||||
* Bind the IP socket sockfd to the given address and a random port in the | ||||
* specified range. | ||||
* | ||||
* @param sockfd The socket desriptor. | ||||
* @param addr The local address and port to bind the socket to. | ||||
* @param port_range The port range, relative the to start port number | ||||
* specified in port field in #addr. Note that if the | ||||
* port is zero, this param will be ignored. | ||||
* @param max_try Maximum retries. | ||||
* | ||||
* @return Zero on success. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_sock_bind_random( pj_sock_t sockfd, | ||||
const pj_sockaddr_t *addr, | ||||
pj_uint16_t port_range, | ||||
pj_uint16_t max_try); | ||||
#if PJ_HAS_TCP | #if PJ_HAS_TCP | |||
/** | /** | |||
* Listen for incoming connection. This function only applies to connection | * Listen for incoming connection. This function only applies to connection | |||
* oriented sockets (such as PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET), and it | * oriented sockets (such as PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET), and it | |||
* indicates the willingness to accept incoming connections. | * indicates the willingness to accept incoming connections. | |||
* | * | |||
* @param sockfd The socket descriptor. | * @param sockfd The socket descriptor. | |||
* @param backlog Defines the maximum length the queue of pending | * @param backlog Defines the maximum length the queue of pending | |||
* connections may grow to. | * connections may grow to. | |||
* | * | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 19 lines changed or added | |||
stun_config.h | stun_config.h | |||
---|---|---|---|---|
/* $Id: stun_config.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: stun_config.h 4199 2012-07-05 10:52:55Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 82 | skipping to change at line 82 | |||
unsigned rto_msec; | unsigned rto_msec; | |||
/** | /** | |||
* The interval to cache outgoing STUN response in the STUN session, | * The interval to cache outgoing STUN response in the STUN session, | |||
* in miliseconds. | * in miliseconds. | |||
* | * | |||
* Default 10000 (10 seconds). | * Default 10000 (10 seconds). | |||
*/ | */ | |||
unsigned res_cache_msec; | unsigned res_cache_msec; | |||
/** | ||||
* Software name to be included in all STUN requests and responses. | ||||
* | ||||
* Default: PJNATH_STUN_SOFTWARE_NAME. | ||||
*/ | ||||
pj_str_t software_name; | ||||
} pj_stun_config; | } pj_stun_config; | |||
/** | /** | |||
* Initialize STUN config. | * Initialize STUN config. | |||
*/ | */ | |||
PJ_INLINE(void) pj_stun_config_init(pj_stun_config *cfg, | PJ_INLINE(void) pj_stun_config_init(pj_stun_config *cfg, | |||
pj_pool_factory *factory, | pj_pool_factory *factory, | |||
unsigned options, | unsigned options, | |||
pj_ioqueue_t *ioqueue, | pj_ioqueue_t *ioqueue, | |||
pj_timer_heap_t *timer_heap) | pj_timer_heap_t *timer_heap) | |||
{ | { | |||
pj_bzero(cfg, sizeof(*cfg)); | pj_bzero(cfg, sizeof(*cfg)); | |||
cfg->pf = factory; | cfg->pf = factory; | |||
cfg->options = options; | cfg->options = options; | |||
cfg->ioqueue = ioqueue; | cfg->ioqueue = ioqueue; | |||
cfg->timer_heap = timer_heap; | cfg->timer_heap = timer_heap; | |||
cfg->rto_msec = PJ_STUN_RTO_VALUE; | cfg->rto_msec = PJ_STUN_RTO_VALUE; | |||
cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION; | cfg->res_cache_msec = PJ_STUN_RES_CACHE_DURATION; | |||
cfg->software_name = pj_str((char*)PJNATH_STUN_SOFTWARE_NAME); | ||||
} | } | |||
/** | /** | |||
* Check that STUN config is valid. | * Check that STUN config is valid. | |||
*/ | */ | |||
PJ_INLINE(pj_status_t) pj_stun_config_check_valid(const pj_stun_config *cfg ) | PJ_INLINE(pj_status_t) pj_stun_config_check_valid(const pj_stun_config *cfg ) | |||
{ | { | |||
PJ_ASSERT_RETURN(cfg->ioqueue && cfg->pf && cfg->timer_heap && | PJ_ASSERT_RETURN(cfg->ioqueue && cfg->pf && cfg->timer_heap && | |||
cfg->rto_msec && cfg->res_cache_msec, PJ_EINVAL); | cfg->rto_msec && cfg->res_cache_msec, PJ_EINVAL); | |||
return PJ_SUCCESS; | return PJ_SUCCESS; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added | |||
stun_session.h | stun_session.h | |||
---|---|---|---|---|
/* $Id: stun_session.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: stun_session.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 33 | skipping to change at line 33 | |||
/** | /** | |||
* @file stun_session.h | * @file stun_session.h | |||
* @brief STUN session management for client/server. | * @brief STUN session management for client/server. | |||
*/ | */ | |||
#include <pjnath/stun_msg.h> | #include <pjnath/stun_msg.h> | |||
#include <pjnath/stun_auth.h> | #include <pjnath/stun_auth.h> | |||
#include <pjnath/stun_config.h> | #include <pjnath/stun_config.h> | |||
#include <pjnath/stun_transaction.h> | #include <pjnath/stun_transaction.h> | |||
#include <pj/list.h> | #include <pj/list.h> | |||
#include <pj/lock.h> | ||||
#include <pj/timer.h> | #include <pj/timer.h> | |||
PJ_BEGIN_DECL | PJ_BEGIN_DECL | |||
/* ************************************************************************ **/ | /* ************************************************************************ **/ | |||
/** | /** | |||
* @addtogroup PJNATH_STUN_SESSION | * @addtogroup PJNATH_STUN_SESSION | |||
* @{ | * @{ | |||
* | * | |||
* This is is a transport-independent object to manage a client or server | * This is is a transport-independent object to manage a client or server | |||
skipping to change at line 379 | skipping to change at line 380 | |||
} pj_stun_sess_msg_log_flag; | } pj_stun_sess_msg_log_flag; | |||
/** | /** | |||
* Create a STUN session. | * Create a STUN session. | |||
* | * | |||
* @param cfg The STUN endpoint, to be used to register timers etc . | * @param cfg The STUN endpoint, to be used to register timers etc . | |||
* @param name Optional name to be associated with this instance. T he | * @param name Optional name to be associated with this instance. T he | |||
* name will be used for example for logging purpose. | * name will be used for example for logging purpose. | |||
* @param cb Session callback. | * @param cb Session callback. | |||
* @param fingerprint Enable message fingerprint for outgoing messages. | * @param fingerprint Enable message fingerprint for outgoing messages. | |||
* @param grp_lock Optional group lock to be used by this session. | ||||
* If NULL, the session will create one itself. | ||||
* @param p_sess Pointer to receive STUN session instance. | * @param p_sess Pointer to receive STUN session instance. | |||
* | * | |||
* @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) pj_stun_session_create(pj_stun_config *cfg, | PJ_DECL(pj_status_t) pj_stun_session_create(pj_stun_config *cfg, | |||
const char *name, | const char *name, | |||
const pj_stun_session_cb *cb, | const pj_stun_session_cb *cb, | |||
pj_bool_t fingerprint, | pj_bool_t fingerprint, | |||
pj_grp_lock_t *grp_lock, | ||||
pj_stun_session **p_sess); | pj_stun_session **p_sess); | |||
/** | /** | |||
* Destroy the STUN session and all objects created in the context of | * Destroy the STUN session and all objects created in the context of | |||
* this session. | * this session. | |||
* | * | |||
* @param sess The STUN session instance. | * @param sess The STUN session instance. | |||
* | * | |||
* @return PJ_SUCCESS on success, or the appropriate error code. | * @return PJ_SUCCESS on success, or the appropriate error code. | |||
* This function will return PJ_EPENDING if the operation | * This function will return PJ_EPENDING if the operation | |||
skipping to change at line 426 | skipping to change at line 430 | |||
* Retrieve the user data previously associated to this STUN session with | * Retrieve the user data previously associated to this STUN session with | |||
* pj_stun_session_set_user_data(). | * pj_stun_session_set_user_data(). | |||
* | * | |||
* @param sess The STUN session instance. | * @param sess The STUN session instance. | |||
* | * | |||
* @return The user data associated with this STUN session. | * @return The user data associated with this STUN session. | |||
*/ | */ | |||
PJ_DECL(void*) pj_stun_session_get_user_data(pj_stun_session *sess); | PJ_DECL(void*) pj_stun_session_get_user_data(pj_stun_session *sess); | |||
/** | /** | |||
* Change the lock object used by the STUN session. By default, the STUN | ||||
* session uses a mutex to protect its internal data. If application alread | ||||
y | ||||
* protects access to STUN session with higher layer lock, it may disable | ||||
* the mutex protection in the STUN session by changing the STUN session | ||||
* lock to a NULL mutex. | ||||
* | ||||
* @param sess The STUN session instance. | ||||
* @param lock New lock instance to be used by the STUN session. | ||||
* @param auto_del Specify whether STUN session should destroy this | ||||
* lock instance when it's destroyed. | ||||
*/ | ||||
PJ_DECL(pj_status_t) pj_stun_session_set_lock(pj_stun_session *sess, | ||||
pj_lock_t *lock, | ||||
pj_bool_t auto_del); | ||||
/** | ||||
* Set SOFTWARE name to be included in all requests and responses. | * Set SOFTWARE name to be included in all requests and responses. | |||
* | * | |||
* @param sess The STUN session instance. | * @param sess The STUN session instance. | |||
* @param sw Software name string. If this argument is NULL or | * @param sw Software name string. If this argument is NULL or | |||
* empty, the session will not include SOFTWARE attribute | * empty, the session will not include SOFTWARE attribute | |||
* in STUN requests and responses. | * in STUN requests and responses. | |||
* | * | |||
* @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) pj_stun_session_set_software_name(pj_stun_session *ses s, | PJ_DECL(pj_status_t) pj_stun_session_set_software_name(pj_stun_session *ses s, | |||
skipping to change at line 677 | skipping to change at line 665 | |||
pj_bool_t notify, | pj_bool_t notify, | |||
pj_status_t status); | pj_status_t status); | |||
/** | /** | |||
* Explicitly request retransmission of the request. Normally application | * Explicitly request retransmission of the request. Normally application | |||
* doesn't need to do this, but this functionality is needed by ICE to | * doesn't need to do this, but this functionality is needed by ICE to | |||
* speed up connectivity check completion. | * speed up connectivity check completion. | |||
* | * | |||
* @param sess The STUN session instance. | * @param sess The STUN session instance. | |||
* @param tdata The request message previously sent. | * @param tdata The request message previously sent. | |||
* @param mod_count Boolean flag to indicate whether transmission count | ||||
* needs to be incremented. | ||||
* | * | |||
* @return PJ_SUCCESS on success, or the appropriate error. | * @return PJ_SUCCESS on success, or the appropriate error. | |||
* This function will return PJNATH_ESTUNDESTROYED if | * This function will return PJNATH_ESTUNDESTROYED if | |||
* application has destroyed the session in \a on_send_msg( ) | * application has destroyed the session in \a on_send_msg( ) | |||
* callback. | * callback. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_stun_session_retransmit_req(pj_stun_session *sess, | PJ_DECL(pj_status_t) pj_stun_session_retransmit_req(pj_stun_session *sess, | |||
pj_stun_tx_data *tdata); | pj_stun_tx_data *tdata, | |||
pj_bool_t mod_count); | ||||
/** | /** | |||
* Application must call this function to notify the STUN session about | * Application must call this function to notify the STUN session about | |||
* the arrival of STUN packet. The STUN packet MUST have been checked | * the arrival of STUN packet. The STUN packet MUST have been checked | |||
* first with #pj_stun_msg_check() to verify that this is indeed a valid | * first with #pj_stun_msg_check() to verify that this is indeed a valid | |||
* STUN packet. | * STUN packet. | |||
* | * | |||
* The STUN session will decode the packet into pj_stun_msg, and process | * The STUN session will decode the packet into pj_stun_msg, and process | |||
* the message accordingly. If the message is a response, it will search | * the message accordingly. If the message is a response, it will search | |||
* through the outstanding STUN client transactions for a matching | * through the outstanding STUN client transactions for a matching | |||
End of changes. 7 change blocks. | ||||
19 lines changed or deleted | 9 lines changed or added | |||
stun_simple.h | stun_simple.h | |||
---|---|---|---|---|
/* $Id: stun_simple.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: stun_simple.h 4224 2012-08-09 05:21:25Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 196 | skipping to change at line 196 | |||
* are returned by servers. | * are returned by servers. | |||
* - etc. | * - etc. | |||
* | * | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, | PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, | |||
int sock_cnt, pj_sock_t sock[] , | int sock_cnt, pj_sock_t sock[] , | |||
const pj_str_t *srv1, int port 1, | const pj_str_t *srv1, int port 1, | |||
const pj_str_t *srv2, int port 2, | const pj_str_t *srv2, int port 2, | |||
pj_sockaddr_in mapped_addr[]); | pj_sockaddr_in mapped_addr[]); | |||
/* | ||||
* This structre describes configurable setting for requesting mapped addre | ||||
ss. | ||||
*/ | ||||
typedef struct pjstun_setting | ||||
{ | ||||
/** | ||||
* Specifies whether STUN request generated by old STUN library should | ||||
* insert magic cookie (specified in RFC 5389) in the transaction ID. | ||||
*/ | ||||
pj_bool_t use_stun2; | ||||
/** | ||||
* Host name or IP address string of the first STUN server. | ||||
*/ | ||||
pj_str_t srv1; | ||||
/** | ||||
* The port number of the first STUN server. | ||||
*/ | ||||
int port1; | ||||
/** | ||||
* Host name or IP address string of the second STUN server. | ||||
*/ | ||||
pj_str_t srv2; | ||||
/** | ||||
* The port number of the second STUN server. | ||||
*/ | ||||
int port2; | ||||
} pjstun_setting; | ||||
/** | ||||
* Another version of mapped address resolution of local sockets to multipl | ||||
e | ||||
* STUN servers configured in #pjstun_setting. This function is able to fin | ||||
d | ||||
* the mapped addresses of multiple sockets simultaneously, and for each | ||||
* socket, two requests will be sent to two different STUN servers to see i | ||||
f | ||||
* both servers get the same public address for the same socket. (Note that | ||||
* application can specify the same address for the two servers, but still | ||||
* two requests will be sent for each server). | ||||
* | ||||
* This function will perform necessary retransmissions of the requests if | ||||
* response is not received within a predetermined period. When all respons | ||||
es | ||||
* have been received, the function will compare the mapped addresses retur | ||||
ned | ||||
* by the servers, and when both are equal, the address will be returned in | ||||
* \a mapped_addr argument. | ||||
* | ||||
* @param pf The pool factory where memory will be allocated from | ||||
. | ||||
* @param opt The STUN settings. | ||||
* @param sock_cnt Number of sockets in the socket array. | ||||
* @param sock Array of local UDP sockets which public addresses ar | ||||
e | ||||
* to be queried from the STUN servers. | ||||
* @param mapped_addr Array to receive the mapped public address of the lo | ||||
cal | ||||
* UDP sockets, when the function returns PJ_SUCCESS. | ||||
* | ||||
* @return This functions returns PJ_SUCCESS if responses are | ||||
* received from all servers AND all servers returned t | ||||
he | ||||
* same mapped public address. Otherwise this function | ||||
may | ||||
* return one of the following error codes: | ||||
* - PJLIB_UTIL_ESTUNNOTRESPOND: no respons from server | ||||
s. | ||||
* - PJLIB_UTIL_ESTUNSYMMETRIC: different mapped addres | ||||
ses | ||||
* are returned by servers. | ||||
* - etc. | ||||
* | ||||
*/ | ||||
PJ_DECL(pj_status_t) pjstun_get_mapped_addr2( pj_pool_factory *pf, | ||||
const pjstun_setting *opt, | ||||
int sock_cnt, | ||||
pj_sock_t sock[], | ||||
pj_sockaddr_in mapped_addr[]); | ||||
PJ_END_DECL | PJ_END_DECL | |||
/** | /** | |||
* @} | * @} | |||
*/ | */ | |||
#endif /* __PJSTUN_H__ */ | #endif /* __PJSTUN_H__ */ | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 86 lines changed or added | |||
stun_sock.h | stun_sock.h | |||
---|---|---|---|---|
/* $Id: stun_sock.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: stun_sock.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 30 | skipping to change at line 30 | |||
#ifndef __PJNATH_STUN_SOCK_H__ | #ifndef __PJNATH_STUN_SOCK_H__ | |||
#define __PJNATH_STUN_SOCK_H__ | #define __PJNATH_STUN_SOCK_H__ | |||
/** | /** | |||
* @file stun_sock.h | * @file stun_sock.h | |||
* @brief STUN aware socket transport | * @brief STUN aware socket transport | |||
*/ | */ | |||
#include <pjnath/stun_config.h> | #include <pjnath/stun_config.h> | |||
#include <pjlib-util/resolver.h> | #include <pjlib-util/resolver.h> | |||
#include <pj/ioqueue.h> | #include <pj/ioqueue.h> | |||
#include <pj/lock.h> | ||||
#include <pj/sock.h> | #include <pj/sock.h> | |||
#include <pj/sock_qos.h> | #include <pj/sock_qos.h> | |||
PJ_BEGIN_DECL | PJ_BEGIN_DECL | |||
/** | /** | |||
* @addtogroup PJNATH_STUN_SOCK | * @addtogroup PJNATH_STUN_SOCK | |||
* @{ | * @{ | |||
* | * | |||
* The STUN transport provides asynchronous UDP like socket transport | * The STUN transport provides asynchronous UDP like socket transport | |||
skipping to change at line 215 | skipping to change at line 216 | |||
} pj_stun_sock_info; | } pj_stun_sock_info; | |||
/** | /** | |||
* This describe the settings to be given to the STUN transport during its | * This describe the settings to be given to the STUN transport during its | |||
* creation. Application should initialize this structure by calling | * creation. Application should initialize this structure by calling | |||
* #pj_stun_sock_cfg_default(). | * #pj_stun_sock_cfg_default(). | |||
*/ | */ | |||
typedef struct pj_stun_sock_cfg | typedef struct pj_stun_sock_cfg | |||
{ | { | |||
/** | /** | |||
* Packet buffer size. Default value is PJ_STUN_SOCK_PKT_LEN. | * The group lock to be used by the STUN socket. If NULL, the STUN sock | |||
et | ||||
* will create one internally. | ||||
* | ||||
* Default: NULL | ||||
*/ | ||||
pj_grp_lock_t *grp_lock; | ||||
/** | ||||
* Packet buffer size. | ||||
* | ||||
* Default value is PJ_STUN_SOCK_PKT_LEN. | ||||
*/ | */ | |||
unsigned max_pkt_size; | unsigned max_pkt_size; | |||
/** | /** | |||
* Specify the number of simultaneous asynchronous read operations to | * Specify the number of simultaneous asynchronous read operations to | |||
* be invoked to the ioqueue. Having more than one read operations will | * be invoked to the ioqueue. Having more than one read operations will | |||
* increase performance on multiprocessor systems since the application | * increase performance on multiprocessor systems since the application | |||
* will be able to process more than one incoming packets simultaneousl y. | * will be able to process more than one incoming packets simultaneousl y. | |||
* Default value is 1. | * Default value is 1. | |||
*/ | */ | |||
unsigned async_cnt; | unsigned async_cnt; | |||
/** | /** | |||
* Specify the interface where the socket should be bound to. If the | * Specify the interface where the socket should be bound to. If the | |||
* address is zero, socket will be bound to INADDR_ANY. If the address | * address is zero, socket will be bound to INADDR_ANY. If the address | |||
* is non-zero, socket will be bound to this address only, and the | * is non-zero, socket will be bound to this address only, and the | |||
* transport will have only one address alias (the \a alias_cnt field | * transport will have only one address alias (the \a alias_cnt field | |||
* in #pj_stun_sock_info structure. | * in #pj_stun_sock_info structure. If the port is set to zero, the | |||
* socket will bind at any port (chosen by the OS). | ||||
*/ | */ | |||
pj_sockaddr bound_addr; | pj_sockaddr bound_addr; | |||
/** | /** | |||
* Specify the port range for STUN socket binding, relative to the star | ||||
t | ||||
* port number specified in \a bound_addr. Note that this setting is on | ||||
ly | ||||
* applicable when the start port number is non zero. | ||||
* | ||||
* Default value is zero. | ||||
*/ | ||||
pj_uint16_t port_range; | ||||
/** | ||||
* Specify the STUN keep-alive duration, in seconds. The STUN transport | * Specify the STUN keep-alive duration, in seconds. The STUN transport | |||
* does keep-alive by sending STUN Binding request to the STUN server. | * does keep-alive by sending STUN Binding request to the STUN server. | |||
* If this value is zero, the PJ_STUN_KEEP_ALIVE_SEC value will be used . | * If this value is zero, the PJ_STUN_KEEP_ALIVE_SEC value will be used . | |||
* If the value is negative, it will disable STUN keep-alive. | * If the value is negative, it will disable STUN keep-alive. | |||
*/ | */ | |||
int ka_interval; | int ka_interval; | |||
/** | /** | |||
* QoS traffic type to be set on this transport. When application wants | * QoS traffic type to be set on this transport. When application wants | |||
* to apply QoS tagging to the transport, it's preferable to set this | * to apply QoS tagging to the transport, it's preferable to set this | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 27 lines changed or added | |||
stun_transaction.h | stun_transaction.h | |||
---|---|---|---|---|
/* $Id: stun_transaction.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: stun_transaction.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 30 | skipping to change at line 30 | |||
#ifndef __PJNATH_STUN_TRANSACTION_H__ | #ifndef __PJNATH_STUN_TRANSACTION_H__ | |||
#define __PJNATH_STUN_TRANSACTION_H__ | #define __PJNATH_STUN_TRANSACTION_H__ | |||
/** | /** | |||
* @file stun_transaction.h | * @file stun_transaction.h | |||
* @brief STUN transaction | * @brief STUN transaction | |||
*/ | */ | |||
#include <pjnath/stun_msg.h> | #include <pjnath/stun_msg.h> | |||
#include <pjnath/stun_config.h> | #include <pjnath/stun_config.h> | |||
#include <pj/lock.h> | ||||
PJ_BEGIN_DECL | PJ_BEGIN_DECL | |||
/* ************************************************************************ **/ | /* ************************************************************************ **/ | |||
/** | /** | |||
* @defgroup PJNATH_STUN_TRANSACTION STUN Client Transaction | * @defgroup PJNATH_STUN_TRANSACTION STUN Client Transaction | |||
* @brief STUN client transaction | * @brief STUN client transaction | |||
* @ingroup PJNATH_STUN_BASE | * @ingroup PJNATH_STUN_BASE | |||
* @{ | * @{ | |||
* | * | |||
skipping to change at line 122 | skipping to change at line 123 | |||
/** | /** | |||
* Create an instance of STUN client transaction. The STUN client | * Create an instance of STUN client transaction. The STUN client | |||
* transaction is used to transmit outgoing STUN request and to | * transaction is used to transmit outgoing STUN request and to | |||
* ensure the reliability of the request by periodically retransmitting | * ensure the reliability of the request by periodically retransmitting | |||
* the request, if necessary. | * the request, if necessary. | |||
* | * | |||
* @param cfg The STUN endpoint, which will be used to retrieve | * @param cfg The STUN endpoint, which will be used to retrieve | |||
* various settings for the transaction. | * various settings for the transaction. | |||
* @param pool Pool to be used to allocate memory from. | * @param pool Pool to be used to allocate memory from. | |||
* @param grp_lock Group lock to synchronize. | ||||
* @param cb Callback structure, to be used by the transaction | * @param cb Callback structure, to be used by the transaction | |||
* to send message and to notify the application about | * to send message and to notify the application about | |||
* the completion of the transaction. | * the completion of the transaction. | |||
* @param p_tsx Pointer to receive the transaction instance. | * @param p_tsx Pointer to receive the transaction instance. | |||
* | * | |||
* @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) pj_stun_client_tsx_create( pj_stun_config *cfg, | PJ_DECL(pj_status_t) pj_stun_client_tsx_create( pj_stun_config *cfg, | |||
pj_pool_t *pool, | pj_pool_t *pool, | |||
pj_grp_lock_t *grp_lock, | ||||
const pj_stun_tsx_cb *cb, | const pj_stun_tsx_cb *cb, | |||
pj_stun_client_tsx **p_tsx); | pj_stun_client_tsx **p_tsx); | |||
/** | /** | |||
* Schedule timer to destroy the transaction after the transaction is | * Schedule timer to destroy the transaction after the transaction is | |||
* complete. Application normally calls this function in the on_complete() | * complete. Application normally calls this function in the on_complete() | |||
* callback. When this timer elapsed, the on_destroy() callback will be | * callback. When this timer elapsed, the on_destroy() callback will be | |||
* called. | * called. | |||
* | * | |||
* This is convenient to let the STUN transaction absorbs any response | * This is convenient to let the STUN transaction absorbs any response | |||
skipping to change at line 156 | skipping to change at line 159 | |||
* @param delay The delay interval before on_destroy() callb ack | * @param delay The delay interval before on_destroy() callb ack | |||
* is called. | * is called. | |||
* | * | |||
* @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) | PJ_DECL(pj_status_t) | |||
pj_stun_client_tsx_schedule_destroy(pj_stun_client_tsx *tsx, | pj_stun_client_tsx_schedule_destroy(pj_stun_client_tsx *tsx, | |||
const pj_time_val *delay); | const pj_time_val *delay); | |||
/** | /** | |||
* Destroy a STUN client transaction immediately. This function can be | * Stop the client transaction. | |||
* called at any time to stop the transaction and destroy it. | ||||
* | * | |||
* @param tsx The STUN transaction. | * @param tsx The STUN transaction. | |||
* | * | |||
* @return PJ_SUCCESS on success or PJ_EINVAL if the parameter | * @return PJ_SUCCESS on success or PJ_EINVAL if the parameter | |||
* is NULL. | * is NULL. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_stun_client_tsx_destroy(pj_stun_client_tsx *tsx); | PJ_DECL(pj_status_t) pj_stun_client_tsx_stop(pj_stun_client_tsx *tsx); | |||
/** | /** | |||
* Check if transaction has completed. | * Check if transaction has completed. | |||
* | * | |||
* @param tsx The STUN transaction. | * @param tsx The STUN transaction. | |||
* | * | |||
* @return Non-zero if transaction has completed. | * @return Non-zero if transaction has completed. | |||
*/ | */ | |||
PJ_DECL(pj_bool_t) pj_stun_client_tsx_is_complete(pj_stun_client_tsx *tsx); | PJ_DECL(pj_bool_t) pj_stun_client_tsx_is_complete(pj_stun_client_tsx *tsx); | |||
skipping to change at line 227 | skipping to change at line 229 | |||
pj_bool_t retransmit, | pj_bool_t retransmit, | |||
void *pkt, | void *pkt, | |||
unsigned pkt_len); | unsigned pkt_len); | |||
/** | /** | |||
* Request to retransmit the request. Normally application should not need | * Request to retransmit the request. Normally application should not need | |||
* to call this function since retransmission would be handled internally, | * to call this function since retransmission would be handled internally, | |||
* but this functionality is needed by ICE. | * but this functionality is needed by ICE. | |||
* | * | |||
* @param tsx The STUN client transaction instance. | * @param tsx The STUN client transaction instance. | |||
* @param mod_count Boolean flag to indicate whether transmission count | ||||
* needs to be incremented. | ||||
* | * | |||
* @return PJ_SUCCESS on success, or PJNATH_ESTUNDESTROYED | * @return PJ_SUCCESS on success, or PJNATH_ESTUNDESTROYED | |||
* when the user has destroyed the transaction in | * when the user has destroyed the transaction in | |||
* \a on_send_msg() callback, or any other error code | * \a on_send_msg() callback, or any other error code | |||
* as returned by \a on_send_msg() callback. | * as returned by \a on_send_msg() callback. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_stun_client_tsx_retransmit(pj_stun_client_tsx *tsx) | PJ_DECL(pj_status_t) pj_stun_client_tsx_retransmit(pj_stun_client_tsx *tsx, | |||
; | pj_bool_t mod_count); | |||
/** | /** | |||
* Notify the STUN transaction about the arrival of STUN response. | * Notify the STUN transaction about the arrival of STUN response. | |||
* If the STUN response contains a final error (300 and greater), the | * If the STUN response contains a final error (300 and greater), the | |||
* transaction will be terminated and callback will be called. If the | * transaction will be terminated and callback will be called. If the | |||
* STUN response contains response code 100-299, retransmission | * STUN response contains response code 100-299, retransmission | |||
* will cease, but application must still call this function again | * will cease, but application must still call this function again | |||
* with a final response later to allow the transaction to complete. | * with a final response later to allow the transaction to complete. | |||
* | * | |||
* @param tsx The STUN client transaction instance. | * @param tsx The STUN client transaction instance. | |||
End of changes. 8 change blocks. | ||||
6 lines changed or deleted | 10 lines changed or added | |||
timer.h | timer.h | |||
---|---|---|---|---|
/* $Id: timer.h 4154 2012-06-05 10:41:17Z bennylp $ */ | /* $Id: timer.h 4359 2013-02-21 11:18:36Z bennylp $ */ | |||
/* | /* | |||
* 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 | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
skipping to change at line 27 | skipping to change at line 27 | |||
#ifndef __PJ_TIMER_H__ | #ifndef __PJ_TIMER_H__ | |||
#define __PJ_TIMER_H__ | #define __PJ_TIMER_H__ | |||
/** | /** | |||
* @file timer.h | * @file timer.h | |||
* @brief Timer Heap | * @brief Timer Heap | |||
*/ | */ | |||
#include <pj/types.h> | #include <pj/types.h> | |||
#include <pj/lock.h> | ||||
PJ_BEGIN_DECL | PJ_BEGIN_DECL | |||
/** | /** | |||
* @defgroup PJ_TIMER Timer Heap Management. | * @defgroup PJ_TIMER Timer Heap Management. | |||
* @ingroup PJ_MISC | * @ingroup PJ_MISC | |||
* @brief | * @brief | |||
* The timer scheduling implementation here is based on ACE library's | * The timer scheduling implementation here is based on ACE library's | |||
* ACE_Timer_Heap, with only little modification to suit our library's styl e | * ACE_Timer_Heap, with only little modification to suit our library's styl e | |||
* (I even left most of the comments in the original source). | * (I even left most of the comments in the original source). | |||
skipping to change at line 119 | skipping to change at line 120 | |||
* Application should not touch this ID. | * Application should not touch this ID. | |||
*/ | */ | |||
pj_timer_id_t _timer_id; | pj_timer_id_t _timer_id; | |||
/** | /** | |||
* The future time when the timer expires, which the value is updated | * The future time when the timer expires, which the value is updated | |||
* by timer heap when the timer is scheduled. | * by timer heap when the timer is scheduled. | |||
*/ | */ | |||
pj_time_val _timer_value; | pj_time_val _timer_value; | |||
/** | ||||
* Internal: the group lock used by this entry, set when | ||||
* pj_timer_heap_schedule_w_lock() is used. | ||||
*/ | ||||
pj_grp_lock_t *_grp_lock; | ||||
#if PJ_TIMER_DEBUG | #if PJ_TIMER_DEBUG | |||
const char *src_file; | const char *src_file; | |||
int src_line; | int src_line; | |||
#endif | #endif | |||
} pj_timer_entry; | } pj_timer_entry; | |||
/** | /** | |||
* Calculate memory size required to create a timer heap. | * Calculate memory size required to create a timer heap. | |||
* | * | |||
* @param count Number of timer entries to be supported. | * @param count Number of timer entries to be supported. | |||
skipping to change at line 228 | skipping to change at line 235 | |||
const pj_time_val *delay, | const pj_time_val *delay, | |||
const char *src_file, | const char *src_file, | |||
int src_line); | int src_line); | |||
#else | #else | |||
PJ_DECL(pj_status_t) pj_timer_heap_schedule( pj_timer_heap_t *ht, | PJ_DECL(pj_status_t) pj_timer_heap_schedule( pj_timer_heap_t *ht, | |||
pj_timer_entry *entry, | pj_timer_entry *entry, | |||
const pj_time_val *delay); | const pj_time_val *delay); | |||
#endif /* PJ_TIMER_DEBUG */ | #endif /* PJ_TIMER_DEBUG */ | |||
/** | /** | |||
* Cancel a previously registered timer. | * Schedule a timer entry which will expire AFTER the specified delay, and | |||
* increment the reference counter of the group lock while the timer entry | ||||
* is active. The group lock reference counter will automatically be releas | ||||
ed | ||||
* after the timer callback is called or when the timer is cancelled. | ||||
* | ||||
* @param ht The timer heap. | ||||
* @param entry The entry to be registered. | ||||
* @param id_val The value to be set to the "id" field of the timer entr | ||||
y | ||||
* once the timer is scheduled. | ||||
* @param delay The interval to expire. | ||||
* @param grp_lock The group lock. | ||||
* | ||||
* @return PJ_SUCCESS, or the appropriate error code. | ||||
*/ | ||||
#if PJ_TIMER_DEBUG | ||||
# define pj_timer_heap_schedule_w_grp_lock(ht,e,d,id,g) \ | ||||
pj_timer_heap_schedule_w_grp_lock_dbg(ht,e,d,id,g,__FILE__,__LINE__) | ||||
PJ_DECL(pj_status_t) pj_timer_heap_schedule_w_grp_lock_dbg( | ||||
pj_timer_heap_t *ht, | ||||
pj_timer_entry *entry, | ||||
const pj_time_val *delay, | ||||
int id_val, | ||||
pj_grp_lock_t *grp_lock, | ||||
const char *src_file, | ||||
int src_line); | ||||
#else | ||||
PJ_DECL(pj_status_t) pj_timer_heap_schedule_w_grp_lock( | ||||
pj_timer_heap_t *ht, | ||||
pj_timer_entry *entry, | ||||
const pj_time_val *delay | ||||
, | ||||
int id_val, | ||||
pj_grp_lock_t *grp_lock) | ||||
; | ||||
#endif /* PJ_TIMER_DEBUG */ | ||||
/** | ||||
* Cancel a previously registered timer. This will also decrement the | ||||
* reference counter of the group lock associated with the timer entry, | ||||
* if the entry was scheduled with one. | ||||
* | * | |||
* @param ht The timer heap. | * @param ht The timer heap. | |||
* @param entry The entry to be cancelled. | * @param entry The entry to be cancelled. | |||
* @return The number of timer cancelled, which should be one if t he | * @return The number of timer cancelled, which should be one if t he | |||
* entry has really been registered, or zero if no timer w as | * entry has really been registered, or zero if no timer w as | |||
* cancelled. | * cancelled. | |||
*/ | */ | |||
PJ_DECL(int) pj_timer_heap_cancel( pj_timer_heap_t *ht, | PJ_DECL(int) pj_timer_heap_cancel( pj_timer_heap_t *ht, | |||
pj_timer_entry *entry); | pj_timer_entry *entry); | |||
/** | /** | |||
* Cancel only if the previously registered timer is active. This will | ||||
* also decrement the reference counter of the group lock associated | ||||
* with the timer entry, if the entry was scheduled with one. In any | ||||
* case, set the "id" to the specified value. | ||||
* | ||||
* @param ht The timer heap. | ||||
* @param entry The entry to be cancelled. | ||||
* @param id_val Value to be set to "id" | ||||
* | ||||
* @return The number of timer cancelled, which should be one if t | ||||
he | ||||
* entry has really been registered, or zero if no timer w | ||||
as | ||||
* cancelled. | ||||
*/ | ||||
PJ_DECL(int) pj_timer_heap_cancel_if_active(pj_timer_heap_t *ht, | ||||
pj_timer_entry *entry, | ||||
int id_val); | ||||
/** | ||||
* Get the number of timer entries. | * Get the number of timer entries. | |||
* | * | |||
* @param ht The timer heap. | * @param ht The timer heap. | |||
* @return The number of timer entries. | * @return The number of timer entries. | |||
*/ | */ | |||
PJ_DECL(pj_size_t) pj_timer_heap_count( pj_timer_heap_t *ht ); | PJ_DECL(pj_size_t) pj_timer_heap_count( pj_timer_heap_t *ht ); | |||
/** | /** | |||
* Get the earliest time registered in the timer heap. The timer heap | * Get the earliest time registered in the timer heap. The timer heap | |||
* MUST have at least one timer being scheduled (application should use | * MUST have at least one timer being scheduled (application should use | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 71 lines changed or added | |||
transport.h | transport.h | |||
---|---|---|---|---|
/* $Id: transport.h 3664 2011-07-19 03:42:28Z nanang $ */ | /* $Id: transport.h 4345 2013-02-13 07:43:32Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 557 | skipping to change at line 557 | |||
info->specific_info_cnt = 0; | info->specific_info_cnt = 0; | |||
} | } | |||
/** | /** | |||
* Get media transport info from the specified transport and all underlying | * Get media transport info from the specified transport and all underlying | |||
* transports if any. The transport also contains information about socket info | * transports if any. The transport also contains information about socket info | |||
* which describes the local address of the transport, and would be needed | * which describes the local address of the transport, and would be needed | |||
* for example to fill in the "c=" and "m=" line of local SDP. | * for example to fill in the "c=" and "m=" line of local SDP. | |||
* | * | |||
* @param tp The transport. | * @param tp The transport. | |||
* @param info Media socket info to be initialized. | * @param info Media transport info to be initialized. | |||
* | * | |||
* @return PJ_SUCCESS on success. | * @return PJ_SUCCESS on success. | |||
*/ | */ | |||
PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, | PJ_INLINE(pj_status_t) pjmedia_transport_get_info(pjmedia_transport *tp, | |||
pjmedia_transport_info *in fo) | pjmedia_transport_info *in fo) | |||
{ | { | |||
if (tp && tp->op && tp->op->get_info) | if (tp && tp->op && tp->op->get_info) | |||
return (*tp->op->get_info)(tp, info); | return (*tp->op->get_info)(tp, info); | |||
return PJ_ENOTSUP; | return PJ_ENOTSUP; | |||
} | } | |||
/** | /** | |||
* Utility API to get transport type specific info from the specified media | ||||
* transport info. | ||||
* | ||||
* @param info Media transport info. | ||||
* @param type Media transport type. | ||||
* | ||||
* @return Pointer to media transport specific info, or NULL if | ||||
* specific info for the transport type is not found. | ||||
*/ | ||||
PJ_INLINE(void*) pjmedia_transport_info_get_spc_info( | ||||
pjmedia_transport_info *info | ||||
, | ||||
pjmedia_transport_type type) | ||||
{ | ||||
unsigned i; | ||||
for (i = 0; i < info->specific_info_cnt; ++i) { | ||||
if (info->spc_info[i].type == type) | ||||
return (void*)info->spc_info[i].buffer; | ||||
} | ||||
return NULL; | ||||
} | ||||
/** | ||||
* 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. 3 change blocks. | ||||
2 lines changed or deleted | 25 lines changed or added | |||
transport_ice.h | transport_ice.h | |||
---|---|---|---|---|
/* $Id: transport_ice.h 3872 2011-10-28 04:27:41Z bennylp $ */ | /* $Id: transport_ice.h 4350 2013-02-15 03:57:31Z nanang $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 68 | skipping to change at line 68 | |||
} pjmedia_ice_cb; | } pjmedia_ice_cb; | |||
/** | /** | |||
* This structure specifies ICE transport specific info. This structure | * This structure specifies ICE transport specific info. This structure | |||
* will be filled in media transport specific info. | * will be filled in media transport specific info. | |||
*/ | */ | |||
typedef struct pjmedia_ice_transport_info | typedef struct pjmedia_ice_transport_info | |||
{ | { | |||
/** | /** | |||
* Specifies whether ICE is used, i.e. SDP offer and answer indicates | ||||
* that both parties support ICE and ICE should be used for the session | ||||
. | ||||
*/ | ||||
pj_bool_t active; | ||||
/** | ||||
* ICE sesion state. | * ICE sesion state. | |||
*/ | */ | |||
pj_ice_strans_state sess_state; | pj_ice_strans_state sess_state; | |||
/** | /** | |||
* Session role. | * Session role. | |||
*/ | */ | |||
pj_ice_sess_role role; | pj_ice_sess_role role; | |||
/** | /** | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 8 lines changed or added | |||
turn_session.h | turn_session.h | |||
---|---|---|---|---|
/* $Id: turn_session.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: turn_session.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 408 | skipping to change at line 408 | |||
* must call pj_turn_session_alloc() to allocate a relay address in the TUR N | * must call pj_turn_session_alloc() to allocate a relay address in the TUR N | |||
* server. | * server. | |||
* | * | |||
* @param cfg The STUN configuration which contains among other | * @param cfg The STUN configuration which contains among other | |||
* things the ioqueue and timer heap instance for | * things the ioqueue and timer heap instance for | |||
* the operation of this session. | * the operation of this session. | |||
* @param name Optional name to identify this session in the log. | * @param name Optional name to identify this session in the log. | |||
* @param af Address family of the client connection. Currently | * @param af Address family of the client connection. Currently | |||
* pj_AF_INET() and pj_AF_INET6() are supported. | * pj_AF_INET() and pj_AF_INET6() are supported. | |||
* @param conn_type Connection type to the TURN server. | * @param conn_type Connection type to the TURN server. | |||
* @param grp_lock Optional group lock object to be used by this sessio | ||||
n. | ||||
* If this value is NULL, the session will create | ||||
* a group lock internally. | ||||
* @param cb Callback to receive events from the TURN session. | * @param cb Callback to receive events from the TURN session. | |||
* @param options Option flags, currently this value must be zero. | * @param options Option flags, currently this value must be zero. | |||
* @param user_data Arbitrary application data to be associated with | * @param user_data Arbitrary application data to be associated with | |||
* this transport. | * this transport. | |||
* @param p_sess Pointer to receive the created instance of the | * @param p_sess Pointer to receive the created instance of the | |||
* TURN session. | * TURN session. | |||
* | * | |||
* @return PJ_SUCCESS if the operation has been successful, | * @return PJ_SUCCESS if the operation has been successful, | |||
* or the appropriate error code on failure. | * or the appropriate error code on failure. | |||
*/ | */ | |||
PJ_DECL(pj_status_t) pj_turn_session_create(const pj_stun_config *cfg, | PJ_DECL(pj_status_t) pj_turn_session_create(const pj_stun_config *cfg, | |||
const char *name, | const char *name, | |||
int af, | int af, | |||
pj_turn_tp_type conn_type, | pj_turn_tp_type conn_type, | |||
pj_grp_lock_t *grp_lock, | ||||
const pj_turn_session_cb *cb, | const pj_turn_session_cb *cb, | |||
unsigned options, | unsigned options, | |||
void *user_data, | void *user_data, | |||
pj_turn_session **p_sess); | pj_turn_session **p_sess); | |||
/** | /** | |||
* Shutdown TURN client session. This will gracefully deallocate and | * Shutdown TURN client session. This will gracefully deallocate and | |||
* destroy the client session. | * destroy the client session. | |||
* | * | |||
* @param sess The TURN client session. | * @param sess The TURN client session. | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
turn_sock.h | turn_sock.h | |||
---|---|---|---|---|
/* $Id: turn_sock.h 3553 2011-05-05 06:14:19Z nanang $ */ | /* $Id: turn_sock.h 4360 2013-02-21 11:26:35Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 108 | skipping to change at line 108 | |||
} pj_turn_sock_cb; | } pj_turn_sock_cb; | |||
/** | /** | |||
* This structure describes options that can be specified when creating | * This structure describes options that can be specified when creating | |||
* the TURN socket. Application should call #pj_turn_sock_cfg_default() | * the TURN socket. Application should call #pj_turn_sock_cfg_default() | |||
* to initialize this structure with its default values before using it. | * to initialize this structure with its default values before using it. | |||
*/ | */ | |||
typedef struct pj_turn_sock_cfg | typedef struct pj_turn_sock_cfg | |||
{ | { | |||
/** | /** | |||
* The group lock to be used by the STUN socket. If NULL, the STUN sock | ||||
et | ||||
* will create one internally. | ||||
* | ||||
* Default: NULL | ||||
*/ | ||||
pj_grp_lock_t *grp_lock; | ||||
/** | ||||
* Packet buffer size. | ||||
* | ||||
* Default value is PJ_TURN_MAX_PKT_LEN. | ||||
*/ | ||||
unsigned max_pkt_size; | ||||
/** | ||||
* QoS traffic type to be set on this transport. When application wants | * QoS traffic type to be set on this transport. When application wants | |||
* to apply QoS tagging to the transport, it's preferable to set this | * to apply QoS tagging to the transport, it's preferable to set this | |||
* field rather than \a qos_param fields since this is more portable. | * field rather than \a qos_param fields since this is more portable. | |||
* | * | |||
* Default value is PJ_QOS_TYPE_BEST_EFFORT. | * Default value is PJ_QOS_TYPE_BEST_EFFORT. | |||
*/ | */ | |||
pj_qos_type qos_type; | pj_qos_type qos_type; | |||
/** | /** | |||
* Set the low level QoS parameters to the transport. This is a lower | * Set the low level QoS parameters to the transport. This is a lower | |||
skipping to change at line 133 | skipping to change at line 148 | |||
pj_qos_params qos_params; | pj_qos_params qos_params; | |||
/** | /** | |||
* Specify if STUN socket should ignore any errors when setting the QoS | * Specify if STUN socket should ignore any errors when setting the QoS | |||
* traffic type/parameters. | * traffic type/parameters. | |||
* | * | |||
* Default: PJ_TRUE | * Default: PJ_TRUE | |||
*/ | */ | |||
pj_bool_t qos_ignore_error; | pj_bool_t qos_ignore_error; | |||
/** | ||||
* Specify the interface where the socket should be bound to. If the | ||||
* address is zero, socket will be bound to INADDR_ANY. If the address | ||||
* is non-zero, socket will be bound to this address only. If the port | ||||
is | ||||
* set to zero, the socket will bind at any port (chosen by the OS). | ||||
*/ | ||||
pj_sockaddr bound_addr; | ||||
/** | ||||
* Specify the port range for TURN socket binding, relative to the star | ||||
t | ||||
* port number specified in \a bound_addr. Note that this setting is on | ||||
ly | ||||
* applicable when the start port number is non zero. | ||||
* | ||||
* Default value is zero. | ||||
*/ | ||||
pj_uint16_t port_range; | ||||
} pj_turn_sock_cfg; | } pj_turn_sock_cfg; | |||
/** | /** | |||
* Initialize pj_turn_sock_cfg structure with default values. | * Initialize pj_turn_sock_cfg structure with default values. | |||
*/ | */ | |||
PJ_DECL(void) pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg); | PJ_DECL(void) pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg); | |||
/** | /** | |||
* Create a TURN transport instance with the specified address family and | * Create a TURN transport instance with the specified address family and | |||
* connection type. Once TURN transport instance is created, application | * connection type. Once TURN transport instance is created, application | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 37 lines changed or added | |||
types.h | types.h | |||
---|---|---|---|---|
/* $Id: types.h 4154 2012-06-05 10:41:17Z bennylp $ */ | /* $Id: types.h 4359 2013-02-21 11:18:36Z bennylp $ */ | |||
/* | /* | |||
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) | |||
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> | * Copyright (C) 2003-2008 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, | |||
skipping to change at line 229 | skipping to change at line 229 | |||
typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t; | typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t; | |||
/* ************************************************************************ * */ | /* ************************************************************************ * */ | |||
/** Thread handle. */ | /** Thread handle. */ | |||
typedef struct pj_thread_t pj_thread_t; | typedef struct pj_thread_t pj_thread_t; | |||
/** Lock object. */ | /** Lock object. */ | |||
typedef struct pj_lock_t pj_lock_t; | typedef struct pj_lock_t pj_lock_t; | |||
/** Group lock */ | ||||
typedef struct pj_grp_lock_t pj_grp_lock_t; | ||||
/** Mutex handle. */ | /** Mutex handle. */ | |||
typedef struct pj_mutex_t pj_mutex_t; | typedef struct pj_mutex_t pj_mutex_t; | |||
/** Semaphore handle. */ | /** Semaphore handle. */ | |||
typedef struct pj_sem_t pj_sem_t; | typedef struct pj_sem_t pj_sem_t; | |||
/** Event object. */ | /** Event object. */ | |||
typedef struct pj_event_t pj_event_t; | typedef struct pj_event_t pj_event_t; | |||
/** Unidirectional stream pipe object. */ | /** Unidirectional stream pipe object. */ | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||