simworld/common/include/request.h

43 lines
967 B
C
Raw Normal View History

#ifndef COMMON_REQUEST_H
#define COMMON_REQUEST_H
#include <stdbool.h>
#include <stdlib.h>
#include "error.h"
#include "request/get_world_data.h"
enum request_type_t {
REQUEST_NONE,
REQUEST_GET_WORLD_DATA,
};
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);
struct response_t {
2024-10-23 01:25:27 +00:00
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