diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-02-22 11:10:17 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-02-22 11:10:17 +0000 |
commit | 5e9005a6ed8321e2a3d6cd307bafe5c6ca79eee3 (patch) | |
tree | 825983a1fde955b6914870b7ba9f4a767b8fb761 /pjsip/include/pjsip/sip_config.h | |
parent | eb962bb2cade592db6319e2004e06c9ac8ee2ae2 (diff) |
Ticket #7: Move PJSIP compile time configurations/settings (such as T1, T2 timers) to run-time (thanks Philippe Leuba)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1818 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsip/sip_config.h')
-rw-r--r-- | pjsip/include/pjsip/sip_config.h | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h index e72ab394..f54397a7 100644 --- a/pjsip/include/pjsip/sip_config.h +++ b/pjsip/include/pjsip/sip_config.h @@ -50,7 +50,7 @@ */ /** - * @defgroup PJSIP_CONFIG Compile Time Configuration + * @defgroup PJSIP_CONFIG PJSIP Configurations/Settings * @ingroup PJSIP_BASE * @brief PJSIP compile time configurations. * @{ @@ -65,6 +65,75 @@ /** + * This structure describes PJSIP run-time configurations/settings. + * Application may use #pjsip_cfg() function to modify the settings + * before creating the stack. + */ +typedef struct pjsip_cfg_t +{ + /** Transaction layer settings. */ + struct { + + /** Maximum number of transactions. The value is initialized with + * PJSIP_MAX_TSX_COUNT + */ + unsigned max_count; + + /* Timeout values: */ + + /** Transaction T1 timeout, in msec. Default value is PJSIP_T1_TIMEOUT + */ + unsigned t1; + + /** Transaction T2 timeout, in msec. Default value is PJSIP_T2_TIMEOUT + */ + unsigned t2; + + /** Transaction completed timer for non-INVITE, in msec. Default value + * is PJSIP_T4_TIMEOUT + */ + unsigned t4; + + /** Transaction completed timer for INVITE, in msec. Default value is + * PJSIP_TD_TIMEOUT. + */ + unsigned td; + + } tsx; + + /* Dialog layer settings .. TODO */ + +} pjsip_cfg_t; + + +#ifdef PJ_DLL +/** + * Get pjsip configuration instance. Application may modify the + * settings before creating the SIP endpoint and modules. + * + * @return Configuration instance. + */ +PJ_DECL(pjsip_cfg_t*) pjsip_cfg(void); + +#else /* PJ_DLL */ + +PJ_DECL_DATA(pjsip_cfg_t) pjsip_sip_cfg_var; + +/** + * Get pjsip configuration instance. Application may modify the + * settings before creating the SIP endpoint and modules. + * + * @return Configuration instance. + */ +PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void) +{ + return &pjsip_sip_cfg_var; +} + +#endif /* PJ_DLL */ + + +/** * Specify maximum transaction count in transaction hash table. * Default value is 16*1024 */ @@ -407,7 +476,8 @@ /* Endpoint. */ -#define PJSIP_MAX_TIMER_COUNT (2*PJSIP_MAX_TSX_COUNT + 2*PJSIP_MAX_DIALOG_COUNT) +#define PJSIP_MAX_TIMER_COUNT (2*pjsip_cfg()->tsx.max_count + \ + 2*PJSIP_MAX_DIALOG_COUNT) /** * Initial memory block for the endpoint. @@ -632,6 +702,7 @@ * @} */ + #include <pj/config.h> |