diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-25 21:16:36 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-25 21:16:36 +0000 |
commit | fd81f3d4f4987cba762713d3e615c2a04b3b8597 (patch) | |
tree | dbc8d426eeb871f1b1e60174760f3038563f5733 /pjsip | |
parent | 478d2bc6e45a2dc66472bb577a77537ea97fac5d (diff) |
Tidying up and make it consistent with the documentation
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@230 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsip/sip_endpoint.h | 50 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_module.h | 7 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transaction.h | 2 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_ua_layer.h | 4 | ||||
-rw-r--r-- | pjsip/src/pjsip-simple/evsub.c | 27 | ||||
-rw-r--r-- | pjsip/src/pjsip-simple/presence.c | 3 | ||||
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 27 | ||||
-rw-r--r-- | pjsip/src/pjsip-ua/sip_xfer.c | 27 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_endpoint.c | 49 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_transaction.c | 3 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_transport.c | 1 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_ua_layer.c | 5 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_util_statefull.c | 1 | ||||
-rw-r--r-- | pjsip/src/pjsua/main.c | 4 | ||||
-rw-r--r-- | pjsip/src/pjsua/pjsua_core.c | 5 | ||||
-rw-r--r-- | pjsip/src/pjsua/pjsua_pres.c | 1 |
16 files changed, 60 insertions, 156 deletions
diff --git a/pjsip/include/pjsip/sip_endpoint.h b/pjsip/include/pjsip/sip_endpoint.h index ef9d44c9..8b344db8 100644 --- a/pjsip/include/pjsip/sip_endpoint.h +++ b/pjsip/include/pjsip/sip_endpoint.h @@ -45,15 +45,12 @@ PJ_BEGIN_DECL * - it manages the allocation/deallocation of memory pools for all objects. * - it manages listeners and transports, and how they are used by * transactions. - * - it owns transaction hash table. * - it receives incoming messages from transport layer and automatically * dispatches them to the correct transaction (or create a new one). * - it has a single instance of timer management (timer heap). * - it manages modules, which is the primary means of extending the library. * - it provides single polling function for all objects and distributes * events. - * - it provides SIP policy such as which outbound proxy to use for all - * outgoing SIP request messages. * - it automatically handles incoming requests which can not be handled by * existing modules (such as when incoming request has unsupported method). * - and so on.. @@ -144,18 +141,6 @@ PJ_DECL(void) pjsip_endpt_cancel_timer( pjsip_endpoint *endpt, /** - * Dump endpoint status to the log. This will print the status to the log - * with log level 3. - * - * @param endpt The endpoint. - * @param detail If non zero, then it will dump a detailed output. - * BEWARE that this option may crash the system because - * it tries to access all memory pools. - */ -PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail ); - - -/** * Register new module to the endpoint. * The endpoint will then call the load and start function in the module to * properly initialize the module, and assign a unique module ID for the @@ -394,6 +379,7 @@ PJ_DECL(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt, /** * Get list of additional headers to be put in outgoing request message. + * Currently only Max-Forwards are defined. * * @param e The endpoint. * @@ -403,35 +389,17 @@ PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *e); /** - * Set list of SIP proxies to be visited for all outbound request messages. - * Application can call this function to specify how outgoing request messages - * should be routed. For example, if outgoing requests should go through an - * outbound proxy, then application can specify the URL of the proxy when - * calling this function. More than one proxy can be specified, and the - * order of which proxy is specified when calling this function specifies - * the order of which proxy will be visited first by the request messages. - * - * @param endpt The endpoint instance. - * @param url_cnt Number of proxies/URLs in the array. - * @param url Array of proxy URL, which specifies the order of which - * proxy will be visited first (e.g. url[0] will be visited - * before url[1]). + * Dump endpoint status to the log. This will print the status to the log + * with log level 3. * - * @return Zero on success. + * @param endpt The endpoint. + * @param detail If non zero, then it will dump a detailed output. + * BEWARE that this option may crash the system because + * it tries to access all memory pools. */ -PJ_DECL(pj_status_t) pjsip_endpt_set_proxies( pjsip_endpoint *endpt, - int url_cnt, const pj_str_t url[]); +PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail ); + -/** - * Get the list of "Route" header that are configured for this endpoint. - * The "Route" header specifies how outbound request messages will be sent, - * and is built when application sets the outbound proxy. - * - * @param endpt The endpoint instance. - * - * @return List of "Route" header. - */ -PJ_DECL(const pjsip_route_hdr*) pjsip_endpt_get_routing( pjsip_endpoint *endpt ); /** * Log an error. diff --git a/pjsip/include/pjsip/sip_module.h b/pjsip/include/pjsip/sip_module.h index 57d1652d..94e3002c 100644 --- a/pjsip/include/pjsip/sip_module.h +++ b/pjsip/include/pjsip/sip_module.h @@ -63,12 +63,6 @@ struct pjsip_module int priority; /** - * Opaque data which can be used by a module to identify a resource within - * the module itself. - */ - void *user_data; - - /** * Pointer to function to be called to initialize the module. * * @param endpt The endpoint instance. @@ -166,6 +160,7 @@ enum pjsip_module_priority PJSIP_MOD_PRIORITY_TRANSPORT_LAYER = 8, PJSIP_MOD_PRIORITY_TSX_LAYER = 16, PJSIP_MOD_PRIORITY_UA_PROXY_LAYER = 32, + PJSIP_MOD_PRIORITY_DIALOG_USAGE = 48, PJSIP_MOD_PRIORITY_APPLICATION = 64, }; diff --git a/pjsip/include/pjsip/sip_transaction.h b/pjsip/include/pjsip/sip_transaction.h index 33e39c18..1ffcbc3c 100644 --- a/pjsip/include/pjsip/sip_transaction.h +++ b/pjsip/include/pjsip/sip_transaction.h @@ -120,7 +120,7 @@ struct pjsip_transaction * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjsip_tsx_layer_init(pjsip_endpoint *endpt); +PJ_DECL(pj_status_t) pjsip_tsx_layer_init_module(pjsip_endpoint *endpt); /** * Get the instance of the transaction layer module. diff --git a/pjsip/include/pjsip/sip_ua_layer.h b/pjsip/include/pjsip/sip_ua_layer.h index 012628a5..983efb5d 100644 --- a/pjsip/include/pjsip/sip_ua_layer.h +++ b/pjsip/include/pjsip/sip_ua_layer.h @@ -55,8 +55,8 @@ typedef struct pjsip_ua_init_param * * @return PJ_SUCCESS on success. */ -PJ_DECL(pj_status_t) pjsip_ua_init(pjsip_endpoint *endpt, - const pjsip_ua_init_param *prm); +PJ_DECL(pj_status_t) pjsip_ua_init_module(pjsip_endpoint *endpt, + const pjsip_ua_init_param *prm); /** * Get the instance of the user agent. diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c index 8f102af5..874f9204 100644 --- a/pjsip/src/pjsip-simple/evsub.c +++ b/pjsip/src/pjsip-simple/evsub.c @@ -169,20 +169,19 @@ static struct mod_evsub } mod_evsub = { { - NULL, NULL, /* prev, next. */ - { "mod-evsub", 9 }, /* Name. */ - -1, /* Id */ - PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ - NULL, /* User data. */ - NULL, /* load() */ - NULL, /* start() */ - NULL, /* stop() */ - &mod_evsub_unload, /* unload() */ - NULL, /* on_rx_request() */ - NULL, /* on_rx_response() */ - NULL, /* on_tx_request. */ - NULL, /* on_tx_response() */ - &mod_evsub_on_tsx_state, /* on_tsx_state() */ + NULL, NULL, /* prev, next. */ + { "mod-evsub", 9 }, /* Name. */ + -1, /* Id */ + PJSIP_MOD_PRIORITY_DIALOG_USAGE, /* Priority */ + NULL, /* load() */ + NULL, /* start() */ + NULL, /* stop() */ + &mod_evsub_unload, /* unload() */ + NULL, /* on_rx_request() */ + NULL, /* on_rx_response() */ + NULL, /* on_tx_request. */ + NULL, /* on_tx_response() */ + &mod_evsub_on_tsx_state, /* on_tsx_state() */ } }; diff --git a/pjsip/src/pjsip-simple/presence.c b/pjsip/src/pjsip-simple/presence.c index c47ae1fa..b2cdcf34 100644 --- a/pjsip/src/pjsip-simple/presence.c +++ b/pjsip/src/pjsip-simple/presence.c @@ -41,8 +41,7 @@ static struct pjsip_module mod_presence = NULL, NULL, /* prev, next. */ { "mod-presence", 12 }, /* Name. */ -1, /* Id */ - PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ - NULL, /* User data. */ + PJSIP_MOD_PRIORITY_DIALOG_USAGE,/* Priority */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index 7d1814a0..16cf69f3 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -70,20 +70,19 @@ static struct mod_inv } mod_inv = { { - NULL, NULL, /* prev, next. */ - { "mod-invite", 10 }, /* Name. */ - -1, /* Id */ - PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ - NULL, /* User data. */ - &mod_inv_load, /* load() */ - NULL, /* start() */ - NULL, /* stop() */ - &mod_inv_unload, /* unload() */ - &mod_inv_on_rx_request, /* on_rx_request() */ - &mod_inv_on_rx_response, /* on_rx_response() */ - NULL, /* on_tx_request. */ - NULL, /* on_tx_response() */ - &mod_inv_on_tsx_state, /* on_tsx_state() */ + NULL, NULL, /* prev, next. */ + { "mod-invite", 10 }, /* Name. */ + -1, /* Id */ + PJSIP_MOD_PRIORITY_DIALOG_USAGE, /* Priority */ + &mod_inv_load, /* load() */ + NULL, /* start() */ + NULL, /* stop() */ + &mod_inv_unload, /* unload() */ + &mod_inv_on_rx_request, /* on_rx_request() */ + &mod_inv_on_rx_response, /* on_rx_response() */ + NULL, /* on_tx_request. */ + NULL, /* on_tx_response() */ + &mod_inv_on_tsx_state, /* on_tsx_state() */ } }; diff --git a/pjsip/src/pjsip-ua/sip_xfer.c b/pjsip/src/pjsip-ua/sip_xfer.c index aadcd3f2..9531fd26 100644 --- a/pjsip/src/pjsip-ua/sip_xfer.c +++ b/pjsip/src/pjsip-ua/sip_xfer.c @@ -33,20 +33,19 @@ */ static struct pjsip_module mod_xfer = { - NULL, NULL, /* prev, next. */ - { "mod-refer", 9 }, /* Name. */ - -1, /* Id */ - PJSIP_MOD_PRIORITY_APPLICATION-1, /* Priority */ - NULL, /* User data. */ - NULL, /* load() */ - NULL, /* start() */ - NULL, /* stop() */ - NULL, /* unload() */ - NULL, /* on_rx_request() */ - NULL, /* on_rx_response() */ - NULL, /* on_tx_request. */ - NULL, /* on_tx_response() */ - NULL, /* on_tsx_state() */ + NULL, NULL, /* prev, next. */ + { "mod-refer", 9 }, /* Name. */ + -1, /* Id */ + PJSIP_MOD_PRIORITY_DIALOG_USAGE, /* Priority */ + NULL, /* load() */ + NULL, /* start() */ + NULL, /* stop() */ + NULL, /* unload() */ + NULL, /* on_rx_request() */ + NULL, /* on_rx_response() */ + NULL, /* on_tx_request. */ + NULL, /* on_tx_response() */ + NULL, /* on_tsx_state() */ }; diff --git a/pjsip/src/pjsip/sip_endpoint.c b/pjsip/src/pjsip/sip_endpoint.c index 95273b3a..46341929 100644 --- a/pjsip/src/pjsip/sip_endpoint.c +++ b/pjsip/src/pjsip/sip_endpoint.c @@ -77,9 +77,6 @@ struct pjsip_endpoint /** Module list, sorted by priority. */ pjsip_module module_list; - /** Route header list. */ - pjsip_route_hdr route_hdr_list; - /** Capability header list. */ pjsip_hdr cap_hdr; @@ -370,49 +367,6 @@ PJ_DEF(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *endpt) return &endpt->req_hdr; } -PJ_DEF(pj_status_t) pjsip_endpt_set_proxies( pjsip_endpoint *endpt, - int url_cnt, const pj_str_t url[]) -{ - int i; - pjsip_route_hdr *hdr; - pj_str_t str_ROUTE = { "Route", 5 }; - - /* Lock endpoint mutex. */ - pj_mutex_lock(endpt->mutex); - - pj_list_init(&endpt->route_hdr_list); - - for (i=0; i<url_cnt; ++i) { - int len = url[i].slen; - char *dup = pj_pool_alloc(endpt->pool, len + 1); - pj_memcpy(dup, url[i].ptr, len); - dup[len] = '\0'; - - hdr = pjsip_parse_hdr(endpt->pool, &str_ROUTE, dup, len, NULL); - if (!hdr) { - pj_mutex_unlock(endpt->mutex); - PJ_LOG(4,(THIS_FILE, "Invalid URL %s in proxy URL", dup)); - return -1; - } - - pj_assert(hdr->type == PJSIP_H_ROUTE); - pj_list_insert_before(&endpt->route_hdr_list, hdr); - } - - /* Unlock endpoint mutex. */ - pj_mutex_unlock(endpt->mutex); - - return 0; -} - -/* - * Get "Route" header list. - */ -PJ_DEF(const pjsip_route_hdr*) pjsip_endpt_get_routing( pjsip_endpoint *endpt ) -{ - return &endpt->route_hdr_list; -} - /* * Initialize endpoint. @@ -521,9 +475,6 @@ PJ_DEF(pj_status_t) pjsip_endpt_create(pj_pool_factory *pf, /* Initialize request headers. */ pj_list_init(&endpt->req_hdr); - /* Initialist "Route" header list. */ - pj_list_init(&endpt->route_hdr_list); - /* Add "Max-Forwards" for request header. */ mf_hdr = pjsip_max_fwd_hdr_create(endpt->pool, PJSIP_MAX_FORWARDS_VALUE); diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c index c266934e..631bd14c 100644 --- a/pjsip/src/pjsip/sip_transaction.c +++ b/pjsip/src/pjsip/sip_transaction.c @@ -67,7 +67,6 @@ static struct mod_tsx_layer { "mod-tsx-layer", 13 }, /* Module name. */ -1, /* Module ID */ PJSIP_MOD_PRIORITY_TSX_LAYER, /* Priority. */ - NULL, /* User_data. */ mod_tsx_layer_load, /* load(). */ mod_tsx_layer_start, /* start() */ mod_tsx_layer_stop, /* stop() */ @@ -410,7 +409,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_key( pj_pool_t *pool, pj_str_t *key, /* * Create transaction layer module and registers it to the endpoint. */ -PJ_DEF(pj_status_t) pjsip_tsx_layer_init(pjsip_endpoint *endpt) +PJ_DEF(pj_status_t) pjsip_tsx_layer_init_module(pjsip_endpoint *endpt) { pj_pool_t *pool; pj_status_t status; diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c index d58de2f3..d52f96cb 100644 --- a/pjsip/src/pjsip/sip_transport.c +++ b/pjsip/src/pjsip/sip_transport.c @@ -47,7 +47,6 @@ static pjsip_module mod_msg_print = { "mod-msg-print", 13}, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_TRANSPORT_LAYER, /* Priority */ - NULL, /* User data. */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ diff --git a/pjsip/src/pjsip/sip_ua_layer.c b/pjsip/src/pjsip/sip_ua_layer.c index 6dbc9600..6fe2d551 100644 --- a/pjsip/src/pjsip/sip_ua_layer.c +++ b/pjsip/src/pjsip/sip_ua_layer.c @@ -89,7 +89,6 @@ static struct user_agent { "mod-ua", 6 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_UA_PROXY_LAYER, /* Priority */ - NULL, /* User data. */ &mod_ua_load, /* load() */ NULL, /* start() */ NULL, /* stop() */ @@ -182,8 +181,8 @@ static void mod_ua_on_tsx_state( pjsip_transaction *tsx, pjsip_event *e) /* * Init user agent module and register it to the endpoint. */ -PJ_DEF(pj_status_t) pjsip_ua_init( pjsip_endpoint *endpt, - const pjsip_ua_init_param *prm) +PJ_DEF(pj_status_t) pjsip_ua_init_module( pjsip_endpoint *endpt, + const pjsip_ua_init_param *prm) { pj_status_t status; diff --git a/pjsip/src/pjsip/sip_util_statefull.c b/pjsip/src/pjsip/sip_util_statefull.c index f9c6138f..c0427653 100644 --- a/pjsip/src/pjsip/sip_util_statefull.c +++ b/pjsip/src/pjsip/sip_util_statefull.c @@ -41,7 +41,6 @@ pjsip_module mod_stateful_util = { "mod-stateful-util", 17 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ - NULL, /* User data. */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ diff --git a/pjsip/src/pjsua/main.c b/pjsip/src/pjsua/main.c index f0d04818..7070c761 100644 --- a/pjsip/src/pjsua/main.c +++ b/pjsip/src/pjsua/main.c @@ -281,7 +281,7 @@ static void conf_list(void) pj_ansi_strcat(txlist, s); } } - printf("Port #%02d %20.*s tx to: %s\n", + printf("Port #%02d %20.*s transmitting to: %s\n", port_info->slot, (int)port_info->name.slen, port_info->name.ptr, @@ -679,7 +679,6 @@ static pjsip_module console_msg_logger = { "mod-pjsua-log", 13 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_TRANSPORT_LAYER-1,/* Priority */ - NULL, /* User data. */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ @@ -764,6 +763,7 @@ void pjsua_perror(const char *sender, const char *title, */ int main(int argc, char *argv[]) { + /* Init default settings. */ pjsua_default(); diff --git a/pjsip/src/pjsua/pjsua_core.c b/pjsip/src/pjsua/pjsua_core.c index 56a29063..f5c35468 100644 --- a/pjsip/src/pjsua/pjsua_core.c +++ b/pjsip/src/pjsua/pjsua_core.c @@ -344,7 +344,7 @@ static pj_status_t init_stack(void) /* Initialize transaction layer: */ - status = pjsip_tsx_layer_init(pjsua.endpt); + status = pjsip_tsx_layer_init_module(pjsua.endpt); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Transaction layer initialization error", status); @@ -353,7 +353,7 @@ static pj_status_t init_stack(void) /* Initialize UA layer module: */ - status = pjsip_ua_init( pjsua.endpt, NULL ); + status = pjsip_ua_init_module( pjsua.endpt, NULL ); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "UA layer initialization error", status); goto on_error; @@ -368,7 +368,6 @@ static pj_status_t init_stack(void) { "mod-pjsua", 9 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ - NULL, /* User data. */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ diff --git a/pjsip/src/pjsua/pjsua_pres.c b/pjsip/src/pjsua/pjsua_pres.c index 8129a829..cba02b5c 100644 --- a/pjsip/src/pjsua/pjsua_pres.c +++ b/pjsip/src/pjsua/pjsua_pres.c @@ -43,7 +43,6 @@ static pjsip_module mod_pjsua_pres = { "mod-pjsua-pres", 14 }, /* Name. */ -1, /* Id */ PJSIP_MOD_PRIORITY_APPLICATION, /* Priority */ - NULL, /* User data. */ NULL, /* load() */ NULL, /* start() */ NULL, /* stop() */ |