From 07e2a48ab12580ef4a6279fdf2edbcaa4a038efa Mon Sep 17 00:00:00 2001 From: Kevin Harwell Date: Sat, 17 Jan 2015 00:35:59 +0000 Subject: REVERTING res_pjsip: make it unloadable Due to the original patch causing memory corruptions the patch is being removed until the problem can be resolved. ........ Merged revisions 430734 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430735 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip/config_auth.c | 3 +-- res/res_pjsip/config_transport.c | 4 +--- res/res_pjsip/include/res_pjsip_private.h | 30 +----------------------------- res/res_pjsip/location.c | 4 +--- res/res_pjsip/pjsip_configuration.c | 5 +---- res/res_pjsip/pjsip_distributor.c | 17 ++++++++--------- res/res_pjsip/pjsip_global_headers.c | 5 +---- res/res_pjsip/pjsip_options.c | 4 ++-- res/res_pjsip/pjsip_outbound_auth.c | 9 ++------- 9 files changed, 18 insertions(+), 63 deletions(-) (limited to 'res/res_pjsip') diff --git a/res/res_pjsip/config_auth.c b/res/res_pjsip/config_auth.c index 773889c7a..fcab6a84b 100644 --- a/res/res_pjsip/config_auth.c +++ b/res/res_pjsip/config_auth.c @@ -312,7 +312,7 @@ int ast_sip_initialize_sorcery_auth(void) ast_sorcery_object_field_register_custom(sorcery, SIP_SORCERY_AUTH_TYPE, "auth_type", "userpass", auth_type_handler, auth_type_to_str, NULL, 0, 0); - internal_sip_register_endpoint_formatter(&endpoint_auth_formatter); + ast_sip_register_endpoint_formatter(&endpoint_auth_formatter); cli_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL); if (!cli_formatter) { @@ -337,7 +337,6 @@ int ast_sip_destroy_sorcery_auth(void) { ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands)); ast_sip_unregister_cli_formatter(cli_formatter); - internal_sip_unregister_endpoint_formatter(&endpoint_auth_formatter); return 0; } diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c index 9c7298b98..ce170da36 100644 --- a/res/res_pjsip/config_transport.c +++ b/res/res_pjsip/config_transport.c @@ -769,7 +769,7 @@ int ast_sip_initialize_sorcery_transport(void) ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos)); ast_sorcery_object_field_register(sorcery, "transport", "websocket_write_timeout", AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR, OPT_INT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_transport, write_timeout), 1, INT_MAX); - internal_sip_register_endpoint_formatter(&endpoint_transport_formatter); + ast_sip_register_endpoint_formatter(&endpoint_transport_formatter); cli_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL); if (!cli_formatter) { @@ -795,7 +795,5 @@ int ast_sip_destroy_sorcery_transport(void) ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands)); ast_sip_unregister_cli_formatter(cli_formatter); - internal_sip_unregister_endpoint_formatter(&endpoint_transport_formatter); - return 0; } diff --git a/res/res_pjsip/include/res_pjsip_private.h b/res/res_pjsip/include/res_pjsip_private.h index b3d66dbb5..fa37c8c4b 100644 --- a/res/res_pjsip/include/res_pjsip_private.h +++ b/res/res_pjsip/include/res_pjsip_private.h @@ -57,15 +57,7 @@ int ast_res_pjsip_init_contact_transports(void); * \retval 0 Success * \retval non-zero Failure */ -int internal_sip_initialize_outbound_authentication(void); - -/*! - * \brief Destroy outbound authentication support - * - * \retval 0 Success - * \retval non-zero Failure - */ -void internal_sip_destroy_outbound_authentication(void); +int ast_sip_initialize_outbound_authentication(void); /*! * \brief Initialize system configuration @@ -120,24 +112,4 @@ char *ast_sip_global_default_outbound_endpoint(void); int ast_sip_initialize_cli(void); void ast_sip_destroy_cli(void); -/*! - * \internal \brief Used by res_pjsip.so to register a service without adding a self reference - */ -int internal_sip_register_service(pjsip_module *module); - -/*! - * \internal \brief Used by res_pjsip.so to unregister a service without removing a self reference - */ -int internal_sip_unregister_service(pjsip_module *module); - -/*! - * \internal \brief Used by res_pjsip.so to register an endpoint formatter without adding a self reference - */ -void internal_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj); - -/*! - * \internal \brief Used by res_pjsip.so to unregister a endpoint formatter without removing a self reference - */ -int internal_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj); - #endif /* RES_PJSIP_PRIVATE_H_ */ diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 73ffdca0e..f36235161 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -870,7 +870,7 @@ int ast_sip_initialize_sorcery_location(void) ast_sorcery_object_field_register(sorcery, "aor", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, outbound_proxy)); ast_sorcery_object_field_register(sorcery, "aor", "support_path", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, support_path)); - internal_sip_register_endpoint_formatter(&endpoint_aor_formatter); + ast_sip_register_endpoint_formatter(&endpoint_aor_formatter); contact_formatter = ao2_alloc(sizeof(struct ast_sip_cli_formatter_entry), NULL); if (!contact_formatter) { @@ -911,8 +911,6 @@ int ast_sip_destroy_sorcery_location(void) ast_sip_unregister_cli_formatter(contact_formatter); ast_sip_unregister_cli_formatter(aor_formatter); - internal_sip_unregister_endpoint_formatter(&endpoint_aor_formatter); - return 0; } diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index d818361a4..7dad58c15 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1670,9 +1670,7 @@ int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_mod return -1; } - if (ast_sorcery_internal_object_register(sip_sorcery, "nat_hook", sip_nat_hook_alloc, NULL, NULL)) { - ast_log(LOG_ERROR, "Failed to register nat_hook\n"); - } + ast_sorcery_internal_object_register(sip_sorcery, "nat_hook", sip_nat_hook_alloc, NULL, NULL); ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0); ast_sorcery_object_field_register(sip_sorcery, "endpoint", "context", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, context)); @@ -1851,7 +1849,6 @@ void ast_res_pjsip_destroy_configuration(void) ast_sip_unregister_cli_formatter(endpoint_formatter); ast_sip_unregister_cli_formatter(channel_formatter); ast_sorcery_unref(sip_sorcery); - ao2_cleanup(persistent_endpoints); } int ast_res_pjsip_reload_configuration(void) diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c index e32f02833..90744fdf0 100644 --- a/res/res_pjsip/pjsip_distributor.c +++ b/res/res_pjsip/pjsip_distributor.c @@ -21,7 +21,6 @@ #include #include "asterisk/res_pjsip.h" -#include "include/res_pjsip_private.h" static int distribute(void *data); static pj_bool_t distributor(pjsip_rx_data *rdata); @@ -223,7 +222,7 @@ struct ast_sip_auth *ast_sip_get_artificial_auth(void) return artificial_auth; } -static struct ast_sip_endpoint *artificial_endpoint = NULL; +static struct ast_sip_endpoint *artificial_endpoint; static int create_artificial_endpoint(void) { @@ -237,7 +236,7 @@ static int create_artificial_endpoint(void) * the proper size of the vector is returned. This value is * not actually used anywhere */ - AST_VECTOR_APPEND(&artificial_endpoint->inbound_auths, ast_strdup("artificial-auth")); + AST_VECTOR_APPEND(&artificial_endpoint->inbound_auths, "artificial-auth"); return 0; } @@ -374,13 +373,13 @@ int ast_sip_initialize_distributor(void) return -1; } - if (internal_sip_register_service(&distributor_mod)) { + if (ast_sip_register_service(&distributor_mod)) { return -1; } - if (internal_sip_register_service(&endpoint_mod)) { + if (ast_sip_register_service(&endpoint_mod)) { return -1; } - if (internal_sip_register_service(&auth_mod)) { + if (ast_sip_register_service(&auth_mod)) { return -1; } @@ -389,9 +388,9 @@ int ast_sip_initialize_distributor(void) void ast_sip_destroy_distributor(void) { - internal_sip_unregister_service(&distributor_mod); - internal_sip_unregister_service(&endpoint_mod); - internal_sip_unregister_service(&auth_mod); + ast_sip_unregister_service(&distributor_mod); + ast_sip_unregister_service(&endpoint_mod); + ast_sip_unregister_service(&auth_mod); ao2_cleanup(artificial_auth); ao2_cleanup(artificial_endpoint); diff --git a/res/res_pjsip/pjsip_global_headers.c b/res/res_pjsip/pjsip_global_headers.c index fc7226761..eff870314 100644 --- a/res/res_pjsip/pjsip_global_headers.c +++ b/res/res_pjsip/pjsip_global_headers.c @@ -23,7 +23,6 @@ #include "asterisk/res_pjsip.h" #include "asterisk/linkedlists.h" -#include "include/res_pjsip_private.h" static pj_status_t add_request_headers(pjsip_tx_data *tdata); static pj_status_t add_response_headers(pjsip_tx_data *tdata); @@ -152,7 +151,7 @@ void ast_sip_initialize_global_headers(void) AST_RWLIST_HEAD_INIT(&request_headers); AST_RWLIST_HEAD_INIT(&response_headers); - internal_sip_register_service(&global_header_mod); + ast_sip_register_service(&global_header_mod); } static void destroy_headers(struct header_list *headers) @@ -169,6 +168,4 @@ void ast_sip_destroy_global_headers(void) { destroy_headers(&request_headers); destroy_headers(&response_headers); - - internal_sip_unregister_service(&global_header_mod); } diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index cf55f4dd6..927555230 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1123,7 +1123,7 @@ int ast_res_pjsip_init_options_handling(int reload) return -1; } - internal_sip_register_endpoint_formatter(&contact_status_formatter); + ast_sip_register_endpoint_formatter(&contact_status_formatter); ast_manager_register2("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify, NULL, NULL, NULL); ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options)); @@ -1136,7 +1136,7 @@ void ast_res_pjsip_cleanup_options_handling(void) { ast_cli_unregister_multiple(cli_options, ARRAY_LEN(cli_options)); ast_manager_unregister("PJSIPQualify"); - internal_sip_unregister_endpoint_formatter(&contact_status_formatter); + ast_sip_unregister_endpoint_formatter(&contact_status_formatter); pjsip_endpt_unregister_module(ast_sip_get_pjsip_endpoint(), &options_module); ao2_cleanup(sched_qualifies); diff --git a/res/res_pjsip/pjsip_outbound_auth.c b/res/res_pjsip/pjsip_outbound_auth.c index 1f754227a..28ca3ec8a 100644 --- a/res/res_pjsip/pjsip_outbound_auth.c +++ b/res/res_pjsip/pjsip_outbound_auth.c @@ -91,11 +91,6 @@ int ast_sip_dialog_setup_outbound_authentication(pjsip_dialog *dlg, const struct return 0; } -int internal_sip_initialize_outbound_authentication(void) { - return internal_sip_register_service(&outbound_auth_mod); -} - - -void internal_sip_destroy_outbound_authentication(void) { - internal_sip_unregister_service(&outbound_auth_mod); +int ast_sip_initialize_outbound_authentication(void) { + return ast_sip_register_service(&outbound_auth_mod); } -- cgit v1.2.3