diff options
Diffstat (limited to 'components/tollgate_core/include')
| -rw-r--r-- | components/tollgate_core/include/tollgate_core.h | 34 | ||||
| -rw-r--r-- | components/tollgate_core/include/tollgate_platform.h | 17 |
2 files changed, 51 insertions, 0 deletions
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 @@ | |||
| 1 | #ifndef TOLLGATE_CORE_H | ||
| 2 | #define TOLLGATE_CORE_H | ||
| 3 | |||
| 4 | #include "tollgate_platform.h" | ||
| 5 | #include "esp_err.h" | ||
| 6 | #include "esp_netif.h" | ||
| 7 | #include <stdbool.h> | ||
| 8 | #include <stdint.h> | ||
| 9 | |||
| 10 | esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip); | ||
| 11 | |||
| 12 | esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns); | ||
| 13 | void tollgate_core_dns_stop(void); | ||
| 14 | |||
| 15 | esp_err_t tollgate_core_process_payment(uint32_t client_ip, const char *token_str); | ||
| 16 | |||
| 17 | void tollgate_core_client_connected(const uint8_t *mac, uint32_t client_ip); | ||
| 18 | void tollgate_core_client_disconnected(const uint8_t *mac); | ||
| 19 | |||
| 20 | void tollgate_core_tick(void); | ||
| 21 | |||
| 22 | bool tollgate_core_is_client_allowed(uint32_t client_ip); | ||
| 23 | bool tollgate_core_is_dns_running(void); | ||
| 24 | |||
| 25 | char *tollgate_core_get_status_json(void); | ||
| 26 | char *tollgate_core_get_config_json(void); | ||
| 27 | |||
| 28 | int tollgate_core_active_session_count(void); | ||
| 29 | int tollgate_core_allowed_client_count(void); | ||
| 30 | |||
| 31 | bool tollgate_core_is_owner(uint32_t client_ip); | ||
| 32 | bool tollgate_core_is_owner_connected(void); | ||
| 33 | |||
| 34 | #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 @@ | |||
| 1 | #ifndef TOLLGATE_PLATFORM_H | ||
| 2 | #define TOLLGATE_PLATFORM_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 7 | typedef struct { | ||
| 8 | uint16_t (*get_price_sats)(void); | ||
| 9 | int32_t (*get_step_ms)(void); | ||
| 10 | const char * (*get_mint_url)(void); | ||
| 11 | const char * (*get_metric)(void); | ||
| 12 | int32_t (*get_step_bytes)(void); | ||
| 13 | int64_t (*get_time_ms)(void); | ||
| 14 | bool (*spend_proofs)(const char *raw_token_json); | ||
| 15 | } tollgate_platform_t; | ||
| 16 | |||
| 17 | #endif | ||