From eea34c085e661c3315196e2e6f5bd73fab8fdbe0 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sat, 5 Jun 2010 14:43:23 +0100 Subject: [PATCH] Stub + document shutdown command Organization: Straylight/Edgeware From: Richard Kettlewell --- doc/disorder_protocol.5.in | 4 ++++ lib/client-stubs.c | 4 ++++ lib/client-stubs.h | 8 ++++++++ lib/client.c | 8 -------- scripts/protocol | 5 ++++- 5 files changed, 20 insertions(+), 9 deletions(-) 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", -- [mdw]