Index: code/branches/merger/src/enet/Makefile
===================================================================
--- code/branches/merger/src/enet/Makefile	(revision 278)
+++ code/branches/merger/src/enet/Makefile	(revision 278)
@@ -0,0 +1,367 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# include/enet/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+srcdir = .
+top_srcdir = ../..
+
+pkgdatadir = $(datadir)/libenet.a
+pkglibdir = $(libdir)/libenet.a
+pkgincludedir = $(includedir)/libenet.a
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = include/enet
+DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libenetincludedir)"
+libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libenetinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run aclocal-1.9
+AMDEP_FALSE = #
+AMDEP_TRUE = 
+AMTAR = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run tar
+AUTOCONF = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run automake-1.9
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS = 
+CYGPATH_W = echo
+DEFS = -DPACKAGE_NAME=\"libenet\" -DPACKAGE_TARNAME=\"libenet\" -DPACKAGE_VERSION=\"6-6-2007\" -DPACKAGE_STRING=\"libenet\ 6-6-2007\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libenet.a\" -DVERSION=\"6-6-2007\" -DHAS_GETHOSTBYADDR_R=1 -DHAS_GETHOSTBYNAME_R=1 -DHAS_POLL=1 -DHAS_FCNTL=1 -DHAS_INET_PTON=1 -DHAS_INET_NTOP=1 -DHAS_MSGHDR_FLAGS=1 -DHAS_SOCKLEN_T=1
+DEPDIR = .deps
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = /bin/grep -E
+EXEEXT = 
+GREP = /bin/grep
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LDFLAGS = 
+LIBOBJS = 
+LIBS = 
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/scheusso/orxonox/enet-1.1/missing --run makeinfo
+OBJEXT = o
+PACKAGE = libenet.a
+PACKAGE_BUGREPORT = 
+PACKAGE_NAME = libenet
+PACKAGE_STRING = libenet 6-6-2007
+PACKAGE_TARNAME = libenet
+PACKAGE_VERSION = 6-6-2007
+PATH_SEPARATOR = :
+RANLIB = ranlib
+SET_MAKE = 
+SHELL = /bin/sh
+STRIP = 
+VERSION = 6-6-2007
+ac_ct_CC = gcc
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE = 
+am__include = include
+am__leading_dot = .
+am__quote = 
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build_alias = 
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host_alias = 
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = /home/scheusso/orxonox/enet-1.1/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = mkdir -p --
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+sysconfdir = ${prefix}/etc
+target_alias = 
+libenetincludedir = $(includedir)/enet
+libenetinclude_HEADERS = \
+	types.h \
+	list.h \
+	utility.h \
+	time.h \
+	callbacks.h \
+	unix.h \
+	win32.h \
+	protocol.h \
+	enet.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  include/enet/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  include/enet/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
+	@list='$(libenetinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
+	  $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
+	done
+
+uninstall-libenetincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libenetinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(libenetincludedir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libenetincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	ctags distclean distclean-generic distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-libenetincludeHEADERS \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+	uninstall uninstall-am uninstall-info-am \
+	uninstall-libenetincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: code/branches/merger/src/enet/Makefile.am
===================================================================
--- code/branches/merger/src/enet/Makefile.am	(revision 278)
+++ code/branches/merger/src/enet/Makefile.am	(revision 278)
@@ -0,0 +1,12 @@
+libenetincludedir = $(includedir)/enet
+libenetinclude_HEADERS = \
+	types.h \
+	list.h \
+	utility.h \
+	time.h \
+	callbacks.h \
+	unix.h \
+	win32.h \
+	protocol.h \
+	enet.h
+	
Index: code/branches/merger/src/enet/Makefile.in
===================================================================
--- code/branches/merger/src/enet/Makefile.in	(revision 278)
+++ code/branches/merger/src/enet/Makefile.in	(revision 278)
@@ -0,0 +1,367 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = include/enet
+DIST_COMMON = $(libenetinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libenetincludedir)"
+libenetincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libenetinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+libenetincludedir = $(includedir)/enet
+libenetinclude_HEADERS = \
+	types.h \
+	list.h \
+	utility.h \
+	time.h \
+	callbacks.h \
+	unix.h \
+	win32.h \
+	protocol.h \
+	enet.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  include/enet/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  include/enet/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-libenetincludeHEADERS: $(libenetinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libenetincludedir)" || $(mkdir_p) "$(DESTDIR)$(libenetincludedir)"
+	@list='$(libenetinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(libenetincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libenetincludedir)/$$f'"; \
+	  $(libenetincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libenetincludedir)/$$f"; \
+	done
+
+uninstall-libenetincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libenetinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(libenetincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(libenetincludedir)/$$f"; \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(libenetincludedir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libenetincludeHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libenetincludeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	ctags distclean distclean-generic distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-libenetincludeHEADERS \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+	uninstall uninstall-am uninstall-info-am \
+	uninstall-libenetincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: code/branches/merger/src/enet/callbacks.h
===================================================================
--- code/branches/merger/src/enet/callbacks.h	(revision 278)
+++ code/branches/merger/src/enet/callbacks.h	(revision 278)
@@ -0,0 +1,28 @@
+/** 
+ @file  callbacks.h
+ @brief ENet callbacks
+*/
+#ifndef __ENET_CALLBACKS_H__
+#define __ENET_CALLBACKS_H__
+
+#include <stdlib.h>
+
+typedef struct
+{
+    void * (ENET_CALLBACK * malloc) (size_t size);
+    void (ENET_CALLBACK * free) (void * memory);
+    int (ENET_CALLBACK * rand) (void);
+} ENetCallbacks;
+
+/** @defgroup callbacks ENet internal callbacks
+    @{
+    @ingroup private
+*/
+extern void * enet_malloc (size_t);
+extern void   enet_free (void *);
+extern int    enet_rand (void);
+
+/** @} */
+
+#endif /* __ENET_CALLBACKS_H__ */
+
Index: code/branches/merger/src/enet/enet.h
===================================================================
--- code/branches/merger/src/enet/enet.h	(revision 278)
+++ code/branches/merger/src/enet/enet.h	(revision 278)
@@ -0,0 +1,470 @@
+/** 
+ @file  enet.h
+ @brief ENet public header file
+*/
+#ifndef __ENET_ENET_H__
+#define __ENET_ENET_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+
+#ifdef WIN32
+#include "enet/win32.h"
+#else
+#include "enet/unix.h"
+#endif
+
+#include "enet/types.h"
+#include "enet/protocol.h"
+#include "enet/list.h"
+#include "enet/callbacks.h"
+
+typedef enum
+{
+   ENET_VERSION = 1
+} ENetVersion;
+
+typedef enum
+{
+   ENET_SOCKET_TYPE_STREAM   = 1,
+   ENET_SOCKET_TYPE_DATAGRAM = 2
+} ENetSocketType;
+
+typedef enum
+{
+   ENET_SOCKET_WAIT_NONE    = 0,
+   ENET_SOCKET_WAIT_SEND    = (1 << 0),
+   ENET_SOCKET_WAIT_RECEIVE = (1 << 1)
+} ENetSocketWait;
+
+enum
+{
+   ENET_HOST_ANY       = 0,            /**< specifies the default server host */
+   ENET_HOST_BROADCAST = 0xFFFFFFFF,   /**< specifies a subnet-wide broadcast */
+
+   ENET_PORT_ANY       = 0             /**< specifies that a port should be automatically chosen */
+};
+
+/**
+ * Portable internet address structure. 
+ *
+ * The host must be specified in network byte-order, and the port must be in host 
+ * byte-order. The constant ENET_HOST_ANY may be used to specify the default 
+ * server host. The constant ENET_HOST_BROADCAST may be used to specify the
+ * broadcast address (255.255.255.255).  This makes sense for enet_host_connect,
+ * but not for enet_host_create.  Once a server responds to a broadcast, the
+ * address is updated from ENET_HOST_BROADCAST to the server's actual IP address.
+ */
+typedef struct _ENetAddress
+{
+   enet_uint32 host;
+   enet_uint16 port;
+} ENetAddress;
+
+/**
+ * Packet flag bit constants.
+ *
+ * The host must be specified in network byte-order, and the port must be in
+ * host byte-order. The constant ENET_HOST_ANY may be used to specify the
+ * default server host.
+ 
+   @sa ENetPacket
+*/
+typedef enum
+{
+   /** packet must be received by the target peer and resend attempts should be
+     * made until the packet is delivered */
+   ENET_PACKET_FLAG_RELIABLE    = (1 << 0),
+   /** packet will not be sequenced with other packets
+     * not supported for reliable packets
+     */
+   ENET_PACKET_FLAG_UNSEQUENCED = (1 << 1),
+   /** packet will not allocate data, and user must supply it instead */
+   ENET_PACKET_FLAG_NO_ALLOCATE = (1 << 2)
+} ENetPacketFlag;
+
+struct _ENetPacket;
+typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *);
+
+/**
+ * ENet packet structure.
+ *
+ * An ENet data packet that may be sent to or received from a peer. The shown 
+ * fields should only be read and never modified. The data field contains the 
+ * allocated data for the packet. The dataLength fields specifies the length 
+ * of the allocated data.  The flags field is either 0 (specifying no flags), 
+ * or a bitwise-or of any combination of the following flags:
+ *
+ *    ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer
+ *    and resend attempts should be made until the packet is delivered
+ *
+ *    ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets 
+ *    (not supported for reliable packets)
+ *
+ *    ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead
+ 
+   @sa ENetPacketFlag
+ */
+typedef struct _ENetPacket
+{
+   size_t                   referenceCount;  /**< internal use only */
+   enet_uint32              flags;           /**< bitwise-or of ENetPacketFlag constants */
+   enet_uint8 *             data;            /**< allocated data for packet */
+   size_t                   dataLength;      /**< length of data */
+   ENetPacketFreeCallback   freeCallback;    /**< function to be called when the packet is no longer in use */
+} ENetPacket;
+
+typedef struct _ENetAcknowledgement
+{
+   ENetListNode acknowledgementList;
+   enet_uint32  sentTime;
+   ENetProtocol command;
+} ENetAcknowledgement;
+
+typedef struct _ENetOutgoingCommand
+{
+   ENetListNode outgoingCommandList;
+   enet_uint16  reliableSequenceNumber;
+   enet_uint16  unreliableSequenceNumber;
+   enet_uint32  sentTime;
+   enet_uint32  roundTripTimeout;
+   enet_uint32  roundTripTimeoutLimit;
+   enet_uint32  fragmentOffset;
+   enet_uint16  fragmentLength;
+   ENetProtocol command;
+   ENetPacket * packet;
+} ENetOutgoingCommand;
+
+typedef struct _ENetIncomingCommand
+{  
+   ENetListNode     incomingCommandList;
+   enet_uint16      reliableSequenceNumber;
+   enet_uint16      unreliableSequenceNumber;
+   ENetProtocol     command;
+   enet_uint32      fragmentCount;
+   enet_uint32      fragmentsRemaining;
+   enet_uint32 *    fragments;
+   ENetPacket *     packet;
+} ENetIncomingCommand;
+
+typedef enum
+{
+   ENET_PEER_STATE_DISCONNECTED                = 0,
+   ENET_PEER_STATE_CONNECTING                  = 1,
+   ENET_PEER_STATE_ACKNOWLEDGING_CONNECT       = 2,
+   ENET_PEER_STATE_CONNECTION_PENDING          = 3,
+   ENET_PEER_STATE_CONNECTION_SUCCEEDED        = 4,
+   ENET_PEER_STATE_CONNECTED                   = 5,
+   ENET_PEER_STATE_DISCONNECT_LATER            = 6,
+   ENET_PEER_STATE_DISCONNECTING               = 7,
+   ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT    = 8,
+   ENET_PEER_STATE_ZOMBIE                      = 9 
+} ENetPeerState;
+
+#ifndef ENET_BUFFER_MAXIMUM
+#define ENET_BUFFER_MAXIMUM (1 + 2 * ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS)
+#endif
+
+enum
+{
+   ENET_HOST_RECEIVE_BUFFER_SIZE          = 256 * 1024,
+   ENET_HOST_SEND_BUFFER_SIZE             = 256 * 1024,
+   ENET_HOST_BANDWIDTH_THROTTLE_INTERVAL  = 1000,
+   ENET_HOST_DEFAULT_MTU                  = 1400,
+
+   ENET_PEER_DEFAULT_ROUND_TRIP_TIME      = 500,
+   ENET_PEER_DEFAULT_PACKET_THROTTLE      = 32,
+   ENET_PEER_PACKET_THROTTLE_SCALE        = 32,
+   ENET_PEER_PACKET_THROTTLE_COUNTER      = 7, 
+   ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2,
+   ENET_PEER_PACKET_THROTTLE_DECELERATION = 2,
+   ENET_PEER_PACKET_THROTTLE_INTERVAL     = 5000,
+   ENET_PEER_PACKET_LOSS_SCALE            = (1 << 16),
+   ENET_PEER_PACKET_LOSS_INTERVAL         = 10000,
+   ENET_PEER_WINDOW_SIZE_SCALE            = 64 * 1024,
+   ENET_PEER_TIMEOUT_LIMIT                = 32,
+   ENET_PEER_TIMEOUT_MINIMUM              = 5000,
+   ENET_PEER_TIMEOUT_MAXIMUM              = 30000,
+   ENET_PEER_PING_INTERVAL                = 500,
+   ENET_PEER_UNSEQUENCED_WINDOW_SIZE      = 4 * 32
+};
+
+typedef struct _ENetChannel
+{
+   enet_uint16  outgoingReliableSequenceNumber;
+   enet_uint16  outgoingUnreliableSequenceNumber;
+   enet_uint16  incomingReliableSequenceNumber;
+   enet_uint16  incomingUnreliableSequenceNumber;
+   ENetList     incomingReliableCommands;
+   ENetList     incomingUnreliableCommands;
+} ENetChannel;
+
+/**
+ * An ENet peer which data packets may be sent or received from. 
+ *
+ * No fields should be modified unless otherwise specified. 
+ */
+typedef struct _ENetPeer
+{ 
+   struct _ENetHost * host;
+   enet_uint16   outgoingPeerID;
+   enet_uint16   incomingPeerID;
+   enet_uint32   sessionID;
+   ENetAddress   address;            /**< Internet address of the peer */
+   void *        data;               /**< Application private data, may be freely modified */
+   ENetPeerState state;
+   ENetChannel * channels;
+   size_t        channelCount;       /**< Number of channels allocated for communication with peer */
+   enet_uint32   incomingBandwidth;  /**< Downstream bandwidth of the client in bytes/second */
+   enet_uint32   outgoingBandwidth;  /**< Upstream bandwidth of the client in bytes/second */
+   enet_uint32   incomingBandwidthThrottleEpoch;
+   enet_uint32   outgoingBandwidthThrottleEpoch;
+   enet_uint32   incomingDataTotal;
+   enet_uint32   outgoingDataTotal;
+   enet_uint32   lastSendTime;
+   enet_uint32   lastReceiveTime;
+   enet_uint32   nextTimeout;
+   enet_uint32   earliestTimeout;
+   enet_uint32   packetLossEpoch;
+   enet_uint32   packetsSent;
+   enet_uint32   packetsLost;
+   enet_uint32   packetLoss;          /**< mean packet loss of reliable packets as a ratio with respect to the constant ENET_PEER_PACKET_LOSS_SCALE */
+   enet_uint32   packetLossVariance;
+   enet_uint32   packetThrottle;
+   enet_uint32   packetThrottleLimit;
+   enet_uint32   packetThrottleCounter;
+   enet_uint32   packetThrottleEpoch;
+   enet_uint32   packetThrottleAcceleration;
+   enet_uint32   packetThrottleDeceleration;
+   enet_uint32   packetThrottleInterval;
+   enet_uint32   lastRoundTripTime;
+   enet_uint32   lowestRoundTripTime;
+   enet_uint32   lastRoundTripTimeVariance;
+   enet_uint32   highestRoundTripTimeVariance;
+   enet_uint32   roundTripTime;            /**< mean round trip time (RTT), in milliseconds, between sending a reliable packet and receiving its acknowledgement */
+   enet_uint32   roundTripTimeVariance;
+   enet_uint16   mtu;
+   enet_uint32   windowSize;
+   enet_uint32   reliableDataInTransit;
+   enet_uint16   outgoingReliableSequenceNumber;
+   ENetList      acknowledgements;
+   ENetList      sentReliableCommands;
+   ENetList      sentUnreliableCommands;
+   ENetList      outgoingReliableCommands;
+   ENetList      outgoingUnreliableCommands;
+   enet_uint16   incomingUnsequencedGroup;
+   enet_uint16   outgoingUnsequencedGroup;
+   enet_uint32   unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; 
+   enet_uint32   disconnectData;
+} ENetPeer;
+
+/** An ENet host for communicating with peers.
+  *
+  * No fields should be modified.
+
+    @sa enet_host_create()
+    @sa enet_host_destroy()
+    @sa enet_host_connect()
+    @sa enet_host_service()
+    @sa enet_host_flush()
+    @sa enet_host_broadcast()
+    @sa enet_host_bandwidth_limit()
+    @sa enet_host_bandwidth_throttle()
+  */
+typedef struct _ENetHost
+{
+   ENetSocket         socket;
+   ENetAddress        address;                     /**< Internet address of the host */
+   enet_uint32        incomingBandwidth;           /**< downstream bandwidth of the host */
+   enet_uint32        outgoingBandwidth;           /**< upstream bandwidth of the host */
+   enet_uint32        bandwidthThrottleEpoch;
+   enet_uint32        mtu;
+   int                recalculateBandwidthLimits;
+   ENetPeer *         peers;                       /**< array of peers allocated for this host */
+   size_t             peerCount;                   /**< number of peers allocated for this host */
+   ENetPeer *         lastServicedPeer;
+   int                continueSending;
+   size_t             packetSize;
+   enet_uint16        headerFlags;
+   ENetProtocol       commands [ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS];
+   size_t             commandCount;
+   ENetBuffer         buffers [ENET_BUFFER_MAXIMUM];
+   size_t             bufferCount;
+   ENetAddress        receivedAddress;
+   enet_uint8         receivedData [ENET_PROTOCOL_MAXIMUM_MTU];
+   size_t             receivedDataLength;
+} ENetHost;
+
+/**
+ * An ENet event type, as specified in @ref ENetEvent.
+ */
+typedef enum
+{
+   /** no event occurred within the specified time limit */
+   ENET_EVENT_TYPE_NONE       = 0,  
+
+   /** a connection request initiated by enet_host_connect has completed.  
+     * The peer field contains the peer which successfully connected. 
+     */
+   ENET_EVENT_TYPE_CONNECT    = 1,  
+
+   /** a peer has disconnected.  This event is generated on a successful 
+     * completion of a disconnect initiated by enet_pper_disconnect, if 
+     * a peer has timed out, or if a connection request intialized by 
+     * enet_host_connect has timed out.  The peer field contains the peer 
+     * which disconnected. The data field contains user supplied data 
+     * describing the disconnection, or 0, if none is available.
+     */
+   ENET_EVENT_TYPE_DISCONNECT = 2,  
+
+   /** a packet has been received from a peer.  The peer field specifies the
+     * peer which sent the packet.  The channelID field specifies the channel
+     * number upon which the packet was received.  The packet field contains
+     * the packet that was received; this packet must be destroyed with
+     * enet_packet_destroy after use.
+     */
+   ENET_EVENT_TYPE_RECEIVE    = 3
+} ENetEventType;
+
+/**
+ * An ENet event as returned by enet_host_service().
+   
+   @sa enet_host_service
+ */
+typedef struct _ENetEvent 
+{
+   ENetEventType        type;      /**< type of the event */
+   ENetPeer *           peer;      /**< peer that generated a connect, disconnect or receive event */
+   enet_uint8           channelID; /**< channel on the peer that generated the event, if appropriate */
+   enet_uint32          data;      /**< data associated with the event, if appropriate */
+   ENetPacket *         packet;    /**< packet associated with the event, if appropriate */
+} ENetEvent;
+
+/** @defgroup global ENet global functions
+    @{ 
+*/
+
+/** 
+  Initializes ENet globally.  Must be called prior to using any functions in
+  ENet.
+  @returns 0 on success, < 0 on failure
+*/
+ENET_API int enet_initialize (void);
+
+/** 
+  Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant.
+
+  @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use
+  @param inits user-overriden callbacks where any NULL callbacks will use ENet's defaults
+  @returns 0 on success, < 0 on failure
+*/
+ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits);
+
+/** 
+  Shuts down ENet globally.  Should be called when a program that has
+  initialized ENet exits.
+*/
+ENET_API void enet_deinitialize (void);
+
+/** @} */
+
+/** @defgroup private ENet private implementation functions */
+
+/**
+  Returns the wall-time in milliseconds.  Its initial value is unspecified
+  unless otherwise set.
+  */
+ENET_API enet_uint32 enet_time_get (void);
+/**
+  Sets the current wall-time in milliseconds.
+  */
+ENET_API void enet_time_set (enet_uint32);
+
+/** @defgroup socket ENet socket functions
+    @{
+*/
+ENET_API ENetSocket enet_socket_create (ENetSocketType, const ENetAddress *);
+ENET_API ENetSocket enet_socket_accept (ENetSocket, ENetAddress *);
+ENET_API int        enet_socket_connect (ENetSocket, const ENetAddress *);
+ENET_API int        enet_socket_send (ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
+ENET_API int        enet_socket_receive (ENetSocket, ENetAddress *, ENetBuffer *, size_t);
+ENET_API int        enet_socket_wait (ENetSocket, enet_uint32 *, enet_uint32);
+ENET_API void       enet_socket_destroy (ENetSocket);
+
+/** @} */
+
+/** @defgroup Address ENet address functions
+    @{
+*/
+/** Attempts to resolve the host named by the parameter hostName and sets
+    the host field in the address parameter if successful.
+    @param address destination to store resolved address
+    @param hostName host name to lookup
+    @retval 0 on success
+    @retval < 0 on failure
+    @returns the address of the given hostName in address on success
+*/
+ENET_API int enet_address_set_host (ENetAddress * address, const char * hostName);
+
+/** Gives the printable form of the ip address specified in the address parameter.
+    @param address    address printed
+    @param hostName   destination for name, must not be NULL
+    @param nameLength maximum length of hostName.
+    @returns the null-terminated name of the host in hostName on success
+    @retval 0 on success
+    @retval < 0 on failure
+*/
+ENET_API int enet_address_get_host_ip (const ENetAddress * address, char * hostName, size_t nameLength);
+
+/** Attempts to do a reverse lookup of the host field in the address parameter.
+    @param address    address used for reverse lookup
+    @param hostName   destination for name, must not be NULL
+    @param nameLength maximum length of hostName.
+    @returns the null-terminated name of the host in hostName on success
+    @retval 0 on success
+    @retval < 0 on failure
+*/
+ENET_API int enet_address_get_host (const ENetAddress * address, char * hostName, size_t nameLength);
+
+/** @} */
+
+ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32);
+ENET_API void         enet_packet_destroy (ENetPacket *);
+ENET_API int          enet_packet_resize  (ENetPacket *, size_t);
+extern enet_uint32    enet_crc32 (const ENetBuffer *, size_t);
+                
+ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uint32, enet_uint32);
+ENET_API void       enet_host_destroy (ENetHost *);
+ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t);
+ENET_API int        enet_host_service (ENetHost *, ENetEvent *, enet_uint32);
+ENET_API void       enet_host_flush (ENetHost *);
+ENET_API void       enet_host_broadcast (ENetHost *, enet_uint8, ENetPacket *);
+ENET_API void       enet_host_bandwidth_limit (ENetHost *, enet_uint32, enet_uint32);
+extern   void       enet_host_bandwidth_throttle (ENetHost *);
+
+ENET_API int                 enet_peer_send (ENetPeer *, enet_uint8, ENetPacket *);
+ENET_API ENetPacket *        enet_peer_receive (ENetPeer *, enet_uint8);
+ENET_API void                enet_peer_ping (ENetPeer *);
+ENET_API void                enet_peer_reset (ENetPeer *);
+ENET_API void                enet_peer_disconnect (ENetPeer *, enet_uint32);
+ENET_API void                enet_peer_disconnect_now (ENetPeer *, enet_uint32);
+ENET_API void                enet_peer_disconnect_later (ENetPeer *, enet_uint32);
+ENET_API void                enet_peer_throttle_configure (ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
+extern int                   enet_peer_throttle (ENetPeer *, enet_uint32);
+extern void                  enet_peer_reset_queues (ENetPeer *);
+extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
+extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32);
+extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16);
+
+extern size_t enet_protocol_command_size (enet_uint8);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ENET_ENET_H__ */
+
Index: code/branches/merger/src/enet/list.h
===================================================================
--- code/branches/merger/src/enet/list.h	(revision 278)
+++ code/branches/merger/src/enet/list.h	(revision 278)
@@ -0,0 +1,42 @@
+/** 
+ @file  list.h
+ @brief ENet list management 
+*/
+#ifndef __ENET_LIST_H__
+#define __ENET_LIST_H__
+
+#include <stdlib.h>
+
+typedef struct _ENetListNode
+{
+   struct _ENetListNode * next;
+   struct _ENetListNode * previous;
+} ENetListNode;
+
+typedef ENetListNode * ENetListIterator;
+
+typedef struct _ENetList
+{
+   ENetListNode sentinel;
+} ENetList;
+
+extern void enet_list_clear (ENetList *);
+
+extern ENetListIterator enet_list_insert (ENetListIterator, void *);
+extern void * enet_list_remove (ENetListIterator);
+
+extern size_t enet_list_size (ENetList *);
+
+#define enet_list_begin(list) ((list) -> sentinel.next)
+#define enet_list_end(list) (& (list) -> sentinel)
+
+#define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
+
+#define enet_list_next(iterator) ((iterator) -> next)
+#define enet_list_previous(iterator) ((iterator) -> previous)
+
+#define enet_list_front(list) ((void *) (list) -> sentinel.next)
+#define enet_list_back(list) ((void *) (list) -> sentinel.previous)
+
+#endif /* __ENET_LIST_H__ */
+
Index: code/branches/merger/src/enet/protocol.h
===================================================================
--- code/branches/merger/src/enet/protocol.h	(revision 278)
+++ code/branches/merger/src/enet/protocol.h	(revision 278)
@@ -0,0 +1,174 @@
+/** 
+ @file  protocol.h
+ @brief ENet protocol
+*/
+#ifndef __ENET_PROTOCOL_H__
+#define __ENET_PROTOCOL_H__
+
+#include "enet/types.h"
+
+enum
+{
+   ENET_PROTOCOL_MINIMUM_MTU             = 576,
+   ENET_PROTOCOL_MAXIMUM_MTU             = 4096,
+   ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
+   ENET_PROTOCOL_MINIMUM_WINDOW_SIZE     = 4096,
+   ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE     = 32768,
+   ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT   = 1,
+   ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT   = 255,
+   ENET_PROTOCOL_MAXIMUM_PEER_ID         = 0x7FFF
+};
+
+typedef enum
+{
+   ENET_PROTOCOL_COMMAND_NONE               = 0,
+   ENET_PROTOCOL_COMMAND_ACKNOWLEDGE        = 1,
+   ENET_PROTOCOL_COMMAND_CONNECT            = 2,
+   ENET_PROTOCOL_COMMAND_VERIFY_CONNECT     = 3,
+   ENET_PROTOCOL_COMMAND_DISCONNECT         = 4,
+   ENET_PROTOCOL_COMMAND_PING               = 5,
+   ENET_PROTOCOL_COMMAND_SEND_RELIABLE      = 6,
+   ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE    = 7,
+   ENET_PROTOCOL_COMMAND_SEND_FRAGMENT      = 8,
+   ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED   = 9,
+   ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT    = 10,
+   ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
+   ENET_PROTOCOL_COMMAND_COUNT              = 12,
+
+   ENET_PROTOCOL_COMMAND_MASK               = 0x0F
+} ENetProtocolCommand;
+
+typedef enum
+{
+   ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
+   ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
+
+   ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
+   ENET_PROTOCOL_HEADER_FLAG_MASK      = 0x8000
+} ENetProtocolFlag;
+
+typedef struct
+{
+   enet_uint32 checksum;
+   enet_uint16 peerID;
+   enet_uint16 sentTime;
+} ENetProtocolHeader;
+
+typedef struct
+{
+   enet_uint8 command;
+   enet_uint8 channelID;
+   enet_uint16 reliableSequenceNumber;
+} ENetProtocolCommandHeader;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 receivedReliableSequenceNumber;
+   enet_uint16 receivedSentTime;
+} ENetProtocolAcknowledge;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 outgoingPeerID;
+   enet_uint16 mtu;
+   enet_uint32 windowSize;
+   enet_uint32 channelCount;
+   enet_uint32 incomingBandwidth;
+   enet_uint32 outgoingBandwidth;
+   enet_uint32 packetThrottleInterval;
+   enet_uint32 packetThrottleAcceleration;
+   enet_uint32 packetThrottleDeceleration;
+   enet_uint32 sessionID;
+} ENetProtocolConnect;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 outgoingPeerID;
+   enet_uint16 mtu;
+   enet_uint32 windowSize;
+   enet_uint32 channelCount;
+   enet_uint32 incomingBandwidth;
+   enet_uint32 outgoingBandwidth;
+   enet_uint32 packetThrottleInterval;
+   enet_uint32 packetThrottleAcceleration;
+   enet_uint32 packetThrottleDeceleration;
+} ENetProtocolVerifyConnect;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint32 incomingBandwidth;
+   enet_uint32 outgoingBandwidth;
+} ENetProtocolBandwidthLimit;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint32 packetThrottleInterval;
+   enet_uint32 packetThrottleAcceleration;
+   enet_uint32 packetThrottleDeceleration;
+} ENetProtocolThrottleConfigure;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint32 data;
+} ENetProtocolDisconnect;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+} ENetProtocolPing;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 dataLength;
+} ENetProtocolSendReliable;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 unreliableSequenceNumber;
+   enet_uint16 dataLength;
+} ENetProtocolSendUnreliable;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 unsequencedGroup;
+   enet_uint16 dataLength;
+} ENetProtocolSendUnsequenced;
+
+typedef struct
+{
+   ENetProtocolCommandHeader header;
+   enet_uint16 startSequenceNumber;
+   enet_uint16 dataLength;
+   enet_uint32 fragmentCount;
+   enet_uint32 fragmentNumber;
+   enet_uint32 totalLength;
+   enet_uint32 fragmentOffset;
+} ENetProtocolSendFragment;
+
+typedef union
+{
+   ENetProtocolCommandHeader header;
+   ENetProtocolAcknowledge acknowledge;
+   ENetProtocolConnect connect;
+   ENetProtocolVerifyConnect verifyConnect;
+   ENetProtocolDisconnect disconnect;
+   ENetProtocolPing ping;
+   ENetProtocolSendReliable sendReliable;
+   ENetProtocolSendUnreliable sendUnreliable;
+   ENetProtocolSendUnsequenced sendUnsequenced;
+   ENetProtocolSendFragment sendFragment;
+   ENetProtocolBandwidthLimit bandwidthLimit;
+   ENetProtocolThrottleConfigure throttleConfigure;
+} ENetProtocol;
+
+#endif /* __ENET_PROTOCOL_H__ */
+
Index: code/branches/merger/src/enet/time.h
===================================================================
--- code/branches/merger/src/enet/time.h	(revision 278)
+++ code/branches/merger/src/enet/time.h	(revision 278)
@@ -0,0 +1,18 @@
+/** 
+ @file  time.h
+ @brief ENet time constants and macros
+*/
+#ifndef __ENET_TIME_H__
+#define __ENET_TIME_H__
+
+#define ENET_TIME_OVERFLOW 86400000
+
+#define ENET_TIME_LESS(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW)
+#define ENET_TIME_GREATER(a, b) ((b) - (a) >= ENET_TIME_OVERFLOW)
+#define ENET_TIME_LESS_EQUAL(a, b) (! ENET_TIME_GREATER (a, b))
+#define ENET_TIME_GREATER_EQUAL(a, b) (! ENET_TIME_LESS (a, b))
+
+#define ENET_TIME_DIFFERENCE(a, b) ((a) - (b) >= ENET_TIME_OVERFLOW ? (b) - (a) : (a) - (b))
+
+#endif /* __ENET_TIME_H__ */
+
Index: code/branches/merger/src/enet/types.h
===================================================================
--- code/branches/merger/src/enet/types.h	(revision 278)
+++ code/branches/merger/src/enet/types.h	(revision 278)
@@ -0,0 +1,13 @@
+/** 
+ @file  types.h
+ @brief type definitions for ENet
+*/
+#ifndef __ENET_TYPES_H__
+#define __ENET_TYPES_H__
+
+typedef unsigned char enet_uint8;       /**< unsigned 8-bit type  */
+typedef unsigned short enet_uint16;     /**< unsigned 16-bit type */
+typedef unsigned int enet_uint32;      /**< unsigned 32-bit type */
+
+#endif /* __ENET_TYPES_H__ */
+
Index: code/branches/merger/src/enet/unix.h
===================================================================
--- code/branches/merger/src/enet/unix.h	(revision 278)
+++ code/branches/merger/src/enet/unix.h	(revision 278)
@@ -0,0 +1,36 @@
+/** 
+ @file  unix.h
+ @brief ENet Unix header
+*/
+#ifndef __ENET_UNIX_H__
+#define __ENET_UNIX_H__
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+
+typedef int ENetSocket;
+
+enum
+{
+    ENET_SOCKET_NULL = -1
+};
+
+#define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
+#define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
+
+#define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
+#define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
+
+typedef struct
+{
+    void * data;
+    size_t dataLength;
+} ENetBuffer;
+
+#define ENET_CALLBACK
+
+#define ENET_API extern
+
+#endif /* __ENET_UNIX_H__ */
+
Index: code/branches/merger/src/enet/utility.h
===================================================================
--- code/branches/merger/src/enet/utility.h	(revision 278)
+++ code/branches/merger/src/enet/utility.h	(revision 278)
@@ -0,0 +1,12 @@
+/** 
+ @file  utility.h
+ @brief ENet utility header
+*/
+#ifndef __ENET_UTILITY_H__
+#define __ENET_UTILITY_H__
+
+#define ENET_MAX(x, y) ((x) > (y) ? (x) : (y))
+#define ENET_MIN(x, y) ((x) < (y) ? (x) : (y))
+
+#endif /* __ENET_UTILITY_H__ */
+
Index: code/branches/merger/src/enet/win32.h
===================================================================
--- code/branches/merger/src/enet/win32.h	(revision 278)
+++ code/branches/merger/src/enet/win32.h	(revision 278)
@@ -0,0 +1,51 @@
+/** 
+ @file  win32.h
+ @brief ENet Win32 header
+*/
+#ifndef __ENET_WIN32_H__
+#define __ENET_WIN32_H__
+
+#ifdef ENET_BUILDING_LIB
+#pragma warning (disable: 4996) // 'strncpy' was declared deprecated
+#pragma warning (disable: 4267) // size_t to int conversion
+#pragma warning (disable: 4244) // 64bit to 32bit int
+#pragma warning (disable: 4018) // signed/unsigned mismatch
+#endif
+
+#include <stdlib.h>
+#include <winsock2.h>
+
+typedef SOCKET ENetSocket;
+
+enum
+{
+    ENET_SOCKET_NULL = INVALID_SOCKET
+};
+
+#define ENET_HOST_TO_NET_16(value) (htons (value))
+#define ENET_HOST_TO_NET_32(value) (htonl (value))
+
+#define ENET_NET_TO_HOST_16(value) (ntohs (value))
+#define ENET_NET_TO_HOST_32(value) (ntohl (value))
+
+typedef struct
+{
+    size_t dataLength;
+    void * data;
+} ENetBuffer;
+
+#define ENET_CALLBACK __cdecl
+
+#if defined ENET_DLL
+#if defined ENET_BUILDING_LIB
+#define ENET_API __declspec( dllexport )
+#else
+#define ENET_API __declspec( dllimport )
+#endif /* ENET_BUILDING_LIB */
+#else /* !ENET_DLL */
+#define ENET_API extern
+#endif /* ENET_DLL */
+
+#endif /* __ENET_WIN32_H__ */
+
+
Index: code/branches/merger/src/network/Client.cc
===================================================================
--- code/branches/merger/src/network/Client.cc	(revision 278)
+++ code/branches/merger/src/network/Client.cc	(revision 278)
@@ -0,0 +1,142 @@
+//
+// C++ Implementation: Client
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include "network/Client.h"
+
+namespace network{
+  
+  /**
+   * Constructor for the Client class
+   * initializes the address and the port to default localhost:NETWORK_PORT
+   */
+  Client::Client(): client_connection(NETWORK_PORT,"127.0.0.1"){
+    // set server address to localhost
+    //server_address="127.0.0.1";
+    //port = NETWORK_PORT;
+    isConnected=false;
+  }
+  
+  /**
+   * Constructor for the Client class
+   * @param address the server address
+   * @param port port of the application on the server
+   */
+  Client::Client(std::string address, int port) : client_connection(port, address){
+    //server_address=address.c_str();
+    //this->port = port;
+    isConnected=false;
+  }
+  
+  /**
+   * Constructor for the Client class
+   * @param address the server address
+   * @param port port of the application on the server
+   */
+  Client::Client(const char *address, int port) : client_connection(port, address){
+    //server_address = address;
+    //this->port = port;
+    isConnected=false;
+  }
+  
+  /**
+   * Establish the Connection to the Server
+   * @return true/false
+   */
+  bool Client::establishConnection(){
+    isConnected=client_connection.createConnection();
+    return isConnected;
+  }
+  
+  /**
+   * closes the Connection to the Server
+   * @return true/false
+   */
+  bool Client::closeConnection(){
+    isConnected=false;
+    return client_connection.closeConnection();
+  }
+  
+  /**
+   * submits a MouseAction to the server
+   * @param x x Coordinate
+   * @param y y Coordinate
+   * @return true/false
+   */
+  bool Client::sendMouse(double x, double y){
+    ENetEvent event;
+    // generate packet and add it to the queue
+    if(!client_connection.addPacket(pck_gen.mousem(x, y)))
+        return false;
+    // send packets
+    client_connection.sendPackets(&event);
+    if(event.type==ENET_EVENT_TYPE_NONE)
+      return true;
+    else
+      return false;
+  }
+  
+  /**
+   * submits a Keystrike to the server
+   * @param key_code code to submit
+   * @return true/false
+   */
+  bool Client::sendKeyboard(char key_code){
+    ENetEvent event;
+    // generate packet and add it to queue
+    if(!client_connection.addPacket(pck_gen.keystrike(key_code)))
+        return false;
+    // send packets
+    client_connection.sendPackets(&event);
+    if(event.type==ENET_EVENT_TYPE_NONE)
+      return true;
+    else
+      return false;
+  }
+  
+  /**
+   * Adds a MouseAction to the PacketQueue
+   * @param x x Coordinate
+   * @param y y Coordinate
+   * @return true/false
+   */
+  bool Client::addMouse(double x, double y){
+    // generate packet and add it to the queue
+    if(client_connection.addPacket(pck_gen.mousem(x, y)))
+      return true;
+    else
+      return false;
+  }
+  
+  /**
+   * Adds a Keystrike to the PacketQueue
+   * @param key_code
+   * @return true/false
+   */
+  bool Client::addKeyboard(char key_code){
+    ENetEvent event;
+    // generate packet and add it to queue
+    if(client_connection.addPacket(pck_gen.keystrike(key_code)))
+      return true;
+    else
+      return false;
+  }
+  
+  /**
+   * Performs a GameState update
+   */
+  void Client::update(){
+    // to be implemented ==================
+    
+    
+  }
+  
+}
Index: code/branches/merger/src/network/Client.h
===================================================================
--- code/branches/merger/src/network/Client.h	(revision 278)
+++ code/branches/merger/src/network/Client.h	(revision 278)
@@ -0,0 +1,58 @@
+//
+// C++ Interface: Client
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef NETWORK_CLIENT_H
+#define NETWORK_CLIENT_H
+
+#include <string>
+
+#include "network/ClientConnection.h"
+#include "network/PacketManager.h"
+
+
+namespace network{
+
+/**
+ * The network/Client class
+ * This class implements all necessary function for the network communication
+ * It is the root class of the network module
+ * 
+ */
+class Client : PacketDecoder{
+  public:
+  Client();
+  Client(std::string address, int port);
+  Client(const char *address, int port);
+  
+  bool establishConnection();
+  bool closeConnection();
+  
+  bool sendMouse(double x, double y);
+  bool sendKeyboard(char key_code);
+  
+  bool addMouse(double x, double y);
+  bool addKeyboard(char key_code);
+  
+  void update();
+  
+  private:
+  ClientConnection client_connection;
+  PacketGenerator pck_gen;
+  
+  //const char *server_address;
+  //int port;
+  bool isConnected;
+};
+
+}
+
+#endif
Index: code/branches/merger/src/network/ClientConnection.cc
===================================================================
--- code/branches/merger/src/network/ClientConnection.cc	(revision 278)
+++ code/branches/merger/src/network/ClientConnection.cc	(revision 278)
@@ -0,0 +1,171 @@
+//
+// C++ Interface: ClientConnection
+//
+// Description: The Class ClientConnection manages the servers conenctions to the clients. 
+// each connection is provided by a new process. communication between master process and 
+// connection processes is provided by ...
+//
+//
+// Author:  Oliver Scheuss
+//
+
+#include "network/ClientConnection.h"
+
+namespace network{
+  
+  boost::thread_group network_threads;
+  
+  ClientConnection::ClientConnection(int port, std::string address){
+    quit=false;
+    server=NULL;
+    enet_address_set_host(&serverAddress, address.c_str());
+    serverAddress.port = NETWORK_PORT;
+    established=false;
+  }
+  
+  ClientConnection::ClientConnection(int port, const char *address){
+    quit=false;
+    server=NULL;
+    enet_address_set_host(&serverAddress, address);
+    serverAddress.port = NETWORK_PORT;
+    established=false;
+  }
+  
+  bool ClientConnection::waitEstablished(int milisec){
+    for(int i=0; i<=milisec && !established; i++)
+      usleep(1000);
+    return established;
+  }
+  
+  
+  ENetPacket *ClientConnection::getPacket(ENetAddress &address){
+    if(!buffer.isEmpty())
+      return buffer.pop(address);
+    else
+        return NULL;
+  }
+  
+  bool ClientConnection::queueEmpty(){
+    return buffer.isEmpty();
+  }
+  
+  bool ClientConnection::createConnection(){
+    network_threads.create_thread(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this));
+    // wait 10 seconds for the connection to be established
+    return waitEstablished(10000);
+  }
+  
+  bool ClientConnection::closeConnection(){
+    quit=true;
+    network_threads.join_all();
+    established=false;
+    return true;
+  }
+  
+  
+  bool ClientConnection::addPacket(ENetPacket *packet){
+    if(server==NULL)
+      return false;
+    if(enet_peer_send(server, 1, packet)!=0)
+      return false;
+    else
+      return true;
+  }
+  
+  bool ClientConnection::sendPackets(ENetEvent *event){
+    if(server==NULL)
+      return false;
+    if(enet_host_service(client, event, NETWORK_SEND_WAIT)>=0)
+      return true;
+    else 
+      return false;
+  }
+  
+  bool ClientConnection::sendPackets(){
+    ENetEvent event;
+    if(server==NULL)
+      return false;
+    if(enet_host_service(client, &event, NETWORK_SEND_WAIT)>=0)
+      return true;
+    else 
+      return false;
+  }
+  
+  void ClientConnection::receiverThread(){
+    // what about some error-handling here ?
+    enet_initialize();
+    atexit(enet_deinitialize);
+    ENetEvent event;
+    client = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0);
+    if(client==NULL)
+      // add some error handling here ==========================
+      quit=true;
+    //connect to the server
+    if(!establishConnection())
+      quit=true;
+    //main loop
+    while(!quit){
+      if(enet_host_service(client, &event, NETWORK_WAIT_TIMEOUT)<0){
+        // we should never reach this point
+        quit=true;
+        // add some error handling here ========================
+      }
+      switch(event.type){
+        // log handling ================
+      case ENET_EVENT_TYPE_RECEIVE:
+        processData(&event);
+        break;
+      case ENET_EVENT_TYPE_DISCONNECT:
+        // add some error/log handling here
+        // extend =====================
+        break;
+      }
+    }
+    // now disconnect
+    
+    if(!disconnectConnection()) 
+    // if disconnecting failed destroy conn.
+      enet_peer_reset(server);
+    return;
+  }
+  
+  bool ClientConnection::disconnectConnection(){
+    ENetEvent event;
+    enet_peer_disconnect(server, 0);
+    while(enet_host_service(client, &event, NETWORK_WAIT_TIMEOUT) > 0){
+      switch (event.type)
+      {
+        case ENET_EVENT_TYPE_RECEIVE:
+          enet_packet_destroy(event.packet);
+          break;
+        case ENET_EVENT_TYPE_DISCONNECT:
+          return true;
+      }
+    }
+    enet_peer_reset(server);
+  }
+  
+  bool ClientConnection::establishConnection(){
+    ENetEvent event;
+    // connect to peer
+    server = enet_host_connect(client, &serverAddress, NETWORK_CLIENT_CHANNELS);
+    if(server==NULL)
+      // error handling
+      return false;
+    // handshake
+    if(enet_host_service(client, &event, NETWORK_WAIT_TIMEOUT)>0 && event.type == ENET_EVENT_TYPE_CONNECT){
+      established=true;
+      return true;
+    }
+    else
+      return false;
+  }
+  
+  bool ClientConnection::processData(ENetEvent *event){
+    // just add packet to the buffer
+    // this can be extended with some preprocessing
+    return buffer.push(event);
+  }
+  
+  
+}
Index: code/branches/merger/src/network/ClientConnection.h
===================================================================
--- code/branches/merger/src/network/ClientConnection.h	(revision 278)
+++ code/branches/merger/src/network/ClientConnection.h	(revision 278)
@@ -0,0 +1,79 @@
+//
+// C++ Interface: ClientConnection
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef NETWORK_CLIENTCONNECTION_H
+#define NETWORK_CLIENTCONNECTION_H
+
+#include <iostream>
+#include <string>
+// enet library for networking support
+#include <enet/enet.h>
+// boost.thread library for multithreading support
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+// headerfile
+#include "network/ClientConnection.h"
+#include "network/PacketBuffer.h"
+
+namespace network{
+  //
+#define NETWORK_PORT 55556
+#define NETWORK_CLIENT_MAX_CONNECTIONS 5
+#define NETWORK_WAIT_TIMEOUT 5000
+#define NETWORK_SEND_WAIT 5
+#define NETWORK_CLIENT_CHANNELS 2
+  
+  
+  class ClientConnection{
+    public:
+    ClientConnection(int port, std::string address);
+    ClientConnection(int port, const char* address);
+    ENetPacket *getPacket(ENetAddress &address); // thread1
+    // check wheter the packet queue is empty
+    bool queueEmpty();
+    // create a new listener thread
+    bool createConnection();
+    bool closeConnection();
+    // add a packet to queue for the server
+    bool addPacket(ENetPacket *packet);
+    // send out all queued packets
+    bool sendPackets();
+    // send out all queued packets and save result in event
+    bool sendPackets(ENetEvent *event);
+    bool waitEstablished(int milisec);
+    private:
+    bool processData(ENetEvent *event);
+    // implementation of the listener
+    void receiverThread(); //thread2
+    //packetbuffer
+    bool establishConnection();
+    bool disconnectConnection();
+    PacketBuffer buffer;
+    // enet stuff
+    ENetHost *client;
+    ENetAddress serverAddress;
+    // quit-variable (communication with threads)
+    bool quit;
+    bool established;
+    // clientlist
+    ENetPeer *server;
+  };
+  
+  
+  
+  
+  
+  
+  
+  
+}
+
+#endif
Index: code/branches/merger/src/network/ConnectionManager.cc
===================================================================
--- code/branches/merger/src/network/ConnectionManager.cc	(revision 278)
+++ code/branches/merger/src/network/ConnectionManager.cc	(revision 278)
@@ -0,0 +1,206 @@
+//
+// C++ Interface: ConnectionManager
+//
+// Description: The Class ConnectionManager manages the servers conenctions to the clients. 
+// each connection is provided by a new process. communication between master process and 
+// connection processes is provided by ...
+//
+//
+// Author:  Oliver Scheuss
+//
+
+#include "network/ConnectionManager.h"
+
+namespace network{
+  
+  boost::thread_group network_threads;
+  
+  void test(){
+    return;
+  }
+  
+  ConnectionManager::ConnectionManager(){
+    quit=false;
+    client=NULL;
+    bindAddress.host = ENET_HOST_ANY;
+    bindAddress.port = NETWORK_PORT;
+  }
+  
+  ConnectionManager::ConnectionManager(int port, std::string address){
+    quit=false;
+    client=NULL;
+    enet_address_set_host (& bindAddress, address.c_str());
+    bindAddress.port = NETWORK_PORT;
+  }
+  
+  ConnectionManager::ConnectionManager(int port, const char *address){
+    quit=false;
+    client=NULL;
+    enet_address_set_host (& bindAddress, address);
+    bindAddress.port = NETWORK_PORT;
+  }
+  
+  ENetPacket *ConnectionManager::getPacket(ENetAddress &address){
+    if(!buffer.isEmpty())
+      return buffer.pop(address);
+    else
+        return NULL;
+  }
+  
+  bool ConnectionManager::queueEmpty(){
+    return buffer.isEmpty();
+  }
+  
+  void ConnectionManager::createListener(){
+    network_threads.create_thread(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
+//     boost::thread thr(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this));
+    return;
+  }
+  
+  bool ConnectionManager::quitListener(){
+    quit=true;
+    network_threads.join_all();
+    return true;
+  }
+  
+  bool ConnectionManager::addPacket(ENetPacket *packet, ENetPeer *peer){
+    if(client=NULL)
+      return false;
+    ClientList *temp=client;
+    while(peer->host != temp->event->peer->host){
+      temp=temp->next;
+      if(temp==NULL)
+        return false;
+    }
+    if(enet_peer_send(temp->event->peer, temp->ID, packet)!=0)
+      return false;
+    return true;
+  }
+  
+  bool ConnectionManager::addPacket(ENetPacket *packet, int ID){
+    if(client==NULL)
+      return false;
+    ClientList *temp=client;
+    while(ID != temp->ID){
+      temp=temp->next;
+      if(temp==NULL)
+        return false;
+    }
+    if(enet_peer_send(temp->event->peer, temp->ID, packet)!=0)
+      return false;
+    else
+      return true;
+  }
+  
+  bool ConnectionManager::addPacketAll(ENetPacket *packet){
+    ClientList *temp=client;
+    while(temp!=NULL){
+      if(enet_peer_send(temp->event->peer, temp->ID, packet)!=0)
+         return false;
+    }
+    return true;
+  }
+  
+  bool ConnectionManager::sendPackets(ENetEvent *event){
+    if(server==NULL)
+      return false;
+    if(enet_host_service(server, event, NETWORK_SEND_WAIT)>=0)
+      return true;
+    else 
+      return false;
+  }
+  
+  void ConnectionManager::receiverThread(){
+    // what about some error-handling here ?
+    enet_initialize();
+    atexit(enet_deinitialize);
+    ENetEvent event;
+    server = enet_host_create(&bindAddress, NETWORK_MAX_CONNECTIONS, 0, 0);
+    if(server==NULL)
+      // add some error handling here ==========================
+      quit=true;
+    
+    while(!quit){
+      if(enet_host_service(server, &event, NETWORK_WAIT_TIMEOUT)<0){
+        // we should never reach this point
+        quit=true;
+        // add some error handling here ========================
+      }
+      switch(event.type){
+        // log handling ================
+        case ENET_EVENT_TYPE_CONNECT:
+        addClient(&event);
+        break;
+      case ENET_EVENT_TYPE_RECEIVE:
+        processData(&event);
+        break;
+      case ENET_EVENT_TYPE_DISCONNECT:
+        // add some error/log handling here
+        clientDisconnect(event.peer);
+        break;
+      }
+    }
+    // if we're finishied, destroy server
+    enet_host_destroy(server);
+  }
+  
+  bool ConnectionManager::processData(ENetEvent *event){
+    // just add packet to the buffer
+    // this can be extended with some preprocessing
+    return buffer.push(event);
+  }
+  
+  bool ConnectionManager::clientDisconnect(ENetPeer *peer){
+    ClientList *temp=client;
+    // do we have to remove the first item ?
+    if(temp->event->peer->host==peer->host){
+      if(temp->next==NULL){
+        client=NULL;
+      } else{
+        client=temp->next;
+      }
+      delete temp;
+      return true;
+    } else {
+      while(temp->next!=NULL){
+        if(temp->next->event->peer->host==peer->host){
+          // do a correct relink and delete the disconnected client
+          ClientList *temp2=temp->next;
+          temp->next=temp2->next;
+          delete temp2;
+          return true;
+        } else
+          //otherwise keep on searching ;)
+          temp=temp->next;
+      }
+    }
+    return false;
+  }
+  
+  bool ConnectionManager::addClient(ENetEvent *event){
+    
+    // first client?
+    if(client==NULL){
+      client =new ClientList;
+      client->ID=1;
+      client->next=NULL;
+      client->event = event;
+    } else {
+      // otherwise add a new element to clientlist
+      ClientList *temp = client;
+      int i=1;
+      while(temp->next != NULL){
+        temp=temp->next;
+        i++;
+      }
+      temp->next=new ClientList;
+      temp=temp->next;
+      temp->ID=i+1;
+      temp->event=event;
+      temp->next=NULL;
+    }
+    return true;
+  }
+  
+  
+}
Index: code/branches/merger/src/network/ConnectionManager.h
===================================================================
--- code/branches/merger/src/network/ConnectionManager.h	(revision 278)
+++ code/branches/merger/src/network/ConnectionManager.h	(revision 278)
@@ -0,0 +1,91 @@
+//
+// C++ Interface: ConnectionManager
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef NETWORK_CONNECTIONMANAGER_H
+#define NETWORK_CONNECTIONMANAGER_H
+
+#include <iostream>
+#include <string>
+// enet library for networking support
+#include <enet/enet.h>
+// boost.thread library for multithreading support
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+// headerfile
+#include "network/ConnectionManager.h"
+#include "network/PacketBuffer.h"
+
+namespace network{
+  //
+#define NETWORK_PORT 55556
+#define NETWORK_MAX_CONNECTIONS 50
+#define NETWORK_WAIT_TIMEOUT 5000
+#define NETWORK_SEND_WAIT 5
+  //just some defines to make life easier ;)
+// #define ENetEvent std::ENetEvent
+// #define ENetHost std::ENetHost
+// #define ENetAddress std::ENetAddress
+// #define ENetPeer std::ENetPeer
+  
+  struct ClientList{
+    ENetEvent *event;
+    int ID;
+    ClientList *next;
+  };
+  
+  class ConnectionManager{
+    public:
+    ConnectionManager();
+    ConnectionManager(int port, const char *address);
+    ConnectionManager(int port, std::string address);
+    ENetPacket *getPacket(ENetAddress &address); // thread1
+    // check wheter the packet queue is empty
+    bool queueEmpty();
+    // create a new listener thread
+    void createListener();
+    bool quitListener();
+    // add a packet to queue for a specific client peer
+    bool addPacket(ENetPacket *packet, ENetPeer *peer);
+    // add ad packet to queue for a specific client ID
+    bool addPacket(ENetPacket *packet, int ID);
+    // add a packet to queue for all clients
+    bool addPacketAll(ENetPacket *packet);
+    // send out all queued packets
+    bool sendPackets(ENetEvent *event);
+    private:
+    bool clientDisconnect(ENetPeer *peer);
+    bool processData(ENetEvent *event);
+    bool addClient(ENetEvent *event);
+    // implementation of the listener
+    void receiverThread(); //thread2
+    //packetbuffer
+    PacketBuffer buffer;
+    // enet stuff
+    ENetHost *server;
+    ENetAddress bindAddress;
+    // quit-variable (communication with threads)
+    bool quit;
+    // clientlist
+    ClientList *client;
+//     thread group
+//     boost::thread_group threads;
+  };
+  
+  
+  
+  
+  
+  
+  
+  
+}
+
+#endif
Index: code/branches/merger/src/network/GameStateManager.cc
===================================================================
--- code/branches/merger/src/network/GameStateManager.cc	(revision 278)
+++ code/branches/merger/src/network/GameStateManager.cc	(revision 278)
@@ -0,0 +1,32 @@
+//
+// C++ Implementation: GameStateManager
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "GameStateManager.h"
+
+namespace network {
+
+GameStateManager::GameStateManager()
+{
+}
+
+GameStateManager::~GameStateManager()
+{
+}
+
+GameState GameStateManager::getSnapshot(){
+  
+}
+
+bool GameStateManager::loadSnapshot(GameState state){
+  
+}
+
+}
Index: code/branches/merger/src/network/GameStateManager.h
===================================================================
--- code/branches/merger/src/network/GameStateManager.h	(revision 278)
+++ code/branches/merger/src/network/GameStateManager.h	(revision 278)
@@ -0,0 +1,46 @@
+//
+// C++ Interface: GameStateManager
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef NETWORK_GAMESTATEMANAGER_H
+#define NETWORK_GAMESTATEMANAGER_H
+
+namespace network {
+
+/**
+ * This struct defines a gamestate:
+ * size: total size of the data in *data
+ * data: pointer to the data allocated in the memory
+ */
+struct GameState{
+  int size;
+  unsigned char *data;
+};
+
+/**
+ * This Class implements a manager for gamestates:
+ * - creating snapshots of gamestates
+ * - writing gamestates to universe
+ * - diffing gamestates ?
+ * @author Oliver Scheuss
+*/
+class GameStateManager{
+public:
+  GameStateManager();
+  ~GameStateManager();
+  GameState getSnapshot();
+  bool loadSnapshot(GameState state);
+private:
+  
+};
+
+}
+
+#endif
Index: code/branches/merger/src/network/Makefile
===================================================================
--- code/branches/merger/src/network/Makefile	(revision 278)
+++ code/branches/merger/src/network/Makefile	(revision 278)
@@ -0,0 +1,40 @@
+CC=g++
+MAIN_INC=..
+INC=-I ${MAIN_INC}
+
+all: server client
+
+# Link command:
+server: PacketBuffer.o ConnectionManager.o dummyserver.o PacketDecoder.o PacketGenerator.o
+	${CC} PacketDecoder.o PacketGenerator.o ConnectionManager.o dummyserver.o PacketBuffer.o -o server -lenet -lboost_thread -g
+
+dummyserver.o: dummyserver.cc
+	${CC} -c dummyserver.cc -o dummyserver.o -g ${INC}
+# Compilation commands:
+ConnectionManager.o: ConnectionManager.cc ConnectionManager.h
+	${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC}
+ClientConnection.o: ClientConnection.cc ClientConnection.h
+	${CC} -c ClientConnection.cc -o ClientConnection.o -g ${INC}
+
+PacketBuffer.o: PacketBuffer.cc
+	${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC}
+PacketGenerator.o: PacketGenerator.cc
+	${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC}
+PacketDecoder.o: PacketDecoder.cc
+	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
+Client.o: Client.cc
+	${CC} -c Client.cc -g ${INC}
+Server.o: Server.cc
+	${CC} -c Server.cc -g ${INC}
+Synchronisable.o: Synchronisable.cc
+	${CC} -c Synchronisable.cc -g ${INC}
+GameStateManager.o: GameStateManager.cc
+	${CC} -c GameStateManager.cc -g ${INC}
+
+clean:
+	rm -rf *.o
+
+client_old: PacketGenerator.o dummyclient.cc
+	${CC} dummyclient.cc PacketGenerator.o -o client -lenet -g ${INC}
+client: PacketGenerator.o ClientConnection.o PacketBuffer.o dummyclient2.cc 
+	${CC} dummyclient2.cc PacketGenerator.o PacketBuffer.o ClientConnection.o -o client -lenet -lboost_thread -g ${INC}
Index: code/branches/merger/src/network/Makefile.tardis
===================================================================
--- code/branches/merger/src/network/Makefile.tardis	(revision 278)
+++ code/branches/merger/src/network/Makefile.tardis	(revision 278)
@@ -0,0 +1,39 @@
+all: server client
+
+CC=g++-4.1.1
+
+BOOST_INC=/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include/boost-1_34_1/
+BOOST_LIB=/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/lib/
+MAIN_INC=..
+ENET_INC=/usr/pack/enet-2007-sd/include/
+ENET_LIB=/usr/pack/enet-2007-sd/i686-debian-linux3.1/lib/
+INC=-I ${BOOST_INC} -I ${MAIN_INC} -I ${ENET_INC}
+LIB=-L ${BOOST_LIB} -L ${ENET_LIB}
+
+# Link command:
+server: clean PacketBuffer.o ConnectionManager.o dummyserver.o PacketGenerator.o PacketDecoder.o
+	${CC} ConnectionManager.o dummyserver.o PacketBuffer.o PacketDecoder.o PacketGenerator.o -o server -lenet -lboost_thread-gcc41-mt -g ${INC} ${LIB} -Wl,-rpath,${BOOST_LIB} -Wl,-rpath,${ENET_LIB}
+
+dummyserver.o:
+	${CC} -c dummyserver.cc -o dummyserver.o -g ${INC}
+# Compilation commands:
+
+ConnectionManager.o:
+	${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC}
+
+PacketBuffer.o: 
+	${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC}
+PacketGenerator.o: PacketGenerator.cc
+	${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC}
+PacketDecoder.o: PacketDecoder.cc
+	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
+Synchronisable.o: Synchronisable.cc
+	${CC} -c Synchronisable.cc -g ${INC}
+GameStateManager.o: GameStateManager.cc
+	${CC} -c GameStateManager.cc -g ${INC}
+
+clean:
+	rm -rf *.o
+
+client: dummyclient.cc PacketDecoder.o PacketGenerator.o
+	${CC} PacketGenerator.o PacketDecoder.o dummyclient.cc -o client -lenet ${LIB} ${INC} -Wl,-rpath,${BOOST_LIB}
Index: code/branches/merger/src/network/PacketBuffer.cc
===================================================================
--- code/branches/merger/src/network/PacketBuffer.cc	(revision 278)
+++ code/branches/merger/src/network/PacketBuffer.cc	(revision 278)
@@ -0,0 +1,103 @@
+// C++ PacketBuffer
+// d
+// Author Oliver Scheuss
+
+#ifndef NETWORK_PACKETBUFFER_CC
+#define NETWORK_PACKETBUFFER_CC
+
+#include <iostream>
+#include "network/PacketBuffer.h"
+
+namespace network{
+  
+   boost::mutex networkPacketBufferMutex;
+  
+PacketBuffer::PacketBuffer(){
+  closed=false;
+  first=NULL;
+  last=NULL;
+}
+    //this is needed in order to make the packetbuffer threadsafe
+  
+
+bool PacketBuffer::push(ENetEvent *ev){
+  boost::mutex::scoped_lock lock(networkPacketBufferMutex);
+//   if(closed)
+//     return false;
+  // first element?
+  if(first==NULL){
+    first=new QueueItem;
+    last=first;
+    last->next=NULL;
+    // change this!!!!!!!
+    last->packet = ev->packet;
+    last->address = ev->peer->address;
+    } else {
+    //insert a new element at the bottom
+    last->next = new QueueItem;
+    last=last->next;
+    // initialize last->next
+    last->next=NULL;
+    // save the packet to the new element
+    last->packet = ev->packet;
+    last->address = ev->peer->address;
+  }
+  return true;
+}
+
+ENetPacket *PacketBuffer::pop(){
+  boost::mutex::scoped_lock lock(networkPacketBufferMutex);
+  if(first!=NULL /*&& !closed*/){
+    QueueItem *temp = first;
+    // get packet
+    ENetPacket *pck=first->packet;
+    // remove first element
+    first = first->next;
+    delete temp;
+    return pck;
+  } else{
+    return NULL;
+  }
+}
+
+ENetPacket *PacketBuffer::pop(ENetAddress &address){
+  boost::mutex::scoped_lock lock(networkPacketBufferMutex);
+  if(first!=NULL /*&& !closed*/){
+    QueueItem *temp = first;
+    // get packet
+    ENetPacket *pck=first->packet;
+    address = first->address;
+    // remove first element
+    first = first->next;
+    delete temp;
+    return pck;
+  } else{
+    return NULL;
+  }
+}
+
+bool PacketBuffer::isEmpty(){
+  return (first==NULL);
+}
+
+void PacketBuffer::print(){
+  QueueItem *temp=first;
+  while(temp!=NULL){
+//    std::cout << temp->packet->data << std::endl;
+    temp=temp->next;
+  }
+  
+}
+
+bool PacketBuffer::isClosed(){
+  return closed;
+}
+
+void PacketBuffer::setClosed(bool value){
+  closed=value;
+  return;
+}
+
+}// namespace network
+
+#endif
Index: code/branches/merger/src/network/PacketBuffer.h
===================================================================
--- code/branches/merger/src/network/PacketBuffer.h	(revision 278)
+++ code/branches/merger/src/network/PacketBuffer.h	(revision 278)
@@ -0,0 +1,58 @@
+//
+// C++ Interface: PacketBuffer
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef NETWORK_PACKETBUFFER_H 
+#define NETWORK_PACKETBUFFER_H
+
+#include <queue>
+#include <string>
+#include <enet/enet.h>
+#include <boost/bind.hpp>
+#include <boost/thread/mutex.hpp>
+
+
+namespace network{
+
+
+struct PacketEnvelope{
+  int length;
+  int data;
+};
+
+struct QueueItem{
+  ENetPacket *packet;
+  ENetAddress address;
+  QueueItem *next;
+};
+
+class PacketBuffer{
+public:
+  PacketBuffer();
+  bool isEmpty();
+  bool isClosed();
+  void setClosed(bool value);
+  void print();
+  // pops a packet from the queue
+  ENetPacket *pop();
+  ENetPacket *pop(ENetAddress &address);
+  // pushs a packet to the queue
+  bool push(ENetEvent *ev);
+  
+private:
+  QueueItem *first;
+  QueueItem *last;
+  bool closed;
+  
+};
+
+} //namespace
+#endif /* NETWORK_PACKETBUFFER_H */
Index: code/branches/merger/src/network/PacketBufferTest.cc
===================================================================
--- code/branches/merger/src/network/PacketBufferTest.cc	(revision 278)
+++ code/branches/merger/src/network/PacketBufferTest.cc	(revision 278)
@@ -0,0 +1,25 @@
+#include "network/PacketBuffer.h"
+#include "network/PacketBuffer.cc"
+#include <iostream>
+#include <string>
+
+using namespace network;
+
+int main(int argc, char **argv[]){
+  PacketBuffer test = PacketBuffer();
+  PacketEnvelope p={8, 5};
+  if(test.isEmpty())
+    std::cout << "empty buffer" << std::endl;
+  for(int i=0; i<10; i++){
+    p.data=i*i;
+    std::cout << i << ": pushing " << p.data << std::endl;
+    test.push(p);
+  }
+  std::cout << std::endl << "queue.print()" << std::endl;
+  test.print();
+  while(!test.isEmpty()){
+    int i=test.pop().data;
+    std::cout << "We popped the value " << i << std::endl;
+  }
+  return 0;
+}
Index: code/branches/merger/src/network/PacketBufferTestExt.cc
===================================================================
--- code/branches/merger/src/network/PacketBufferTestExt.cc	(revision 278)
+++ code/branches/merger/src/network/PacketBufferTestExt.cc	(revision 278)
@@ -0,0 +1,51 @@
+#include <string>
+#include <iostream>
+#include <enet/enet.h>
+#include <boost/thread/thread.hpp>
+#include "network/PacketBuffer.h"
+#include "network/PacketBuffer.cc"
+
+using namespace network;
+
+
+void write(PacketBuffer *test){
+  ENetPacket *packet;
+  if(test->isEmpty())
+    std::cout << "empty buffer" << std::endl;
+  for(int i=0; i<10; i++){
+    std::string temp = "packet ";
+    packet = enet_packet_create("packet", strlen("packet ")+1, 
+ENET_PACKET_FLAG_RELIABLE);
+    std::cout << i << ": pushing " << packet->data << std::endl;
+    test->push(packet);
+    if(i==5)
+      usleep(200000);
+  }
+  test->setClosed(true);
+  return;
+}
+
+void read(PacketBuffer *test){
+  //test->print();
+  // exit if the queue is closed and empty
+  while(!test->isClosed() || !test->isEmpty()){
+    // only pop if the queue isn't empty
+    while(!test->isEmpty()){
+      std::cout << "We popped the value " << test->pop()->data << std::endl;
+    }
+  }
+  return;
+}
+
+
+int main(int argc, char **argv[]){
+  PacketBuffer test = PacketBuffer();
+  boost::thread thrd1(boost::bind(&write, &test));
+  boost::thread thrd2(boost::bind(&read, &test));
+    
+  thrd1.join();
+  thrd2.join();
+  
+  return 0;
+}
+
Index: code/branches/merger/src/network/PacketDecoder.cc
===================================================================
--- code/branches/merger/src/network/PacketDecoder.cc	(revision 278)
+++ code/branches/merger/src/network/PacketDecoder.cc	(revision 278)
@@ -0,0 +1,104 @@
+/*
+ * Class contains functions to determine and decode incomming packages
+ * 
+ * Autor: Dumeni Manatschal
+ * 
+*/
+
+
+#include "enet/enet.h"
+#include "PacketManager.h"
+#include <iostream>
+
+using namespace std;
+using namespace network;
+
+PacketDecoder::PacketDecoder(){}
+
+//call this function out of an instance of PacketDecoder
+//it will determine the type id and call the right decode function
+bool PacketDecoder::elaborate( ENetPacket* packet, int clientId )
+{
+	int client = clientId;
+	cout << "clientId: " << client << endl;
+	int id = (int)*packet->data;
+	switch( id ) {
+	case ACK:
+		acknowledgement( packet );
+		return true;
+		break;
+	case MOUSE:
+		mousem( packet );
+		return true;
+		break;
+	case KEYBOARD:
+		keystrike( packet );
+		return true;
+		break;
+	case CHAT:
+		chatMessage( packet );
+		return true;
+		break;
+	}
+	return false;
+}
+
+//following are the decode functions for the data of the packets
+
+void PacketDecoder::acknowledgement( ENetPacket* packet )
+{
+	ack* a = new ack;
+	*a = *(ack*)packet->data;
+	printAck( a );
+}
+
+void PacketDecoder::mousem( ENetPacket* packet )
+{
+	mouse* mouseMove = new mouse;
+	*mouseMove = *(mouse*)packet->data;
+	printMouse( mouseMove );
+}
+
+void PacketDecoder::keystrike( ENetPacket* packet )
+{
+	keyboard* key = new keyboard;
+	*key = *(keyboard*)packet->data;
+	printKey( key );
+}
+
+void PacketDecoder::chatMessage( ENetPacket* packet )
+{
+	chat* chatting = new chat;
+	chatting->id = (int)*packet->data;
+	char* reserve = new char[packet->dataLength-4];
+	memcpy( &reserve[0], packet->data+sizeof(int), packet->dataLength-4 );
+	chatting->message = reserve;
+	printChat( chatting );
+}
+
+//these are some print functions for test stuff
+
+void PacketDecoder::printAck( ack* data )
+{
+	cout << "data id: " << data->id << endl;
+	cout << "data:    " << data->a << endl;
+}
+
+void PacketDecoder::printMouse( mouse* data )
+{
+	cout << "data id: " << data->id << endl;
+	cout << "data:    " << data->x << " " << data->y << endl;
+}
+
+void PacketDecoder::printKey( keyboard* data )
+{
+	cout << "data id: " << data->id << endl;
+	cout << "data:    " << (char)data->press << endl;
+}
+
+void PacketDecoder::printChat( chat* data )
+{
+	cout << "data id: " << data->id << endl;
+	cout << "blablabla" << endl;
+	cout << "data:    " << data->message << endl;
+}
Index: code/branches/merger/src/network/PacketGenerator.cc
===================================================================
--- code/branches/merger/src/network/PacketGenerator.cc	(revision 278)
+++ code/branches/merger/src/network/PacketGenerator.cc	(revision 278)
@@ -0,0 +1,69 @@
+/*
+ *Class generates packets that can be send by enet
+ * 
+ * Autor: Dumeni Manatschal
+ *  
+*/
+
+#include "PacketManager.h"
+#include "enet/enet.h"
+#include <iostream>
+#include <list>
+#include <string>
+#include <cstring>
+
+using namespace std;
+using namespace network;
+
+PacketGenerator::PacketGenerator() {}
+
+//following functions create a packet in form of bytestream
+
+ENetPacket* PacketGenerator::acknowledgement( int state, int reliable )
+{
+	cout << "generating new acknowledgement" << endl;
+	ack* ackreq = new ack;
+	ackreq->id = ACK;
+	ackreq->a = state;
+	
+	ENetPacket *packet = enet_packet_create( ackreq , sizeof( *ackreq ), reliable );
+	
+	return packet;
+}
+/*### mouseupdates */
+ENetPacket* PacketGenerator::mousem( double x, double y, int reliable )
+{
+	cout << "generating new mouse" << endl;
+	mouse* mousemove = new mouse;
+	mousemove->id = MOUSE;
+	mousemove->x = x;
+	mousemove->y = y;
+	
+	ENetPacket *packet = enet_packet_create( mousemove , sizeof( *mousemove ), reliable );
+	
+	return packet;
+}
+/*### keystrikes updates */
+ENetPacket* PacketGenerator::keystrike( char press, int reliable )
+{
+	cout << "generating new keyboard" << endl;
+	keyboard* key = new keyboard;
+	key->id = KEYBOARD;
+	key->press = press;
+	
+	ENetPacket *packet = enet_packet_create( key , sizeof( *key ), reliable );
+	
+	return packet;
+}
+/*### chat messages packet */
+ENetPacket* PacketGenerator::chatMessage( const char* message, int reliable )
+{
+	int* trans = new int[sizeof(int) + strlen(message) + 1];
+	*trans = CHAT;
+	//be carefull here, don't forget to allocate the space before using it ;-)
+	memcpy( &trans[1], (const void*)message, strlen( message ) + 1);
+	ENetPacket *packet = enet_packet_create( trans , sizeof( int ) + strlen( message ) + 1, reliable );
+	
+	return packet;
+}
+
Index: code/branches/merger/src/network/PacketManager.h
===================================================================
--- code/branches/merger/src/network/PacketManager.h	(revision 278)
+++ code/branches/merger/src/network/PacketManager.h	(revision 278)
@@ -0,0 +1,99 @@
+#ifndef PACKETMANAGER_H_
+#define PACKETMANAGER_H_
+
+#include <enet/enet.h>
+
+//enum netowk generaly used to set the type ID of a packet
+namespace network
+{
+enum packet_id {
+	ACK,
+	MOUSE,
+	KEYBOARD,
+	CHAT
+};
+
+/*
+ * class to generate packets
+ * 
+ * Autor: Dumeni Manatschal
+ * 
+*/ 
+class PacketGenerator
+{
+public:
+	PacketGenerator();
+	//call one of this functions out of an instance of PacketGenerator to create a packet
+	ENetPacket* acknowledgement( int state, int reliable = ENET_PACKET_FLAG_RELIABLE );
+	ENetPacket* mousem( double x, double y, int reliable = ENET_PACKET_FLAG_RELIABLE );
+	ENetPacket* keystrike( char press, int reliable = ENET_PACKET_FLAG_RELIABLE );
+	ENetPacket* chatMessage( const char* message, int reliable = ENET_PACKET_FLAG_RELIABLE );
+private:
+	//used to set the bytes in the right order
+	struct ack {
+		int id;
+		int a;
+	};
+
+	struct mouse {
+		int id;
+		double x;
+		double y;
+	};
+
+	struct keyboard {
+		int id;
+		char press;
+	};	
+};
+
+/*
+ * class used to decode incoming packets
+ * 
+ * Autor: Dumeni Manatschal
+ * 
+*/
+class PacketDecoder
+{
+public:
+	PacketDecoder();
+	//call this function to decode, it calls the right decoding function below
+	bool elaborate( ENetPacket* packet, int clientId );
+private:
+	struct ack {
+		int id;
+		int a;
+	};
+
+	struct mouse {
+		int id;
+		double x;
+		double y;
+	};
+
+	struct keyboard {
+		int id;
+		char press;
+	};
+	//only in this class, not PacketGenerator, used as pattern to put incoming
+	//bytes inside
+	struct chat {
+		int id;
+		const char* message;
+	};
+	
+	void acknowledgement( ENetPacket* packet );
+	void mousem( ENetPacket* packet );
+	void keystrike( ENetPacket* packet );
+	void chatMessage( ENetPacket* packet );
+	
+	//print functions
+	void printAck( ack* data );
+	void printMouse( mouse* data );
+	void printKey( keyboard* data );
+	void printChat( chat* data );
+	void printPeer( ENetPeer* peer );
+};
+}
+
+#endif /*PACKETMANAGER_H_*/
Index: code/branches/merger/src/network/Server.cc
===================================================================
--- code/branches/merger/src/network/Server.cc	(revision 278)
+++ code/branches/merger/src/network/Server.cc	(revision 278)
@@ -0,0 +1,53 @@
+//
+// C++ Implementation: Server
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+
+#include "network/Server.h"
+
+namespace network{
+  
+  /**
+   * Constructor for default values (bindaddress is set to ENET_HOST_ANY
+   * 
+   */
+  Server::Server(){
+    
+    
+  }
+  
+  /**
+   * Constructor
+   * @param port Port to listen on
+   * @param bindAddress Address to listen on
+   */
+  Server::Server(int port, std::string bindAddress) : connection(port, bindAddress){
+    
+    
+  }
+  
+  /**
+   * Constructor
+   * @param port Port to listen on
+   * @param bindAddress Address to listen on
+   */
+  Server::Server(int port, const char *bindAddress) : connection(port, bindAddress){
+    
+    
+    
+    
+  }
+  
+  
+  
+  
+  
+}
Index: code/branches/merger/src/network/Server.h
===================================================================
--- code/branches/merger/src/network/Server.h	(revision 278)
+++ code/branches/merger/src/network/Server.h	(revision 278)
@@ -0,0 +1,51 @@
+//
+// C++ Interface: Server
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#ifndef NETWORK_SERVER_H
+#define NETWORK_SERVER_H
+
+#include <string>
+
+#include "network/ConnectionManager.h"
+#include "network/PacketManager.h"
+
+
+namespace network{
+  
+  /**
+   * This class is the root class of the network module for a server.
+   * It implements all functions necessary for a Server
+   */
+  class Server : PacketDecoder{
+    public:
+    Server();
+    Server(int port, std::string bindAddress);
+    Server(int port, const char *bindAddress);
+    
+    private:
+    ConnectionManager connection;
+    
+    
+    
+    
+    
+    
+    
+  };
+  
+  
+  
+  
+  
+}
+
+#endif
Index: code/branches/merger/src/network/Synchronisable.cc
===================================================================
--- code/branches/merger/src/network/Synchronisable.cc	(revision 278)
+++ code/branches/merger/src/network/Synchronisable.cc	(revision 278)
@@ -0,0 +1,141 @@
+//
+// C++ Implementation: synchronisable
+//
+// Description: 
+//
+//
+// Author:  Dumeni, Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+
+#include "network/Synchronisable.h"
+
+namespace network {
+
+/**
+ * Constructor:
+ * calls registarAllVariables, that has to be implemented by the inheriting classID
+ */
+Synchronisable::Synchronisable()
+{
+  datasize=0;
+  registerAllVariables();
+}
+
+
+Synchronisable::~Synchronisable()
+{
+  
+}
+
+/**
+ * This function is used to register a variable to be synchronized
+ * also counts the total datasize needed to save the variables
+ * @param var pointer to the variable
+ * @param size size of the datatype the variable consists of
+ */
+void Synchronisable::registerVar(const void *var, int size){
+  // create temporary synch.Var struct
+  synchronisableVariable temp={size, var};
+  // increase datasize
+  datasize+=sizeof(int)+size;
+  // push temp to syncList (at the bottom)
+  syncList.push_back(temp);
+}
+
+/**
+ * note: only use this function for debug use, because it's inefficient (in order to produce a gamestate, you have to copy the whole data again to another memory location after this process)
+ * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct
+ * structure of the bitstream:
+ * (var1_size,var1,var2_size,var2,...)
+ * varx_size: size = sizeof(int)
+ * varx: size = varx_size
+ * @return data containing all variables and their sizes
+ */
+syncData Synchronisable::getData(){
+  std::list<synchronisableVariable>::iterator i;
+  int totalsize=0;
+  //figure out size of data to be allocated
+  for(i=syncList.begin(); i!=syncList.end(); i++){
+    // increase size (size of variable and size of size of variable ;)
+    totalsize+=sizeof(int)+i->size;
+  }
+  syncData retVal;
+  retVal.objectID=this->objectID;
+  retVal.classID=this->classID;
+  retVal.length=totalsize;
+  // allocate memory
+  retVal.data = (unsigned char *)malloc(totalsize);
+  // copy to location
+  //CHANGED: REMOVED DECLARATION int n=0 FROM LOOP
+  int n=0;
+  for(i=syncList.begin(); n<totalsize && i!=syncList.end(); i++){
+	//CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID*  
+    std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int));
+    n+=sizeof(int);
+    //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i
+    std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
+    n+=i->size;
+  }
+  return retVal;
+}
+/**
+ * This function takes all SynchronisableVariables out of the Synchronisable and saves it into a syncData struct
+ * Difference to the above function:
+ * takes a pointer to already allocated memory (must have at least getSize bytes length)
+ * structure of the bitstream:
+ * (var1_size,var1,var2_size,var2,...)
+ * varx_size: size = sizeof(int)
+ * varx: size = varx_size
+ * @return data containing all variables and their sizes
+ */
+syncData Synchronisable::getData(unsigned char *mem){
+  std::list<synchronisableVariable>::iterator i;
+  syncData retVal;
+  retVal.objectID=this->objectID;
+  retVal.classID=this->classID;
+  retVal.length=datasize;
+  retVal.data=mem;
+  // copy to location
+  //CHANGED: REMOVED DECLARATION int n=0 FROM LOOP
+  int n=0;
+  for(i=syncList.begin(); n<datasize && i!=syncList.end(); i++){
+        //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID*  
+    std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int));
+    n+=sizeof(int);
+    //CHANGED: i->var TO (const void*)(&(i->var)) SINCE var IS A POINTER, NO & BEFORE i
+    std::memcpy(retVal.data+n, (const void*)(i->var), i->size);
+    n+=i->size;
+  }
+  return retVal;
+}
+
+/**
+ * This function takes a syncData struct and takes it to update the variables
+ * @param vars data of the variables
+ * @return true/false
+ */
+bool Synchronisable::updateData(syncData vars){
+  unsigned char *data=vars.data;
+  std::list<synchronisableVariable>::iterator i;
+  for(i=syncList.begin(); i!=syncList.end(); i++){
+    if((int)*data==i->size){
+      data+=sizeof(int);
+      //CHANGED: THIS FROM i->var TO (void*)i->var SINCE var IS A CONST VOID* AND memcpy NEEDS A VOID* AS FIRST ARGUMENT
+      memcpy((void*)i->var, data, i->size);
+      data+=i->size;
+    } else
+      return false; //there was some problem with registerVar
+  }
+}
+
+/**
+ * This function returns the total amount of bytes needed by getData to save the whole content of the variables
+ * @return amount of bytes
+ */
+int Synchronisable::getSize(){
+  return datasize;
+}
+
+}
Index: code/branches/merger/src/network/Synchronisable.h
===================================================================
--- code/branches/merger/src/network/Synchronisable.h	(revision 278)
+++ code/branches/merger/src/network/Synchronisable.h	(revision 278)
@@ -0,0 +1,60 @@
+//
+// C++ Interface: synchronisable
+//
+// Description: 
+//
+//
+// Author:  Oliver Scheuss, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef NETWORK_SYNCHRONISABLE_H
+#define NETWORK_SYNCHRONISABLE_H
+
+#include <list>
+
+namespace network {
+
+  
+struct syncData{
+  int length;
+  int classID;
+  int objectID;
+  unsigned char *data;
+};
+
+typedef struct synchronisableVariable{
+  int size;
+  const void *var;
+}SYNCVAR;
+
+  
+/**
+ * This class is the base class of all the Objects in the universe that need to be synchronised over the network
+ * Every class, that inherits from this class has to link the DATA THAT NEEDS TO BE SYNCHRONISED into the linked list. Additionally it also has to provide a Constructor, that takes exactly the variables in this linked list.
+ * @author Oliver Scheuss
+*/
+class Synchronisable{
+public:
+  Synchronisable();
+
+  ~Synchronisable();
+  int objectID;
+  int classID;
+    
+  void registerVar(const void *var, int size);
+  syncData getData();
+  syncData getData(unsigned char *mem);
+  int getSize();
+  bool updateData(syncData vars);
+  virtual void registerAllVariables();
+
+private:
+  std::list<SYNCVAR> syncList;
+  int datasize;
+};
+
+}
+
+#endif
Index: code/branches/merger/src/network/dummyclient.cc
===================================================================
--- code/branches/merger/src/network/dummyclient.cc	(revision 278)
+++ code/branches/merger/src/network/dummyclient.cc	(revision 278)
@@ -0,0 +1,92 @@
+//
+// Dummy client to test ConnectionManager and PacketBuffer classes
+//
+// Author: Oliver Scheuss
+
+#include <iostream>
+#include <string>
+#include <enet/enet.h>
+#include "network/PacketManager.h"
+
+using namespace std;
+
+int main(){
+  ENetHost * client;
+  ENetAddress address;
+  ENetEvent event;
+  ENetPeer *peer;
+  network::PacketGenerator pck;
+
+  enet_initialize();
+  atexit(enet_deinitialize);
+  
+  cout << "Enter address of the server xxx.xxx.xxx.xxx (enter for localhost)" << endl;
+  string str;
+  getline(cin, str);
+  cout << "You entered: " << str << endl;
+  if(str.compare("")==0)
+    str="127.0.0.1";
+  
+  enet_address_set_host(&address, str.c_str());
+  address.port = 55556;
+
+        // create client object
+  client = enet_host_create(NULL, 2, 0, 0);
+
+  if(client==NULL){
+    fprintf(stderr, "An error occured");
+    exit(EXIT_FAILURE);
+  }
+        // connect peer
+  peer = enet_host_connect(client, &address, 2);
+  if(peer==NULL){
+    fprintf(stderr, "Peer establishing error");
+    exit(EXIT_FAILURE);
+  }
+        // wait 5 seconds for the connection attempt to succeed
+  if(enet_host_service(client, &event, 5000) > 0 && event.type == ENET_EVENT_TYPE_CONNECT){
+    cout << "Connection to " << str << " succeeded." << endl;
+    //puts("Connection to localhost:5555 succeeded.");
+  }else{
+    enet_peer_reset(peer);
+    cout << "Connection to " << str << " failed." << endl;
+    //puts("Connection to localhost:5555 failed.");
+    exit(EXIT_FAILURE);
+  }
+
+  for(int i=0; i<10; i++){
+        // weihnachtsmann bringt packete
+    //ENetPacket *packet = enet_packet_create ("packet1234", strlen("packet1234") + 1, ENET_PACKET_FLAG_RELIABLE);
+        // extend the packet and append the string foo to it
+        // send packet to peer on channel id 0
+    enet_peer_send(peer, 1, pck.chatMessage("test2"));
+        // keep the timeout very small for low delay
+    if(enet_host_service(client, &event, 1)==0){
+      cout << "successfully sent: " << event.type << endl;
+    }else{
+      cout << "failed sending" << endl;
+    }
+    usleep(1000000);
+  }
+
+        // now disconnect
+  enet_peer_disconnect (peer, 0);
+        // 3 seconds timeout
+  while(enet_host_service(client, &event, 3000) > 0){
+    switch (event.type)
+    {
+      case ENET_EVENT_TYPE_RECEIVE:
+        enet_packet_destroy(event.packet);
+        break;
+      case ENET_EVENT_TYPE_DISCONNECT:
+        puts("Disconnection succeeded.");
+        return 0;
+    }
+  }
+        // if disconnect failed
+  enet_peer_reset(peer);
+
+  
+  
+  return 0;
+}
Index: code/branches/merger/src/network/dummyclient2.cc
===================================================================
--- code/branches/merger/src/network/dummyclient2.cc	(revision 278)
+++ code/branches/merger/src/network/dummyclient2.cc	(revision 278)
@@ -0,0 +1,61 @@
+//
+// Dummy client to test ConnectionManager, PacketBuffer, ClientConnection and other classes
+//
+// Author: Oliver Scheuss
+
+#include <iostream>
+#include <string>
+#include <enet/enet.h>
+#include "network/PacketManager.h"
+#include "network/ClientConnection.h"
+
+using namespace network;
+
+int main(){
+  network::PacketGenerator pck;
+
+  std::cout << "Enter address of the server xxx.xxx.xxx.xxx (enter for localhost)" << std::endl;
+  std::string str;
+  std::getline(std::cin, str);
+  std::cout << "You entered: " << str << std::endl;
+  if(str.compare("")==0)
+    str="127.0.0.1";
+
+  ClientConnection client = ClientConnection(55556, str);
+
+  client.createConnection();
+  
+  if(client.waitEstablished(10000))
+    std::cout << "Connection established" << std::endl;
+  else
+    std::cout << "Connection failed" << std::endl;
+  
+  ENetPacket *packet;
+  ENetEvent event;
+  
+  
+  
+  for(int i=0; i<10; i++){
+        // weihnachtsmann bringt packete
+        // extend the packet and append the string foo to it
+        // send packet to peer on channel id 0
+    client.addPacket(pck.chatMessage("test"));
+        // keep the timeout very small for low delay
+    if(client.sendPackets(&event)){
+      std::cout << "successfully sent: " << event.type << std::endl;
+    }else{
+      std::cout << "failed sending" << std::endl;
+    }
+    //usleep(100000);
+  }
+
+        // now disconnect
+  if(client.closeConnection())
+    std::cout << "Connection successfully closed" << std::endl;
+  else
+    std::cout << "Connection closing failed" << std::endl;
+
+        // 3 seconds timeout
+  return 0;
+}
+
Index: code/branches/merger/src/network/dummyserver.cc
===================================================================
--- code/branches/merger/src/network/dummyserver.cc	(revision 278)
+++ code/branches/merger/src/network/dummyserver.cc	(revision 278)
@@ -0,0 +1,42 @@
+//
+// Dummy server to test ConnectionManager and PacketBuffer classes
+//
+// Author: Oliver Scheuss
+
+
+#include <iostream>
+#include "enet/enet.h"
+#include "network/ConnectionManager.h"
+#include "network/PacketManager.h"
+
+using namespace network;
+
+int main(){
+  ConnectionManager server = ConnectionManager();
+  bool quit=false;
+  ENetPacket *packet;
+  ENetEvent event;
+  server.createListener();
+  
+  PacketDecoder dec;
+  
+  while(!quit){
+    if(server.queueEmpty())
+      usleep(100);
+    else{
+      ENetAddress addr;
+      packet=server.getPacket(addr);
+      if(packet==NULL){
+        // there was some error
+        //std::cout << "null pointer" << std::endl;
+        quit=true;
+      }
+      else{
+        //std::cout << "We received: " << packet->data << std::endl;
+        dec.elaborate(packet, 1);
+      }
+    }
+  }
+  server.quitListener();
+  return 0;
+}
