aboutsummaryrefslogtreecommitdiff
path: root/manage.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-10-24 09:21:40 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-10-24 09:21:40 +0000
commit5f435d64d7c0694a56a64dc7a79d4828fcf8154c (patch)
tree73f96b3705c2134d9cea87305f83e3571c81da4a /manage.c
parentAdded optional files SAMPCONF_CONF2 (second sample configuration (diff)
downloadopenvpn-5f435d64d7c0694a56a64dc7a79d4828fcf8154c.tar.xz
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
Diffstat (limited to '')
-rw-r--r--manage.c27
1 files changed, 25 insertions, 2 deletions
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)
{