diff options
Diffstat (limited to 'tollgate_core/src/tollgate_session.h')
| -rw-r--r-- | tollgate_core/src/tollgate_session.h | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tollgate_core/src/tollgate_session.h b/tollgate_core/src/tollgate_session.h deleted file mode 100644 index 4008b24..0000000 --- a/tollgate_core/src/tollgate_session.h +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | #ifndef TOLLGATE_CORE_SESSION_H | ||
| 2 | #define TOLLGATE_CORE_SESSION_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 7 | #define TG_SESSION_MAX_CLIENTS 10 | ||
| 8 | #define TG_SESSION_MAX_MAC_LEN 18 | ||
| 9 | |||
| 10 | typedef enum { | ||
| 11 | TG_PAYMENT_CASHU, | ||
| 12 | TG_PAYMENT_MINING, | ||
| 13 | TG_PAYMENT_BYTES | ||
| 14 | } tg_payment_method_t; | ||
| 15 | |||
| 16 | typedef struct { | ||
| 17 | uint32_t client_ip; | ||
| 18 | char mac[TG_SESSION_MAX_MAC_LEN]; | ||
| 19 | uint64_t allotment_ms; | ||
| 20 | int64_t start_time_ms; | ||
| 21 | uint64_t allotment_bytes; | ||
| 22 | uint64_t bytes_consumed; | ||
| 23 | tg_payment_method_t payment_method; | ||
| 24 | bool active; | ||
| 25 | } tg_session_t; | ||
| 26 | |||
| 27 | int tg_session_init(void); | ||
| 28 | tg_session_t *tg_session_create(uint32_t client_ip, uint64_t allotment_ms); | ||
| 29 | tg_session_t *tg_session_create_bytes(uint32_t client_ip, uint64_t allotment_bytes); | ||
| 30 | void tg_session_add_bytes(uint32_t client_ip, uint64_t bytes); | ||
| 31 | tg_session_t *tg_session_find_by_ip(uint32_t client_ip); | ||
| 32 | tg_session_t *tg_session_find_by_mac(const char *mac); | ||
| 33 | void tg_session_extend(tg_session_t *session, uint64_t additional_ms); | ||
| 34 | bool tg_session_is_expired(const tg_session_t *session); | ||
| 35 | void tg_session_revoke(tg_session_t *session); | ||
| 36 | void tg_session_revoke_all(void); | ||
| 37 | int tg_session_active_count(void); | ||
| 38 | void tg_session_tick(void); | ||
| 39 | tg_session_t *tg_session_get_array(void); | ||
| 40 | int tg_session_get_array_size(void); | ||
| 41 | |||
| 42 | #endif | ||