From 4128ca881c3f5c1631fd0d854c417928423fde27 Mon Sep 17 00:00:00 2001 From: Vlad Patrascu Date: Wed, 17 Apr 2019 13:42:28 +0300 Subject: [PATCH] Fix bad modparam names and doc examples caused by mi modules rename (cherry picked from commit 4af34c03e75a6c48c9784bd002024ccaf23bf7e3) --- modules/mi_html/doc/mi_html_admin.xml | 32 +++++++------- modules/mi_html/mi_html.c | 4 +- modules/mi_http/doc/mi_http_admin.xml | 62 +++++++++------------------ modules/mi_http/mi_http.c | 4 +- 4 files changed, 41 insertions(+), 61 deletions(-) diff --git a/modules/mi_html/doc/mi_html_admin.xml b/modules/mi_html/doc/mi_html_admin.xml index 6e72c4ce2b..703f16bbf9 100644 --- a/modules/mi_html/doc/mi_html_admin.xml +++ b/modules/mi_html/doc/mi_html_admin.xml @@ -7,8 +7,8 @@
Overview - This module provides an HTTP transport layer implementation - for &osips;'s Management Interface. + This module provides a minimal web user interface for the &osips;'s + Management Interface.
@@ -43,28 +43,28 @@
Exported Parameters -
- <varname>mi_http_root</varname>(string) +
+ <varname>root</varname>(string) - Specifies the root path for mi http requests. + Specifies the root path for the HTTP requests. The link to the mi web interface must be constructed using the following patern: - http://[opensips_IP]:[opensips_mi_port]/[mi_http_root] + http://[opensips_IP]:[opensips_mi_port]/[root] The default value is "mi". - Set <varname>mi_http_root</varname> parameter + Set <varname>root</varname> parameter ... -modparam("mi_http", "mi_http_root", "opensips_mi") +modparam("mi_html", "root", "opensips_mi") ...
-
- <varname>mi_http_method</varname>(integer) +
+ <varname>http_method</varname>(integer) Specifies the HTTP request method to be used: @@ -76,10 +76,10 @@ modparam("mi_http", "mi_http_root", "opensips_mi") The default value is 0. - Set <varname>mi_http_method</varname> parameter + Set <varname>http_method</varname> parameter ... -modparam("mi_http", "mi_http_method", 1) +modparam("mi_html", "http_method", 1) ... @@ -108,7 +108,7 @@ modparam("mi_http", "mi_http_method", 1) ... modparam("proto_hep", "trace_destination", "[hep_dest]10.0.0.2;transport=tcp;version=3") -modparam("mi_http", "trace_destination", "hep_dest") +modparam("mi_html", "trace_destination", "hep_dest") ... @@ -148,11 +148,11 @@ modparam("mi_http", "trace_destination", "hep_dest") ... ## blacklist ps and which mi commands ## all the other commands shall be traced -modparam("mi_http", "trace_bwlist", "b: ps, which") +modparam("mi_html", "trace_bwlist", "b: ps, which") ... ## allow only sip_trace mi command ## all the other commands will not be traced -modparam("mi_http", "trace_bwlist", "w: sip_trace") +modparam("mi_html", "trace_bwlist", "w: sip_trace") ... @@ -177,7 +177,7 @@ modparam("mi_http", "trace_bwlist", "w: sip_trace") enough pkg memory configured). - Future realeases of the httpd and mi_httpd modules will address this issue. + Future realeases of the httpd module will address this issue.
diff --git a/modules/mi_html/mi_html.c b/modules/mi_html/mi_html.c index 684ea51167..7805801146 100644 --- a/modules/mi_html/mi_html.c +++ b/modules/mi_html/mi_html.c @@ -71,8 +71,8 @@ static str MI_HTTP_U_METHOD_REASON = str_init("500 Unexpected method! Only GET i /* module parameters */ static param_export_t mi_params[] = { - {"mi_http_root", STR_PARAM, &http_root.s}, - {"mi_http_method", INT_PARAM, &http_method}, + {"root", STR_PARAM, &http_root.s}, + {"http_method", INT_PARAM, &http_method}, {"trace_destination", STR_PARAM, &trace_destination_name.s}, {"trace_bwlist", STR_PARAM, &mi_trace_bwlist_s }, {0,0,0} diff --git a/modules/mi_http/doc/mi_http_admin.xml b/modules/mi_http/doc/mi_http_admin.xml index d512dee499..22f731241b 100644 --- a/modules/mi_http/doc/mi_http_admin.xml +++ b/modules/mi_http/doc/mi_http_admin.xml @@ -7,8 +7,8 @@
Overview - This module implements a JSON server that handles GET - requests and generates JSON responses. + This module provides a HTTP transport layer implementation + for &osips;'s Management Interface.
@@ -34,20 +34,20 @@
Exported Parameters -
- <varname>mi_json_root</varname>(string) +
+ <varname>root</varname>(string) - Specifies the root path for JSON requests: - http://[opensips_IP]:[opensips_httpd_port]/[mi_json_root] + Specifies the root path for HTTP requests: + http://[opensips_IP]:[opensips_httpd_port]/[root] - The default value is "json". + The default value is "mi". - Set <varname>mi_json_root</varname> parameter + Set <varname>root</varname> parameter ... -modparam("mi_json", "mi_json_root", "opensips_mi_json") +modparam("mi_http", "root", "opensips_mi") ... @@ -76,7 +76,7 @@ modparam("mi_json", "mi_json_root", "opensips_mi_json") ... modparam("proto_hep", "trace_destination", "[hep_dest]10.0.0.2;transport=tcp;version=3") -modparam("mi_json", "trace_destination", "hep_dest") +modparam("mi_http", "trace_destination", "hep_dest") ... @@ -116,11 +116,11 @@ modparam("mi_json", "trace_destination", "hep_dest") ... ## blacklist ps and which mi commands ## all the other commands shall be traced -modparam("mi_json", "trace_bwlist", "b: ps, which") +modparam("mi_http", "trace_bwlist", "b: ps, which") ... ## allow only sip_trace mi command ## all the other commands will not be traced -modparam("mi_json", "trace_bwlist", "w: sip_trace") +modparam("mi_http", "trace_bwlist", "w: sip_trace") ... @@ -145,53 +145,33 @@ modparam("mi_json", "trace_bwlist", "w: sip_trace") isn't enough pkg memory configured). - Future realeases of the httpd and mi_json modules - will address this issue. + Future realeases of the httpd module will address this issue.
Examples - This is an example showing the JSON format for the - get_statistics net: uri: MI command. - Notice how the parameters are comma-separated then URI-encoded. + This is an example showing the JSON-RPC request and reply over HTTP + for the ps MI command. - JSON request + JSON-RPC request - - - - Here is another example showing the JSON format for the - ps MI command. - - - JSON request - - diff --git a/modules/mi_http/mi_http.c b/modules/mi_http/mi_http.c index 26f787d005..1f835941cf 100644 --- a/modules/mi_http/mi_http.c +++ b/modules/mi_http/mi_http.c @@ -44,7 +44,7 @@ int mi_json_answer_to_connection (void *cls, void *connection, static ssize_t mi_json_flush_data(void *cls, uint64_t pos, char *buf, size_t max); -str http_root = str_init("json"); +str http_root = str_init("mi"); httpd_api_t httpd_api; static str trace_destination_name = {NULL, 0}; @@ -70,7 +70,7 @@ static union sockaddr_union* sv_socket = NULL; /* module parameters */ static param_export_t mi_params[] = { - {"mi_json_root", STR_PARAM, &http_root.s}, + {"root", STR_PARAM, &http_root.s}, {"trace_destination", STR_PARAM, &trace_destination_name.s}, {"trace_bwlist", STR_PARAM, &mi_trace_bwlist_s }, {"pretty_printing", INT_PARAM, &pretty_print},