diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-08-22 17:11:58 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-10-28 17:02:14 +0100 |
| commit | 39512e6f9b08f8057c6056473cb34bcbcf29af66 (patch) | |
| tree | b7404940e0cd34fca0d33afa34c1fa1c46d60dbc /exports/exports.h | |
| parent | 582c828d4473bc2a97d541b80fae19f8906e39a2 (diff) | |
Exports: Initial tests
Diffstat (limited to 'exports/exports.h')
| -rw-r--r-- | exports/exports.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/exports/exports.h b/exports/exports.h new file mode 100644 index 0000000..a31920b --- /dev/null +++ b/exports/exports.h @@ -0,0 +1,46 @@ +#ifndef EXPORTS_H +#define EXPORTS_H + +#include <stdint.h> +#include <stdlib.h> + +typedef long long int (*ReadRxBytes)(); + +typedef int (*StateCB)(int oldstate, int newstate, void* data); + +typedef void (*RefreshList)(); +typedef void (*TokenGetter)(const char* server_id, int server_type, char* out, size_t len); +typedef void (*TokenSetter)(const char* server_id, int server_type, const char* tokens); +typedef void (*ProxySetup)(int fd, const char* peer_ips); +typedef void (*ProxyReady)(); + +static long long int get_read_rx_bytes(ReadRxBytes read) +{ + return read(); +} +static int call_callback(StateCB callback, int oldstate, int newstate, void* data) +{ + return callback(oldstate, newstate, data); +} +static void call_refresh_list(RefreshList refresh) +{ + refresh(); +} +static void call_token_getter(TokenGetter getter, const char* server_id, int server_type, char* out, size_t len) +{ + getter(server_id, server_type, out, len); +} +static void call_token_setter(TokenSetter setter, const char* server_id, int server_type, const char* tokens) +{ + setter(server_id, server_type, tokens); +} +static void call_proxy_setup(ProxySetup proxysetup, int fd, const char* peer_ips) +{ + proxysetup(fd, peer_ips); +} +static void call_proxy_ready(ProxyReady ready) +{ + ready(); +} + +#endif /* EXPORTS_H */ |
