diff options
Diffstat (limited to 'types.h')
-rw-r--r-- | types.h | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -0,0 +1,52 @@ +#ifndef _TYPES_H_ +#define _TYPES_H_ + +#include <stddef.h> +#include <stdint.h> +#include <time.h> + +#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 |