Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
rest.h
Go to the documentation of this file.
1
11#ifdef FLECS_REST
12
21/* Used for the HTTP server */
22#ifndef FLECS_HTTP
23#define FLECS_HTTP
24#endif
25
26/* Used for building the JSON replies */
27#ifndef FLECS_JSON
28#define FLECS_JSON
29#endif
30
31/* Query engine used */
32#ifndef FLECS_RULES
33#define FLECS_RULES
34#endif
35
36/* For the REST system */
37#ifndef FLECS_PIPELINE
38#define FLECS_PIPELINE
39#endif
40
41#ifndef FLECS_REST_H
42#define FLECS_REST_H
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#define ECS_REST_DEFAULT_PORT (27750)
49
51FLECS_API extern const ecs_entity_t ecs_id(EcsRest);
52
53typedef struct {
54 uint16_t port;
55 char *ipaddr;
56 void *impl;
57} EcsRest;
58
59/* Global statistics */
60extern int64_t ecs_rest_request_count;
61extern int64_t ecs_rest_entity_count;
62extern int64_t ecs_rest_entity_error_count;
63extern int64_t ecs_rest_query_count;
64extern int64_t ecs_rest_query_error_count;
65extern int64_t ecs_rest_query_name_count;
66extern int64_t ecs_rest_query_name_error_count;
67extern int64_t ecs_rest_query_name_from_cache_count;
68extern int64_t ecs_rest_enable_count;
69extern int64_t ecs_rest_enable_error_count;
70extern int64_t ecs_rest_delete_count;
71extern int64_t ecs_rest_delete_error_count;
72extern int64_t ecs_rest_world_stats_count;
73extern int64_t ecs_rest_pipeline_stats_count;
74extern int64_t ecs_rest_stats_error_count;
75
84FLECS_API
86 ecs_world_t *world,
87 const ecs_http_server_desc_t *desc);
88
92FLECS_API
95
96/* Module import */
97FLECS_API
98void FlecsRestImport(
99 ecs_world_t *world);
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif
106
109#endif
struct ecs_http_server_t ecs_http_server_t
HTTP server.
Definition: http.h:48
FLECS_API ecs_http_server_t * ecs_rest_server_init(ecs_world_t *world, const ecs_http_server_desc_t *desc)
Create HTTP server for REST API.
FLECS_API const ecs_entity_t ecs_id(EcsRest)
Component that instantiates the REST API.
FLECS_API void ecs_rest_server_fini(ecs_http_server_t *srv)
Cleanup REST HTTP server.
ecs_id_t ecs_entity_t
An entity identifier.
Definition: flecs.h:270
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition: flecs.h:279
Definition: rest.h:53
uint16_t port
Port of server (optional, default = 27750)
Definition: rest.h:54
char * ipaddr
Interface address (optional, default = 0.0.0.0)
Definition: rest.h:55
Used with ecs_http_server_init.
Definition: http.h:123