Flecs v4.0
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/* For the REST system */
32#ifndef FLECS_PIPELINE
33#define FLECS_PIPELINE
34#endif
35
36#ifndef FLECS_REST_H
37#define FLECS_REST_H
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#define ECS_REST_DEFAULT_PORT (27750)
44
46FLECS_API extern const ecs_entity_t ecs_id(EcsRest);
47
49typedef struct {
50 uint16_t port;
51 char *ipaddr;
52 void *impl;
53} EcsRest;
54
63FLECS_API
65 ecs_world_t *world,
66 const ecs_http_server_desc_t *desc);
67
71FLECS_API
74
83FLECS_API
85 ecs_world_t *world);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif
92
95#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.
FLECS_API void FlecsRestImport(ecs_world_t *world)
Rest module import function.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:346
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:390
Component that creates a REST API server when instantiated.
Definition rest.h:49
uint16_t port
Port of server (optional, default = 27750)
Definition rest.h:50
char * ipaddr
Interface address (optional, default = 0.0.0.0)
Definition rest.h:51
Used with ecs_http_server_init().
Definition http.h:123