summaryrefslogtreecommitdiff
path: root/src/base/protect.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/protect.h')
-rw-r--r--src/base/protect.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/base/protect.h b/src/base/protect.h
new file mode 100644
index 0000000..b0db5a9
--- /dev/null
+++ b/src/base/protect.h
@@ -0,0 +1,30 @@
+
+#ifndef PROTECT_H
+
+#define PROTECT_H
+
+#include "base/main.h"
+#include "base/myTimer.h"
+
+#define PROTECT_PING_INTERVAL_TIMEOUT 5000
+#define PROTECT_SPEED_INTERVAL_TIMEOUT 40
+#define PROTECT_SPEED_AVARAGE 10
+
+typedef struct protect_struct
+{
+ my_time_t lastPing;
+
+ my_time_t lastMove;
+ my_time_t avarage;
+ int count;
+
+ bool_t isDown;
+} protect_t;
+
+extern protect_t* newProtect();
+extern void refreshLastMove(protect_t *p);
+extern void rereshLastPing(protect_t *p);
+extern bool_t isDown(protect_t *p);
+extern void destroyProtect(protect_t *p);
+
+#endif