From 5f435d64d7c0694a56a64dc7a79d4828fcf8154c Mon Sep 17 00:00:00 2001 From: james Date: Fri, 24 Oct 2008 09:21:40 +0000 Subject: Extended Management Interface "bytecount" command to work when OpenVPN is running as a server. Documented Management Interface "bytecount" command in management/management-notes.txt. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3452 e7ae566f-a301-0410-adde-c780ea21d3b5 --- manage.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'manage.c') diff --git a/manage.c b/manage.c index 129e19e..a1de027 100644 --- a/manage.c +++ b/manage.c @@ -367,11 +367,15 @@ man_status (struct management *man, const int version, struct status_output *so) static void man_bytecount (struct management *man, const int update_seconds) { - man->connection.bytecount_update_seconds = update_seconds; + if (update_seconds >= 0) + man->connection.bytecount_update_seconds = update_seconds; + else + man->connection.bytecount_update_seconds = 0; + msg (M_CLIENT, "SUCCESS: bytecount interval changed"); } void -man_bytecount_output (struct management *man) +man_bytecount_output_client (struct management *man) { char in[32]; char out[32]; @@ -382,6 +386,25 @@ man_bytecount_output (struct management *man) man->connection.bytecount_last_update = now; } +#ifdef MANAGEMENT_DEF_AUTH + +void +man_bytecount_output_server (struct management *man, + const counter_type *bytes_in_total, + const counter_type *bytes_out_total, + struct man_def_auth_context *mdac) +{ + char in[32]; + char out[32]; + /* do in a roundabout way to work around possible mingw or mingw-glibc bug */ + openvpn_snprintf (in, sizeof (in), counter_format, *bytes_in_total); + openvpn_snprintf (out, sizeof (out), counter_format, *bytes_out_total); + msg (M_CLIENT, ">BYTECOUNT_CLI:%lu,%s,%s", mdac->cid, in, out); + mdac->bytecount_last_update = now; +} + +#endif + static void man_kill (struct management *man, const char *victim) { -- cgit v1.2.3