65 lines
2.0 KiB
C
65 lines
2.0 KiB
C
#ifndef _LIB_NETWORK_FORMAT_SERIALIZER_H_
|
|
#define _LIB_NETWORK_FORMAT_SERIALIZER_H_
|
|
|
|
#include <string.h>
|
|
#include "../../../plane.h"
|
|
|
|
struct plane_request{ // Plane Request
|
|
struct coord co;
|
|
struct control ct;
|
|
};
|
|
|
|
struct vterm_request{ // ViewTerminal Request
|
|
char flags;
|
|
};
|
|
|
|
struct term_response{ // Terminal-s Response
|
|
char flags;
|
|
struct coord co;
|
|
struct control ct;
|
|
};
|
|
|
|
struct cterm_request{ // ControlTerminal Request
|
|
char flags;
|
|
int z;
|
|
struct control ct;
|
|
};
|
|
|
|
/* Parse a plane request ('char*' to 'struct plane_request')
|
|
*
|
|
* @history
|
|
* [1] Check if buffer have correct size (according to destination struct)
|
|
* [2] Parse buffer to struct
|
|
*
|
|
*/
|
|
int parse_plane_request(const char* pIn, struct plane_request* pOut);
|
|
|
|
/* Parse a viewTerminal request ('char*' to 'struct vt_request')
|
|
*
|
|
* @history
|
|
* [1] Check if buffer have correct size (according to destination struct)
|
|
* [2] Parse buffer to struct
|
|
*
|
|
*/
|
|
int parse_viewterm_request(const char* pIn, struct vterm_request* pOut);
|
|
|
|
/* Parse a ctrlTerminal request ('char*' to 'struct ct_request')
|
|
*
|
|
* @history
|
|
* [1] Check if buffer have correct size (according to destination struct)
|
|
* [2] Parse buffer to struct
|
|
*
|
|
*/
|
|
int parse_ctrlterm_request(const char* pIn, struct cterm_request* pOut);
|
|
|
|
/* Serialize a Terminal response ('struct t_response' to 'char*')
|
|
*
|
|
* @history
|
|
* [1] Check if buffer have correct size (according to input struct)
|
|
* [2] Serialize struct into buffer
|
|
*
|
|
*/
|
|
int serialize_term_response(const struct term_response* pIn, char* pOut, const size_t pSize);
|
|
|
|
|
|
#endif |