diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 96a490d2ad7..0c8a6477633 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -1041,23 +1041,6 @@ $ &ctltool; fifo nh_ping_rtpp all - -
- <function moreinfo="none">nh_show_hash_total</function> - - Print the total number of hash entries in the hash table at a given moment. - - - - <function moreinfo="none">nh_show_hash_total</function> usage - -... -$ &ctltool; fifo nh_show_hash_total -... - - -
- diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index b3ca0110b92..e48f31811e1 100644 --- a/modules/rtpengine/rtpengine.c +++ b/modules/rtpengine/rtpengine.c @@ -109,7 +109,6 @@ MODULE_VERSION #define MI_ENABLE_RTP_PROXY "nh_enable_rtpp" #define MI_SHOW_RTP_PROXIES "nh_show_rtpp" #define MI_PING_RTP_PROXY "nh_ping_rtpp" -#define MI_SHOW_HASH_TOTAL "nh_show_hash_total" #define MI_RTP_PROXY_NOT_FOUND "RTP proxy not found" #define MI_RTP_PROXY_NOT_FOUND_LEN (sizeof(MI_RTP_PROXY_NOT_FOUND)-1) @@ -144,10 +143,6 @@ MODULE_VERSION #define MI_SUCCESS_LEN (sizeof(MI_SUCCESS)-1) #define MI_FAIL "fail" #define MI_FAIL_LEN (sizeof(MI_FAIL)-1) -#define MI_HASH_ENTRIES "entries" -#define MI_HASH_ENTRIES_LEN (sizeof(MI_HASH_ENTRIES)-1) -#define MI_HASH_ENTRIES_FAIL "Fail to get entry details" -#define MI_HASH_ENTRIES_FAIL_LEN (sizeof(MI_HASH_ENTRIES_FAIL)-1) #define MI_FOUND_ALL 2 #define MI_FOUND_ONE 1 @@ -220,10 +215,12 @@ static int rtpp_test_ping(struct rtpp_node *node); static int pv_get_rtpstat_f(struct sip_msg *, pv_param_t *, pv_value_t *); /*mi commands*/ -static struct mi_root* mi_enable_rtp_proxy(struct mi_root* cmd_tree, void* param); -static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree, void* param); -static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, void* param); -static struct mi_root* mi_show_hash_total(struct mi_root* cmd_tree, void* param); +static struct mi_root* mi_enable_rtp_proxy(struct mi_root* cmd_tree, + void* param ); +static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree, + void* param); +static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, + void* param); static int rtpengine_disable_tout = 60; @@ -353,7 +350,6 @@ static mi_export_t mi_cmds[] = { {MI_ENABLE_RTP_PROXY, mi_enable_rtp_proxy, 0, 0, 0}, {MI_SHOW_RTP_PROXIES, mi_show_rtp_proxy, 0, 0, 0}, {MI_PING_RTP_PROXY, mi_ping_rtp_proxy, 0, 0, 0}, - {MI_SHOW_HASH_TOTAL, mi_show_hash_total, 0, 0, 0}, { 0, 0, 0, 0, 0} }; @@ -1110,7 +1106,8 @@ static int add_rtpp_node_info (struct mi_node *node, return -1; } -static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree, void* param) +static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree, + void* param) { struct mi_node *node; struct mi_root *root = NULL; @@ -1199,7 +1196,8 @@ static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree, void* param) return init_mi_tree(404, MI_ERROR, MI_ERROR_LEN); } -static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, void* param) +static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, + void* param) { struct mi_node *node, *crt_node; struct mi_attr *attr; @@ -1324,48 +1322,6 @@ static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree, void* param) } -static struct mi_root* mi_show_hash_total(struct mi_root* cmd_tree, void* param) -{ - struct mi_node *node, *crt_node; - struct mi_attr *attr; - struct mi_root *root = NULL; - unsigned int total; - str total_str; - - // Init print tree - root = init_mi_tree(200, MI_OK_S, MI_OK_LEN); - if (!root) { - LM_ERR("the MI tree cannot be initialized!\n"); - return 0; - } - node = &root->node; - - // Create new node and add it to the roots's kids - if(!(crt_node = add_mi_node_child(node, MI_DUP_NAME, "total", strlen("total"), 0, 0))) { - LM_ERR("cannot add the child node to the tree\n"); - goto error; - } - - // Get total number of entries - total = rtpengine_hash_table_total(); - total_str.s = int2str(total, &total_str.len); - - // Add node attributes - if ((attr = add_mi_attr(crt_node, MI_DUP_VALUE, MI_HASH_ENTRIES, MI_HASH_ENTRIES_LEN, total_str.s, total_str.len)) == 0) { - LM_ERR("cannot add attributes to the node\n"); - goto error; - } - - return root; - -error: - if (root) { - free_mi_tree(root); - } - - return init_mi_tree(404, MI_HASH_ENTRIES_FAIL, MI_HASH_ENTRIES_FAIL_LEN); -} - static int mod_init(void) diff --git a/modules/rtpengine/rtpengine_hash.c b/modules/rtpengine/rtpengine_hash.c index 76aa144cd50..3cca5749f6e 100644 --- a/modules/rtpengine/rtpengine_hash.c +++ b/modules/rtpengine/rtpengine_hash.c @@ -74,7 +74,6 @@ int rtpengine_hash_table_init(int size) { // never expire the head of the hashtable index lists rtpengine_hash_table->entry_list[i]->tout = -1; rtpengine_hash_table->entry_list[i]->next = NULL; - rtpengine_hash_table->total = 0; } // init lock @@ -166,9 +165,6 @@ int rtpengine_hash_table_insert(void *key, void *value) { // set pointers entry = last_entry; - - // update total - rtpengine_hash_table->total--; } // next entry in the list @@ -178,9 +174,6 @@ int rtpengine_hash_table_insert(void *key, void *value) { last_entry->next = new_entry; - // update total - rtpengine_hash_table->total++; - // unlock lock_release(rtpengine_hash_lock); @@ -212,9 +205,6 @@ int rtpengine_hash_table_remove(void *key) { shm_free(entry->callid.s); shm_free(entry); - // update total - rtpengine_hash_table->total--; - // unlock lock_release(rtpengine_hash_lock); @@ -232,9 +222,6 @@ int rtpengine_hash_table_remove(void *key) { // set pointers entry = last_entry; - - // update total - rtpengine_hash_table->total--; } last_entry = entry; @@ -284,9 +271,6 @@ void* rtpengine_hash_table_lookup(void *key) { // set pointers entry = last_entry; - - // update total - rtpengine_hash_table->total--; } last_entry = entry; @@ -330,9 +314,6 @@ void rtpengine_hash_table_print() { // set pointers entry = last_entry; - - // update total - rtpengine_hash_table->total--; } else { LM_DBG("hash_index=%d callid=%.*s tout=%u\n", i, entry->callid.len, entry->callid.s, entry->tout - get_ticks()); @@ -346,14 +327,3 @@ void rtpengine_hash_table_print() { // unlock lock_release(rtpengine_hash_lock); } - -unsigned int rtpengine_hash_table_total() { - - // check rtpengine hashtable - if (!rtpengine_hash_table) { - LM_ERR("NULL rtpengine_hash_table"); - return 0; - } - - return rtpengine_hash_table->total; -} diff --git a/modules/rtpengine/rtpengine_hash.h b/modules/rtpengine/rtpengine_hash.h index c9957e92199..b0a8c739317 100644 --- a/modules/rtpengine/rtpengine_hash.h +++ b/modules/rtpengine/rtpengine_hash.h @@ -15,8 +15,7 @@ struct rtpengine_hash_entry { /* table */ struct rtpengine_hash_table { - struct rtpengine_hash_entry **entry_list; // hastable - unsigned int total; // total number of entries in the hashtable + struct rtpengine_hash_entry **entry_list; }; @@ -25,7 +24,6 @@ int rtpengine_hash_table_destroy(); int rtpengine_hash_table_insert(void *key, void *value); int rtpengine_hash_table_remove(void *key); void* rtpengine_hash_table_lookup(void *key); -void rtpengine_hash_table_print(); -unsigned int rtpengine_hash_table_total(); +void rtpengine_hash_table_print() ; #endif