From bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 15 Mar 2014 01:49:50 +0100 Subject: Lean and mean initial commit Not much functionality yet --- types.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 types.h (limited to 'types.h') diff --git a/types.h b/types.h new file mode 100644 index 0000000..058d3df --- /dev/null +++ b/types.h @@ -0,0 +1,52 @@ +#ifndef _TYPES_H_ +#define _TYPES_H_ + +#include +#include +#include + +#define REQLEN 4000 +#define MAXMSGLEN 10000 + +#define BOOL uint8_t +#define TRUE 1 +#define FALSE 0 + +typedef struct { + void (*callback)(void *data, int haveIn, int haveOut, int doCleanup); + int fd; +} epoll_item_t; + +typedef struct { + void (*callback)(void *data, int haveIn, int haveOut, int doCleanup); + int fd; +} epoll_listen_t; + +typedef struct { + void (*callback)(void *data, int haveIn, int haveOut, int doCleanup); + int fd; + int padding; + // Send buffer (me to client) + size_t sbPos, sbFill, sbLen; + char *sendBuffer; // Dynamically allocated, might or might not get huge + // Recv buffer (client's request) + size_t rbPos; + char readBuffer[REQLEN]; // Static, queries > 4000 bytes simply not supported + BOOL bound; +} epoll_client_t; + +typedef struct { + void (*callback)(void *data, int haveIn, int haveOut, int doCleanup); + int fd; + // Send buffer (me to server) + size_t sbPos, sbFill, sbLen; + char *sendBuffer; // Dynamically allocated, might or might not get huge + // Recv buffer (server's response) + size_t rbPos; + char readBuffer[MAXMSGLEN]; + BOOL bound; + //unsigned long messageId; // ID of message currently being received + time_t lastActive; +} epoll_server_t; + +#endif -- cgit v1.2.3-55-g7522