diff options
-rw-r--r-- | Makefile.in | 2 | ||||
-rwxr-xr-x | configure | 137 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | src/Makefile.in | 2 | ||||
-rw-r--r-- | src/Net/Connection.cpp | 4 | ||||
-rw-r--r-- | src/Net/Connection.h | 5 | ||||
-rw-r--r-- | src/Net/Makefile.in | 2 | ||||
-rw-r--r-- | src/mad-core.cpp | 9 |
8 files changed, 135 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in index f0f0577..47cb6bc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -177,6 +177,8 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +sigc_CFLAGS = @sigc_CFLAGS@ +sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @@ -879,6 +879,8 @@ LIBTOOL PKG_CONFIG GnuTLS_CFLAGS GnuTLS_LIBS +sigc_CFLAGS +sigc_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -899,7 +901,9 @@ F77 FFLAGS PKG_CONFIG GnuTLS_CFLAGS -GnuTLS_LIBS' +GnuTLS_LIBS +sigc_CFLAGS +sigc_LIBS' # Initialize some variables set by options. @@ -1515,6 +1519,8 @@ Some influential environment variables: GnuTLS_CFLAGS C compiler flags for GnuTLS, overriding pkg-config GnuTLS_LIBS linker flags for GnuTLS, overriding pkg-config + sigc_CFLAGS C compiler flags for sigc, overriding pkg-config + sigc_LIBS linker flags for sigc, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4954,7 +4960,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4957 "configure"' > conftest.$ac_ext + echo '#line 4963 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7539,11 +7545,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7542: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7548: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7546: \$? = $ac_status" >&5 + echo "$as_me:7552: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7829,11 +7835,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7838: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7836: \$? = $ac_status" >&5 + echo "$as_me:7842: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7933,11 +7939,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7936: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7942: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7940: \$? = $ac_status" >&5 + echo "$as_me:7946: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10310,7 +10316,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10313 "configure" +#line 10319 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10410,7 +10416,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10413 "configure" +#line 10419 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12811,11 +12817,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12814: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12820: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12818: \$? = $ac_status" >&5 + echo "$as_me:12824: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12915,11 +12921,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12918: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12924: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12922: \$? = $ac_status" >&5 + echo "$as_me:12928: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14513,11 +14519,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14516: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14522: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14520: \$? = $ac_status" >&5 + echo "$as_me:14526: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14617,11 +14623,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14620: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14626: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14624: \$? = $ac_status" >&5 + echo "$as_me:14630: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16837,11 +16843,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16840: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16846: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16844: \$? = $ac_status" >&5 + echo "$as_me:16850: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17127,11 +17133,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17130: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17136: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17134: \$? = $ac_status" >&5 + echo "$as_me:17140: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17231,11 +17237,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17234: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17240: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17238: \$? = $ac_status" >&5 + echo "$as_me:17244: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20119,8 +20125,83 @@ echo "${ECHO_T}yes" >&6; } : fi -CPPFLAGS="$GnuTLS_CFLAGS $CPPFLAGS" -LIBS="$GnuTLS_LIBS $LIBS" +pkg_failed=no +{ echo "$as_me:$LINENO: checking for sigc" >&5 +echo $ECHO_N "checking for sigc... $ECHO_C" >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$sigc_CFLAGS"; then + pkg_cv_sigc_CFLAGS="$sigc_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sigc++-2.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "sigc++-2.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_sigc_CFLAGS=`$PKG_CONFIG --cflags "sigc++-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$sigc_LIBS"; then + pkg_cv_sigc_LIBS="$sigc_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sigc++-2.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "sigc++-2.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_sigc_LIBS=`$PKG_CONFIG --libs "sigc++-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + sigc_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sigc++-2.0"` + else + sigc_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sigc++-2.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$sigc_PKG_ERRORS" >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { { echo "$as_me:$LINENO: error: Test for SigC++ 2.0 failed." >&5 +echo "$as_me: error: Test for SigC++ 2.0 failed." >&2;} + { (exit 1); exit 1; }; } +elif test $pkg_failed = untried; then + { { echo "$as_me:$LINENO: error: Test for SigC++ 2.0 failed." >&5 +echo "$as_me: error: Test for SigC++ 2.0 failed." >&2;} + { (exit 1); exit 1; }; } +else + sigc_CFLAGS=$pkg_cv_sigc_CFLAGS + sigc_LIBS=$pkg_cv_sigc_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + : +fi + +CPPFLAGS="$GnuTLS_CFLAGS $sigc_CFLAGS $CPPFLAGS" +LIBS="$GnuTLS_LIBS $sigc_LIBS $LIBS" # Checks for header files. @@ -21378,11 +21459,13 @@ LIBTOOL!$LIBTOOL$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim GnuTLS_CFLAGS!$GnuTLS_CFLAGS$ac_delim GnuTLS_LIBS!$GnuTLS_LIBS$ac_delim +sigc_CFLAGS!$sigc_CFLAGS$ac_delim +sigc_LIBS!$sigc_LIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 15; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 17; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 7ced8ea..bcd30f2 100644 --- a/configure.ac +++ b/configure.ac @@ -17,9 +17,10 @@ AC_PROG_LIBTOOL # Checks for libraries. PKG_CHECK_MODULES(GnuTLS, gnutls, , AC_MSG_ERROR(Test for GnuTLS failed.)) +PKG_CHECK_MODULES(sigc, sigc++-2.0, , AC_MSG_ERROR(Test for SigC++ 2.0 failed.)) -CPPFLAGS="$GnuTLS_CFLAGS $CPPFLAGS" -LIBS="$GnuTLS_LIBS $LIBS" +CPPFLAGS="$GnuTLS_CFLAGS $sigc_CFLAGS $CPPFLAGS" +LIBS="$GnuTLS_LIBS $sigc_LIBS $LIBS" # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h sys/socket.h]) diff --git a/src/Makefile.in b/src/Makefile.in index 738f494..362222e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -189,6 +189,8 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +sigc_CFLAGS = @sigc_CFLAGS@ +sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ diff --git a/src/Net/Connection.cpp b/src/Net/Connection.cpp index 49b51b4..298eb3e 100644 --- a/src/Net/Connection.cpp +++ b/src/Net/Connection.cpp @@ -74,7 +74,7 @@ bool Connection::recieve() { continue; if(!header.length) { - Packet packet(header.type, header.requestId); + signal(this, Packet(header.type, header.requestId)); return true; } @@ -96,7 +96,7 @@ bool Connection::recieve() { if(read < header.length+sizeof(Packet::Data)) continue; - Packet packet(header.type, header.requestId, data, header.length); + signal(this, Packet(header.type, header.requestId, data, header.length)); delete [] data; data = 0; diff --git a/src/Net/Connection.h b/src/Net/Connection.h index 80b721f..f48ef20 100644 --- a/src/Net/Connection.h +++ b/src/Net/Connection.h @@ -21,6 +21,7 @@ #define MAD_NET_CONNECTION_H_ #include <gnutls/gnutls.h> +#include <sigc++/signal.h> #include "Packet.h" namespace Mad { @@ -36,6 +37,8 @@ class Connection { unsigned long read; + sigc::signal<void,const Connection*,const Packet&> signal; + protected: virtual gnutls_session_t& getSession() = 0; @@ -51,6 +54,8 @@ class Connection { bool send(const Packet &packet); bool recieve(); + sigc::signal<void,const Connection*,const Packet&> signalRecieve() const {return signal;} + static void init() { gnutls_global_init(); } diff --git a/src/Net/Makefile.in b/src/Net/Makefile.in index 4e7923a..83b718d 100644 --- a/src/Net/Makefile.in +++ b/src/Net/Makefile.in @@ -173,6 +173,8 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +sigc_CFLAGS = @sigc_CFLAGS@ +sigc_LIBS = @sigc_LIBS@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ diff --git a/src/mad-core.cpp b/src/mad-core.cpp index 0c1630b..219621f 100644 --- a/src/mad-core.cpp +++ b/src/mad-core.cpp @@ -21,11 +21,20 @@ #include "Net/IPAddress.h" #include <iostream> +void recieveHandler(const Mad::Net::Connection*, const Mad::Net::Packet &packet) { + std::cout << "Recieved packet:" << std::endl; + std::cout << " Type: " << packet.getType() << std::endl; + std::cout << " Request ID: " << packet.getRequestId() << std::endl; + std::cout << " Length: " << packet.getLength() << std::endl; +} + int main() { Mad::Net::Connection::init(); Mad::Net::ServerConnection connection; + connection.signalRecieve().connect(sigc::ptr_fun(recieveHandler)); + connection.loadDHParams("dh.pem"); connection.listen(Mad::Net::IPAddress("0.0.0.0", 6666)); |