43 lines
967 B
C
43 lines
967 B
C
#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 {
|
|
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
|