sysdis-project/central-manager/lib/network/format/serializer.h

66 lines
2.0 KiB
C
Raw Normal View History

2017-04-01 15:01:36 +00:00
#ifndef _LIB_NETWORK_FORMAT_SERIALIZER_H_
#define _LIB_NETWORK_FORMAT_SERIALIZER_H_
2017-04-03 16:04:57 +00:00
#include <string.h>
#include "../../plane/plane.h"
2017-04-01 15:01:36 +00:00
2017-04-03 16:04:57 +00:00
struct plane_request{ // Plane Request
struct coord co;
struct control ct;
};
2017-04-06 10:01:18 +00:00
2017-04-03 16:04:57 +00:00
struct vterm_request{ // ViewTerminal Request
char flags;
};
2017-04-06 10:01:18 +00:00
2017-04-03 16:04:57 +00:00
struct term_response{ // Terminal-s Response
char flags;
struct coord co;
struct control ct;
};
2017-04-01 15:01:36 +00:00
2017-04-03 16:04:57 +00:00
struct cterm_request{ // ControlTerminal Request
char flags;
2017-04-06 10:01:18 +00:00
int z;
2017-04-03 16:04:57 +00:00
struct control ct;
};
2017-04-06 10:01:18 +00:00
2017-04-03 16:04:57 +00:00
/* 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);
2017-04-01 15:01:36 +00:00
2017-04-03 16:04:57 +00:00
/* 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);
2017-04-01 15:01:36 +00:00
2017-04-03 16:04:57 +00:00
/* 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);
2017-04-06 10:03:46 +00:00
2017-04-03 16:04:57 +00:00
/* 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);
2017-04-06 10:03:46 +00:00
>>>>>>> d647392d99c86e94aa550f6cf0e7f284c4b226a3
2017-04-01 15:01:36 +00:00
#endif