Browse Source
huge refactoring of build structure as well as other changes...sorry for the huge diff. These are the changes done within the sister project taskrambler, including reactivation of the existing tests as well as code coverage reports
master
huge refactoring of build structure as well as other changes...sorry for the huge diff. These are the changes done within the sister project taskrambler, including reactivation of the existing tests as well as code coverage reports
master
171 changed files with 1973 additions and 961 deletions
-
10.gitignore
-
1AUTHORS
-
4Makefile.am
-
33Makefile.am.coverage
-
27configure.ac
-
40include/auth.h
-
45include/auth/auth.h
-
54include/auth/credential.h
-
10include/auth/interface/auth.h
-
22include/auth/ldap.h
-
2include/cbuf.h
-
128include/class.h
-
128include/class/class.h
-
12include/class/interface.h
-
12include/class/interface/class.h
-
22include/commons.h
-
32include/credential.h
-
16include/hash.h
-
42include/hash/hash.h
-
10include/hash/interface/hashable.h
-
42include/hash/value.h
-
20include/hash_value.h
-
17include/http.h
-
22include/http/cookie.h
-
2include/http/header.h
-
2include/http/interface/http_intro.h
-
3include/http/message.h
-
2include/http/message/queue.h
-
2include/http/parser.h
-
2include/http/request.h
-
2include/http/response.h
-
2include/http/worker.h
-
28include/http/writer.h
-
2include/interface/observer.h
-
2include/interface/subject.h
-
52include/logger.h
-
10include/logger/interface/logger.h
-
57include/logger/logger.h
-
2include/server.h
-
2include/session.h
-
2include/socket.h
-
23include/stream.h
-
10include/stream/interface/reader.h
-
10include/stream/interface/writer.h
-
49include/stream/stream.h
-
2include/utils/hash.h
-
22include/utils/http.h
-
2include/utils/memory.h
-
2include/utils/signalHandling.h
-
86src/Makefile.am
-
6src/auth/Makefile.am
-
27src/auth/credential.c
-
6src/auth/interface/auth.c
-
31src/auth/ldap.c
-
13src/cbuf/Makefile.am
-
2src/cbuf/addr_index.c
-
3src/cbuf/cbuf.c
-
2src/cbuf/empty.c
-
2src/cbuf/get_data.c
-
2src/cbuf/get_free.c
-
2src/cbuf/get_line.c
-
2src/cbuf/get_read.c
-
2src/cbuf/get_write.c
-
2src/cbuf/inc_read.c
-
2src/cbuf/inc_write.c
-
2src/cbuf/is_empty.c
-
2src/cbuf/is_locked.c
-
2src/cbuf/lock.c
-
2src/cbuf/memchr.c
-
2src/cbuf/read.c
-
2src/cbuf/release.c
-
2src/cbuf/set_data.c
-
2src/cbuf/skip_non_alpha.c
-
2src/cbuf/write.c
-
6src/class/Makefile.am
-
12src/class/interface.c
-
8src/class/interface/i_class.c
-
42src/hash.c
-
9src/hash/Makefile.am
-
25src/hash/add.c
-
23src/hash/delete.c
-
22src/hash/each.c
-
23src/hash/get.c
-
63src/hash/hash.c
-
2src/hash/interface/hashable.c
-
29src/hash/value.c
-
41src/http/Makefile.am
-
28src/http/cookie.c
-
5src/http/header.c
-
2src/http/header/to_string.c
-
2src/http/interface/i_http_intro.c
-
7src/http/message.c
-
2src/http/message/get_version.c
-
2src/http/message/has_keep_alive.c
-
2src/http/message/has_valid_version.c
-
4src/http/message/header_size_get.c
-
4src/http/message/header_to_string.c
-
3src/http/message/queue.c
-
5src/http/parser.c
-
22src/http/parser/new_message.c
@ -0,0 +1 @@ |
|||||
|
Georg Hopp <georg@steffers.org> |
||||
@ -0,0 +1,33 @@ |
|||||
|
|
||||
|
# Coverage targets
|
||||
|
|
||||
|
#if HAVE_GCOV
|
||||
|
|
||||
|
.PHONY: clean-gcda |
||||
|
clean-gcda: |
||||
|
@echo Removing old coverage results |
||||
|
-find -name '*.gcda' -print | xargs -r rm |
||||
|
|
||||
|
.PHONY: coverage-html generate-coverage-html clean-coverage-html |
||||
|
coverage-html: clean-gcda |
||||
|
-$(MAKE) -C tests $(AM_MAKEFLAGS) -k check-build |
||||
|
$(MAKE) $(AM_MAKEFLAGS) init-coverage-html |
||||
|
-$(MAKE) $(AM_MAKEFLAGS) -k check |
||||
|
$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html |
||||
|
|
||||
|
init-coverage-html: |
||||
|
$(LCOV) -d $(top_builddir) -c -i -o coverage.base --no-checksum --compat-libtool |
||||
|
|
||||
|
generate-coverage-html: |
||||
|
@echo Collecting coverage data |
||||
|
$(LCOV) -d $(top_builddir) -c -o coverage.run --no-checksum --compat-libtool |
||||
|
$(LCOV) -d $(top_builddir) -a ./coverage.base -a ./coverage.run -o coverage.info --no-checksum --compat-libtool |
||||
|
LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --branch-coverage --show-details coverage.info |
||||
|
|
||||
|
clean-coverage-html: clean-gcda |
||||
|
-$(LCOV) --directory $(top_builddir) -z |
||||
|
-rm -rf coverage.info coveragereport |
||||
|
|
||||
|
clean-local: clean-coverage-html |
||||
|
|
||||
|
#endif # HAVE_GCOV
|
||||
@ -1,44 +1,10 @@ |
|||||
/** |
|
||||
* \file |
|
||||
* Authenticatio module factory |
|
||||
* |
|
||||
* A factory to get a specific authentication module. |
|
||||
* An authentication module is a class that implement the Auth interface. |
|
||||
* |
|
||||
* \author Georg Hopp |
|
||||
* |
|
||||
* \copyright |
|
||||
* Copyright © 2012 Georg Hopp |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef __AUTH_H__ |
#ifndef __AUTH_H__ |
||||
#define __AUTH_H__ |
#define __AUTH_H__ |
||||
|
|
||||
#include "class.h" |
|
||||
|
#include "auth/auth.h" |
||||
#include "auth/ldap.h" |
#include "auth/ldap.h" |
||||
|
|
||||
typedef enum e_AuthModule { |
|
||||
AUTH_LDAP = 0 |
|
||||
} AuthModule; |
|
||||
|
|
||||
CLASS(Auth) { |
|
||||
}; |
|
||||
|
|
||||
void * authCreateById(Auth, int); |
|
||||
AuthLdap authCreateLdap(Auth); |
|
||||
|
#include "auth/credential.h" |
||||
|
#include "auth/interface/auth.h" |
||||
|
|
||||
#endif // __AUTH_H__ |
#endif // __AUTH_H__ |
||||
|
|
||||
|
|||||
@ -0,0 +1,45 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* Authenticatio module factory |
||||
|
* |
||||
|
* A factory to get a specific authentication module. |
||||
|
* An authentication module is a class that implement the Auth interface. |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __AUTH_AUTH_H__ |
||||
|
#define __AUTH_AUTH_H__ |
||||
|
|
||||
|
#include "class.h" |
||||
|
#include "auth/ldap.h" |
||||
|
|
||||
|
typedef enum e_AuthModule { |
||||
|
AUTH_LDAP = 0 |
||||
|
} AuthModule; |
||||
|
|
||||
|
CLASS(Auth) { |
||||
|
}; |
||||
|
|
||||
|
void * authCreateById(Auth, int); |
||||
|
AuthLdap authCreateLdap(Auth); |
||||
|
|
||||
|
#endif // __AUTH_AUTH_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -0,0 +1,54 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __AUTH_CREDENTIAL_H__ |
||||
|
#define __AUTH_CREDENTIAL_H__ |
||||
|
|
||||
|
#include <sys/types.h> |
||||
|
|
||||
|
#include "class.h" |
||||
|
|
||||
|
#define CRED_PWD(c) (((c)->cred).pwd) |
||||
|
|
||||
|
typedef enum e_CredentialType { |
||||
|
CRED_PASSWORD = 0 |
||||
|
} CredentialType; |
||||
|
|
||||
|
|
||||
|
CLASS(Credential) { |
||||
|
CredentialType type; |
||||
|
|
||||
|
union { |
||||
|
|
||||
|
struct { |
||||
|
char * user; |
||||
|
size_t nuser; |
||||
|
char * pass; |
||||
|
size_t npass; |
||||
|
} pwd; |
||||
|
|
||||
|
} cred; |
||||
|
}; |
||||
|
|
||||
|
#endif // __AUTH_CREDENTIAL_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,131 +1,9 @@ |
|||||
/** |
|
||||
* \file |
|
||||
* My own class implementation for C. It combines a data structure |
|
||||
* with a set of dynamically linked methods defined by an interface. A |
|
||||
* dynamically linked method will be called via a selector method which in |
|
||||
* turn gets the implementation stored in the class. |
|
||||
* |
|
||||
* \author Georg Hopp |
|
||||
* |
|
||||
* \copyright |
|
||||
* Copyright (C) 2012 Georg Hopp |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef __CLASS_H__ |
#ifndef __CLASS_H__ |
||||
#define __CLASS_H__ |
#define __CLASS_H__ |
||||
|
|
||||
#include <stdarg.h> |
|
||||
#include <sys/types.h> |
|
||||
#include <string.h> |
|
||||
#include <assert.h> |
|
||||
|
|
||||
#include "interface.h" |
|
||||
|
|
||||
#ifndef _ISOC99_SOURCE |
|
||||
#define _ISOC99_SOURCE |
|
||||
#endif |
|
||||
|
|
||||
#define CLASS_MAGIC 0xFEFE |
|
||||
|
|
||||
#define CLASS(name) \ |
|
||||
struct c_##name; \ |
|
||||
typedef struct c_##name * name; \ |
|
||||
extern struct class * const _##name; \ |
|
||||
struct c_##name |
|
||||
|
|
||||
#define EXTENDS(parent) \ |
|
||||
const char _[sizeof(struct c_##parent)] |
|
||||
|
|
||||
#define _NULL NULL |
|
||||
#define CREATE_CLASS(name,_parent,...) \ |
|
||||
static struct class c_##name; \ |
|
||||
static void _classInit_(void) { \ |
|
||||
c_##name.parent = _##_parent; \ |
|
||||
c_##name.init = NULL; \ |
|
||||
} \ |
|
||||
static struct class c_##name = { \ |
|
||||
CLASS_MAGIC, \ |
|
||||
NULL, \ |
|
||||
sizeof(struct c_##name), \ |
|
||||
_classInit_, \ |
|
||||
INIT_IMPL(__VA_ARGS__) \ |
|
||||
}; struct class * const _##name = &c_##name |
|
||||
|
|
||||
#define GET_CLASS(object) (*(class_ptr *)((object) - sizeof(void*))) |
|
||||
#define IFACE_GET(class,iface) (interfaceGet(&((class)->impl),(iface))) |
|
||||
#define IFACE_EXISTS(class,iface) (NULL != IFACE_GET((class),(iface))) |
|
||||
|
|
||||
/** |
|
||||
* \todo actually i use gcc feature ## for variadoc... think about |
|
||||
* a way to make this standard. |
|
||||
*/ |
|
||||
#define _CALL(object,_iface,method,...) \ |
|
||||
do { \ |
|
||||
class_ptr class = GET_CLASS((object)); \ |
|
||||
if (class->init) class->init(); \ |
|
||||
iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ |
|
||||
while ((NULL == iface || NULL == iface->method) && HAS_PARENT(class)) { \ |
|
||||
class = class->parent; \ |
|
||||
if (class->init) class->init(); \ |
|
||||
iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ |
|
||||
}; \ |
|
||||
assert(NULL != iface->method); \ |
|
||||
} while(0) |
|
||||
|
|
||||
#define CALL(object,_iface,method,...) \ |
|
||||
do { \ |
|
||||
struct i_##_iface * iface; \ |
|
||||
_CALL(object, _iface, method, ##__VA_ARGS__); \ |
|
||||
iface->method(object, ##__VA_ARGS__); \ |
|
||||
} while(0) |
|
||||
|
|
||||
#define RETCALL(object,_iface,method,ret,...) \ |
|
||||
do { \ |
|
||||
struct i_##_iface * iface; \ |
|
||||
_CALL(object, _iface, method, ##__VA_ARGS__); \ |
|
||||
ret = iface->method(object, ##__VA_ARGS__); \ |
|
||||
} while(0) |
|
||||
|
|
||||
#define PARENTCALL(object,_iface,method,...) \ |
|
||||
do { \ |
|
||||
struct i_##_iface * iface; \ |
|
||||
class_ptr class = GET_CLASS((object)); \ |
|
||||
if (class->init) class->init(); \ |
|
||||
assert(HAS_PARENT(class)); \ |
|
||||
class = class->parent; \ |
|
||||
if (class->init) class->init(); \ |
|
||||
iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ |
|
||||
assert(NULL != iface->method); \ |
|
||||
iface->method(object, ##__VA_ARGS__); \ |
|
||||
} while(0) |
|
||||
|
|
||||
|
|
||||
#define HAS_PARENT(class) (NULL != ((class)->parent)) |
|
||||
|
|
||||
typedef void (* fptr_classInit)(void); |
|
||||
|
|
||||
struct class; |
|
||||
typedef struct class * class_ptr; |
|
||||
struct class { |
|
||||
const int magic; |
|
||||
class_ptr parent; |
|
||||
size_t object_size; |
|
||||
fptr_classInit init; |
|
||||
struct iface_impl impl; |
|
||||
}; |
|
||||
|
#include "class/class.h" |
||||
|
#include "class/interface.h" |
||||
|
#include "class/interface/class.h" |
||||
|
|
||||
#endif // __CLASS_H__ |
#endif // __CLASS_H__ |
||||
|
|
||||
|
|||||
@ -0,0 +1,128 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* My own class implementation for C. It combines a data structure |
||||
|
* with a set of dynamically linked methods defined by an interface. A |
||||
|
* dynamically linked method will be called via a selector method which in |
||||
|
* turn gets the implementation stored in the class. |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __CLASS_CLASS_H__ |
||||
|
#define __CLASS_CLASS_H__ |
||||
|
|
||||
|
#include <stdarg.h> |
||||
|
#include <sys/types.h> |
||||
|
#include <string.h> |
||||
|
#include <assert.h> |
||||
|
|
||||
|
#include "class/interface.h" |
||||
|
|
||||
|
#ifndef _ISOC99_SOURCE |
||||
|
#define _ISOC99_SOURCE |
||||
|
#endif |
||||
|
|
||||
|
#define CLASS_MAGIC 0xFEFE |
||||
|
|
||||
|
#define CLASS(name) \ |
||||
|
struct c_##name; \ |
||||
|
typedef struct c_##name * name; \ |
||||
|
extern struct class * const _##name; \ |
||||
|
struct c_##name |
||||
|
|
||||
|
#define EXTENDS(parent) \ |
||||
|
const char _[sizeof(struct c_##parent)] |
||||
|
|
||||
|
#define _NULL NULL |
||||
|
#define CREATE_CLASS(name,_parent,...) \ |
||||
|
static struct class c_##name; \ |
||||
|
static class_ptr _classInit##name##_(void) { \ |
||||
|
c_##name.parent = _##_parent; \ |
||||
|
c_##name.init = NULL; \ |
||||
|
return &c_##name; \ |
||||
|
} \ |
||||
|
static struct class c_##name = { \ |
||||
|
CLASS_MAGIC, \ |
||||
|
NULL, \ |
||||
|
sizeof(struct c_##name), \ |
||||
|
_classInit##name##_, \ |
||||
|
INIT_IFACE_IMPL(__VA_ARGS__) \ |
||||
|
}; struct class * const _##name = &c_##name |
||||
|
|
||||
|
#define INIT_CLASS(class) ((class)->init? (class)->init() : (class)) |
||||
|
#define GET_CLASS(object) (INIT_CLASS(*(class_ptr *)((void*)(object) - sizeof(void*)))) |
||||
|
#define IFACE_GET(class,iface) (interfaceGet(&((class)->impl),(iface))) |
||||
|
#define HAS_PARENT(class) (NULL != ((class)->parent) && INIT_CLASS((class)->parent)) |
||||
|
|
||||
|
#define IS_OBJECT(obj) ((GET_CLASS((obj)))->magic == CLASS_MAGIC) |
||||
|
#define INSTANCE_OF(class,obj) ((GET_CLASS((obj))) == _##class) |
||||
|
|
||||
|
/** |
||||
|
* \todo actually i use gcc feature ## for variadoc... think about |
||||
|
* a way to make this standard. |
||||
|
*/ |
||||
|
#define _CALL(_class,_iface,method,...) \ |
||||
|
do { \ |
||||
|
class_ptr class = _class; \ |
||||
|
iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ |
||||
|
while ((NULL == iface || NULL == iface->method) && HAS_PARENT(class)) { \ |
||||
|
class = class->parent; \ |
||||
|
iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ |
||||
|
} \ |
||||
|
assert(NULL != iface->method); \ |
||||
|
} while(0) |
||||
|
|
||||
|
#define CALL(object,_iface,method,...) \ |
||||
|
do { \ |
||||
|
struct i_##_iface * iface; \ |
||||
|
_CALL(GET_CLASS(object), _iface, method, ##__VA_ARGS__); \ |
||||
|
iface->method(object, ##__VA_ARGS__); \ |
||||
|
} while(0) |
||||
|
|
||||
|
#define RETCALL(object,_iface,method,ret,...) \ |
||||
|
do { \ |
||||
|
struct i_##_iface * iface; \ |
||||
|
_CALL(GET_CLASS(object), _iface, method, ##__VA_ARGS__); \ |
||||
|
ret = iface->method(object, ##__VA_ARGS__); \ |
||||
|
} while(0) |
||||
|
|
||||
|
#define PARENTCALL(object,_iface,method,...) \ |
||||
|
do { \ |
||||
|
struct i_##_iface * iface; \ |
||||
|
class_ptr pc_class = GET_CLASS((object)); \ |
||||
|
assert(HAS_PARENT(pc_class)); \ |
||||
|
_CALL(pc_class->parent, _iface, method, ##__VA_ARGS__); \ |
||||
|
iface->method(object, ##__VA_ARGS__); \ |
||||
|
} while(0) |
||||
|
|
||||
|
|
||||
|
struct class; |
||||
|
typedef struct class * class_ptr; |
||||
|
typedef class_ptr (* fptr_classInit)(void); |
||||
|
struct class { |
||||
|
const int magic; |
||||
|
class_ptr parent; |
||||
|
size_t object_size; |
||||
|
fptr_classInit init; |
||||
|
struct iface_impl impl; |
||||
|
}; |
||||
|
|
||||
|
#endif // __CLASS_CLASS_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,32 +0,0 @@ |
|||||
#ifndef __CREDENTIAL_H__ |
|
||||
#define __CREDENTIAL_H__ |
|
||||
|
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
#include "class.h" |
|
||||
|
|
||||
#define CRED_PWD(c) (((c)->cred).pwd) |
|
||||
|
|
||||
typedef enum e_CredentialType { |
|
||||
CRED_PASSWORD = 0 |
|
||||
} CredentialType; |
|
||||
|
|
||||
|
|
||||
CLASS(Credential) { |
|
||||
CredentialType type; |
|
||||
|
|
||||
union { |
|
||||
|
|
||||
struct { |
|
||||
char * user; |
|
||||
size_t nuser; |
|
||||
char * pass; |
|
||||
size_t npass; |
|
||||
} pwd; |
|
||||
|
|
||||
} cred; |
|
||||
}; |
|
||||
|
|
||||
#endif // __CREDENTIAL_H__ |
|
||||
|
|
||||
// vim: set ts=4 sw=4: |
|
||||
@ -1,19 +1,9 @@ |
|||||
#ifndef __HASH_H__ |
#ifndef __HASH_H__ |
||||
#define __HASH_H__ |
#define __HASH_H__ |
||||
|
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
#include "class.h" |
|
||||
|
|
||||
|
|
||||
CLASS(Hash) { |
|
||||
void * root; |
|
||||
}; |
|
||||
|
|
||||
void * hashAdd(Hash, void *); |
|
||||
void * hashDelete(Hash, const char *, size_t); |
|
||||
void * hashGet(Hash, const char *, size_t); |
|
||||
void hashEach(Hash, void (*)(const void*)); |
|
||||
|
#include "hash/hash.h" |
||||
|
#include "hash/value.h" |
||||
|
#include "hash/interface/hashable.h" |
||||
|
|
||||
#endif // __HASH_H__ |
#endif // __HASH_H__ |
||||
|
|
||||
|
|||||
@ -0,0 +1,42 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __HASH_HASH_H__ |
||||
|
#define __HASH_HASH_H__ |
||||
|
|
||||
|
#include <sys/types.h> |
||||
|
|
||||
|
#include "class.h" |
||||
|
|
||||
|
|
||||
|
CLASS(Hash) { |
||||
|
void * root; |
||||
|
}; |
||||
|
|
||||
|
void * hashAdd(Hash, void *); |
||||
|
void * hashDelete(Hash, const char *, size_t); |
||||
|
void * hashGet(Hash, const char *, size_t); |
||||
|
void hashEach(Hash, void (*)(const void*)); |
||||
|
|
||||
|
#endif // __HASH_HASH_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -0,0 +1,42 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __HASH_VALUE_H__ |
||||
|
#define __HASH_VALUE_H__ |
||||
|
|
||||
|
#include <sys/types.h> |
||||
|
|
||||
|
#include "class.h" |
||||
|
|
||||
|
CLASS(HashValue) { |
||||
|
unsigned long hash; |
||||
|
|
||||
|
char * key; |
||||
|
void * value; |
||||
|
|
||||
|
size_t nkey; |
||||
|
size_t nvalue; |
||||
|
}; |
||||
|
|
||||
|
#endif // __HASH_VALUE_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,20 +0,0 @@ |
|||||
#ifndef __HASH_VALUE_H__ |
|
||||
#define __HASH_VALUE_H__ |
|
||||
|
|
||||
#include <sys/types.h> |
|
||||
|
|
||||
#include "class.h" |
|
||||
|
|
||||
CLASS(HashValue) { |
|
||||
unsigned long hash; |
|
||||
|
|
||||
char * key; |
|
||||
void * value; |
|
||||
|
|
||||
size_t nkey; |
|
||||
size_t nvalue; |
|
||||
}; |
|
||||
|
|
||||
#endif // __HASH_VALUE_H__ |
|
||||
|
|
||||
// vim: set ts=4 sw=4: |
|
||||
@ -0,0 +1,17 @@ |
|||||
|
#ifndef __HTTP_H__ |
||||
|
#define __HTTP_H__ |
||||
|
|
||||
|
#include "http/cookie.h" |
||||
|
#include "http/header.h" |
||||
|
#include "http/message.h" |
||||
|
#include "http/message/queue.h" |
||||
|
#include "http/request.h" |
||||
|
#include "http/response.h" |
||||
|
#include "http/parser.h" |
||||
|
#include "http/writer.h" |
||||
|
#include "http/worker.h" |
||||
|
#include "http/interface/http_intro.h" |
||||
|
|
||||
|
#endif // __HTTP_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,56 +1,8 @@ |
|||||
/** |
|
||||
* \file |
|
||||
* A generic logger class and two extended classes, One that logs to |
|
||||
* stderr and one that logs to the system syslog. |
|
||||
* |
|
||||
* \author Georg Hopp |
|
||||
* |
|
||||
* \copyright |
|
||||
* Copyright (C) 2012 Georg Hopp |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU General Public License as published by |
|
||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||
* (at your option) any later version. |
|
||||
* |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU General Public License for more details. |
|
||||
* |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
*/ |
|
||||
|
|
||||
#ifndef __LOGGER_H__ |
#ifndef __LOGGER_H__ |
||||
#define __LOGGER_H__ |
#define __LOGGER_H__ |
||||
|
|
||||
#include "class.h" |
|
||||
|
|
||||
typedef enum logger_level { |
|
||||
LOGGER_DEBUG=0, |
|
||||
LOGGER_INFO, |
|
||||
LOGGER_NOTICE, |
|
||||
LOGGER_WARNING, |
|
||||
LOGGER_ERR, |
|
||||
LOGGER_CRIT, |
|
||||
LOGGER_ALERT, |
|
||||
LOGGER_EMERG |
|
||||
} logger_level; |
|
||||
|
|
||||
extern const char * const logger_level_str[]; |
|
||||
|
|
||||
CLASS(Logger) { |
|
||||
logger_level min_level; |
|
||||
}; |
|
||||
|
|
||||
CLASS(LoggerStderr) { |
|
||||
EXTENDS(Logger); |
|
||||
}; |
|
||||
|
|
||||
CLASS(LoggerSyslog) { |
|
||||
EXTENDS(Logger); |
|
||||
}; |
|
||||
|
#include "logger/logger.h" |
||||
|
#include "logger/interface/logger.h" |
||||
|
|
||||
#endif // __LOGGER_H__ |
#endif // __LOGGER_H__ |
||||
|
|
||||
|
|||||
@ -0,0 +1,57 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* A generic logger class and two extended classes, One that logs to |
||||
|
* stderr and one that logs to the system syslog. |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __LOGGER_LOGGER_H__ |
||||
|
#define __LOGGER_LOGGER_H__ |
||||
|
|
||||
|
#include "class.h" |
||||
|
|
||||
|
typedef enum logger_level { |
||||
|
LOGGER_DEBUG=0, |
||||
|
LOGGER_INFO, |
||||
|
LOGGER_NOTICE, |
||||
|
LOGGER_WARNING, |
||||
|
LOGGER_ERR, |
||||
|
LOGGER_CRIT, |
||||
|
LOGGER_ALERT, |
||||
|
LOGGER_EMERG |
||||
|
} logger_level; |
||||
|
|
||||
|
extern const char * const logger_level_str[]; |
||||
|
|
||||
|
CLASS(Logger) { |
||||
|
logger_level min_level; |
||||
|
}; |
||||
|
|
||||
|
CLASS(LoggerStderr) { |
||||
|
EXTENDS(Logger); |
||||
|
}; |
||||
|
|
||||
|
CLASS(LoggerSyslog) { |
||||
|
EXTENDS(Logger); |
||||
|
}; |
||||
|
|
||||
|
#endif // __LOGGER_LOGGER_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,26 +1,9 @@ |
|||||
#ifndef __STREAM_H__ |
#ifndef __STREAM_H__ |
||||
#define __STREAM_H__ |
#define __STREAM_H__ |
||||
|
|
||||
#include <sys/types.h> |
|
||||
#include <openssl/ssl.h> |
|
||||
|
|
||||
#include "class.h" |
|
||||
|
|
||||
typedef enum e_StreamHandleType { |
|
||||
STREAM_FD = 0, |
|
||||
STREAM_SSL |
|
||||
} StreamHandleType; |
|
||||
|
|
||||
CLASS(Stream) { |
|
||||
StreamHandleType type; |
|
||||
union { |
|
||||
int fd; |
|
||||
SSL * ssl; |
|
||||
} handle; |
|
||||
}; |
|
||||
|
|
||||
ssize_t streamRead(Stream, void *, size_t); |
|
||||
ssize_t streamWrite(Stream, void *, size_t); |
|
||||
|
#include "stream/stream.h" |
||||
|
#include "stream/interface/reader.h" |
||||
|
#include "stream/interface/writer.h" |
||||
|
|
||||
#endif // __STREAM_H__ |
#endif // __STREAM_H__ |
||||
|
|
||||
|
|||||
@ -0,0 +1,49 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#ifndef __STREAM_STREAM_H__ |
||||
|
#define __STREAM_STREAM_H__ |
||||
|
|
||||
|
#include <sys/types.h> |
||||
|
#include <openssl/ssl.h> |
||||
|
|
||||
|
#include "class.h" |
||||
|
|
||||
|
typedef enum e_StreamHandleType { |
||||
|
STREAM_FD = 0, |
||||
|
STREAM_SSL |
||||
|
} StreamHandleType; |
||||
|
|
||||
|
CLASS(Stream) { |
||||
|
StreamHandleType type; |
||||
|
union { |
||||
|
int fd; |
||||
|
SSL * ssl; |
||||
|
} handle; |
||||
|
}; |
||||
|
|
||||
|
ssize_t streamRead(Stream, void *, size_t); |
||||
|
ssize_t streamWrite(Stream, void *, size_t); |
||||
|
|
||||
|
#endif // __STREAM_STREAM_H__ |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,71 +1,31 @@ |
|||||
ACLOCAL_AMFLAGS = -I m4 |
ACLOCAL_AMFLAGS = -I m4 |
||||
AUTOMAKE_OPTIONS = subdir-objects |
|
||||
|
|
||||
IFACE = interface/class.c interface/stream_reader.c interface/logger.c \
|
|
||||
interface/stream_writer.c interface/http_intro.c \
|
|
||||
interface/subject.c interface/observer.c interface.c |
|
||||
SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c |
|
||||
STREAM = stream.c stream/read.c stream/write.c |
|
||||
HASH = hash.c hash/add.c hash/get.c hash/delete.c \
|
|
||||
hash/each.c interface/hashable.c hash_value.c |
|
||||
SERVER = server.c server/run.c server/close_conn.c server/poll.c \
|
|
||||
server/handle_accept.c server/read.c server/write.c |
|
||||
LOGGER = logger.c logger/stderr.c logger/syslog.c |
|
||||
CB = cbuf.c cbuf/read.c cbuf/write.c \
|
|
||||
cbuf/get_line.c cbuf/set_data.c cbuf/get_data.c \
|
|
||||
cbuf/addr_index.c cbuf/get_free.c cbuf/get_read.c cbuf/get_write.c \
|
|
||||
cbuf/inc_read.c cbuf/inc_write.c cbuf/is_empty.c cbuf/memchr.c \
|
|
||||
cbuf/skip_non_alpha.c cbuf/is_locked.c cbuf/lock.c cbuf/release.c \
|
|
||||
cbuf/empty.c |
|
||||
MSG = http/message.c \
|
|
||||
http/message/has_keep_alive.c \
|
|
||||
http/message/header_size_get.c \
|
|
||||
http/message/header_to_string.c \
|
|
||||
http/message/get_version.c \
|
|
||||
http/message/has_valid_version.c |
|
||||
MSGQ = http/message/queue.c |
|
||||
REQ = http/request.c \
|
|
||||
http/request/has_valid_method.c |
|
||||
RESP = http/response.c \
|
|
||||
http/response/304.c \
|
|
||||
http/response/404.c \
|
|
||||
http/response/403.c \
|
|
||||
http/response/login_form.c \
|
|
||||
http/response/asset.c \
|
|
||||
http/response/randval.c \
|
|
||||
http/response/session.c |
|
||||
PARSER = http/parser.c \
|
|
||||
http/parser/parse.c \
|
|
||||
http/parser/new_message.c \
|
|
||||
http/parser/header.c \
|
|
||||
http/parser/body.c \
|
|
||||
http/parser/request_vars.c \
|
|
||||
http/parser/post_vars.c |
|
||||
WRITER = http/writer.c \
|
|
||||
http/writer/write.c |
|
||||
WORKER = http/worker.c \
|
|
||||
http/worker/process.c \
|
|
||||
http/worker/write.c \
|
|
||||
http/worker/get_asset.c \
|
|
||||
http/worker/add_common_header.c |
|
||||
HEADER = http/header.c \
|
|
||||
http/header/to_string.c |
|
||||
SESSION = session.c session/add.c session/get.c session/delete.c |
|
||||
UTILS = utils/hash.c \
|
|
||||
utils/memory.c \
|
|
||||
utils/http.c \
|
|
||||
utils/daemonize.c \
|
|
||||
utils/signalHandling.c |
|
||||
AUTH = interface/auth.c auth/ldap.c credential.c |
|
||||
|
IFACE = interface/subject.c \
|
||||
|
interface/observer.c |
||||
|
UTILS = utils/hash.c \
|
||||
|
utils/memory.c \
|
||||
|
utils/http.c \
|
||||
|
utils/daemonize.c \
|
||||
|
utils/signalHandling.c |
||||
|
|
||||
|
LIBS = ./http/libhttp.a \
|
||||
|
./auth/libauth.a \
|
||||
|
./cbuf/libcbuf.a \
|
||||
|
./class/libclass.a \
|
||||
|
./hash/libhash.a \
|
||||
|
./logger/liblogger.a \
|
||||
|
./server/libserver.a \
|
||||
|
./session/libsession.a \
|
||||
|
./socket/libsocket.a \
|
||||
|
./stream/libstream.a |
||||
|
|
||||
AM_CFLAGS = -Wall -I ../include/ |
AM_CFLAGS = -Wall -I ../include/ |
||||
|
|
||||
bin_PROGRAMS = webgameserver |
bin_PROGRAMS = webgameserver |
||||
|
|
||||
webgameserver_SOURCES = webgameserver.c \
|
|
||||
$(IFACE) $(SOCKET) $(SERVER) $(LOGGER) $(MSG) $(REQ) \
|
|
||||
$(WRITER) $(RESP) $(HEADER) $(PARSER) $(WORKER) $(CB) \
|
|
||||
$(UTILS) $(MSGQ) $(SESSION) $(STREAM) $(HASH) $(AUTH) |
|
||||
webgameserver_CFLAGS = -Wall -I ../include/ |
|
||||
webgameserver_LDFLAGS = -lrt -lssl -lldap |
|
||||
|
webgameserver_SOURCES = webgameserver.c $(IFACE) $(UTILS) |
||||
|
webgameserver_CFLAGS = -Wall -I ../include/# $(COVERAGE_CFLAGS) |
||||
|
webgameserver_LDADD = $(LIBS) -lrt -lssl -lldap |
||||
|
#webgameserver_LDFLAGS = $(COVERAGE_LDFLAGS)
|
||||
|
|
||||
|
SUBDIRS = auth cbuf class hash http logger server session socket stream |
||||
@ -0,0 +1,6 @@ |
|||||
|
ACLOCAL_AMFLAGS = -I m4 |
||||
|
|
||||
|
noinst_LIBRARIES = libauth.a |
||||
|
|
||||
|
libauth_a_SOURCES = interface/auth.c credential.c ldap.c |
||||
|
libauth_a_CFLAGS = -Wall -I ../../include/ |
||||
@ -1,14 +1,35 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
#include <stdarg.h> |
#include <stdarg.h> |
||||
#include <sys/types.h> |
#include <sys/types.h> |
||||
#include <stdlib.h> |
#include <stdlib.h> |
||||
#include <string.h> |
#include <string.h> |
||||
|
|
||||
#include "credential.h" |
|
||||
#include "class.h" |
#include "class.h" |
||||
#include "interface/class.h" |
|
||||
|
|
||||
#include "utils/memory.h" |
#include "utils/memory.h" |
||||
|
|
||||
|
#include "auth/credential.h" |
||||
|
|
||||
static |
static |
||||
int |
int |
||||
credentialCtor(void * _this, va_list * params) |
credentialCtor(void * _this, va_list * params) |
||||
@ -0,0 +1,13 @@ |
|||||
|
ACLOCAL_AMFLAGS = -I m4 |
||||
|
|
||||
|
CB = cbuf.c read.c write.c \
|
||||
|
get_line.c set_data.c get_data.c \
|
||||
|
addr_index.c get_free.c get_read.c get_write.c \
|
||||
|
inc_read.c inc_write.c is_empty.c memchr.c \
|
||||
|
skip_non_alpha.c is_locked.c lock.c release.c \
|
||||
|
empty.c |
||||
|
|
||||
|
noinst_LIBRARIES = libcbuf.a |
||||
|
|
||||
|
libcbuf_a_SOURCES = $(CB) |
||||
|
libcbuf_a_CFLAGS = -Wall -I ../../include/ |
||||
@ -0,0 +1,6 @@ |
|||||
|
ACLOCAL_AMFLAGS = -I m4 |
||||
|
|
||||
|
noinst_LIBRARIES = libclass.a |
||||
|
|
||||
|
libclass_a_SOURCES = interface.c interface/i_class.c |
||||
|
libclass_a_CFLAGS = -Wall -I ../../include/ |
||||
@ -1,42 +0,0 @@ |
|||||
#define _GNU_SOURCE |
|
||||
|
|
||||
#include <search.h> |
|
||||
#include <stdarg.h> |
|
||||
|
|
||||
#include "hash.h" |
|
||||
#include "class.h" |
|
||||
#include "interface/class.h" |
|
||||
|
|
||||
static |
|
||||
int |
|
||||
hashCtor(void * _this, va_list * params) |
|
||||
{ |
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
static |
|
||||
inline |
|
||||
void |
|
||||
tDelete(void * node) |
|
||||
{ |
|
||||
delete(node); |
|
||||
} |
|
||||
|
|
||||
static |
|
||||
void |
|
||||
hashDtor(void * _this) |
|
||||
{ |
|
||||
Hash this = _this; |
|
||||
|
|
||||
/** |
|
||||
* this is a GNU extension...anyway on most non |
|
||||
* GNUish systems i would not use tsearch anyway |
|
||||
* as the trees will be unbalanced. |
|
||||
*/ |
|
||||
tdestroy(this->root, tDelete); |
|
||||
} |
|
||||
|
|
||||
INIT_IFACE(Class, hashCtor, hashDtor, NULL); |
|
||||
CREATE_CLASS(Hash, NULL, IFACE(Class)); |
|
||||
|
|
||||
// vim: set ts=4 sw=4: |
|
||||
@ -0,0 +1,9 @@ |
|||||
|
ACLOCAL_AMFLAGS = -I m4 |
||||
|
|
||||
|
HASH = hash.c add.c get.c delete.c each.c value.c \
|
||||
|
interface/hashable.c |
||||
|
|
||||
|
noinst_LIBRARIES = libhash.a |
||||
|
|
||||
|
libhash_a_SOURCES = $(HASH) |
||||
|
libhash_a_CFLAGS = -Wall -I ../../include/ |
||||
@ -0,0 +1,63 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
|
#define _GNU_SOURCE |
||||
|
|
||||
|
#include <search.h> |
||||
|
#include <stdarg.h> |
||||
|
|
||||
|
#include "hash/hash.h" |
||||
|
#include "class.h" |
||||
|
|
||||
|
static |
||||
|
int |
||||
|
hashCtor(void * _this, va_list * params) |
||||
|
{ |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
static |
||||
|
inline |
||||
|
void |
||||
|
tDelete(void * node) |
||||
|
{ |
||||
|
delete(node); |
||||
|
} |
||||
|
|
||||
|
static |
||||
|
void |
||||
|
hashDtor(void * _this) |
||||
|
{ |
||||
|
Hash this = _this; |
||||
|
|
||||
|
/** |
||||
|
* this is a GNU extension...anyway on most non |
||||
|
* GNUish systems i would not use tsearch anyway |
||||
|
* as the trees will be unbalanced. |
||||
|
*/ |
||||
|
tdestroy(this->root, tDelete); |
||||
|
} |
||||
|
|
||||
|
INIT_IFACE(Class, hashCtor, hashDtor, NULL); |
||||
|
CREATE_CLASS(Hash, NULL, IFACE(Class)); |
||||
|
|
||||
|
// vim: set ts=4 sw=4: |
||||
@ -1,14 +1,37 @@ |
|||||
|
/** |
||||
|
* \file |
||||
|
* |
||||
|
* \author Georg Hopp |
||||
|
* |
||||
|
* \copyright |
||||
|
* Copyright © 2012 Georg Hopp |
||||
|
* |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
|
*/ |
||||
|
|
||||
#include <stdarg.h> |
#include <stdarg.h> |
||||
#include <stdlib.h> |
#include <stdlib.h> |
||||
#include <string.h> |
#include <string.h> |
||||
#include <sys/types.h> |
#include <sys/types.h> |
||||
|
|
||||
#include "hash_value.h" |
|
||||
|
#include "class.h" |
||||
#include "utils/hash.h" |
#include "utils/hash.h" |
||||
#include "utils/memory.h" |
#include "utils/memory.h" |
||||
#include "commons.h" |
#include "commons.h" |
||||
#include "interface/class.h" |
|
||||
#include "interface/hashable.h" |
|
||||
|
|
||||
|
#include "hash/value.h" |
||||
|
#include "hash/interface/hashable.h" |
||||
|
|
||||
static |
static |
||||
int |
int |
||||
@ -0,0 +1,41 @@ |
|||||
|
ACLOCAL_AMFLAGS = -I m4 |
||||
|
|
||||
|
MSG = message.c \
|
||||
|
message/has_keep_alive.c \
|
||||
|
message/header_size_get.c \
|
||||
|
message/header_to_string.c \
|
||||
|
message/get_version.c \
|
||||
|
message/has_valid_version.c |
||||
|
MSGQ = message/queue.c |
||||
|
REQ = request.c \
|
||||
|
request/has_valid_method.c |
||||
|
RESP = response.c \
|
||||
|
response/304.c \
|
||||
|
response/404.c \
|
||||
|
response/403.c \
|
||||
|
response/login_form.c \
|
||||
|
response/asset.c \
|
||||
|
response/randval.c \
|
||||
|
response/session.c |
||||
|
PARSER = parser.c \
|
||||
|
parser/parse.c \
|
||||
|
parser/new_message.c \
|
||||
|
parser/p_header.c \
|
||||
|
parser/p_body.c \
|
||||
|
parser/p_request_vars.c \
|
||||
|
parser/p_post_vars.c |
||||
|
WRITER = writer.c \
|
||||
|
writer/write.c |
||||
|
WORKER = worker.c \
|
||||
|
worker/process.c \
|
||||
|
worker/answer.c \
|
||||
|
worker/get_asset.c \
|
||||
|
worker/add_common_header.c |
||||
|
HEADER = header.c \
|
||||
|
header/to_string.c |
||||
|
|
||||
|
noinst_LIBRARIES = libhttp.a |
||||
|
|
||||
|
libhttp_a_SOURCES = $(MSG) $(MSGQ) $(REQ) $(RESP) $(PARSER) $(WRITER) \
|
||||
|
$(WORKER) $(HEADER) interface/i_http_intro.c |
||||
|
libhttp_a_CFLAGS = -Wall -I ../../include/ |
||||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue