#ifndef COMMON_REQUEST_H #define COMMON_REQUEST_H #include #include "error.h" #include "world.h" // ### REQUEST TYPES ### // enum request_type_t { REQUEST_NONE, REQUEST_GET_WORLD_DATA, }; struct request_body_get_world_data_t { size_t world_id; }; struct request_t { enum request_type_t type; void *body; // The body's type depends on the request's type }; enum error_t request_serialise_str(struct request_t const *, char const **); enum error_t request_deserialise_str(struct request_t *, char const *); enum error_t request_serialise_buf(struct request_t const *, char *, size_t); // ### RESPONSE TYPES ### // struct response_body_get_world_data_t { struct world_t world; }; struct response_t { enum request_type_t type; bool success; void *body; // The body's type depends on the request's type }; enum error_t response_serialise_str(struct response_t const *, char const **); enum error_t response_deserialise_str(struct response_t *, char const *); enum error_t response_serialise_buf(struct response_t const *, char *, size_t); #endif