upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tollgate_core/src/tollgate_session.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-23 04:50:26 +0530
committerYour Name <you@example.com>2026-05-23 04:50:26 +0530
commit9330b01c28aebc865a3c0a51df8730196cb4152e (patch)
tree60c3ae35b2550c737c228e81fd342c8d07af11af /tollgate_core/src/tollgate_session.h
parent851801f50f1282ab1db5f8a241dbd245f59e447e (diff)
Phase 6a-6d: Consolidate and clean up
6a: Delete dead standalone tollgate_core/ (12 files, never compiled) 6b: Rewrite dns_server.c as thin shim to component's tollgate_core_dns - Fix component DNS to bind to AP IP instead of INADDR_ANY 6c: Rewrite stratum_proxy.c as thin shim with struct cast to component types 6d: Move sandbox logic into component's tollgate_core_firewall - Add tollgate_core_fw_set_sandbox_ports/set_sandbox_mint_access - Add is_sandbox_allowed() to component's ip4_canforward_filter - Clean main/firewall.c to delegate filter to component - Remove redundant DNS auth double-calls from main firewall Add ROADMAP.md with full extraction plan and checklists All 21 unit tests pass. ESP-IDF build passes.
Diffstat (limited to 'tollgate_core/src/tollgate_session.h')
-rw-r--r--tollgate_core/src/tollgate_session.h42
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
10typedef enum {
11 TG_PAYMENT_CASHU,
12 TG_PAYMENT_MINING,
13 TG_PAYMENT_BYTES
14} tg_payment_method_t;
15
16typedef 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
27int tg_session_init(void);
28tg_session_t *tg_session_create(uint32_t client_ip, uint64_t allotment_ms);
29tg_session_t *tg_session_create_bytes(uint32_t client_ip, uint64_t allotment_bytes);
30void tg_session_add_bytes(uint32_t client_ip, uint64_t bytes);
31tg_session_t *tg_session_find_by_ip(uint32_t client_ip);
32tg_session_t *tg_session_find_by_mac(const char *mac);
33void tg_session_extend(tg_session_t *session, uint64_t additional_ms);
34bool tg_session_is_expired(const tg_session_t *session);
35void tg_session_revoke(tg_session_t *session);
36void tg_session_revoke_all(void);
37int tg_session_active_count(void);
38void tg_session_tick(void);
39tg_session_t *tg_session_get_array(void);
40int tg_session_get_array_size(void);
41
42#endif