diff options
| author | Your Name <you@example.com> | 2026-05-23 04:10:28 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-23 04:10:28 +0530 |
| commit | 851801f50f1282ab1db5f8a241dbd245f59e447e (patch) | |
| tree | 3285d0714da89879acd21b8c3fb9afeff586ed1e /tollgate_core/include | |
| parent | 39aa27a9522aeb8f731f4d3de48939e75775900e (diff) | |
Phase 5: Wire main/ shims to components/tollgate_core
- session.c/h: thin shim casting session_t* <-> tg_session_t*, delegates to tollgate_core_session_*
- firewall.c/h: keeps ESP-specific lwIP hooks, delegates allowlist to tollgate_core_fw_*
- cashu.c/h: shim delegates to tollgate_core_cashu_*, multi-mint via config directly
- mining_payment.c: shim delegates to tollgate_core_mining_*
- tollgate_main.c: calls tollgate_core_init(tollgate_esp_get_platform(), ap_ip) in start_services()
- tollgate_esp: removed target_sources for standalone sources, depends on tollgate_core component
- tollgate_core component: added tollgate_core_get_platform(), tg_payment_method_t enum
- Unit tests: updated Makefile for component source compilation, all 22 tests pass
- Hardware verified: Board A boots, AP visible, 5/6 smoke tests pass (internet test needs upstream WiFi)
Diffstat (limited to 'tollgate_core/include')
| -rw-r--r-- | tollgate_core/include/tollgate_core.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tollgate_core/include/tollgate_core.h b/tollgate_core/include/tollgate_core.h index fc20caa..bbae7cf 100644 --- a/tollgate_core/include/tollgate_core.h +++ b/tollgate_core/include/tollgate_core.h | |||
| @@ -56,8 +56,33 @@ const void *tollgate_core_get_sessions_array(void); | |||
| 56 | int tollgate_core_get_sessions_array_size(void); | 56 | int tollgate_core_get_sessions_array_size(void); |
| 57 | void *tollgate_core_find_session_by_ip(uint32_t ip); | 57 | void *tollgate_core_find_session_by_ip(uint32_t ip); |
| 58 | void *tollgate_core_find_session_by_mac(const char *mac); | 58 | void *tollgate_core_find_session_by_mac(const char *mac); |
| 59 | void *tollgate_core_session_create(uint32_t client_ip, uint64_t allotment_ms); | ||
| 60 | void *tollgate_core_session_create_bytes(uint32_t client_ip, uint64_t allotment_bytes); | ||
| 59 | void tollgate_core_session_extend(void *session, uint64_t additional_ms); | 61 | void tollgate_core_session_extend(void *session, uint64_t additional_ms); |
| 62 | void tollgate_core_session_revoke(void *session); | ||
| 60 | int tollgate_core_session_add_bytes(uint32_t client_ip, uint64_t bytes); | 63 | int tollgate_core_session_add_bytes(uint32_t client_ip, uint64_t bytes); |
| 64 | bool tollgate_core_session_is_expired(const void *session); | ||
| 65 | |||
| 66 | void tollgate_core_firewall_grant(uint32_t client_ip); | ||
| 67 | void tollgate_core_firewall_revoke(uint32_t client_ip); | ||
| 68 | int tollgate_core_firewall_get_mac_for_ip(uint32_t client_ip, char *mac_out, int mac_out_size); | ||
| 69 | |||
| 70 | int tollgate_core_cashu_decode(const char *token_str, void *out); | ||
| 71 | int tollgate_core_cashu_check_states(const char *mint_url, const void *token, | ||
| 72 | void *states, int *state_count); | ||
| 73 | uint64_t tollgate_core_cashu_allotment(uint64_t amount, uint64_t price, uint64_t step_size); | ||
| 74 | bool tollgate_core_cashu_is_mint_accepted(const char *mint_url); | ||
| 75 | const char *tollgate_core_cashu_token_mint(const void *token); | ||
| 76 | uint64_t tollgate_core_cashu_token_amount(const void *token); | ||
| 77 | |||
| 78 | void tollgate_core_mining_update_hashrate(uint32_t client_ip, bool accepted); | ||
| 79 | const void *tollgate_core_mining_get_client_stats(uint32_t client_ip); | ||
| 80 | double tollgate_core_mining_get_hashprice(void); | ||
| 81 | uint64_t tollgate_core_mining_shares_to_allotment_ms(double hashrate, double hashprice, | ||
| 82 | int price, int step_ms); | ||
| 83 | uint64_t tollgate_core_mining_shares_to_allotment_bytes(double hashrate, double hashprice, | ||
| 84 | int price, int step_bytes); | ||
| 85 | void tollgate_core_mining_set_nbits(uint32_t nbits); | ||
| 61 | 86 | ||
| 62 | const tollgate_platform_t *tollgate_core_get_platform(void); | 87 | const tollgate_platform_t *tollgate_core_get_platform(void); |
| 63 | uint32_t tollgate_core_get_ap_ip(void); | 88 | uint32_t tollgate_core_get_ap_ip(void); |