CVSROOT: /sources/gnash Module name: gnash Changes by: Rob Savoye <rsavoye> 07/12/12 23:56:30
Modified files: . : configure.ac ChangeLog libbase : rc.h cygnal : cygnal.cpp Makefile.am cygnal/testsuite/cygnal.all: Makefile.am test_http.cpp Added files: cygnal/testsuite/cygnal.all: cygnalrc.in test_crc.cpp Log message: * configure.ac: Disable LIRC by default. Link cygnalrc test file to copy in source tree. * libbase/rc.h: Add new accessors so we can set private data from a derived class. Make constructor/destructor protected instead of private. * cygnal/crc.{cpp,h}: Cygnal specific init file derived from Gnash RcInitFile to avoid bloating out Gnash's init file handling for options it'll never use, but also let Cygnal share those values, or override them. * cygnal/Makefile.am: Add crc.cpp and crc.h. * cygnal/cygnal.cpp: Use new init file. Clean up port offset handling. * cygnal/testsuite/cygnal.all/cygnalrc.in: Test cygnal init file. * cygnal/testsuite/cygnal.all/test_crc.cpp: Test the Cygnal init file handling. * cygnal/testsuite/cygnal.all/Makefile.am: Add test_crc target. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.458&r2=1.459 http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5152&r2=1.5153 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/rc.h?cvsroot=gnash&r1=1.34&r2=1.35 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cygnal.cpp?cvsroot=gnash&r1=1.15&r2=1.16 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/Makefile.am?cvsroot=gnash&r1=1.9&r2=1.10 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/Makefile.am?cvsroot=gnash&r1=1.1&r2=1.2 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_http.cpp?cvsroot=gnash&r1=1.2&r2=1.3 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/cygnalrc.in?cvsroot=gnash&rev=1.1 http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/testsuite/cygnal.all/test_crc.cpp?cvsroot=gnash&rev=1.1 Patches: Index: configure.ac =================================================================== RCS file: /sources/gnash/gnash/configure.ac,v retrieving revision 1.458 retrieving revision 1.459 diff -u -b -r1.458 -r1.459 --- configure.ac 12 Dec 2007 18:19:27 -0000 1.458 +++ configure.ac 12 Dec 2007 23:56:28 -0000 1.459 @@ -15,7 +15,7 @@ dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA dnl -dnl $Id: configure.ac,v 1.458 2007/12/12 18:19:27 bwy Exp $ +dnl $Id: configure.ac,v 1.459 2007/12/12 23:56:28 rsavoye Exp $ AC_PREREQ(2.50) AC_INIT(gnash, cvs) @@ -542,12 +542,12 @@ [media_handler=ffmpeg] ) -AC_ARG_ENABLE(lirc, AC_HELP_STRING([--disable-lirc], [Disable support for Lirc]), +AC_ARG_ENABLE(lirc, AC_HELP_STRING([--enable-lirc], [Disable support for Lirc]), [case "${enableval}" in yes) lirc=yes ;; no) lirc=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for disble-lirc option]) ;; -esac], lirc=yes) + *) AC_MSG_ERROR([bad value ${enableval} for enable-lirc option]) ;; +esac], lirc=no) if test x"$lirc" = x"yes"; then AC_DEFINE([USE_LIRC], [], [LIRC daemon support]) @@ -1614,6 +1614,7 @@ AC_SUBST(MEDIA_CONFIG) dnl AC_CONFIG_LINKS(doc/C/images) +AC_CONFIG_LINKS(cygnal/testsuite/cygnal.all/cygnalrc:cygnal/testsuite/cygnal.all/cygnalrc.in) AC_CONFIG_LINKS(testsuite/libbase/gnashrc:testsuite/libbase/gnashrc.in) AC_CONFIG_LINKS(testsuite/libbase/gnashrc-local:testsuite/libbase/gnashrc-local.in) Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5152 retrieving revision 1.5153 diff -u -b -r1.5152 -r1.5153 --- ChangeLog 12 Dec 2007 23:49:27 -0000 1.5152 +++ ChangeLog 12 Dec 2007 23:56:28 -0000 1.5153 @@ -1,3 +1,22 @@ +2007-12-12 Rob Savoye <[EMAIL PROTECTED]> + + * configure.ac: Disable LIRC by default. Link cygnalrc test file + to copy in source tree. + * libbase/rc.h: Add new accessors so we can set private data from + a derived class. Make constructor/destructor protected instead of + private. + * cygnal/crc.{cpp,h}: Cygnal specific init file derived from Gnash + RcInitFile to avoid bloating out Gnash's init file handling for + options it'll never use, but also let Cygnal share those values, + or override them. + * cygnal/Makefile.am: Add crc.cpp and crc.h. + * cygnal/cygnal.cpp: Use new init file. Clean up port offset + handling. + * cygnal/testsuite/cygnal.all/cygnalrc.in: Test cygnal init file. + * cygnal/testsuite/cygnal.all/test_crc.cpp: Test the Cygnal init + file handling. + * cygnal/testsuite/cygnal.all/Makefile.am: Add test_crc target. + 2007-12-12 Sandro Santilli <[EMAIL PROTECTED]> * server/parser/button_character_def.{cpp,h}: cleanup parser by Index: libbase/rc.h =================================================================== RCS file: /sources/gnash/gnash/libbase/rc.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -b -r1.34 -r1.35 --- libbase/rc.h 12 Dec 2007 18:19:27 -0000 1.34 +++ libbase/rc.h 12 Dec 2007 23:56:29 -0000 1.35 @@ -15,8 +15,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// #ifndef __RC_H__ #define __RC_H__ @@ -78,7 +76,9 @@ int verbosityLevel() const { return _verbosity; } void verbosityLevel(int value) { _verbosity = value; } + void setDebugLog(std::string &x) { _log = x; } const std::string& getDebugLog() const { return _log; } + void setDocumentRoot(std::string &x) { _wwwroot = x; } std::string getDocumentRoot() { return _wwwroot; } bool useDebugger() const { return _debugger; } @@ -140,13 +140,6 @@ void dump(); private: - - /// Construct only by getDefaultInstance() - RcInitFile(); - - /// Never destroy (TODO: add a destroyDefaultInstance) - ~RcInitFile(); - int _delay; // the timer delay bool _debug; // enable debugging of this class bool _debugger; // enable the Flash movie debugger @@ -198,6 +191,14 @@ /// give the current movie access to. PathList _localSandboxPath; + protected: + + /// Construct only by getDefaultInstance() + RcInitFile(); + + /// Never destroy (TODO: add a destroyDefaultInstance) + ~RcInitFile(); + void expandPath(std::string& path); //path string operations static bool extractSetting(bool *var, const char *pattern, Index: cygnal/cygnal.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/cygnal.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -b -r1.15 -r1.16 --- cygnal/cygnal.cpp 11 Dec 2007 03:23:02 -0000 1.15 +++ cygnal/cygnal.cpp 12 Dec 2007 23:56:29 -0000 1.16 @@ -41,7 +41,7 @@ #include "network.h" #include "log.h" -#include "rc.h" +#include "crc.h" #include "rtmp.h" #include "http.h" #include "limits.h" @@ -82,10 +82,8 @@ static void stream_thread(struct thread_params *sendfile); static void dispatch_thread(struct thread_params *params); -namespace { -gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance(); -gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance(); -} +LogFile& dbglogfile = LogFile::getDefaultInstance(); +CRcInitFile& crcfile = CRcInitFile::getDefaultInstance(); struct thread_params { int netfd; @@ -142,33 +140,21 @@ } } - dbglogfile.setWriteDisk(false); - rcfile.loadFiles(); -// rcfile.dump(); - - if (rcfile.useWriteLog()) { - dbglogfile.setWriteDisk(true); - } + crcfile.loadFiles(); - if (rcfile.verbosityLevel() > 0) { - dbglogfile.setVerbosity(rcfile.verbosityLevel()); + if (crcfile.verbosityLevel() > 0) { + dbglogfile.setVerbosity(crcfile.verbosityLevel()); } - if (rcfile.getRetries() > 0) { - thread_retries = rcfile.getRetries(); - } else { - thread_retries = 3; - } - - if (rcfile.getDocumentRoot().size() > 0) { - docroot = rcfile.getDocumentRoot().c_str(); + if (crcfile.getDocumentRoot().size() > 0) { + docroot = crcfile.getDocumentRoot().c_str(); log_msg (_("Document Root for media files is: %s"), docroot); } else { docroot = "/var/www/html/software/gnash/tests/"; } - while ((c = getopt (argc, argv, "hvwp:")) != -1) { + while ((c = getopt (argc, argv, "hvp:d")) != -1) { switch (c) { case 'h': usage (argv[0]); @@ -177,12 +163,13 @@ dbglogfile.setVerbosity(); log_msg (_("Verbose output turned on")); break; - case 'w': - dbglogfile.setWriteDisk(true); - log_msg (_("Logging to disk enabled")); - break; case 'p': port_offset = strtol(optarg, NULL, 0); + crcfile.setPortOffset(port_offset); + break; + case 'd': + crcfile.dump(); + exit(0); break; } } @@ -193,12 +180,6 @@ log_error (_("Extraneous argument: %s"), argv[optind]); } - // Remove the logfile that's created by default, since leaving a short - // file is confusing. - if (dbglogfile.getWriteDisk() == false) { - dbglogfile.removeLog(); - } - // Trap ^C (SIGINT) so we can kill all the threads act.sa_handler = cntrlc_handler; sigaction (SIGINT, &act, NULL); @@ -206,15 +187,15 @@ struct thread_params rtmp_data; struct thread_params http_data; struct thread_params ssl_data; - rtmp_data.port = 1935; + rtmp_data.port = port_offset + RTMP; // boost::thread rtmp_port(boost::bind(&rtmp_thread, &rtmp_data)); - http_data.port = 4080; + http_data.port = port_offset + RTMPT; Statistics st; http_data.statistics = &st; boost::thread http_port(boost::bind(&http_thread, &http_data)); - ssl_data.port = 4443; + ssl_data.port = port_offset + RTMPTS; // boost::thread ssl_port(boost::bind(&ssl_thread, &ssl_data)); // boost::thread rtmp_port(&rtmp_thread); @@ -232,13 +213,6 @@ } static void -dispatch_thread(struct thread_params *params) -{ - GNASH_REPORT_FUNCTION; - log_msg("Param port is: %d", params->port); -} - -static void http_thread(struct thread_params *conndata) { GNASH_REPORT_FUNCTION; @@ -416,6 +390,8 @@ )); } +//} // end of cygnal namespace + // local Variables: // mode: C++ // indent-tabs-mode: t Index: cygnal/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/cygnal/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -b -r1.9 -r1.10 --- cygnal/Makefile.am 11 Dec 2007 03:23:02 -0000 1.9 +++ cygnal/Makefile.am 12 Dec 2007 23:56:29 -0000 1.10 @@ -62,7 +62,8 @@ alloc.cpp \ netstats.cpp \ stream.cpp \ - statistics.cpp + statistics.cpp \ + crc.cpp # transcode.cpp # flash.cpp @@ -70,7 +71,8 @@ http.h \ netstats.h \ stream.h \ - statistics.h + statistics.h \ + crc.h # transcode.h # flash.h Index: cygnal/testsuite/cygnal.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/cygnal/testsuite/cygnal.all/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- cygnal/testsuite/cygnal.all/Makefile.am 11 Dec 2007 03:23:03 -0000 1.1 +++ cygnal/testsuite/cygnal.all/Makefile.am 12 Dec 2007 23:56:29 -0000 1.2 @@ -39,10 +39,17 @@ $(BOOST_CFLAGS) \ $(PTHREAD_CFLAGS) -check_PROGRAMS = test_http +check_PROGRAMS = test_http test_crc + test_http_SOURCES = test_http.cpp ../../http.o test_http_LDADD = $(AM_LDFLAGS) ../../http.o test_http_DEPENDENCIES = site-update + +test_crc_SOURCES = test_crc.cpp ../../crc.o +test_crc_LDADD = $(AM_LDFLAGS) ../../crc.o +test_crc_DEPENDENCIES = site-update + + # Rebuild with GCC 4.x Mudflap support mudflap: @echo "Rebuilding with GCC Mudflap support" Index: cygnal/testsuite/cygnal.all/test_http.cpp =================================================================== RCS file: /sources/gnash/gnash/cygnal/testsuite/cygnal.all/test_http.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- cygnal/testsuite/cygnal.all/test_http.cpp 11 Dec 2007 04:13:46 -0000 1.2 +++ cygnal/testsuite/cygnal.all/test_http.cpp 12 Dec 2007 23:56:30 -0000 1.3 @@ -35,6 +35,7 @@ #include <sys/types.h> #include <iostream> #include <string> +#include <vector> #include <regex.h> #include "log.h" @@ -266,25 +267,26 @@ // // Decoding tests for HTTP // - const char *buffer = "GET /software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv HTTP/1.1" -"User-Agent: Gnash/0.8.1-cvs (X11; Linux i686; U; en)"; -"Host: localhost:4080" -"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1" -"Accept-Language: en-US,en;q=0.9" -"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1" -"Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0" -"If-Modified-Since: Mon, 10 Dec 2007 02:26:31 GMT" -"If-None-Match: \"4cc434-e266-52ff63c0\"" -"Connection: Keep-Alive, TE" -"Referer: http://localhost/software/gnash/tests/index.html" -"TE: deflate, gzip, chunked, identity, trailers" - ; + const char *buffer = "GET /software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv HTTP/1.1\r\n" +"User-Agent: Gnash/0.8.1-cvs (X11; Linux i686; U; en)\r\n" +"Host: localhost:4080\r\n" +"Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n" +"Accept-Language: en-US,en;q=0.9\r\n" +"Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n" +"Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n" +"If-Modified-Since: Mon, 10 Dec 2007 02:26:31 GMT\r\n" +"If-None-Match: \"4cc434-e266-52ff63c0\"\r\n" +"Connection: Keep-Alive, TE\r\n" +"Referer: http://localhost/software/gnash/tests/index.html\r\n" +"TE: deflate, gzip, chunked, identity, trailers\r\n" +"\r\n"; + // Some browsers have a different synatax, of course, to keep things // interesting. - const char *buffer2 = "GET /software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv HTTP/1.1" -"Content-Language: en-US,en;q=0.9" -"Content-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1" -"Content-Encoding: deflate, gzip, x-gzip, identity, *;q=0"; + const char *buffer2 = "GET /software/gnash/tests/flvplayer.swf?file=http://localhost/software/gnash/tests/Ouray_Ice_Festival_Climbing_Competition.flv HTTP/1.1\r\n" +"Content-Language: en-US,en;q=0.9\r\n" +"Content-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1\r\n" +"Content-Encoding: deflate, gzip, x-gzip, identity, *;q=0\r\n"; // http.extractMethod(buffer); string result; result = http.extractReferer(buffer); @@ -334,16 +336,19 @@ } result = http.extractConnection(buffer); - if (result == "Keep-Alive, TE") { - runtest.fail ("Date::extractConnection()"); - } else { + std::vector<std::string> connections = http.getConnection(); + if ((result == "Keep-Alive, TE") && + (connections[0] == "Keep-Alive") && + (connections[1] == "TE")) { runtest.pass ("Date::extractConnection()"); + } else { + runtest.fail ("Date::extractConnection()"); } result = http.extractEncoding(buffer); if (result == "deflate, gzip, x-gzip, identity, *;q=0") { runtest.fail ("Date::extractEncoding(Accept-)"); - } else { + } else{ runtest.pass ("Date::extractEncoding(Accept-)"); } result = http.extractEncoding(buffer2); @@ -354,13 +359,17 @@ } result = http.extractTE(buffer); - if (result == "deflate, gzip, chunked, identity, trailers") { - runtest.fail ("Date::extractTE()"); - } else { + std::vector<std::string> te = http.getTE(); + if ((te[0] == "deflate") && + (te[1] == "gzip") && + (te[2] == "chunked") && + (te[3] == "identity") && + (te[4] == "trailers")) { runtest.pass ("Date::extractTE()"); + } else { + runtest.fail ("Date::extractTE()"); } - // http.formatHeader(666, RTMP); // http.formatRequest("http://localhost:4080", HTTP::GET); Index: cygnal/testsuite/cygnal.all/cygnalrc.in =================================================================== RCS file: cygnal/testsuite/cygnal.all/cygnalrc.in diff -N cygnal/testsuite/cygnal.all/cygnalrc.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ cygnal/testsuite/cygnal.all/cygnalrc.in 12 Dec 2007 23:56:29 -0000 1.1 @@ -0,0 +1,14 @@ +# The default verbosity level +set verbosity 11 + +# Print debug info about the ActionScript classes as they are processed +set actionDump off + +# Print debug info about how Gnash is parsing the file +set parserDump off + +# The full path to the debug log +set debuglog /tmp/cygnal-dbg.log + +# The Port offset to use when we're not root +set portOffset 4000 Index: cygnal/testsuite/cygnal.all/test_crc.cpp =================================================================== RCS file: cygnal/testsuite/cygnal.all/test_crc.cpp diff -N cygnal/testsuite/cygnal.all/test_crc.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ cygnal/testsuite/cygnal.all/test_crc.cpp 12 Dec 2007 23:56:30 -0000 1.1 @@ -0,0 +1,101 @@ +// +// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +// + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDARG_H +#include <cstdarg> +#endif + +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <regex.h> +#include <cstdio> +#include <cerrno> +#include <iostream> +#include <fstream> +#include <string> + +#ifdef HAVE_DEJAGNU_H +#include "dejagnu.h" +#else +#include "check.h" +#endif + +#include "log.h" +#include "crc.h" + +using namespace std; +using namespace gnash; +using namespace cygnal; + +TestState runtest; + +int +main (int /*argc*/, char** /*argv*/) { + CRcInitFile& crc = CRcInitFile::getDefaultInstance(); + + gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance(); + dbglogfile.setVerbosity(); + + // Parse the test config file + if (crc.parseFile("cygnalrc")) { + runtest.pass ("crc.parseFile()"); + } else { + runtest.fail ("crc.parseFile()"); + } + + if (crc.useActionDump()) { + runtest.fail ("useActionDump"); + } else { + runtest.pass ("useActionDump"); + } + + if (crc.useParserDump()) { + runtest.fail ("useParserDump"); + } else { + runtest.pass ("useParserDump"); + } + + if (crc.verbosityLevel() == 11) { + runtest.pass ("verbosityLevel"); + } else { + runtest.fail ("verbosityLevel"); + } + + if (crc.getDebugLog() == "/tmp/cygnal-dbg.log") { + runtest.pass ("getDebugLog"); + } else { + runtest.fail ("getDebugLog"); + } + + if (crc.getPortOffset() == 4000) { + runtest.pass ("getPortOffset"); + } else { + runtest.fail ("getPortOffset"); + } + + crc.dump(); +} + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit