diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-14 13:56:49 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-14 13:56:49 +0200 |
| commit | da83f54606c9c1d2786d87074ee17ed972d2e1b2 (patch) | |
| tree | 0be57934f9f467c87576abb0b457fb54b2d25d52 /exports/c | |
| parent | fd34e72da8c604517050ada7e883ba982829d985 (diff) | |
Refactor: Return without json
Diffstat (limited to 'exports/c')
| -rw-r--r-- | exports/c/common.c | 6 | ||||
| -rw-r--r-- | exports/c/common.h | 3 | ||||
| -rw-r--r-- | exports/c/disco.h | 15 | ||||
| -rw-r--r-- | exports/c/servers.h | 43 |
4 files changed, 67 insertions, 0 deletions
diff --git a/exports/c/common.c b/exports/c/common.c new file mode 100644 index 0000000..425a459 --- /dev/null +++ b/exports/c/common.c @@ -0,0 +1,6 @@ +#include "common.h" + +void call_callback(PythonCB callback, const char *name, int oldstate, int newstate, void* data) +{ + callback(name, oldstate, newstate, data); +} diff --git a/exports/c/common.h b/exports/c/common.h new file mode 100644 index 0000000..068ad4c --- /dev/null +++ b/exports/c/common.h @@ -0,0 +1,3 @@ +typedef void (*PythonCB)(const char* name, int oldstate, int newstate, void* data); + +void call_callback(PythonCB callback, const char *name, int oldstate, int newstate, void* data); diff --git a/exports/c/disco.h b/exports/c/disco.h new file mode 100644 index 0000000..41d59fa --- /dev/null +++ b/exports/c/disco.h @@ -0,0 +1,15 @@ +// for size_t +#include <stddef.h> + +typedef struct discoveryOrganization { + const char* display_name; + const char* org_id; + const char* secure_internet_home; + const char* keyword_list; +} discoveryOrganization; + +typedef struct discoveryOrganizations { + unsigned long long int version; + discoveryOrganization** organizations; + size_t total_organizations; +} discoveryOrganizations; diff --git a/exports/c/servers.h b/exports/c/servers.h new file mode 100644 index 0000000..39e52a2 --- /dev/null +++ b/exports/c/servers.h @@ -0,0 +1,43 @@ +// for size_t +#include <stddef.h> + +// The struct for a single server profile +typedef struct serverProfile { + const char* id; + const char* display_name; + //const char* proto_list; + int default_gateway; +} serverProfile; + +// The struct for all server profiles +typedef struct serverProfiles { + int current; + serverProfile** profiles; + size_t total_profiles; +} serverProfiles; + +// The struct for server locations +typedef struct serverLocations { + const char** locations; + size_t total_locations; +} serverLocations; + +// The struct for a single server +typedef struct server { + const char* identifier; + const char* display_name; + const char* country_code; + const char** support_contact; + size_t total_support_contact; + serverProfiles* profiles; + unsigned long long int expire_time; +} server; + +// The struct for all servers +typedef struct servers { + server** custom_servers; + size_t total_custom; + server** institute_servers; + size_t total_institute; + server* secure_internet_server; +} servers; |
