From 82f1fc0d5535eda3fc9eab799d81b3e220dbe4ef Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 May 2026 02:10:01 +0530 Subject: feat: add tollgate_core component + market config wiring - Add tollgate_core ESP-IDF component (skeleton: cashu, dns, firewall, session) - Add tollgate_platform.c with SPIFFS config backend - Wire market_enabled, market_scan_interval_s, client_auto_switch in config.c - Add lwip_tollgate_hooks.h (updated from feature branch) - Add E2E fix plan, tollgate_core design doc, WPA autodetect plan - Add integration test network helpers - Add CONSOLIDATION.md plan Reverts the broken merge (be4788b) that gutted config.c/tollgate_main.c/tollgate_api.c and replaces it with a clean addition on top of intact master. --- components/tollgate_core/include/tollgate_core.h | 34 ++++++++++++++++++++++ .../tollgate_core/include/tollgate_platform.h | 17 +++++++++++ 2 files changed, 51 insertions(+) create mode 100644 components/tollgate_core/include/tollgate_core.h create mode 100644 components/tollgate_core/include/tollgate_platform.h (limited to 'components/tollgate_core/include') diff --git a/components/tollgate_core/include/tollgate_core.h b/components/tollgate_core/include/tollgate_core.h new file mode 100644 index 0000000..c47ebeb --- /dev/null +++ b/components/tollgate_core/include/tollgate_core.h @@ -0,0 +1,34 @@ +#ifndef TOLLGATE_CORE_H +#define TOLLGATE_CORE_H + +#include "tollgate_platform.h" +#include "esp_err.h" +#include "esp_netif.h" +#include +#include + +esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip); + +esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns); +void tollgate_core_dns_stop(void); + +esp_err_t tollgate_core_process_payment(uint32_t client_ip, const char *token_str); + +void tollgate_core_client_connected(const uint8_t *mac, uint32_t client_ip); +void tollgate_core_client_disconnected(const uint8_t *mac); + +void tollgate_core_tick(void); + +bool tollgate_core_is_client_allowed(uint32_t client_ip); +bool tollgate_core_is_dns_running(void); + +char *tollgate_core_get_status_json(void); +char *tollgate_core_get_config_json(void); + +int tollgate_core_active_session_count(void); +int tollgate_core_allowed_client_count(void); + +bool tollgate_core_is_owner(uint32_t client_ip); +bool tollgate_core_is_owner_connected(void); + +#endif diff --git a/components/tollgate_core/include/tollgate_platform.h b/components/tollgate_core/include/tollgate_platform.h new file mode 100644 index 0000000..f60f1f9 --- /dev/null +++ b/components/tollgate_core/include/tollgate_platform.h @@ -0,0 +1,17 @@ +#ifndef TOLLGATE_PLATFORM_H +#define TOLLGATE_PLATFORM_H + +#include +#include + +typedef struct { + uint16_t (*get_price_sats)(void); + int32_t (*get_step_ms)(void); + const char * (*get_mint_url)(void); + const char * (*get_metric)(void); + int32_t (*get_step_bytes)(void); + int64_t (*get_time_ms)(void); + bool (*spend_proofs)(const char *raw_token_json); +} tollgate_platform_t; + +#endif -- cgit v1.2.3