aboutsummaryrefslogtreecommitdiff
path: root/manage.h
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-10 10:01:46 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-10 10:01:46 +0000
commit34a507c9ab159a1e56715246c594b93a93d68469 (patch)
tree99a2a001fe9a0e87c5e593f75f1b65146dc90c6a /manage.h
parentAdded feature to --management-client to confirm connection (diff)
downloadopenvpn-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 '')
-rw-r--r--manage.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/manage.h b/manage.h
index d7ed79c..1a776c3 100644
--- a/manage.h
+++ b/manage.h
@@ -187,6 +187,9 @@ struct man_persist {
bool hold_release;
const char *special_state_msg;
+
+ counter_type bytes_in;
+ counter_type bytes_out;
};
struct man_settings {
@@ -239,6 +242,8 @@ struct man_connection {
bool state_realtime;
bool log_realtime;
bool echo_realtime;
+ int bytecount_update_seconds;
+ time_t bytecount_last_update;
const char *up_query_type;
int up_query_mode;
@@ -347,6 +352,35 @@ void management_echo (struct management *man, const char *string, const bool pul
void management_auth_failure (struct management *man, const char *type);
+/*
+ * These functions drive the bytecount in/out counters.
+ */
+
+void man_bytecount_output (struct management *man);
+
+static inline void
+man_bytecount_possible_output (struct management *man)
+{
+ if (man->connection.bytecount_update_seconds > 0
+ && now >= man->connection.bytecount_last_update
+ + man->connection.bytecount_update_seconds)
+ man_bytecount_output (man);
+}
+
+static inline void
+management_bytes_out (struct management *man, const int size)
+{
+ man->persist.bytes_out += size;
+ man_bytecount_possible_output (man);
+}
+
+static inline void
+management_bytes_in (struct management *man, const int size)
+{
+ man->persist.bytes_in += size;
+ man_bytecount_possible_output (man);
+}
+
#endif
#endif