aboutsummaryrefslogtreecommitdiff
path: root/src/net/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/common.h')
-rw-r--r--src/net/common.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/net/common.h b/src/net/common.h
index 947eee7..6bb161c 100644
--- a/src/net/common.h
+++ b/src/net/common.h
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
-#define _GNU_SOURCE
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -26,9 +25,6 @@
#define HTTP_BUFFER_SIZE 4098
#define max_content_length 200000
-static int ports[65535] = { 0 };
-static parray_t* paths = NULL;
-
enum file_status {
_ignore, BARRIER_READ, FILE_HEADER, FILE_BODY, NORMAL
};
@@ -40,10 +36,11 @@ struct file_parse {
};
typedef struct {
- int fd;
+ int fd, ser;
int port;
lua_State* L;
struct sockaddr_in cli;
+ parray_t* paths;
} thread_arg_struct;
struct lchar {
@@ -52,6 +49,10 @@ struct lchar {
char req[20];
};
+struct net_server_state {
+ int event_fd;
+};
+
struct sarray_t {
struct lchar** cs;
int len;
@@ -59,4 +60,12 @@ struct sarray_t {
extern map_t* mime_type;
+int start_serv(lua_State* L, int port, parray_t* paths, struct net_server_state*);
+
+enum {
+ NETEV_NULL = 0,
+ NETEV_DEFAULT = 1,
+ NETEV_CLOSE_EVENT = 2,
+};
+
#endif