/* * protocol.h * * Created on: 28.11.2010 * Author: msloup */ #ifndef PROTOCOL_H_ #define PROTOCOL_H_ #define OP_OK 'O' #define OP_GET 'G' #define OP_SET 'S' #define OP_ERROR 'E' #define OP_CLOSE 'C' struct protocol_header { u_int8_t operation; u_int32_t client_id; u_int32_t send_at_sec; u_int32_t send_at_usec; u_int16_t count; }; struct protocol_item { u_int32_t index; u_int32_t value; u_int32_t ts; }; #define PROTOCOL_HDR_LEN sizeof(struct protocol_header) #define PROTOCOL_ITM_LEN sizeof(struct protocol_item) \ extern struct protocol_header create_header(char operation, int count); extern struct protocol_header create_header(char operation, int count, int client_id); extern struct item protocol_item_to_item(struct protocol_item source); extern struct protocol_item item_to_protocol_item(int index, struct item source); extern int protocol_item_index(struct protocol_item source); #endif /* PROTOCOL_H_ */