diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-02-10 10:01:46 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-02-10 10:01:46 +0000 |
commit | 34a507c9ab159a1e56715246c594b93a93d68469 (patch) | |
tree | 99a2a001fe9a0e87c5e593f75f1b65146dc90c6a /manage.c | |
parent | Added feature to --management-client to confirm connection (diff) | |
download | openvpn-34a507c9ab159a1e56715246c594b93a93d68469.tar.xz |
Added "bytecount" command to management interface.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@887 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'manage.c')
-rw-r--r-- | manage.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -67,6 +67,7 @@ man_help () msg (M_CLIENT, "Management Interface for %s", title_string); msg (M_CLIENT, "Commands:"); msg (M_CLIENT, "auth-retry t : Auth failure retry mode (none,interact,nointeract)."); + msg (M_CLIENT, "bytecount n : Show bytes in/out, update every n secs (0=off)."); msg (M_CLIENT, "echo [on|off] [N|all] : Like log, but only show messages in echo buffer."); msg (M_CLIENT, "exit|quit : Close management session."); msg (M_CLIENT, "help : Print this message."); @@ -301,6 +302,24 @@ 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; +} + +void +man_bytecount_output (struct management *man) +{ + 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, man->persist.bytes_in); + openvpn_snprintf (out, sizeof (out), counter_format, man->persist.bytes_out); + msg (M_CLIENT, ">BYTECOUNT:%s,%s", in, out); + man->connection.bytecount_last_update = now; +} + +static void man_kill (struct management *man, const char *victim) { struct gc_arena gc = gc_new (); @@ -744,6 +763,11 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch { man_hold (man, p[1]); } + else if (streq (p[0], "bytecount")) + { + if (man_need (man, p, 1, 0)) + man_bytecount (man, atoi(p[1])); + } #if 1 else if (streq (p[0], "test")) { @@ -840,6 +864,7 @@ man_connection_settings_reset (struct management *man) man->connection.state_realtime = false; man->connection.log_realtime = false; man->connection.echo_realtime = false; + man->connection.bytecount_update_seconds = 0; man->connection.password_verified = false; man->connection.password_tries = 0; man->connection.halt = false; |