blob: 417baa1f9e49f24e037e64b0e3196205d043714f (
plain) (
tree)
|
|
#ifndef _TYPES_H_
#define _TYPES_H_
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#define REQLEN 4000
#define MAXMSGLEN 100000
#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
|