summaryrefslogtreecommitdiffstats
path: root/types.h
diff options
context:
space:
mode:
authorSimon Rettberg2014-03-15 01:49:50 +0100
committerSimon Rettberg2014-03-15 01:49:50 +0100
commitbedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad (patch)
treec7d1995a09f6ed0c4e6873252e957d72f5d07d07 /types.h
downloadldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.gz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.xz
ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.zip
Lean and mean initial commit
Not much functionality yet
Diffstat (limited to 'types.h')
-rw-r--r--types.h52
1 files changed, 52 insertions, 0 deletions
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 <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