From a702315531cb3da027d6349611196f1f9789ecc1 Mon Sep 17 00:00:00 2001 From: Sam Stevens Date: Fri, 15 Aug 2014 21:33:24 +0100 Subject: [PATCH] More changes --- lib/ut/utstring.h | 1 + nbproject/Makefile-Debug.mk | 6 +++++ nbproject/Makefile-Release.mk | 6 +++++ nbproject/configurations.xml | 20 ++++++++++++++++ src/config.c | 3 ++- src/config.h | 5 ++-- src/data-buffer.c | 3 +-- src/data-buffer.h | 2 +- src/http-reader.c | 10 ++++---- src/http-reader.h | 20 +++++++++++----- src/http-server.c | 5 ++-- src/http-server.h | 4 ++-- src/http.c | 4 +++- src/http.h | 44 ++++++++++++++++++----------------- src/main-loop.c | 17 ++++++-------- src/main-loop.h | 19 +++++---------- src/main.c | 28 ---------------------- src/main.h | 6 ----- src/queue.c | 28 ++++++++++++++++++---- src/queue.h | 1 + src/server-connection.c | 33 ++++++++++++++++++++++++++ src/server-connection.h | 42 +++++++++++++++++++++++++++++++++ src/server-socket.c | 3 ++- src/server-socket.h | 4 +++- src/socket.c | 9 +++---- src/socket.h | 5 ++-- src/thread-pool.h | 1 + src/version.h | 23 ++++++++++++++++++ 28 files changed, 238 insertions(+), 114 deletions(-) create mode 100644 src/server-connection.c create mode 100644 src/server-connection.h create mode 100644 src/version.h diff --git a/lib/ut/utstring.h b/lib/ut/utstring.h index af9bc18..1dd5c0c 100644 --- a/lib/ut/utstring.h +++ b/lib/ut/utstring.h @@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _UNUSED_ #endif +#include #include #include #include diff --git a/nbproject/Makefile-Debug.mk b/nbproject/Makefile-Debug.mk index 2642742..b30040c 100644 --- a/nbproject/Makefile-Debug.mk +++ b/nbproject/Makefile-Debug.mk @@ -47,6 +47,7 @@ OBJECTFILES= \ ${OBJECTDIR}/src/main.o \ ${OBJECTDIR}/src/mime.o \ ${OBJECTDIR}/src/queue.o \ + ${OBJECTDIR}/src/server-connection.o \ ${OBJECTDIR}/src/server-socket.o \ ${OBJECTDIR}/src/socket.o \ ${OBJECTDIR}/src/thread-pool.o \ @@ -137,6 +138,11 @@ ${OBJECTDIR}/src/queue.o: nbproject/Makefile-${CND_CONF}.mk src/queue.c ${RM} "$@.d" $(COMPILE.c) -g -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/queue.o src/queue.c +${OBJECTDIR}/src/server-connection.o: nbproject/Makefile-${CND_CONF}.mk src/server-connection.c + ${MKDIR} -p ${OBJECTDIR}/src + ${RM} "$@.d" + $(COMPILE.c) -g -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/server-connection.o src/server-connection.c + ${OBJECTDIR}/src/server-socket.o: nbproject/Makefile-${CND_CONF}.mk src/server-socket.c ${MKDIR} -p ${OBJECTDIR}/src ${RM} "$@.d" diff --git a/nbproject/Makefile-Release.mk b/nbproject/Makefile-Release.mk index 22190b0..4d8aae0 100644 --- a/nbproject/Makefile-Release.mk +++ b/nbproject/Makefile-Release.mk @@ -47,6 +47,7 @@ OBJECTFILES= \ ${OBJECTDIR}/src/main.o \ ${OBJECTDIR}/src/mime.o \ ${OBJECTDIR}/src/queue.o \ + ${OBJECTDIR}/src/server-connection.o \ ${OBJECTDIR}/src/server-socket.o \ ${OBJECTDIR}/src/socket.o \ ${OBJECTDIR}/src/thread-pool.o \ @@ -137,6 +138,11 @@ ${OBJECTDIR}/src/queue.o: nbproject/Makefile-${CND_CONF}.mk src/queue.c ${RM} "$@.d" $(COMPILE.c) -O2 -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/queue.o src/queue.c +${OBJECTDIR}/src/server-connection.o: nbproject/Makefile-${CND_CONF}.mk src/server-connection.c + ${MKDIR} -p ${OBJECTDIR}/src + ${RM} "$@.d" + $(COMPILE.c) -O2 -Werror -DINI_ALLOW_BOM=0 -DINI_ALLOW_MULTILINE=0 -D_GNU_SOURCE -Ilib -std=c99 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/src/server-connection.o src/server-connection.c + ${OBJECTDIR}/src/server-socket.o: nbproject/Makefile-${CND_CONF}.mk src/server-socket.c ${MKDIR} -p ${OBJECTDIR}/src ${RM} "$@.d" diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 9082983..6b1c5bf 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -11,15 +11,18 @@ src/http.h lib/http_parser.h lib/ini.h + src/khttp.h src/log.h src/main-loop.h src/main.h src/mime.h src/queue.h + src/server-connection.h src/server-socket.h src/socket.h src/thread-pool.h src/util.h + src/version.h src/main.c src/mime.c src/queue.c + src/server-connection.c src/server-socket.c src/socket.c src/thread-pool.c @@ -127,6 +131,8 @@ + + @@ -147,6 +153,10 @@ + + + + @@ -163,6 +173,8 @@ + + @@ -229,6 +241,8 @@ + + @@ -249,6 +263,10 @@ + + + + @@ -265,6 +283,8 @@ + + diff --git a/src/config.c b/src/config.c index 8235acb..5a5c111 100644 --- a/src/config.c +++ b/src/config.c @@ -5,9 +5,10 @@ #include #include #include +#include -#include "main.h" #include "config.h" +#include "util.h" #include "ini.h" const char *default_servername = "localhost"; diff --git a/src/config.h b/src/config.h index 034f224..7b171a6 100644 --- a/src/config.h +++ b/src/config.h @@ -8,11 +8,13 @@ #ifndef CONFIG_H #define CONFIG_H + #ifdef __cplusplus extern "C" { #endif + +#include #include -#include "main.h" #define CONFIG_SERVER_FOREACH_HOST(config, elem) \ elem = config->hosts != NULL ? config->hosts[0] : NULL; \ @@ -32,7 +34,6 @@ extern "C" { char *servername; char *administrator; uint16_t listen_port; - config_host **hosts; size_t host_count; } config_server; diff --git a/src/data-buffer.c b/src/data-buffer.c index ffd2b2c..34b59d5 100644 --- a/src/data-buffer.c +++ b/src/data-buffer.c @@ -6,7 +6,6 @@ #include #include "ut/utlist.h" - #include "data-buffer.h" data_buffer_list* data_buffer_list_new() { @@ -31,7 +30,7 @@ void data_buffer_list_delete(data_buffer_list *list) { free(list->rdlock); free(list); } -int data_buffer_list_append(data_buffer_list *list, const char* src, size_t n) { +void data_buffer_list_append(data_buffer_list *list, const char* src, size_t n) { assert(list!=NULL); assert(src!=NULL && n>0); BUFFER_LIST_WR_LOCK(list); diff --git a/src/data-buffer.h b/src/data-buffer.h index 08a1a51..b619300 100644 --- a/src/data-buffer.h +++ b/src/data-buffer.h @@ -36,7 +36,7 @@ extern "C" { data_buffer_list* data_buffer_list_new(); void data_buffer_list_delete(data_buffer_list *list); - int data_buffer_list_append(data_buffer_list *list, const char* src, size_t n); + void data_buffer_list_append(data_buffer_list *list, const char* src, size_t n); void data_buffer_list_lock(data_buffer_list *list, bool rd, bool wr); void data_buffer_list_unlock(data_buffer_list *list, bool rd, bool wr); diff --git a/src/http-reader.c b/src/http-reader.c index d91ce37..498501c 100644 --- a/src/http-reader.c +++ b/src/http-reader.c @@ -3,21 +3,20 @@ #include #include -#include "main.h" +#include "util.h" #include "http.h" -#include "http_parser.h" +#include "server-connection.h" #include "http-reader.h" -#include "main-loop.h" #define GET_CB_STR(str, at, length) do { \ str = calloc(length+1, sizeof(char));\ strncpy(str, at, length);\ }while(0); -#define SKT(parser) ((hmain_parse_data*)parser->data) +#define SKT(parser) ((request_parse_state*)parser->data) http_parser_settings *parser_settings = NULL; -http_parser_settings* parser_get_settings(hmain_parse_data *data) { +http_parser_settings* parser_get_settings() { if (parser_settings == NULL) { parser_settings = calloc(1, sizeof(http_parser_settings)); parser_settings->on_body = parser_cb_on_body; @@ -28,6 +27,7 @@ http_parser_settings* parser_get_settings(hmain_parse_data *data) { parser_settings->on_message_complete = parser_cb_on_message_complete; parser_settings->on_status = parser_cb_on_status; parser_settings->on_url = parser_cb_on_url; + } return parser_settings; } diff --git a/src/http-reader.h b/src/http-reader.h index 4f725fd..c482577 100644 --- a/src/http-reader.h +++ b/src/http-reader.h @@ -11,13 +11,21 @@ #ifdef __cplusplus extern "C" { #endif - -#include "http_parser.h" -#include "http.h" -#include "main.h" -#include "main-loop.h" - http_parser_settings* parser_get_settings(hmain_parse_data *elem); +#include + +#include "http.h" +#include "http_parser.h" + + typedef struct request_parse_state { + http_request *current_request; + bool request_complete; + struct http_parser *parser; + http_header *parser_current_header; + enum {HSTATE_NONE, HSTATE_VALUE, HSTATE_FIELD} parser_header_state; + } request_parse_state; + + http_parser_settings* parser_get_settings(); void parser_free_settings(); int parser_cb_on_message_begin(http_parser* parser); diff --git a/src/http-server.c b/src/http-server.c index b7c2f3b..9ff3cb2 100644 --- a/src/http-server.c +++ b/src/http-server.c @@ -9,13 +9,14 @@ #include #include +#include "ut/utstring.h" + #include "http_parser.h" #include "http.h" -#include "main.h" #include "config.h" #include "http-server.h" #include "mime.h" -#include "ut/utstring.h" +#include "util.h" http_response* server_process_request(config_server* config, http_request *request) { http_response* response = NULL; diff --git a/src/http-server.h b/src/http-server.h index 6ba5d1f..ccea1d3 100644 --- a/src/http-server.h +++ b/src/http-server.h @@ -12,12 +12,12 @@ extern "C" { #endif +#include #include #include #include + #include "http.h" -#include "main.h" -#include "config.h" typedef struct server_file_result { bool error; diff --git a/src/http.c b/src/http.c index b1eb516..59d7cb3 100644 --- a/src/http.c +++ b/src/http.c @@ -4,10 +4,12 @@ #include #include #include -#include "main.h" #include "ut/utarray.h" #include "ut/utstring.h" + #include "http.h" +#include "util.h" +#include "version.h" void http_header_icd_init_f(void* elem) { memset(elem, 1, sizeof(http_header)); diff --git a/src/http.h b/src/http.h index 8d862fd..4232696 100644 --- a/src/http.h +++ b/src/http.h @@ -8,31 +8,33 @@ #ifndef HTTP_H #define HTTP_H +#include +#include +#include + +#include "ut/utarray.h" + #ifdef __cplusplus extern "C" { #endif - -#include -#include -#include "ut/utarray.h" - -#define HEADER_CONTENT_TYPE "Content-Type" -#define HEADER_CONTENT_LENGTH "Content-Length" -#define HEADER_USER_AGENT "User-Agent" -#define HEADER_SERVER "Server" -#define HEADER_LAST_MODIFIED "Last-Modified" -#define HEADER_LOCATION "Location" -#define HEADER_HOST "Host" -#define HEADER_TRANSFER_ENCODING "Transfer-Encoding" -#define HEADER_DATE "Date" -#define HEADER_CONNECTION "Connection" -#define HEADER_IF_MODIFIED_SINCE "If-Modified-Since" -#define HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" - -#define FORMAT_HEADER_DATE "%a, %d %h %Y %T %Z" -#define DEFAULT_CONTENT_TYPE "text/plain" -#define HTTP_CHUNK_MAXSIZE 1024*16 +#define HEADER_CONTENT_TYPE "Content-Type" +#define HEADER_CONTENT_LENGTH "Content-Length" +#define HEADER_USER_AGENT "User-Agent" +#define HEADER_SERVER "Server" +#define HEADER_LAST_MODIFIED "Last-Modified" +#define HEADER_LOCATION "Location" +#define HEADER_HOST "Host" +#define HEADER_TRANSFER_ENCODING "Transfer-Encoding" +#define HEADER_DATE "Date" +#define HEADER_CONNECTION "Connection" +#define HEADER_IF_MODIFIED_SINCE "If-Modified-Since" +#define HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" + +#define FORMAT_HEADER_DATE "%a, %d %h %Y %T %Z" +#define DEFAULT_CONTENT_TYPE "text/plain" + +#define HTTP_CHUNK_MAXSIZE 1024*16 typedef enum http_request_method { METHOD_GET, METHOD_POST, METHOD_HEAD, METHOD_PUT, diff --git a/src/main-loop.c b/src/main-loop.c index 4044899..8ba2a42 100644 --- a/src/main-loop.c +++ b/src/main-loop.c @@ -8,16 +8,18 @@ #include #include -#include "main-loop.h" #include "mime.h" #include "log.h" #include "socket.h" #include "thread-pool.h" -#include "queue.h" #include "log.h" +#include "http_parser.h" #include "http.h" #include "http-reader.h" #include "server-socket.h" +#include "util.h" +#include "config.h" +#include "main-loop.h" hmain_connection* hmain_connection_new(int fd, hmain_status *status) { static u_int64_t nextid = 1; @@ -121,12 +123,10 @@ void hmain_setup(hmain_status *status) { status->pools[POOL_WORKERS] = pool; thread_pool_start(pool); - } void hmain_teardown(hmain_status *status) { - if (status == NULL) { - fatal("hmain is not setup"); - } + assert(status!=NULL); + //Stop pools size_t pool_count = sizeof(status->pools) / sizeof(status->pools[0]); for(int i=0; idata; CONN_LOCK(conn); - conn->isReading = true; char buffer[16*1024]; int count; @@ -269,7 +268,6 @@ void* thloop_read(void * arg) { } */ } while(count > 0); - conn->isReading = false; CONN_UNLOCK(conn); } } @@ -284,11 +282,10 @@ void* thloop_write(void * arg) { hmain_connection *conn = (hmain_connection*)item->data; do { CONN_LOCK(conn); - conn->isWriting = true; + }while(0); - conn->isWriting = false; CONN_UNLOCK(conn); } } diff --git a/src/main-loop.h b/src/main-loop.h index 235bc0f..25530d1 100644 --- a/src/main-loop.h +++ b/src/main-loop.h @@ -8,20 +8,13 @@ #ifndef MAIN_LOOP_H #define MAIN_LOOP_H -#include -#include -#include - -#include "http_parser.h" - -#include "config.h" -#include "thread-pool.h" -#include "http.h" -#include "data-buffer.h" - #ifdef __cplusplus extern "C" { #endif + +#include +#include +#include #define EPOLL_MAXEVENTS 128 @@ -32,7 +25,7 @@ extern "C" { POOL_READ, POOL_WRITE, POOL_WORKERS, POOL_DISK_READ } hmain_pool; - typedef enum skt_elem_hstate {HSTATE_NONE, HSTATE_VALUE, HSTATE_FIELD} skt_elem_hstate; + //typedef enum skt_elem_hstate {HSTATE_NONE, HSTATE_VALUE, HSTATE_FIELD} skt_elem_hstate; typedef struct hmain_connection { uint64_t cid; @@ -64,7 +57,7 @@ extern "C" { bool request_complete; http_parser *parser; http_header *parser_current_header; - skt_elem_hstate parser_header_state; + int parser_header_state; } hmain_parse_data; hmain_connection* hmain_connection_new(int fd, hmain_status *status); diff --git a/src/main.c b/src/main.c index 11784f6..dbd544b 100644 --- a/src/main.c +++ b/src/main.c @@ -17,38 +17,10 @@ #include #include -#include "http_parser.h" - -#include "ut/utlist.h" -#include "ut/utarray.h" #include "main.h" -#include "socket.h" -#include "http.h" -#include "http-reader.h" -#include "config.h" -#include "http-server.h" -#include "mime.h" -#include "queue.h" -#include "thread-pool.h" -#include "log.h" -#include "main-loop.h" - -int serverfd = 0; -volatile static bool stop = false; - -static void signal_int(int signum) { - fprintf(stderr, "Terminating...\n"); - stop = true; -} int main(int argc, char** argv) { - hmain_status *status = calloc(1, sizeof(hmain_status)); - hmain_setup(status); - - hmain_loop(status); - - hmain_teardown(status); return (EXIT_SUCCESS); } \ No newline at end of file diff --git a/src/main.h b/src/main.h index 9408f69..cd8a9ef 100644 --- a/src/main.h +++ b/src/main.h @@ -11,12 +11,6 @@ #ifdef __cplusplus extern "C" { #endif - -#define SERVER_NAME "KHTTP/0.1" - -#include -#include "http.h" -#include "util.h" int main(int argc, char** argv); diff --git a/src/queue.c b/src/queue.c index f016bd7..6b851ce 100644 --- a/src/queue.c +++ b/src/queue.c @@ -3,9 +3,9 @@ #include #include -#include "queue.h" #include "util.h" #include "ut/utlist.h" +#include "queue.h" queue_item* queue_item_new() { static uint64_t nextid = 0; @@ -18,7 +18,7 @@ queue_item* queue_item_new() { queue_item* queue_item_new2(char* tag, void* data) { queue_item *item = queue_item_new(); item->tag[0] = '\0'; - strncat(item->tag, tag, (sizeof(item->tag)/sizeof(char))+1); + strncat(item->tag, tag, (sizeof(item->tag)/sizeof(char))-1); item->data = data; return item; } @@ -65,16 +65,35 @@ int queue_add(queue *q, queue_item *item) { } int queue_remove(queue *q, queue_item *item) { QUEUE_LOCK(q); + int result = 0; queue_item *elem, *tmp; DL_FOREACH_SAFE(q->list, elem, tmp) { if (elem == item) { DL_DELETE(q->list, elem); queue_item_delete(elem); + result = 1; break; } } - q->count--; + q->count -= result; QUEUE_UNLOCK(q); + return result; +} +int queue_remove_byptr(queue *q, void* ptr) { + QUEUE_LOCK(q); + + int result = 0; + queue_item *elem, *tmp; + DL_FOREACH_SAFE(q->list, elem, tmp) { + if (elem->data == ptr) { + DL_DELETE(q->list, elem); + queue_item_delete(elem); + result ++; + } + } + q->count -= result; + QUEUE_UNLOCK(q); + return result; } queue_item* queue_fetchone(queue *q, bool blocking) { queue_item *item = NULL; @@ -91,8 +110,7 @@ queue_item* queue_fetchone(queue *q, bool blocking) { } } if (item != NULL) { - item = q->list; - DL_DELETE(q->list, q->list); + DL_DELETE(q->list, item); q->count--; } } diff --git a/src/queue.h b/src/queue.h index 21da5fb..d75d7ba 100644 --- a/src/queue.h +++ b/src/queue.h @@ -53,6 +53,7 @@ extern "C" { void queue_delete(queue *q); int queue_add(queue *q, queue_item *item); int queue_remove(queue *q, queue_item *item); + int queue_remove_byptr(queue *q, void* ptr); queue_item* queue_fetchone(queue *q, bool blocking); void queue_unblock(queue *q, uint64_t itemid); void queue_clear(queue *q); diff --git a/src/server-connection.c b/src/server-connection.c new file mode 100644 index 0000000..6302e0a --- /dev/null +++ b/src/server-connection.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include + +#include "http.h" +#include "server-connection.h" + + +server_connection* server_connection_new(skt_info *skt) { + static uint64_t nextid = 1; + assert(skt!=null); + + server_connection *conn = calloc(1, sizeof(server_connection)); + conn->id = __atomic_fetch_add(&nextid, 1, __ATOMIC_SEQ_CST); + conn->last_activity = time(NULL); + conn->parse_state = NULL; + conn->pending_responses = http_response_list_new(); + conn->pending_writes = data_buffer_list_new(); + conn->skt = skt; + conn->write_qid = 0; + return conn; +} +void server_connection_delete(server_connection *conn) { + assert(conn!=NULL); + + http_response_list_delete(conn->pending_responses); + data_buffer_list_delete(conn->pending_writes); + skt_delete(conn->skt); + free(conn); +} \ No newline at end of file diff --git a/src/server-connection.h b/src/server-connection.h new file mode 100644 index 0000000..d3bd949 --- /dev/null +++ b/src/server-connection.h @@ -0,0 +1,42 @@ +/* + * File: server-connection.h + * Author: sam + * + * Created on 15 August 2014, 18:07 + */ + +#ifndef SERVER_CONNECTION_H +#define SERVER_CONNECTION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "data-buffer.h" +#include "http.h" +#include "http-reader.h" +#include "socket.h" + + typedef struct server_connection { + uint64_t id; + struct skt_info *skt; + time_t last_activity; + http_response_list *pending_responses; + data_buffer_list *pending_writes; + uint64_t write_qid;//item id in write queue + request_parse_state *parse_state; + struct server_connection *next; + } server_connection; + + server_connection* server_connection_new(skt_info *skt); + void server_connection_delete(server_connection *conn); + +#ifdef __cplusplus +} +#endif + +#endif /* SERVER_CONNECTION_H */ + diff --git a/src/server-socket.c b/src/server-socket.c index 66eb1a0..e565919 100644 --- a/src/server-socket.c +++ b/src/server-socket.c @@ -9,10 +9,11 @@ #include #include #include +#include #include "socket.h" #include "server-socket.h" -#include "main.h" +#include "util.h" int server_socket_create() { int fd = 0; diff --git a/src/server-socket.h b/src/server-socket.h index 9f9ccf8..0a3c857 100644 --- a/src/server-socket.h +++ b/src/server-socket.h @@ -8,12 +8,14 @@ #ifndef SERVER_SOCKET_H #define SERVER_SOCKET_H -#include "socket.h" #ifdef __cplusplus extern "C" { #endif +#include +#include "socket.h" + int server_socket_create(); void server_socket_listen(int fd, uint16_t port); void server_socket_release(int fd); diff --git a/src/socket.c b/src/socket.c index a2290d3..78f401d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -12,14 +12,15 @@ #include #include -#include "socket.h" #include "ut/utstring.h" -#include "data-buffer.h" -#include "main.h" #include "ut/utlist.h" +#include "util.h" +#include "data-buffer.h" +#include "socket.h" + u_int64_t skt_nextid() { - static u_int64_t id = 0; + static u_int64_t id = 1; return __atomic_fetch_add(&id, 1, __ATOMIC_SEQ_CST); } skt_info* skt_new(int fd) { diff --git a/src/socket.h b/src/socket.h index 74f5022..ba177c1 100644 --- a/src/socket.h +++ b/src/socket.h @@ -13,12 +13,11 @@ extern "C" { #endif #include -#include +#include #include #include #include -#include "http.h" -#include "ut/utstring.h" + #include "data-buffer.h" typedef struct skt_info { diff --git a/src/thread-pool.h b/src/thread-pool.h index 94384b2..29b0eeb 100644 --- a/src/thread-pool.h +++ b/src/thread-pool.h @@ -14,6 +14,7 @@ extern "C" { #include #include + #include "queue.h" typedef struct thread { diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..8b8de35 --- /dev/null +++ b/src/version.h @@ -0,0 +1,23 @@ +/* + * File: version.h + * Author: sam + * + * Created on 15 August 2014, 19:05 + */ + +#ifndef VERSION_H +#define VERSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define SERVER_NAME "KHTTP/0.1" + + +#ifdef __cplusplus +} +#endif + +#endif /* VERSION_H */ +