aboutsummaryrefslogtreecommitdiffstats
path: root/main/http.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-18 22:43:45 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-18 22:43:45 +0000
commitab51c0d7fad1957b36454533cd8e786ed66efa61 (patch)
treed49317ce7050cdca6ecef46706a320e879421c61 /main/http.c
parentcedd5ba68f094ce4082e42b47674c0f1c01d447d (diff)
(issue #10724)
Reported by: eliel Patches: res_features.c.patch uploaded by eliel (license 64) res_agi.c.patch uploaded by seanbright (license 71) res_musiconhold.c.patch uploaded by seanbright (license 71) pbx.c.patch uploaded by moy (license 222) logger.c.patch uploaded by moy (license 222) frame.c.patch uploaded by moy (license 222) manager.c.patch uploaded by moy (license 222) http.c.patch uploaded by moy (license 222) dnsmgr.c.patch uploaded by moy (license 222) res_realtime.c.patch uploaded by eliel (license 64) res_odbc.c.patch uploaded by seanbright (license 71) res_jabber.c.patch uploaded by eliel (license 64) chan_local.c.patch uploaded by eliel (license 64) chan_agent.c.patch uploaded by eliel (license 64) chan_alsa.c.patch uploaded by eliel (license 64) chan_features.c.patch uploaded by eliel (license 64) chan_sip.c.patch uploaded by eliel (license 64) RollUp.1.patch (includes all of the above patches) uploaded by seanbright (license 71) Convert many CLI commands to the NEW_CLI format. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@82930 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/main/http.c b/main/http.c
index c72f35ec5..9413fa9a4 100644
--- a/main/http.c
+++ b/main/http.c
@@ -1232,56 +1232,65 @@ static int __ast_http_load(int reload)
return 0;
}
-static int handle_show_http(int fd, int argc, char *argv[])
+static char *handle_show_http(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_http_uri *urih;
struct http_uri_redirect *redirect;
struct ast_http_post_mapping *post_map;
-
- if (argc != 3)
- return RESULT_SHOWUSAGE;
-
- ast_cli(fd, "HTTP Server Status:\n");
- ast_cli(fd, "Prefix: %s\n", prefix);
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "http show status";
+ e->usage =
+ "Usage: http show status\n"
+ " Lists status of internal HTTP engine\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 3)
+ return CLI_SHOWUSAGE;
+ ast_cli(a->fd, "HTTP Server Status:\n");
+ ast_cli(a->fd, "Prefix: %s\n", prefix);
if (!http_desc.oldsin.sin_family)
- ast_cli(fd, "Server Disabled\n\n");
+ ast_cli(a->fd, "Server Disabled\n\n");
else {
- ast_cli(fd, "Server Enabled and Bound to %s:%d\n\n",
+ ast_cli(a->fd, "Server Enabled and Bound to %s:%d\n\n",
ast_inet_ntoa(http_desc.oldsin.sin_addr),
ntohs(http_desc.oldsin.sin_port));
if (http_tls_cfg.enabled)
- ast_cli(fd, "HTTPS Server Enabled and Bound to %s:%d\n\n",
+ ast_cli(a->fd, "HTTPS Server Enabled and Bound to %s:%d\n\n",
ast_inet_ntoa(https_desc.oldsin.sin_addr),
ntohs(https_desc.oldsin.sin_port));
}
- ast_cli(fd, "Enabled URI's:\n");
+ ast_cli(a->fd, "Enabled URI's:\n");
AST_RWLIST_RDLOCK(&uris);
if (AST_RWLIST_EMPTY(&uris)) {
- ast_cli(fd, "None.\n");
+ ast_cli(a->fd, "None.\n");
} else {
AST_RWLIST_TRAVERSE(&uris, urih, entry)
- ast_cli(fd, "%s/%s%s => %s\n", prefix, urih->uri, (urih->has_subtree ? "/..." : "" ), urih->description);
+ ast_cli(a->fd, "%s/%s%s => %s\n", prefix, urih->uri, (urih->has_subtree ? "/..." : "" ), urih->description);
}
AST_RWLIST_UNLOCK(&uris);
- ast_cli(fd, "\nEnabled Redirects:\n");
+ ast_cli(a->fd, "\nEnabled Redirects:\n");
AST_RWLIST_RDLOCK(&uri_redirects);
AST_RWLIST_TRAVERSE(&uri_redirects, redirect, entry)
- ast_cli(fd, " %s => %s\n", redirect->target, redirect->dest);
+ ast_cli(a->fd, " %s => %s\n", redirect->target, redirect->dest);
if (AST_RWLIST_EMPTY(&uri_redirects))
- ast_cli(fd, " None.\n");
+ ast_cli(a->fd, " None.\n");
AST_RWLIST_UNLOCK(&uri_redirects);
- ast_cli(fd, "\nPOST mappings:\n");
+ ast_cli(a->fd, "\nPOST mappings:\n");
AST_RWLIST_RDLOCK(&post_mappings);
AST_LIST_TRAVERSE(&post_mappings, post_map, entry)
- ast_cli(fd, "%s/%s => %s\n", prefix, post_map->from, post_map->to);
- ast_cli(fd, "%s\n", AST_LIST_EMPTY(&post_mappings) ? "None.\n" : "");
+ ast_cli(a->fd, "%s/%s => %s\n", prefix, post_map->from, post_map->to);
+ ast_cli(a->fd, "%s\n", AST_LIST_EMPTY(&post_mappings) ? "None.\n" : "");
AST_RWLIST_UNLOCK(&post_mappings);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
int ast_http_reload(void)
@@ -1289,14 +1298,8 @@ int ast_http_reload(void)
return __ast_http_load(1);
}
-static char show_http_help[] =
-"Usage: http show status\n"
-" Lists status of internal HTTP engine\n";
-
static struct ast_cli_entry cli_http[] = {
- { { "http", "show", "status", NULL },
- handle_show_http, "Display HTTP server status",
- show_http_help },
+ NEW_CLI(handle_show_http, "Display HTTP server status"),
};
int ast_http_init(void)