2013-11-02 18:44:02 +01:00
|
|
|
#ifndef __MSG
|
|
|
|
# define __MSG
|
2013-11-02 17:51:43 +01:00
|
|
|
|
2013-11-02 19:21:09 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2013-11-02 18:05:41 +01:00
|
|
|
//typedef struct Buffer {
|
|
|
|
// int size;
|
|
|
|
// void *data;
|
|
|
|
//} Buffer;
|
2013-11-02 17:51:43 +01:00
|
|
|
|
2013-11-02 14:44:17 +01:00
|
|
|
struct message {
|
2013-11-02 17:29:41 +01:00
|
|
|
uint32_t timestamp;
|
2013-11-02 19:46:34 +01:00
|
|
|
uint32_t width; // normally 80
|
|
|
|
uint32_t height; // normally 25, may vary
|
2013-11-02 17:29:41 +01:00
|
|
|
//char **image; // dimension is width x height
|
2013-11-02 17:20:34 +01:00
|
|
|
char *image; // dimension is width x height
|
2013-11-02 18:51:10 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* image[row][col] >>> image[row*width+col];
|
|
|
|
*/
|
|
|
|
|
2013-11-02 14:44:17 +01:00
|
|
|
};
|
2013-11-02 17:51:43 +01:00
|
|
|
|
|
|
|
int getBufferSize(struct message *msg);
|
|
|
|
void serialize(char *buf,struct message *msg);
|
|
|
|
void deserialize(struct message *msg,const char *buf);
|
|
|
|
|
2013-11-02 18:05:41 +01:00
|
|
|
/*
|
2013-11-02 17:51:43 +01:00
|
|
|
struct Buffer *new_buffer();
|
|
|
|
void append_space(Buffer *b,int n);
|
|
|
|
void serialize_int(int x,Buffer *b);
|
|
|
|
void serialize_string(char *str,Buffer *b);
|
|
|
|
void serialize_message(struct message *msg,Buffer *b);
|
2013-11-02 18:05:41 +01:00
|
|
|
*/
|
2013-11-02 18:44:02 +01:00
|
|
|
|
|
|
|
#endif
|