Module: sip-router Branch: master Commit: 20fd4b8b75002c70ecfa826509fb5e5f2046b034 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=20fd4b8b...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Tue Jul 13 20:38:08 2010 +0200
core: more version related rpcs
core.flags - prints the compile flags.
core.info - verbose version info, including the version, git hash, compiler, compile date and compile flags.
---
core_cmd.c | 39 ++++++++++++++++++++++++++++++++++++++- ver.c | 4 ++++ ver.h | 4 ++++ 3 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/core_cmd.c b/core_cmd.c index 589908d..2305370 100644 --- a/core_cmd.c +++ b/core_cmd.c @@ -339,6 +339,38 @@ static void core_version(rpc_t* rpc, void* c)
+static const char* core_flags_doc[] = { + "Returns the compile flags.", /* Documentation string */ + 0 /* Method signature(s) */ +}; + +static void core_flags(rpc_t* rpc, void* c) +{ + rpc->add(c, "s", ver_flags); +} + + + +static const char* core_info_doc[] = { + "Verbose info, including version number, compile flags, compiler," + "repository hash a.s.o.", /* Documentation string */ + 0 /* Method signature(s) */ +}; + +static void core_info(rpc_t* rpc, void* c) +{ + void* s; + + if (rpc->add(c, "{", &s) < 0) return; + rpc->struct_printf(s, "version", "%s %s", ver_name, ver_version); + rpc->struct_add(s, "s", "id", ver_id); + rpc->struct_add(s, "s", "compiler", ver_compiler); + rpc->struct_add(s, "s", "compiled", ver_compiled_time); + rpc->struct_add(s, "s", "flags", ver_flags); +} + + + static const char* core_uptime_doc[] = { "Returns uptime of SER server.", /* Documentation string */ 0 /* Method signature(s) */ @@ -824,7 +856,12 @@ static rpc_export_t core_rpc_methods[] = { RET_ARRAY}, {"core.echo", core_echo, core_echo_doc, RET_ARRAY}, - {"core.version", core_version, core_version_doc, 0 }, + {"core.version", core_version, core_version_doc, + 0 }, + {"core.flags", core_flags, core_flags_doc, + 0 }, + {"core.info", core_info, core_info_doc, + 0 }, {"core.uptime", core_uptime, core_uptime_doc, 0 }, {"core.ps", core_ps, core_ps_doc, RET_ARRAY}, {"core.pwd", core_pwd, core_pwd_doc, RET_ARRAY}, diff --git a/ver.c b/ver.c index 80f1b26..e81586f 100644 --- a/ver.c +++ b/ver.c @@ -30,6 +30,10 @@
const char full_version[] = SER_FULL_VERSION " " REPO_VER; +const char ver_name[] = NAME; +const char ver_version[] = VERSION; +const char ver_arch[] = ARCH; +const char ver_os[] = OS_QUOTED; const char ver_id[] = REPO_HASH " " REPO_STATE; const char ver_compiled_time[] = __TIME__ " " __DATE__ ; const char ver_compiler[] = COMPILER; diff --git a/ver.h b/ver.h index ba036f3..25f1309 100644 --- a/ver.h +++ b/ver.h @@ -29,6 +29,10 @@ #define __ver_h
extern const char full_version[]; +extern const char ver_name[]; +extern const char ver_version[]; +extern const char ver_arch[]; +extern const char ver_os[]; extern const char ver_id[]; extern const char ver_compiled_time[]; extern const char ver_compiler[];