Browse Source

huge changes in build system. Moved a lot of stuff to separate archives, not finished right now. Additionally add some support for coverage reports. Next step after build restructuring is to write tests.

release0.1.5
Georg Hopp 14 years ago
parent
commit
f0d05e1413
  1. 5
      .gitignore
  2. 2
      Makefile.am
  3. 27
      Makefile.am.coverage
  4. 18
      configure.ac
  5. 40
      include/auth.h
  6. 45
      include/auth/auth.h
  7. 6
      include/auth/credential.h
  8. 8
      include/auth/interface/auth.h
  9. 38
      include/hash.h
  10. 42
      include/hash/hash.h
  11. 6
      include/hash/interface/hashable.h
  12. 0
      include/hash/value.h
  13. 16
      include/http.h
  14. 1
      include/http/message.h
  15. 77
      m4/gcov.m4
  16. 59
      src/Makefile.am
  17. 6
      src/auth/Makefile.am
  18. 4
      src/auth/credential.c
  19. 6
      src/auth/interface/auth.c
  20. 8
      src/auth/ldap.c
  21. BIN
      src/auth/libauth.a
  22. 13
      src/cbuf/Makefile.am
  23. 0
      src/cbuf/cbuf.c
  24. BIN
      src/cbuf/libcbuf.a
  25. 2
      src/class/Makefile.am
  26. BIN
      src/class/libclass.a
  27. 9
      src/hash/Makefile.am
  28. 1
      src/hash/add.c
  29. 1
      src/hash/delete.c
  30. 1
      src/hash/get.c
  31. 2
      src/hash/hash.c
  32. 2
      src/hash/interface/hashable.c
  33. BIN
      src/hash/libhash.a
  34. 7
      src/hash/value.c
  35. 41
      src/http/Makefile.am
  36. 4
      src/http/cookie.c
  37. 2
      src/http/header.c
  38. BIN
      src/http/libhttp.a
  39. 4
      src/http/message.c
  40. 1
      src/http/parser/header.c
  41. 1
      src/http/parser/post_vars.c
  42. 1
      src/http/parser/request_vars.c
  43. 1
      src/http/request.c
  44. 1
      src/http/worker.c
  45. 4
      src/http/worker/process.c
  46. 2
      src/taskrambler.c
  47. 48
      tests/Makefile.am

5
.gitignore

@ -1,5 +1,7 @@
.*.swp .*.swp
*.o *.o
*.gcda
*.gcno
.dirstamp .dirstamp
.deps/ .deps/
Makefile Makefile
@ -8,6 +10,8 @@ Makefile.in
m4/ m4/
/docs/ /docs/
/INSTALL /INSTALL
coverage.info
coveragereport/
*.m4 *.m4
/autom4te.cache/ /autom4te.cache/
/compile /compile
@ -19,3 +23,4 @@ m4/
/missing /missing
stamp-h1 stamp-h1
src/taskrambler src/taskrambler

2
Makefile.am

@ -8,3 +8,5 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = include assets certs EXTRA_DIST = include assets certs
SUBDIRS = src tests SUBDIRS = src tests
include $(top_srcdir)/Makefile.am.coverage

27
Makefile.am.coverage

@ -0,0 +1,27 @@
# 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) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
generate-coverage-html:
@echo Collecting coverage data
$(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --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

18
configure.ac

@ -3,14 +3,21 @@
AC_PREREQ([2.68]) AC_PREREQ([2.68])
AC_INIT([taskrambler], [0.0.1], [Georg Hopp <georg@steffers.org>]) AC_INIT([taskrambler], [0.0.1], [Georg Hopp <georg@steffers.org>])
LT_INIT
AM_INIT_AUTOMAKE([subdir-objects]) AM_INIT_AUTOMAKE([subdir-objects])
AM_SILENT_RULES([yes])
#AM_SILENT_RULES([yes])
AC_COPYRIGHT([Copyright © 2012 Georg Hopp]) AC_COPYRIGHT([Copyright © 2012 Georg Hopp])
AC_REVISION([$Revision: 0.01 $]) AC_REVISION([$Revision: 0.01 $])
AC_CONFIG_SRCDIR([src/taskrambler.c]) AC_CONFIG_SRCDIR([src/taskrambler.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/gcov.m4])
AC_TDD_GCOV
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_CXXFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)
# Checks for programs. # Checks for programs.
AC_PROG_CXX AC_PROG_CXX
AC_PROG_CC AC_PROG_CC
@ -38,5 +45,12 @@ AC_TYPE_SIZE_T
#AC_FUNC_MALLOC #AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([memset])
AC_CONFIG_FILES([Makefile src/Makefile src/class/Makefile tests/Makefile])
AC_CONFIG_FILES([Makefile
src/Makefile
src/auth/Makefile
src/cbuf/Makefile
src/class/Makefile
src/hash/Makefile
src/http/Makefile
tests/Makefile])
AC_OUTPUT AC_OUTPUT

40
include/auth.h

@ -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__

45
include/auth/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:

6
include/credential.h → include/auth/credential.h

@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __CREDENTIAL_H__
#define __CREDENTIAL_H__
#ifndef __AUTH_CREDENTIAL_H__
#define __AUTH_CREDENTIAL_H__
#include <sys/types.h> #include <sys/types.h>
@ -49,6 +49,6 @@ CLASS(Credential) {
} cred; } cred;
}; };
#endif // __CREDENTIAL_H__
#endif // __AUTH_CREDENTIAL_H__
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:

8
include/interface/auth.h → include/auth/interface/auth.h

@ -25,13 +25,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __INTERFACE_AUTH_H__
#define __INTERFACE_AUTH_H__
#ifndef __AUTH_INTERFACE_AUTH_H__
#define __AUTH_INTERFACE_AUTH_H__
#include <stdarg.h> #include <stdarg.h>
#include "class.h" #include "class.h"
#include "credential.h"
#include "auth/credential.h"
typedef int (* fptr_authenticate)(void *, Credential); typedef int (* fptr_authenticate)(void *, Credential);
@ -44,6 +44,6 @@ struct i_Auth {
extern int authenticate(void *, Credential); extern int authenticate(void *, Credential);
#endif // __INTERFACE_AUTH_H__
#endif // __AUTH_INTERFACE_AUTH_H__
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:

38
include/hash.h

@ -1,41 +1,9 @@
/**
* \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_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__

42
include/hash/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:

6
include/interface/hashable.h → include/hash/interface/hashable.h

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __INTERFACE_HASHABLE_H__
#define __INTERFACE_HASHABLE_H__
#ifndef __HASH_INTERFACE_HASHABLE_H__
#define __HASH_INTERFACE_HASHABLE_H__
#include "class.h" #include "class.h"
@ -40,6 +40,6 @@ struct i_Hashable {
extern unsigned long hashableGetHash(void *); extern unsigned long hashableGetHash(void *);
extern void hashableHandleDouble(void *, void *); extern void hashableHandleDouble(void *, void *);
#endif // __INTERFACE_HASHABLE_H__
#endif // __HASH_INTERFACE_HASHABLE_H__
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:

0
include/hash_value.h → include/hash/value.h

16
include/http.h

@ -0,0 +1,16 @@
#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"
#endif // __HTTP_H__
// vim: set ts=4 sw=4:

1
include/http/message.h

@ -38,7 +38,6 @@ CLASS(HttpMessage) {
char * version; char * version;
Hash header; Hash header;
Hash cookies;
HttpMessageType type; HttpMessageType type;
Stream handle; Stream handle;

77
m4/gcov.m4

@ -0,0 +1,77 @@
# Checks for existence of coverage tools:
# * gcov
# * lcov
# * genhtml
# * gcovr
#
# Sets ac_cv_check_gcov to yes if tooling is present
# and reports the executables to the variables LCOV, GCOVR and GENHTML.
AC_DEFUN([AC_TDD_GCOV],
[
AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov],
[enable coverage testing with gcov]),
[use_gcov=$enableval], [use_gcov=no])
AM_CONDITIONAL(HAVE_GCOV, test "x$use_gcov" = "xyes")
if test "x$use_gcov" = "xyes"; then
# we need gcc:
if test "$GCC" != "yes"; then
AC_MSG_ERROR([GCC is required for --enable-gcov])
fi
# Check if ccache is being used
AC_CHECK_PROG(SHTOOL, shtool, shtool)
case `$SHTOOL path $CC` in
*ccache*[)] gcc_ccache=yes;;
*[)] gcc_ccache=no;;
esac
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
lcov_version_list="1.6 1.7 1.8 1.9"
AC_CHECK_PROG(LCOV, lcov, lcov)
AC_CHECK_PROG(GENHTML, genhtml, genhtml)
if test "$LCOV"; then
AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
glib_cv_lcov_version=invalid
lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
for lcov_check_version in $lcov_version_list; do
if test "$lcov_version" = "$lcov_check_version"; then
glib_cv_lcov_version="$lcov_check_version (ok)"
fi
done
])
else
lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
AC_MSG_ERROR([$lcov_msg])
fi
case $glib_cv_lcov_version in
""|invalid[)]
lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
AC_MSG_ERROR([$lcov_msg])
LCOV="exit 0;"
;;
esac
if test -z "$GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the lcov package])
fi
# Remove all optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
changequote([,])
# Add the special gcc flags
COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
COVERAGE_LDFLAGS="-lgcov"
fi
]) # AC_TDD_GCOV

59
src/Makefile.am

@ -5,68 +5,31 @@ IFACE = interface/stream_reader.c interface/logger.c \
interface/subject.c interface/observer.c interface/subject.c interface/observer.c
SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c
STREAM = stream.c stream/read.c stream/write.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 = server.c server/run.c server/close_conn.c server/poll.c \
server/handle_accept.c server/read.c server/write.c server/handle_accept.c server/read.c server/write.c
LOGGER = logger.c logger/stderr.c logger/syslog.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 SESSION = session.c session/add.c session/get.c session/delete.c
UTILS = utils/hash.c \ UTILS = utils/hash.c \
utils/memory.c \ utils/memory.c \
utils/http.c \ utils/http.c \
utils/daemonize.c \ utils/daemonize.c \
utils/signalHandling.c utils/signalHandling.c
AUTH = interface/auth.c auth/ldap.c credential.c
LIBS = ./http/libhttp.a \
./auth/libauth.a \
./cbuf/libcbuf.a \
./class/libclass.a \
./hash/libhash.a
AM_CFLAGS = -Wall -I ../include/ AM_CFLAGS = -Wall -I ../include/
bin_PROGRAMS = taskrambler bin_PROGRAMS = taskrambler
taskrambler_SOURCES = taskrambler.c \ taskrambler_SOURCES = taskrambler.c \
$(IFACE) $(SOCKET) $(SERVER) $(LOGGER) $(MSG) $(REQ) \
$(WRITER) $(RESP) $(HEADER) $(PARSER) $(WORKER) $(CB) \
$(UTILS) $(MSGQ) $(SESSION) $(STREAM) $(HASH) $(AUTH)
taskrambler_CFLAGS = -Wall -I ../include/
taskrambler_LDFLAGS = -L./class -lclass -lrt -lssl -lldap
$(IFACE) $(SOCKET) $(SERVER) $(LOGGER) \
$(UTILS) $(SESSION) $(STREAM)
taskrambler_CFLAGS = -Wall -I ../include/ $(COVERAGE_CFLAGS)
taskrambler_LDADD = $(LIBS) -lrt -lssl -lldap
taskrambler_LDFLAGS = $(COVERAGE_LDFLAGS)
SUBDIRS = class
SUBDIRS = auth cbuf class hash http

6
src/auth/Makefile.am

@ -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/

4
src/credential.c → src/auth/credential.c

@ -25,11 +25,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "credential.h"
#include "class.h" #include "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)

6
src/interface/auth.c → src/auth/interface/auth.c

@ -20,9 +20,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "auth.h"
#include "credential.h"
#include "interface/auth.h"
#include "auth/auth.h"
#include "auth/credential.h"
#include "auth/interface/auth.h"
const struct interface i_Auth = { const struct interface i_Auth = {
"auth", "auth",

8
src/auth/ldap.c

@ -26,14 +26,14 @@
#include <stdio.h> #include <stdio.h>
#include <ldap.h> #include <ldap.h>
#include "auth/ldap.h"
#include "class.h" #include "class.h"
#include "credential.h"
#include "interface/auth.h"
#include "utils/memory.h" #include "utils/memory.h"
#include "commons.h" #include "commons.h"
#include "auth/ldap.h"
#include "auth/credential.h"
#include "auth/interface/auth.h"
static static
int int
authLdapCtor(void * _this, va_list * params) authLdapCtor(void * _this, va_list * params)

BIN
src/auth/libauth.a

13
src/cbuf/Makefile.am

@ -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
src/cbuf.c → src/cbuf/cbuf.c

BIN
src/cbuf/libcbuf.a

2
src/class/Makefile.am

@ -1,7 +1,5 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Wall -I ../include/
noinst_LIBRARIES = libclass.a noinst_LIBRARIES = libclass.a
libclass_a_SOURCES = interface.c interface/class.c libclass_a_SOURCES = interface.c interface/class.c

BIN
src/class/libclass.a

9
src/hash/Makefile.am

@ -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/

1
src/hash/add.c

@ -23,7 +23,6 @@
#include <search.h> #include <search.h>
#include "hash.h" #include "hash.h"
#include "interface/hashable.h"
#include "class.h" #include "class.h"
static static

1
src/hash/delete.c

@ -24,7 +24,6 @@
#include <sys/types.h> #include <sys/types.h>
#include "hash.h" #include "hash.h"
#include "interface/hashable.h"
#include "utils/hash.h" #include "utils/hash.h"
static static

1
src/hash/get.c

@ -24,7 +24,6 @@
#include <sys/types.h> #include <sys/types.h>
#include "hash.h" #include "hash.h"
#include "interface/hashable.h"
#include "utils/hash.h" #include "utils/hash.h"
static static

2
src/hash.c → src/hash/hash.c

@ -25,7 +25,7 @@
#include <search.h> #include <search.h>
#include <stdarg.h> #include <stdarg.h>
#include "hash.h"
#include "hash/hash.h"
#include "class.h" #include "class.h"
static static

2
src/interface/hashable.c → src/hash/interface/hashable.c

@ -25,7 +25,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "class.h" #include "class.h"
#include "interface/hashable.h"
#include "hash/interface/hashable.h"
const struct interface i_Hashable = { const struct interface i_Hashable = {
"hashable", "hashable",

BIN
src/hash/libhash.a

7
src/hash_value.c → src/hash/value.c

@ -25,12 +25,13 @@
#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 "class.h"
#include "interface/hashable.h"
#include "hash/value.h"
#include "hash/interface/hashable.h"
static static
int int

41
src/http/Makefile.am

@ -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/header.c \
parser/body.c \
parser/request_vars.c \
parser/post_vars.c
WRITER = writer.c \
writer/write.c
WORKER = worker.c \
worker/process.c \
worker/write.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)
libhttp_a_CFLAGS = -Wall -I ../../include/

4
src/http/cookie.c

@ -25,9 +25,9 @@
#include <stdarg.h> #include <stdarg.h>
#include <sys/types.h> #include <sys/types.h>
#include "cookie.h"
#include "class.h" #include "class.h"
#include "interface/hashable"
#include "hash.h"
#include "http/cookie.h"
#include "utils/hash.h" #include "utils/hash.h"
#include "utils/memory.h" #include "utils/memory.h"

2
src/http/header.c

@ -25,8 +25,8 @@
#include <string.h> #include <string.h>
#include "class.h" #include "class.h"
#include "hash.h"
#include "http/header.h" #include "http/header.h"
#include "interface/hashable.h"
#include "utils/hash.h" #include "utils/hash.h"
#include "utils/memory.h" #include "utils/memory.h"

BIN
src/http/libhttp.a

4
src/http/message.c

@ -46,8 +46,7 @@ httpMessageCtor(void * _this, va_list * params)
this->version = calloc(1, strlen(version)+1); this->version = calloc(1, strlen(version)+1);
strcpy(this->version, version); strcpy(this->version, version);
this->header = new(Hash);
this->cookies = new(Hash);
this->header = new(Hash);
return 0; return 0;
} }
@ -59,7 +58,6 @@ httpMessageDtor(void * _this)
HttpMessage this = _this; HttpMessage this = _this;
delete(this->header); delete(this->header);
delete(this->cookies);
FREE(this->version); FREE(this->version);

1
src/http/parser/header.c

@ -30,7 +30,6 @@
#include "http/message.h" #include "http/message.h"
#include "http/request.h" #include "http/request.h"
#include "hash.h" #include "hash.h"
#include "hash_value.h"
void void
httpParserHeader( httpParserHeader(

1
src/http/parser/post_vars.c

@ -25,7 +25,6 @@
#include "http/parser.h" #include "http/parser.h"
#include "http/request.h" #include "http/request.h"
#include "hash_value.h"
#include "hash.h" #include "hash.h"
#include "class.h" #include "class.h"

1
src/http/parser/request_vars.c

@ -26,7 +26,6 @@
#include "http/parser.h" #include "http/parser.h"
#include "http/request.h" #include "http/request.h"
#include "hash_value.h"
#include "hash.h" #include "hash.h"
#include "class.h" #include "class.h"

1
src/http/request.c

@ -26,6 +26,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "class.h" #include "class.h"
#include "hash.h"
#include "interface/http_intro.h" #include "interface/http_intro.h"
#include "http/request.h" #include "http/request.h"

1
src/http/worker.c

@ -62,7 +62,6 @@ httpWorkerCtor(void * _this, va_list * params)
this->writer = new(HttpWriter, this->wbuf); this->writer = new(HttpWriter, this->wbuf);
this->sroot = &(this->session); this->sroot = &(this->session);
this->auth = va_arg(* params, void *); this->auth = va_arg(* params, void *);
return 0; return 0;

4
src/http/worker/process.c

@ -28,7 +28,7 @@
#include <sys/time.h> #include <sys/time.h>
#include "class.h" #include "class.h"
#include "interface/auth.h"
#include "auth.h"
#include "http/worker.h" #include "http/worker.h"
#include "http/header.h" #include "http/header.h"
@ -39,9 +39,7 @@
#include "http/parser.h" #include "http/parser.h"
#include "session.h" #include "session.h"
#include "stream.h" #include "stream.h"
#include "hash_value.h"
#include "hash.h" #include "hash.h"
#include "credential.h"
#include "utils/memory.h" #include "utils/memory.h"
#include "hash.h" #include "hash.h"

2
src/taskrambler.c

@ -38,7 +38,7 @@
#include "server.h" #include "server.h"
#include "logger.h" #include "logger.h"
#include "http/worker.h" #include "http/worker.h"
#include "auth/ldap.h"
#include "auth.h"
#include "class.h" #include "class.h"
#include "interface/logger.h" #include "interface/logger.h"

48
tests/Makefile.am

@ -1,28 +1,28 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet
TESTS = cclassTest loggerTest socketTest serverTest
check_PROGRAMS = cclassTest loggerTest socketTest serverTest
COMMON = runtest.c ../src/interface/class.c
CCLASS = $(COMMON) mock/class.c
LOGGER = $(COMMON) ../src/logger.c ../src/interface/logger.c \
../src/logger/stderr.c ../src/logger/syslog.c
SOCKET = $(LOGGER) ../src/socket.c ../src/socket/listen.c \
../src/socket/accept.c ../src/socket/connect.c
SERVER = $(SOCKET) ../src/server.c ../src/server/run.c \
../src/server/close_conn.c ../src/utils/signalHandling.c
cclassTest_SOURCES = $(CCLASS) cclassTest.c
cclassTest_CFLAGS = -Wall -ggdb -O0 -finline-functions -I ../include -I .. -I .
loggerTest_SOURCES = $(LOGGER) loggerTest.c
loggerTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
socketTest_SOURCES = $(SOCKET) socketTest.c
socketTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
serverTest_SOURCES = $(SERVER) serverTest.c
serverTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
#TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet
#TESTS = cclassTest loggerTest socketTest serverTest
#check_PROGRAMS = cclassTest loggerTest socketTest serverTest
#
#COMMON = runtest.c ../src/interface/class.c
#CCLASS = $(COMMON) mock/class.c
#LOGGER = $(COMMON) ../src/logger.c ../src/interface/logger.c \
# ../src/logger/stderr.c ../src/logger/syslog.c
#SOCKET = $(LOGGER) ../src/socket.c ../src/socket/listen.c \
# ../src/socket/accept.c ../src/socket/connect.c
#SERVER = $(SOCKET) ../src/server.c ../src/server/run.c \
# ../src/server/close_conn.c ../src/utils/signalHandling.c
#
#cclassTest_SOURCES = $(CCLASS) cclassTest.c
#cclassTest_CFLAGS = -Wall -ggdb -O0 -finline-functions -I ../include -I .. -I .
#
#loggerTest_SOURCES = $(LOGGER) loggerTest.c
#loggerTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
#
#socketTest_SOURCES = $(SOCKET) socketTest.c
#socketTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
#
#serverTest_SOURCES = $(SERVER) serverTest.c
#serverTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
EXTRA_DIST = runtest.h mock/class.h EXTRA_DIST = runtest.h mock/class.h
Loading…
Cancel
Save