upleb.uk

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

summaryrefslogtreecommitdiff
path: root/components/tollgate_core/include
diff options
context:
space:
mode:
Diffstat (limited to 'components/tollgate_core/include')
-rw-r--r--components/tollgate_core/include/tollgate_core.h34
-rw-r--r--components/tollgate_core/include/tollgate_platform.h17
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
10esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip);
11
12esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns);
13void tollgate_core_dns_stop(void);
14
15esp_err_t tollgate_core_process_payment(uint32_t client_ip, const char *token_str);
16
17void tollgate_core_client_connected(const uint8_t *mac, uint32_t client_ip);
18void tollgate_core_client_disconnected(const uint8_t *mac);
19
20void tollgate_core_tick(void);
21
22bool tollgate_core_is_client_allowed(uint32_t client_ip);
23bool tollgate_core_is_dns_running(void);
24
25char *tollgate_core_get_status_json(void);
26char *tollgate_core_get_config_json(void);
27
28int tollgate_core_active_session_count(void);
29int tollgate_core_allowed_client_count(void);
30
31bool tollgate_core_is_owner(uint32_t client_ip);
32bool 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
7typedef 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