From: Richard Kettlewell Date: Sat, 5 Jun 2010 13:43:23 +0000 (+0100) Subject: Stub + document shutdown command X-Git-Tag: branchpoint-5.1~22^2~26 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/eea34c085e661c3315196e2e6f5bd73fab8fdbe0 Stub + document shutdown command --- diff --git a/doc/disorder_protocol.5.in b/doc/disorder_protocol.5.in index f3cb615..0f8f909 100644 --- a/doc/disorder_protocol.5.in +++ b/doc/disorder_protocol.5.in @@ -437,6 +437,10 @@ Requires the \fBprefs\fR right. Set a global preference. Requires the \fBglobal prefs\fR right. .TP +.B shutdown +Requests server shutdown. +Requires the \fBadmin\fR right. +.TP .B stats Send server statistics in plain text in a response body. .TP diff --git a/lib/client-stubs.c b/lib/client-stubs.c index 427805f..de9e6cc 100644 --- a/lib/client-stubs.c +++ b/lib/client-stubs.c @@ -210,6 +210,10 @@ int disorder_set_global(disorder_client *c, const char *pref, const char *value) return disorder_simple(c, 0, "set-global", pref, value, (char *)0); } +int disorder_shutdown(disorder_client *c) { + return disorder_simple(c, 0, "shutdown", (char *)0); +} + int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp) { return disorder_simple_list(c, statsp, nstatsp, "stats", (char *)0); } diff --git a/lib/client-stubs.h b/lib/client-stubs.h index d487772..8182213 100644 --- a/lib/client-stubs.h +++ b/lib/client-stubs.h @@ -427,6 +427,14 @@ int disorder_set(disorder_client *c, const char *track, const char *pref, const */ int disorder_set_global(disorder_client *c, const char *pref, const char *value); +/** @brief Request server shutdown + * + * Requires the 'admin' right. + * + * @return 0 on success, non-0 on error + */ +int disorder_shutdown(disorder_client *c); + /** @brief Get server statistics * * The details of what the server reports are not really defined. The returned strings are intended to be printed out one to a line.. diff --git a/lib/client.c b/lib/client.c index cb65114..33f1d35 100644 --- a/lib/client.c +++ b/lib/client.c @@ -544,14 +544,6 @@ int disorder_move(disorder_client *c, const char *track, int delta) { return disorder_simple(c, 0, "move", track, d, (char *)0); } -/** @brief Shut down the server - * @param c Client - * @return 0 on success, non-0 on error - */ -int disorder_shutdown(disorder_client *c) { - return disorder_simple(c, 0, "shutdown", (char *)0); -} - static void client_error(const char *msg, void attribute((unused)) *u) { disorder_error(0, "error parsing reply: %s", msg); diff --git a/scripts/protocol b/scripts/protocol index 979a56a..ac8c0f7 100755 --- a/scripts/protocol +++ b/scripts/protocol @@ -562,7 +562,10 @@ simple("set-global", [["pref", "Preference name"], ["value", "New value"]]); -# TODO shutdown (also needs documenting) +simple("shutdown", + "Request server shutdown", + "Requires the 'admin' right.", + []); list("stats", "Get server statistics",