diff options
author | Jenkins2 <jenkins2@gerrit.asterisk.org> | 2018-01-29 12:39:34 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2018-01-29 12:39:34 -0600 |
commit | a231e1d155130f49f0235a20e6974b4be91c729f (patch) | |
tree | c380bfc8075515f3791935afd737bc5328cddbcf /res/res_pjsip | |
parent | bd565fc7cf79b8b18e3a88c01bbf1d364abdf7c8 (diff) | |
parent | 527cf5a57033820313356414b971fdf0f4382b21 (diff) |
Merge "Remove redundant module checks and references."
Diffstat (limited to 'res/res_pjsip')
-rw-r--r-- | res/res_pjsip/config_auth.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/config_transport.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/include/res_pjsip_private.h | 48 | ||||
-rw-r--r-- | res/res_pjsip/location.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_distributor.c | 12 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_global_headers.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_message_filter.c | 16 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_options.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_session.c | 25 |
9 files changed, 26 insertions, 95 deletions
diff --git a/res/res_pjsip/config_auth.c b/res/res_pjsip/config_auth.c index 47326815b..b1bf9c422 100644 --- a/res/res_pjsip/config_auth.c +++ b/res/res_pjsip/config_auth.c @@ -374,7 +374,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) { @@ -403,7 +403,7 @@ 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); + ast_sip_unregister_endpoint_formatter(&endpoint_auth_formatter); ast_manager_unregister("PJSIPShowAuths"); diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c index 713ab024b..15c03769b 100644 --- a/res/res_pjsip/config_transport.c +++ b/res/res_pjsip/config_transport.c @@ -1436,7 +1436,7 @@ int ast_sip_initialize_sorcery_transport(void) ast_sorcery_object_field_register(sorcery, "transport", "allow_reload", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, allow_reload)); ast_sorcery_object_field_register(sorcery, "transport", "symmetric_transport", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, symmetric_transport)); - 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) { @@ -1466,7 +1466,7 @@ 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); + ast_sip_unregister_endpoint_formatter(&endpoint_transport_formatter); ao2_ref(transport_states, -1); transport_states = NULL; diff --git a/res/res_pjsip/include/res_pjsip_private.h b/res/res_pjsip/include/res_pjsip_private.h index 5ce3c6faf..7fafd8007 100644 --- a/res/res_pjsip/include/res_pjsip_private.h +++ b/res/res_pjsip/include/res_pjsip_private.h @@ -314,58 +314,10 @@ int sip_cli_print_global(struct ast_sip_cli_context *context); */ int sip_cli_print_system(struct ast_sip_cli_context *context); -/*! - * \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 a supplement without adding a self reference - */ -void internal_sip_register_supplement(struct ast_sip_supplement *supplement); - -/*! - * \internal - * \brief Used by res_pjsip.so to unregister a supplement without removing a self reference - */ -int internal_sip_unregister_supplement(struct ast_sip_supplement *supplement); - -/*! - * \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); - struct ast_sip_session_supplement; /*! * \internal - * \brief Used by res_pjsip.so to register a session supplement without adding a self reference - */ -void internal_sip_session_register_supplement(struct ast_sip_session_supplement *supplement); - -/*! - * \internal - * \brief Used by res_pjsip.so to unregister a session supplement without removing a self reference - */ -int internal_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement); - -/*! - * \internal * \brief Finds or creates contact_status for a contact */ struct ast_sip_contact_status *ast_res_pjsip_find_or_create_contact_status(const struct ast_sip_contact *contact); diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index eb9e58870..84f73c742 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -1346,7 +1346,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) { @@ -1402,7 +1402,7 @@ int ast_sip_destroy_sorcery_location(void) ast_sip_unregister_cli_formatter(aor_formatter); ast_manager_unregister("PJSIPShowAors"); - internal_sip_unregister_endpoint_formatter(&endpoint_aor_formatter); + ast_sip_unregister_endpoint_formatter(&endpoint_aor_formatter); return 0; } diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c index b4828d89f..c239c1a79 100644 --- a/res/res_pjsip/pjsip_distributor.c +++ b/res/res_pjsip/pjsip_distributor.c @@ -1243,15 +1243,15 @@ int ast_sip_initialize_distributor(void) return -1; } - if (internal_sip_register_service(&distributor_mod)) { + if (ast_sip_register_service(&distributor_mod)) { ast_sip_destroy_distributor(); return -1; } - if (internal_sip_register_service(&endpoint_mod)) { + if (ast_sip_register_service(&endpoint_mod)) { ast_sip_destroy_distributor(); return -1; } - if (internal_sip_register_service(&auth_mod)) { + if (ast_sip_register_service(&auth_mod)) { ast_sip_destroy_distributor(); return -1; } @@ -1282,9 +1282,9 @@ void ast_sip_destroy_distributor(void) ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands)); ast_sip_unregister_cli_formatter(unid_formatter); - internal_sip_unregister_service(&auth_mod); - internal_sip_unregister_service(&endpoint_mod); - internal_sip_unregister_service(&distributor_mod); + ast_sip_unregister_service(&auth_mod); + ast_sip_unregister_service(&endpoint_mod); + ast_sip_unregister_service(&distributor_mod); ao2_global_obj_release(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 4de28b586..52075ae5c 100644 --- a/res/res_pjsip/pjsip_global_headers.c +++ b/res/res_pjsip/pjsip_global_headers.c @@ -165,7 +165,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) @@ -183,5 +183,5 @@ void ast_sip_destroy_global_headers(void) destroy_headers(&request_headers); destroy_headers(&response_headers); - internal_sip_unregister_service(&global_header_mod); + ast_sip_unregister_service(&global_header_mod); } diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c index 427aec740..f948c4449 100644 --- a/res/res_pjsip/pjsip_message_filter.c +++ b/res/res_pjsip/pjsip_message_filter.c @@ -517,24 +517,24 @@ static pj_bool_t filter_on_rx_message(pjsip_rx_data *rdata) void ast_res_pjsip_cleanup_message_filter(void) { - internal_sip_unregister_service(&filter_module_tsx); - internal_sip_unregister_service(&filter_module_transport); - internal_sip_unregister_supplement(&filter_supplement); - internal_sip_session_unregister_supplement(&filter_session_supplement); + ast_sip_unregister_service(&filter_module_tsx); + ast_sip_unregister_service(&filter_module_transport); + ast_sip_unregister_supplement(&filter_supplement); + ast_sip_session_unregister_supplement(&filter_session_supplement); } int ast_res_pjsip_init_message_filter(void) { - internal_sip_session_register_supplement(&filter_session_supplement); - internal_sip_register_supplement(&filter_supplement); + ast_sip_session_register_supplement(&filter_session_supplement); + ast_sip_register_supplement(&filter_supplement); - if (internal_sip_register_service(&filter_module_transport)) { + if (ast_sip_register_service(&filter_module_transport)) { ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n"); ast_res_pjsip_cleanup_message_filter(); return -1; } - if (internal_sip_register_service(&filter_module_tsx)) { + if (ast_sip_register_service(&filter_module_tsx)) { ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n"); ast_res_pjsip_cleanup_message_filter(); return -1; diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 3465eae34..4ae1f31d1 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1562,7 +1562,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_register_xml("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify); ast_manager_register_xml("PJSIPShowContacts", EVENT_FLAG_SYSTEM, ami_show_contacts); ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options)); @@ -1578,7 +1578,7 @@ void ast_res_pjsip_cleanup_options_handling(void) ast_cli_unregister_multiple(cli_options, ARRAY_LEN(cli_options)); ast_manager_unregister("PJSIPQualify"); ast_manager_unregister("PJSIPShowContacts"); - internal_sip_unregister_endpoint_formatter(&contact_status_formatter); + ast_sip_unregister_endpoint_formatter(&contact_status_formatter); ast_sorcery_observer_remove(ast_sip_get_sorcery(), "aor", &observer_callbacks_options); pjsip_endpt_unregister_module(ast_sip_get_pjsip_endpoint(), &options_module); diff --git a/res/res_pjsip/pjsip_session.c b/res/res_pjsip/pjsip_session.c index 153561ce7..f3f3a4d87 100644 --- a/res/res_pjsip/pjsip_session.c +++ b/res/res_pjsip/pjsip_session.c @@ -32,7 +32,7 @@ AST_RWLIST_HEAD_STATIC(session_supplements, ast_sip_session_supplement); -void internal_sip_session_register_supplement(struct ast_sip_session_supplement *supplement) +void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement) { struct ast_sip_session_supplement *iter; int inserted = 0; @@ -56,39 +56,18 @@ void internal_sip_session_register_supplement(struct ast_sip_session_supplement } } -int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement, - const char *file, int line, const char *func) -{ - internal_sip_session_register_supplement(supplement); - __ast_module_ref(AST_MODULE_SELF, file, line, func); - - return 0; -} - -int internal_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement) +void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement) { struct ast_sip_session_supplement *iter; - int res = -1; SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK); AST_RWLIST_TRAVERSE_SAFE_BEGIN(&session_supplements, iter, next) { if (supplement == iter) { AST_RWLIST_REMOVE_CURRENT(next); - res = 0; break; } } AST_RWLIST_TRAVERSE_SAFE_END; - - return res; -} - -void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement, - const char *file, int line, const char *func) -{ - if (!internal_sip_session_unregister_supplement(supplement)) { - __ast_module_unref(AST_MODULE_SELF, file, line, func); - } } static struct ast_sip_session_supplement *supplement_dup(const struct ast_sip_session_supplement *src) |