summaryrefslogtreecommitdiff
path: root/tacplus-daemon/global.h
diff options
context:
space:
mode:
Diffstat (limited to 'tacplus-daemon/global.h')
-rw-r--r--tacplus-daemon/global.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/tacplus-daemon/global.h b/tacplus-daemon/global.h
new file mode 100644
index 0000000..d7bb592
--- /dev/null
+++ b/tacplus-daemon/global.h
@@ -0,0 +1,38 @@
+/*
+ TACACS+ D-Bus Daemon code
+
+ Copyright (c) 2019, AT&T Intellectual Property
+
+ SPDX-License-Identifier: GPL-2.0-only
+*/
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+struct tacplus_global_state {
+ /* Lock to be held while manipulating global state */
+ pthread_mutex_t lock;
+
+ /* ID of the offline expiry timer returned from timer_create() */
+ timer_t offline_timer;
+
+ /* Internal timer ID used to detect expiry races */
+ uint8_t offline_timer_id;
+
+ /* Flag indicating whether the component is offline */
+ bool offline;
+};
+
+typedef struct {
+ struct tacplus_options *opts;
+ struct tacplus_global_state state;
+} ConnectionControl;
+
+extern ConnectionControl *connControl;
+
+bool tacplusd_go_online();
+bool tacplusd_go_offline(const struct timespec *);
+bool tacplusd_online();