You can subscribe to this list here.
2012 |
Jan
|
Feb
|
Mar
|
Apr
(24) |
May
(35) |
Jun
(5) |
Jul
(8) |
Aug
|
Sep
|
Oct
(7) |
Nov
(3) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(7) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
(3) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rog...@us...> - 2012-04-14 15:13:04
|
Revision: 270 http://responsibility.svn.sourceforge.net/responsibility/?rev=270&view=rev Author: roggan87 Date: 2012-04-14 15:12:58 +0000 (Sat, 14 Apr 2012) Log Message: ----------- Wrapped up all classes in a namespace, NetResponsibility. This ensures they're not mixed up with classes from other libs. Modified Paths: -------------- trunk/include/Report.h trunk/src/ReportSubsystem.cpp Modified: trunk/include/Report.h =================================================================== --- trunk/include/Report.h 2012-04-14 14:17:09 UTC (rev 269) +++ trunk/include/Report.h 2012-04-14 15:12:58 UTC (rev 270) @@ -96,13 +96,12 @@ string makeTableBranch(string, string, string anchorName = ""); string makeJavascriptBranch(string, string); }; + +} // namespace NetResponsibility - -POCO_BEGIN_MANIFEST(ReportBase) -POCO_EXPORT_CLASS(Report) +POCO_BEGIN_MANIFEST(NetResponsibility::ReportBase) +POCO_EXPORT_CLASS(NetResponsibility::Report) POCO_END_MANIFEST - -} // namespace NetResponsibility #endif // REPORT_H Modified: trunk/src/ReportSubsystem.cpp =================================================================== --- trunk/src/ReportSubsystem.cpp 2012-04-14 14:17:09 UTC (rev 269) +++ trunk/src/ReportSubsystem.cpp 2012-04-14 15:12:58 UTC (rev 270) @@ -45,7 +45,7 @@ string lib = MainApplication::getOptions().getReportModule(); try { loader.loadLibrary(lib); - ReportBase* report = loader.create("Report"); + ReportBase* report = loader.create("NetResponsibility::Report"); if (type == REPORT_TEST) { _logger->notice("Sending test report"); report->test(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-14 14:17:17
|
Revision: 269 http://responsibility.svn.sourceforge.net/responsibility/?rev=269&view=rev Author: roggan87 Date: 2012-04-14 14:17:09 +0000 (Sat, 14 Apr 2012) Log Message: ----------- Wrapped up all classes in a namespace, NetResponsibility. This ensures they're not mixed up with classes from other libs. Modified Paths: -------------- trunk/include/Blacklist.h trunk/include/BootHistory.h trunk/include/Bypasses.h trunk/include/ConfigSubsystem.h trunk/include/Database.h trunk/include/Filter.h trunk/include/History.h trunk/include/MainApplication.h trunk/include/MyXml.h trunk/include/Options.h trunk/include/Report.h trunk/include/ReportBase.h trunk/include/ReportSubsystem.h trunk/include/Request.h trunk/include/Sniffer.h trunk/include/SnifferSubsystem.h trunk/include/SnifferThread.h trunk/include/Warnings.h trunk/src/BootHistory.cpp trunk/src/Bypasses.cpp trunk/src/ConfigSubsystem.cpp trunk/src/Database.cpp trunk/src/Filter.cpp trunk/src/History.cpp trunk/src/MainApplication.cpp trunk/src/MyXml.cpp trunk/src/Options.cpp trunk/src/Plugin.cpp trunk/src/Report.cpp trunk/src/ReportBase.cpp trunk/src/ReportSubsystem.cpp trunk/src/Request.cpp trunk/src/Sniffer.cpp trunk/src/SnifferSubsystem.cpp trunk/src/SnifferThread.cpp trunk/src/Warnings.cpp trunk/src/main.cpp Modified: trunk/include/Blacklist.h =================================================================== --- trunk/include/Blacklist.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Blacklist.h 2012-04-14 14:17:09 UTC (rev 269) @@ -33,13 +33,15 @@ #include "Poco/Data/Common.h" #include "Poco/Data/Connector.h" #include "Poco/Data/SQLite/Connector.h" + +namespace NetResponsibility { + +using ::Poco::Timestamp; +using ::Poco::SharedPtr; +using ::Poco::RegularExpression; +using namespace ::Poco::Data; +using namespace ::std; -using Poco::Timestamp; -using namespace Poco::Data; -using Poco::SharedPtr; -using Poco::RegularExpression; -using namespace std; - struct BlacklistKeyword /// This is a small struct to hold each keyword, as a string, compiled as /// separate regular expressions and the adherent strength. @@ -124,12 +126,14 @@ typedef vector<Extension> Extensions; +} // namespace NetResponsibility + namespace Poco { -namespace Data { +namespace Data { template <> -class TypeHandler<class BlacklistMatch> +class TypeHandler<class ::NetResponsibility::BlacklistMatch> { public: static size_t size() @@ -137,34 +141,34 @@ return 4; // we handle four columns of the Table! } - static void bind(size_t pos, const BlacklistMatch& obj, + static void bind(size_t pos, const ::NetResponsibility::BlacklistMatch& obj, AbstractBinder* pBinder) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::bind(pos++, obj.boldUrl, pBinder); - TypeHandler<string>::bind(pos++, obj.abbrUrl, pBinder); + TypeHandler<std::string>::bind(pos++, obj.boldUrl, pBinder); + TypeHandler<std::string>::bind(pos++, obj.abbrUrl, pBinder); TypeHandler<int>::bind(pos++, obj.strength, pBinder); TypeHandler<int>::bind(pos++, (int)obj.whitelist, pBinder); } - static void prepare(size_t pos, const BlacklistMatch& obj, + static void prepare(size_t pos, const ::NetResponsibility::BlacklistMatch& obj, AbstractPreparation* pPrepare) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::prepare(pos++, obj.boldUrl, pPrepare); - TypeHandler<string>::prepare(pos++, obj.abbrUrl, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.boldUrl, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.abbrUrl, pPrepare); TypeHandler<int>::prepare(pos++, obj.strength, pPrepare); TypeHandler<int>::prepare(pos++, (int)obj.whitelist, pPrepare); } - static void extract(size_t pos, BlacklistMatch& obj, - const BlacklistMatch& defVal, AbstractExtractor* pExt) + static void extract(size_t pos, ::NetResponsibility::BlacklistMatch& obj, + const ::NetResponsibility::BlacklistMatch& defVal, AbstractExtractor* pExt) /// obj will contain the result, defVal contains values we should use when one column is NULL { poco_assert_dbg (pExt != 0); int w; - TypeHandler<string>::extract(pos++, obj.boldUrl, defVal.boldUrl, pExt); - TypeHandler<string>::extract(pos++, obj.abbrUrl, defVal.abbrUrl, pExt); + TypeHandler<std::string>::extract(pos++, obj.boldUrl, defVal.boldUrl, pExt); + TypeHandler<std::string>::extract(pos++, obj.abbrUrl, defVal.abbrUrl, pExt); TypeHandler<int>::extract(pos++, obj.strength, defVal.strength, pExt); TypeHandler<int>::extract(pos++, w, defVal.whitelist, pExt); obj.whitelist = (w != 0); @@ -173,7 +177,7 @@ template <> -class TypeHandler<class BlacklistKeyword> +class TypeHandler<class ::NetResponsibility::BlacklistKeyword> { public: static size_t size() @@ -181,31 +185,31 @@ return 3; // we handle four columns of the Table! } - static void bind(size_t pos, const BlacklistKeyword& obj, + static void bind(size_t pos, const ::NetResponsibility::BlacklistKeyword& obj, AbstractBinder* pBinder) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::bind(pos++, obj.asString, pBinder); - TypeHandler<string>::bind(pos++, obj.category, pBinder); + TypeHandler<std::string>::bind(pos++, obj.asString, pBinder); + TypeHandler<std::string>::bind(pos++, obj.category, pBinder); TypeHandler<int>::bind(pos++, obj.strength, pBinder); } - static void prepare(size_t pos, const BlacklistKeyword& obj, + static void prepare(size_t pos, const ::NetResponsibility::BlacklistKeyword& obj, AbstractPreparation* pPrepare) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::prepare(pos++, obj.asString, pPrepare); - TypeHandler<string>::prepare(pos++, obj.category, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.asString, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.category, pPrepare); TypeHandler<int>::prepare(pos++, obj.strength, pPrepare); } - static void extract(size_t pos, BlacklistKeyword& obj, - const BlacklistKeyword& defVal, AbstractExtractor* pExt) + static void extract(size_t pos, ::NetResponsibility::BlacklistKeyword& obj, + const ::NetResponsibility::BlacklistKeyword& defVal, AbstractExtractor* pExt) /// obj will contain the result, defVal contains values we should use when one column is NULL { poco_assert_dbg (pExt != 0); - TypeHandler<string>::extract(pos++, obj.asString, defVal.asString, pExt); - TypeHandler<string>::extract(pos++, obj.category, defVal.category, pExt); + TypeHandler<std::string>::extract(pos++, obj.asString, defVal.asString, pExt); + TypeHandler<std::string>::extract(pos++, obj.category, defVal.category, pExt); TypeHandler<int>::extract(pos++, obj.strength, defVal.strength, pExt); } }; Modified: trunk/include/BootHistory.h =================================================================== --- trunk/include/BootHistory.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/BootHistory.h 2012-04-14 14:17:09 UTC (rev 269) @@ -40,16 +40,10 @@ #include <string.h> #include <signal.h> -using namespace std; - #include "Poco/Timestamp.h" #include "Poco/Logger.h" #include "Poco/Util/Application.h" -using Poco::Timestamp; -using Poco::Logger; -using Poco::Util::Application; - #define OLD_LINESIZE 12 #define OLD_NAMESIZE 8 #define OLD_HOSTSIZE 16 @@ -72,6 +66,13 @@ #define R_PHANTOM 6 /* No logout record but session is stale. */ #define R_TIMECHANGE 7 /* NEW_TIME or OLD_TIME */ +namespace NetResponsibility { + +using ::Poco::Timestamp; +using ::Poco::Logger; +using ::Poco::Util::Application; +using namespace ::std; + struct utmplist { /// Double linked list of struct utmp's struct utmp ut; @@ -153,4 +154,7 @@ /// of logged. }; #endif // UNIX + + +} // namespace NetResponsibility #endif // BOOTHISTORY_H Modified: trunk/include/Bypasses.h =================================================================== --- trunk/include/Bypasses.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Bypasses.h 2012-04-14 14:17:09 UTC (rev 269) @@ -24,7 +24,7 @@ #ifndef BYPASSES_H #define BYPASSES_H -#include "Poco/Timestamp.h" +#include "Poco/Timestamp.h" #include "Poco/Data/Common.h" #include "Poco/Data/Connector.h" #include "Poco/Data/SQLite/Connector.h" @@ -32,12 +32,14 @@ #include <iostream> #include <vector> - -using Poco::Timestamp; -using Poco::DateTimeFormatter; -using namespace Poco::Data; -using namespace std; +namespace NetResponsibility { + +using ::Poco::Timestamp; +using ::Poco::DateTimeFormatter; +using namespace ::Poco::Data; +using namespace ::std; + class Database; enum BypassType @@ -122,14 +124,15 @@ int _index; /// The current index. }; + +} // namespace NetResponsibility - namespace Poco { namespace Data { template <> -class TypeHandler<class BypassRow> +class TypeHandler<class ::NetResponsibility::BypassRow> { public: static size_t size() @@ -137,27 +140,27 @@ return 4; // we handle four columns of the Table! } - static void bind(size_t pos, const BypassRow& obj, AbstractBinder* pBinder) + static void bind(size_t pos, const ::NetResponsibility::BypassRow& obj, AbstractBinder* pBinder) { poco_assert_dbg (pBinder != 0); TypeHandler<int>::bind(pos++, obj.type, pBinder); TypeHandler<Poco::Int64>::bind(pos++, obj.date.epochTime(), pBinder); TypeHandler<Poco::Int64>::bind(pos++, obj.time.epochTime(), pBinder); - TypeHandler<string>::bind(pos++, obj.details, pBinder); + TypeHandler<std::string>::bind(pos++, obj.details, pBinder); } - static void prepare(size_t pos, const BypassRow& obj, + static void prepare(size_t pos, const ::NetResponsibility::BypassRow& obj, AbstractPreparation* pPrepare) { poco_assert_dbg (pBinder != 0); TypeHandler<int>::prepare(pos++, obj.type, pPrepare); TypeHandler<Poco::Int64>::prepare(pos++, obj.date.epochTime(), pPrepare); TypeHandler<Poco::Int64>::prepare(pos++, obj.time.epochTime(), pPrepare); - TypeHandler<string>::prepare(pos++, obj.details, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.details, pPrepare); } - static void extract(size_t pos, BypassRow& obj, - const BypassRow& defVal, AbstractExtractor* pExt) + static void extract(size_t pos, ::NetResponsibility::BypassRow& obj, + const ::NetResponsibility::BypassRow& defVal, AbstractExtractor* pExt) /// obj will contain the result, defVal contains values we should use when one column is NULL { poco_assert_dbg (pExt != 0); @@ -165,7 +168,7 @@ TypeHandler<int>::extract(pos++, obj.type, defVal.type, pExt); TypeHandler<Int64>::extract(pos++, d, defVal.date.epochTime(), pExt); TypeHandler<Int64>::extract(pos++, t, defVal.time.epochTime(), pExt); - TypeHandler<string>::extract(pos++, obj.details, defVal.details, pExt); + TypeHandler<std::string>::extract(pos++, obj.details, defVal.details, pExt); dt = d + (t % 86400); obj.date = Timestamp::fromEpochTime(d); obj.time = Timestamp::fromEpochTime(t); @@ -176,5 +179,6 @@ } } // namespace Poco::Data #include "Options.h" -#include "MainApplication.h" +#include "MainApplication.h" + #endif // BYPASSES_H Modified: trunk/include/ConfigSubsystem.h =================================================================== --- trunk/include/ConfigSubsystem.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/ConfigSubsystem.h 2012-04-14 14:17:09 UTC (rev 269) @@ -35,14 +35,16 @@ #include "Poco/Thread.h" #include <iostream> -class MainApplication; + +namespace NetResponsibility { -using Poco::Util::Application; -using Poco::Logger; -using namespace std; - - -class ConfigSubsystem: public Poco::Util::Subsystem +using ::Poco::Util::Application; +using ::Poco::Logger; +using namespace ::std; + +class MainApplication; + +class ConfigSubsystem: public ::Poco::Util::Subsystem /// ConfigSubsystem is a Subsystem that takes care of the configuration. /// It will only do anything if one of the arguments --config or --install /// is specified. @@ -60,5 +62,7 @@ /// neccessary if --username=X and --password=Y are given as arguments. }; -#include "MainApplication.h" +#include "MainApplication.h" + +} // namespace NetResponsibility #endif // CONFIGSUBSYSTEM_H Modified: trunk/include/Database.h =================================================================== --- trunk/include/Database.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Database.h 2012-04-14 14:17:09 UTC (rev 269) @@ -48,14 +48,17 @@ #include <vector> #include <set> -using Poco::Timestamp; -using Poco::Tuple; -using Poco::Exception; -using Poco::Data::SQLite::DBLockedException; -using Poco::Thread; -using Poco::Net::HTTPRequest; -using namespace Poco::Data; -using namespace std; + +namespace NetResponsibility { + +using ::Poco::Timestamp; +using ::Poco::Tuple; +using ::Poco::Exception; +using ::Poco::Data::SQLite::DBLockedException; +using ::Poco::Thread; +using ::Poco::Net::HTTPRequest; +using namespace ::Poco::Data; +using namespace ::std; class Database /// Database handles all connections to the SQLite database. The Database @@ -186,5 +189,8 @@ Statement *_logWarningStatement; Statement *_logMatchStatement; }; + + +} // namespace NetResponsibility #endif // DATABASE_H Modified: trunk/include/Filter.h =================================================================== --- trunk/include/Filter.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Filter.h 2012-04-14 14:17:09 UTC (rev 269) @@ -35,14 +35,16 @@ #include "Poco/Exception.h" #include "Poco/URI.h" #include "Poco/Net/HTTPRequest.h" -#include "Poco/Util/Application.h" - -using Poco::RegularExpression; -using Poco::SharedPtr; -using Poco::Net::HTTPRequest; -using Poco::Util::Application; -using namespace std; +#include "Poco/Util/Application.h" +namespace NetResponsibility { + +using ::Poco::RegularExpression; +using ::Poco::SharedPtr; +using ::Poco::Net::HTTPRequest; +using ::Poco::Util::Application; +using namespace ::std; + class Options; class Database; @@ -91,9 +93,12 @@ void setRegexps(); float getExtensionFactor(string url); -}; +}; +} // namespace NetResponsibility + #include "Database.h" #include "Request.h" -#include "Options.h" +#include "Options.h" + #endif // FILTER_H Modified: trunk/include/History.h =================================================================== --- trunk/include/History.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/History.h 2012-04-14 14:17:09 UTC (rev 269) @@ -33,12 +33,14 @@ #include <iostream> #include <vector> + +namespace NetResponsibility { + +using ::Poco::Timestamp; +using ::Poco::DateTimeFormatter; +using namespace ::Poco::Data; +using namespace ::std; -using Poco::Timestamp; -using Poco::DateTimeFormatter; -using namespace Poco::Data; -using namespace std; - struct HistoryRow /// A struct that contains each row of the urls table. It is actually nothing /// more than the URL split up in hostname and path, as well as the time, @@ -149,14 +151,16 @@ protected: vector<HistoryRow, allocator<HistoryRow> > _historyRows; int _index; -}; +}; + +} // namespace NetResponsibility namespace Poco { namespace Data { template <> -class TypeHandler<class HistoryRow> +class TypeHandler<class ::NetResponsibility::HistoryRow> { public: static size_t size() @@ -164,33 +168,33 @@ return 4; // we handle four columns of the Table! } - static void bind(size_t pos, const HistoryRow& obj, AbstractBinder* pBinder) + static void bind(size_t pos, const ::NetResponsibility::HistoryRow& obj, AbstractBinder* pBinder) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::bind(pos++, obj.hostname, pBinder); - TypeHandler<string>::bind(pos++, obj.path, pBinder); + TypeHandler<std::string>::bind(pos++, obj.hostname, pBinder); + TypeHandler<std::string>::bind(pos++, obj.path, pBinder); TypeHandler<Int64>::bind(pos++, obj.date.epochTime(), pBinder); TypeHandler<Int64>::bind(pos++, obj.time.epochTime(), pBinder); } - static void prepare(size_t pos, const HistoryRow& obj, + static void prepare(size_t pos, const ::NetResponsibility::HistoryRow& obj, AbstractPreparation* pPrepare) { poco_assert_dbg (pBinder != 0); - TypeHandler<string>::prepare(pos++, obj.hostname, pPrepare); - TypeHandler<string>::prepare(pos++, obj.path, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.hostname, pPrepare); + TypeHandler<std::string>::prepare(pos++, obj.path, pPrepare); TypeHandler<Int64>::prepare(pos++, obj.date.epochTime(), pPrepare); TypeHandler<Int64>::prepare(pos++, obj.time.epochTime(), pPrepare); } - static void extract(size_t pos, HistoryRow& obj, - const HistoryRow& defVal, AbstractExtractor* pExt) + static void extract(size_t pos, ::NetResponsibility::HistoryRow& obj, + const ::NetResponsibility::HistoryRow& defVal, AbstractExtractor* pExt) /// obj will contain the result, defVal contains values we should use when one column is NULL { poco_assert_dbg (pExt != 0); Int64 d, t, dt; - TypeHandler<string>::extract(pos++, obj.hostname, defVal.hostname, pExt); - TypeHandler<string>::extract(pos++, obj.path, defVal.path, pExt); + TypeHandler<std::string>::extract(pos++, obj.hostname, defVal.hostname, pExt); + TypeHandler<std::string>::extract(pos++, obj.path, defVal.path, pExt); TypeHandler<Int64>::extract(pos++, d, defVal.date.epochTime(), pExt); TypeHandler<Int64>::extract(pos++, t, defVal.time.epochTime(), pExt); dt = d + (t % 86400); @@ -201,5 +205,6 @@ }; } } // namespace Poco::Data + #endif // HISTORY_H Modified: trunk/include/MainApplication.h =================================================================== --- trunk/include/MainApplication.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/MainApplication.h 2012-04-14 14:17:09 UTC (rev 269) @@ -25,7 +25,11 @@ #ifndef MAINAPPLICATION_H #define MAINAPPLICATION_H - +/* +namespace Poco { + using namespace NetResponsibility; +} +*/ #define STRINGIFY(path, file) #path #file #define CONCAT(x, y) STRINGIFY(x, y) @@ -64,30 +68,34 @@ #if defined(POCO_OS_FAMILY_UNIX) #include "unistd.h" #include "signal.h" -#include "Poco/SyslogChannel.h" -using Poco::SyslogChannel; -#endif +#include "Poco/SyslogChannel.h" +namespace NetResponsibility { + using ::Poco::SyslogChannel; +} +#endif -using Poco::Logger; -using Poco::FileChannel; -using Poco::ConsoleChannel; -using Poco::SplitterChannel; -using Poco::FormattingChannel; -using Poco::PatternFormatter; -using Poco::Util::Application; -using Poco::Util::ServerApplication; -using Poco::Util::Subsystem; -using Poco::Util::Option; -using Poco::Util::OptionSet; -using Poco::Util::OptionCallback; -using Poco::Util::HelpFormatter; -using Poco::DateTimeFormatter; -using Poco::AutoPtr; -using Poco::Process; -using Poco::ProcessHandle; -using namespace std; +namespace NetResponsibility { + +using ::Poco::Logger; +using ::Poco::FileChannel; +using ::Poco::ConsoleChannel; +using ::Poco::SplitterChannel; +using ::Poco::FormattingChannel; +using ::Poco::PatternFormatter; +using ::Poco::Util::Application; +using ::Poco::Util::ServerApplication; +using ::Poco::Util::Subsystem; +using ::Poco::Util::Option; +using ::Poco::Util::OptionSet; +using ::Poco::Util::OptionCallback; +using ::Poco::Util::HelpFormatter; +using ::Poco::DateTimeFormatter; +using ::Poco::AutoPtr; +using ::Poco::Process; +using ::Poco::ProcessHandle; +using namespace ::std; -class MainApplication: public Poco::Util::ServerApplication +class MainApplication: public ::Poco::Util::ServerApplication /// MainApplication is the skeleton of Net Responsibility. This is where all /// Options are processed, the Database loaded, the Logger set up, the signals /// handled and the Subsystems called. @@ -167,6 +175,9 @@ static MainApplication *_instance; Options *_options; Database *_database; -}; +}; + + +} // namespace NetResponsibility #endif // MAINAPPLICATION_H Modified: trunk/include/MyXml.h =================================================================== --- trunk/include/MyXml.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/MyXml.h 2012-04-14 14:17:09 UTC (rev 269) @@ -24,6 +24,8 @@ #ifndef MYXML_H #define MYXML_H + + #include <iostream> #include <vector> @@ -36,15 +38,17 @@ #include "Poco/Logger.h" #include "Blacklist.h" + +namespace NetResponsibility { + +using ::Poco::AutoPtr; +using ::Poco::Util::XMLConfiguration; +using ::Poco::Util::Application; +using ::Poco::RegularExpression; +using ::Poco::Logger; +using namespace ::std; -using Poco::AutoPtr; -using Poco::Util::XMLConfiguration; -using Poco::Util::Application; -using Poco::RegularExpression; -using Poco::Logger; -using namespace std; - -class MyXml : public Poco::Util::XMLConfiguration +class MyXml : public ::Poco::Util::XMLConfiguration /// MyXml inherits XMLConfiguration and adds some extra functionality to it. /// It's most important task is to extract and compile the blacklists, as /// well as the txtfile. @@ -70,5 +74,8 @@ protected: Logger* _logger; }; + + +} // namespace NetResponsibility #endif // MYXML_H Modified: trunk/include/Options.h =================================================================== --- trunk/include/Options.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Options.h 2012-04-14 14:17:09 UTC (rev 269) @@ -65,11 +65,13 @@ #ifndef VERSION #define VERSION "0" #endif //VERSION - -using Poco::Logger; -using Poco::Util::Application; -using namespace std; +namespace NetResponsibility { + +using ::Poco::Logger; +using ::Poco::Util::Application; +using namespace ::std; + class MainApplication; class Bypasses; @@ -192,6 +194,9 @@ void loadDefaultValues(); void loadTxt(); }; + +} // namespace NetResponsibility -#include "Bypasses.h" +#include "Bypasses.h" + #endif // OPTIONS_H Modified: trunk/include/Report.h =================================================================== --- trunk/include/Report.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Report.h 2012-04-14 14:17:09 UTC (rev 269) @@ -46,13 +46,15 @@ #include "Poco/Path.h" #include "Poco/File.h" #include "Poco/NumberFormatter.h" + +namespace NetResponsibility { + +using ::Poco::RegularExpression; +using ::Poco::DirectoryIterator; +using ::Poco::Zip::Compress; +using ::Poco::Path; +using ::Poco::File; -using Poco::RegularExpression; -using Poco::DirectoryIterator; -using Poco::Zip::Compress; -using Poco::Path; -using Poco::File; - class Report: public ReportBase /// This class is generating the reports. It may also override ReportBase's /// send method to send the reports another way than usual. Report is written @@ -99,5 +101,8 @@ POCO_BEGIN_MANIFEST(ReportBase) POCO_EXPORT_CLASS(Report) POCO_END_MANIFEST + + +} // namespace NetResponsibility #endif // REPORT_H Modified: trunk/include/ReportBase.h =================================================================== --- trunk/include/ReportBase.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/ReportBase.h 2012-04-14 14:17:09 UTC (rev 269) @@ -50,21 +50,22 @@ #include "Poco/Logger.h" #include "Poco/URI.h" #include "Poco/Path.h" + +namespace NetResponsibility { +using ::Poco::Timestamp; +using ::Poco::DateTimeFormatter; +using ::Poco::Net::MailMessage; +using ::Poco::Net::MailRecipient; +using ::Poco::Net::SMTPClientSession; +using ::Poco::Net::StringPartSource; +using ::Poco::Net::FilePartSource; +using ::Poco::Net::NoAddressFoundException; +using ::Poco::Util::Application; +using ::Poco::Exception; +using ::Poco::Logger; +using ::Poco::Path; -using Poco::Timestamp; -using Poco::DateTimeFormatter; -using Poco::Net::MailMessage; -using Poco::Net::MailRecipient; -using Poco::Net::SMTPClientSession; -using Poco::Net::StringPartSource; -using Poco::Net::FilePartSource; -using Poco::Net::NoAddressFoundException; -using Poco::Util::Application; -using Poco::Exception; -using Poco::Logger; -using Poco::Path; - class MainApplication; class ReportBase @@ -147,7 +148,10 @@ void replaceVar(string &subject, string var, string replacement); /// Replace {var} with replacement in subject -}; +}; + +} // namespace NetResponsibility -#include "MainApplication.h" +#include "MainApplication.h" + #endif // REPORTBASE_H Modified: trunk/include/ReportSubsystem.h =================================================================== --- trunk/include/ReportSubsystem.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/ReportSubsystem.h 2012-04-14 14:17:09 UTC (rev 269) @@ -37,15 +37,17 @@ #include "Poco/File.h" #include <iostream> #include <fstream> - + +namespace NetResponsibility { + +using ::Poco::Util::Application; +using ::Poco::Util::Subsystem; +using ::Poco::ClassLoader; +using ::Poco::Logger; +using ::Poco::File; +using namespace ::std; + class MainApplication; - -using Poco::Util::Application; -using Poco::Util::Subsystem; -using Poco::ClassLoader; -using Poco::Logger; -using Poco::File; -using namespace std; enum ReportType { @@ -58,7 +60,7 @@ REPORT_UNINSTALL }; -class ReportSubsystem: public Poco::Util::Subsystem +class ReportSubsystem: public ::Poco::Util::Subsystem /// ReportSubsystem is a Poco::Util::Subsystem that determines if we should /// send a report, and makes sure it's done properly. { @@ -78,6 +80,9 @@ /// Check if it's time to send a scheduled report, and in that case /// set type to REPORT_SCHEDULED }; + +} // namespace NetResponsibility -#include "MainApplication.h" +#include "MainApplication.h" + #endif // REPORTSUBSYSTEM_H Modified: trunk/include/Request.h =================================================================== --- trunk/include/Request.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Request.h 2012-04-14 14:17:09 UTC (rev 269) @@ -46,22 +46,24 @@ #include "Poco/Exception.h" #include "Poco/Thread.h" -using Poco::Net::HTTPClientSession; -using Poco::Net::HTTPRequest; -using Poco::Net::HTTPResponse; -using Poco::Net::HTTPMessage; -using Poco::Util::Application; -using Poco::Util::XMLConfiguration; -using Poco::Logger; -using Poco::StreamCopier; -using Poco::Timestamp; -using Poco::Path; -using Poco::File; -using Poco::URI; -using Poco::Exception; + +namespace NetResponsibility { + +using ::Poco::Net::HTTPClientSession; +using ::Poco::Net::HTTPRequest; +using ::Poco::Net::HTTPResponse; +using ::Poco::Net::HTTPMessage; +using ::Poco::Util::Application; +using ::Poco::Util::XMLConfiguration; +using ::Poco::Logger; +using ::Poco::StreamCopier; +using ::Poco::Timestamp; +using ::Poco::Path; +using ::Poco::File; +using ::Poco::URI; +using ::Poco::Exception; +using namespace ::std; -using namespace std; - class Options; //Forward declaration class Request @@ -90,6 +92,9 @@ private: static string send(Options *options, string uriPath, string filePath = "", string morePostVars = ""); -}; +}; + +} // namespace NetResponsibility + #endif // REQUEST_H Modified: trunk/include/Sniffer.h =================================================================== --- trunk/include/Sniffer.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Sniffer.h 2012-04-14 14:17:09 UTC (rev 269) @@ -62,19 +62,21 @@ #include <netinet/in.h> #include <arpa/inet.h> #endif //POCO_OS_FAMILY_ + +namespace NetResponsibility { + +using ::Poco::RegularExpression; +using ::Poco::SharedPtr; +using ::Poco::ThreadPool; +using ::Poco::Logger; +using ::Poco::LogStream; +using ::Poco::Net::HTTPRequest; +using namespace ::std; + +struct sniff_ethernet; +struct sniff_ip; +struct sniff_tcp; -using Poco::RegularExpression; -using Poco::SharedPtr; -using Poco::ThreadPool; -using Poco::Logger; -using Poco::LogStream; -using Poco::Net::HTTPRequest; -using namespace std; - -struct sniff_ethernet; -struct sniff_ip; -struct sniff_tcp; - class MainApplication; class SnifferThread; @@ -104,7 +106,10 @@ vector<string> getDevices(); friend class SnifferThread; -}; +}; + +} // namespace NetResponsibility -#include "MainApplication.h" +#include "MainApplication.h" + #endif // SNIFFER_H Modified: trunk/include/SnifferSubsystem.h =================================================================== --- trunk/include/SnifferSubsystem.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/SnifferSubsystem.h 2012-04-14 14:17:09 UTC (rev 269) @@ -40,15 +40,17 @@ #include "Poco/File.h" #include "Poco/Logger.h" #include "Poco/Process.h" -#include <iostream> +#include <iostream> -using Poco::Util::Application; -using Poco::Util::Subsystem; -using Poco::File; -using Poco::Logger; -using namespace std; +namespace NetResponsibility { + +using ::Poco::Util::Application; +using ::Poco::Util::Subsystem; +using ::Poco::File; +using ::Poco::Logger; +using namespace ::std; -class SnifferSubsystem: public Poco::Util::Subsystem +class SnifferSubsystem: public ::Poco::Util::Subsystem /// SnifferSubsystem is a Subsystem that takes care of setting up Sniffer. { public: @@ -63,5 +65,8 @@ /// Determines if there is any other instance running, if so this one /// will not survive. }; + + +} // namespace NetResponsibility #endif // SNIFFERSUBSYSTEM_H Modified: trunk/include/SnifferThread.h =================================================================== --- trunk/include/SnifferThread.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/SnifferThread.h 2012-04-14 14:17:09 UTC (rev 269) @@ -86,16 +86,20 @@ #define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) #define IP_V(ip) (((ip)->ip_vhl) >> 4) -/* TCP header */ -typedef u_int tcp_seq; -using Poco::RegularExpression; -using Poco::SharedPtr; -using Poco::Logger; -using Poco::LogStream; -using Poco::Net::HTTPRequest; -using Poco::Exception; -using namespace std; + +namespace NetResponsibility { + +using ::Poco::RegularExpression; +using ::Poco::SharedPtr; +using ::Poco::Logger; +using ::Poco::LogStream; +using ::Poco::Net::HTTPRequest; +using ::Poco::Exception; +using namespace ::std; + +/* TCP header */ +typedef u_int tcp_seq; struct sniff_ethernet; struct sniff_ip; @@ -103,7 +107,7 @@ class MainApplication; -class SnifferThread: public Poco::Runnable +class SnifferThread: public ::Poco::Runnable /// SnifferThread is a thread that listens for HTTP requests on a specific /// interface, and makes sure they're getting logged. It is invoked by Sniffer. /// Much of this code is inspired by examples provided by TCPDump and Winpcap @@ -175,7 +179,10 @@ u_short th_win; /* window */ u_short th_sum; /* checksum */ u_short th_urp; /* urgent pointer */ -}; +}; + +} // namespace NetResponsibility -#include "MainApplication.h" +#include "MainApplication.h" + #endif // SNIFFERTHREAD_H Modified: trunk/include/Warnings.h =================================================================== --- trunk/include/Warnings.h 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/include/Warnings.h 2012-04-14 14:17:09 UTC (rev 269) @@ -26,6 +26,8 @@ #include "History.h" #include "Blacklist.h" + +namespace NetResponsibility { class Warnings: public History /// Warnings is able to store all inappropriate URLs and useful additional info @@ -71,6 +73,9 @@ protected: vector<BlacklistMatch, allocator<BlacklistMatch> > _blacklistMatches; }; + + +} // namespace NetResponsibility #endif // WARNINGS_H Modified: trunk/src/BootHistory.cpp =================================================================== --- trunk/src/BootHistory.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/BootHistory.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -22,6 +22,7 @@ // Almost all code is taken from the Linux command "last", so credit goes to // Miquel van Smoorenburg, mi...@ci... +namespace NetResponsibility { BootHistory::BootHistory() { @@ -546,4 +547,7 @@ +} // namespace NetResponsibility + + #endif // UNIX Modified: trunk/src/Bypasses.cpp =================================================================== --- trunk/src/Bypasses.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Bypasses.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -17,6 +17,8 @@ // // <Bypasses> is able to store all useful information about attempts to bypass // the software + +namespace NetResponsibility { Bypasses::Bypasses() { @@ -189,3 +191,6 @@ void Bypasses::clear() { _bypassRows.clear(); } + + +} // namespace NetResponsibility Modified: trunk/src/ConfigSubsystem.cpp =================================================================== --- trunk/src/ConfigSubsystem.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/ConfigSubsystem.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -16,8 +16,9 @@ // <ConfigSubsystem> is a Subsystem that takes care of configuration - #include "ConfigSubsystem.h" + +namespace NetResponsibility { const char* ConfigSubsystem::name() const { @@ -69,3 +70,6 @@ cin >> password; return; } + + +} // namespace NetResponsibility Modified: trunk/src/Database.cpp =================================================================== --- trunk/src/Database.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Database.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -19,6 +19,8 @@ #include "Database.h" + +namespace NetResponsibility { Database::Database() {} @@ -270,7 +272,7 @@ void Database::logReportStart(int &id) { - int type = Poco::Util::Application::instance().config().getInt("report", 0); + int type = ::Poco::Util::Application::instance().config().getInt("report", 0); const int FINISHED = 30; for (int i = 0; i <= FINISHED; i++) { try { @@ -780,3 +782,6 @@ } } } + + +} // namespace NetResponsibility Modified: trunk/src/Filter.cpp =================================================================== --- trunk/src/Filter.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Filter.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -16,6 +16,8 @@ // <Filter> determines whether the URLs are appropriate or not. #include "Filter.h" + +namespace NetResponsibility { Filter::Filter() { @@ -61,7 +63,7 @@ _extensions = xmlBlacklist->getExtensions(); moreTries = 0; } - catch (Poco::FileNotFoundException &err) { + catch (::Poco::FileNotFoundException &err) { Application::instance().logger() .information("Couldn't load blacklist, downloading new: " + err.displayText()); @@ -69,7 +71,7 @@ db->logBypass(BYPASS_MISSING_FILE, "Blacklist"); Request::downloadBlacklist(options); } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { Application::instance().logger() .information("Couldn't load blacklist, downloading new: " + err.displayText()); @@ -149,9 +151,9 @@ token, decodedUrl = ""; try { - Poco::URI::decode(url, decodedUrl); + ::Poco::URI::decode(url, decodedUrl); } - catch (Poco::Exception &exc) { + catch (::Poco::Exception &exc) { decodedUrl = url; } while (o < decodedUrl.length()) { @@ -247,3 +249,6 @@ } return 1; } + + +} // namespace NetResponsibility Modified: trunk/src/History.cpp =================================================================== --- trunk/src/History.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/History.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -19,6 +19,8 @@ #include "History.h" + +namespace NetResponsibility { History::History() { @@ -153,3 +155,6 @@ void History::next() { _index++; } + + +} // namespace NetResponsibility Modified: trunk/src/MainApplication.cpp =================================================================== --- trunk/src/MainApplication.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/MainApplication.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -19,9 +19,11 @@ #include "MainApplication.h" + + +namespace NetResponsibility { - MainApplication* MainApplication::_instance = 0; @@ -352,3 +354,6 @@ return Application::EXIT_OK; } //POCO_SERVER_MAIN(MainApplication) + + +} // namespace NetResponsibility Modified: trunk/src/MyXml.cpp =================================================================== --- trunk/src/MyXml.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/MyXml.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -20,7 +20,9 @@ #include "MyXml.h" +namespace NetResponsibility { + MyXml::MyXml() : XMLConfiguration() { _logger = &Application::instance().logger(); } @@ -102,7 +104,7 @@ else tempRe.push_back(new RegularExpression(line, options, true)); } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { _logger->information(err.displayText() + (string)": " + line); continue; } @@ -137,7 +139,7 @@ try { tempExt.re = new RegularExpression(line, options, true); } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { _logger->information(err.displayText() + (string)": " + line); continue; } @@ -148,3 +150,6 @@ } return extensions; } + + +} // namespace NetResponsibility Modified: trunk/src/Options.cpp =================================================================== --- trunk/src/Options.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Options.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -19,6 +19,8 @@ #include "Options.h" + +namespace NetResponsibility { Options::Options() @@ -103,7 +105,7 @@ // Compute the MAC address every time, since it will be 00:00:00:00:00:00 // if no internet connection is found. Then we have to reload it when the // internet connection is established. - return Poco::Environment::nodeId(); + return ::Poco::Environment::nodeId(); } @@ -229,12 +231,12 @@ if (!Request::modifiedFilesUpdate(this)) moreTries = 0; } - catch (Poco::FileNotFoundException &err) { + catch (::Poco::FileNotFoundException &err) { Application::instance().config().setBool("config", true); _initBypasses->addRow(BYPASS_MISSING_FILE, "Config file"); moreTries = 0; } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { _logger->information("Corrupt configfile, trying to download new: " + err.displayText()); if (moreTries == 3) @@ -253,7 +255,7 @@ AutoPtr<MyXml> xmlTxt (new MyXml(_txtfile)); _txt = xmlTxt->getStringMap(); } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { _logger->warning("Corrupt txtfile"); _initBypasses->addRow(BYPASS_MODIFIED_FILE, "Txt file"); } @@ -274,3 +276,6 @@ it = find (_attachedReportParts.begin(), _attachedReportParts.end(), part); return it != _attachedReportParts.end(); } + + +} // namespace NetResponsibility Modified: trunk/src/Plugin.cpp =================================================================== --- trunk/src/Plugin.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Plugin.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,6 +18,8 @@ #include "Plugin.h" + +namespace NetResponsibility { Report::Report() @@ -309,9 +311,9 @@ } green = (green < 0 ? 0 : (green > 255 ? 255 : green)); red = (red < 0 ? 0 : (red > 255 ? 255 : red)); - Poco::NumberFormatter::appendHex(hex, red, 2); - Poco::NumberFormatter::appendHex(hex, green, 2); - Poco::NumberFormatter::appendHex(hex, 0, 2); + ::Poco::NumberFormatter::appendHex(hex, red, 2); + ::Poco::NumberFormatter::appendHex(hex, green, 2); + ::Poco::NumberFormatter::appendHex(hex, 0, 2); colored <<"<b style='background-color: #" <<hex <<"'> " <<strength <<" </b>"; @@ -333,3 +335,6 @@ string Report::makeJavascriptBranch(string title, string content) { return "['" + title + "', ['',,'folder'], [\n" + content + "]],\n"; } + + +} // namespace NetResponsibility Modified: trunk/src/Report.cpp =================================================================== --- trunk/src/Report.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Report.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,9 +18,10 @@ #include "Report.h" + +namespace NetResponsibility { - string Report::name() const { return "Report"; } @@ -365,9 +366,9 @@ } green = (green < 0 ? 0 : (green > 255 ? 255 : green)); red = (red < 0 ? 0 : (red > 255 ? 255 : red)); - Poco::NumberFormatter::appendHex(hex, red, 2); - Poco::NumberFormatter::appendHex(hex, green, 2); - Poco::NumberFormatter::appendHex(hex, 0, 2); + ::Poco::NumberFormatter::appendHex(hex, red, 2); + ::Poco::NumberFormatter::appendHex(hex, green, 2); + ::Poco::NumberFormatter::appendHex(hex, 0, 2); colored <<"<b style='background-color: #" <<hex <<"'> " <<strength <<" </b>"; @@ -389,3 +390,6 @@ string Report::makeJavascriptBranch(string title, string content) { return "['" + title + "', ['',,'folder'], [\n" + content + "]],\n"; } + + +} // namespace NetResponsibility Modified: trunk/src/ReportBase.cpp =================================================================== --- trunk/src/ReportBase.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/ReportBase.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -20,6 +20,8 @@ #include "ReportBase.h" + +namespace NetResponsibility { ReportBase::ReportBase() @@ -137,7 +139,7 @@ session.close(); sendImprovementData(); } - catch (Poco::Net::NoAddressFoundException& exc) { + catch (::Poco::Net::NoAddressFoundException& exc) { return 1; } catch (Exception& exc) { @@ -222,3 +224,6 @@ pos = subject.find(var); } } + + +} // namespace NetResponsibility Modified: trunk/src/ReportSubsystem.cpp =================================================================== --- trunk/src/ReportSubsystem.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/ReportSubsystem.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,6 +18,8 @@ #include "ReportSubsystem.h" + +namespace NetResponsibility { const char* ReportSubsystem::name() const { @@ -61,7 +63,7 @@ int errorCode = report->send(); while (errorCode == 1) { _logger->debug("Retrying to send report in 20 seconds"); - Poco::Thread::sleep(20000); + ::Poco::Thread::sleep(20000); errorCode = report->send(); } if (errorCode == 0) { @@ -78,7 +80,7 @@ loader.unloadLibrary(lib); } - catch (Poco::Exception &exc) { + catch (::Poco::Exception &exc) { _logger->warning(exc.displayText()); } } @@ -100,3 +102,6 @@ type = REPORT_SCHEDULED; } } + + +} // namespace NetResponsibility Modified: trunk/src/Request.cpp =================================================================== --- trunk/src/Request.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Request.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,6 +18,8 @@ #include "Request.h" + +namespace NetResponsibility { @@ -134,7 +136,10 @@ } catch (Exception& exc) { Application::instance().logger().debug(exc.displayText()); - Poco::Thread::sleep(20000); + ::Poco::Thread::sleep(20000); } } } + + +} // namespace NetResponsibility Modified: trunk/src/Sniffer.cpp =================================================================== --- trunk/src/Sniffer.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Sniffer.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,6 +18,8 @@ #include "Sniffer.h" + +namespace NetResponsibility { @@ -43,9 +45,9 @@ if (threads.back()->openDevice(*it) == -1) threads.pop_back(); else - Poco::ThreadPool::defaultPool().start(*(threads.back())); + ::Poco::ThreadPool::defaultPool().start(*(threads.back())); } - Poco::ThreadPool::defaultPool().joinAll(); + ::Poco::ThreadPool::defaultPool().joinAll(); } @@ -105,3 +107,6 @@ return devices; } + + +} // namespace NetResponsibility Modified: trunk/src/SnifferSubsystem.cpp =================================================================== --- trunk/src/SnifferSubsystem.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/SnifferSubsystem.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -15,6 +15,8 @@ // along with Net Responsibility. If not, see <http://www.gnu.org/licenses/>. // // <SnifferSubsystem> is a Subsystem that takes care of setting up <Sniffer> + +namespace NetResponsibility { const char* SnifferSubsystem::name() const { @@ -51,7 +53,7 @@ bool SnifferSubsystem::isOnlyInstance() { string pidfile = MainApplication::getOptions().getPidfile(); - int currentPid = Poco::Process::id(), + int currentPid = ::Poco::Process::id(), oldPid = currentPid; if (File(pidfile).exists()) { ifstream f(pidfile.c_str(), ios::in); @@ -71,3 +73,6 @@ return true; } + + +} // namespace NetResponsibility Modified: trunk/src/SnifferThread.cpp =================================================================== --- trunk/src/SnifferThread.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/SnifferThread.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -19,6 +19,8 @@ #include "SnifferThread.h" +namespace NetResponsibility { + @@ -90,7 +92,7 @@ gotPacket(header, pkt_data, request); if (request.empty()) - throw Poco::Exception("No message found"); + throw ::Poco::Exception("No message found"); isMatch = _filter->isMatch(request, match); Sniffer::logUrl(request); @@ -100,7 +102,7 @@ if (isDebugging) *_logStream <<isMatch <<endl; } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { if (isDebugging) *_logStream <<'-' <<endl; } @@ -161,8 +163,11 @@ istringstream istr(payload); request.read(istr); } - catch (Poco::Exception &err) { + catch (::Poco::Exception &err) { request.clear(); } return; } + + +} // namespace NetResponsibility Modified: trunk/src/Warnings.cpp =================================================================== --- trunk/src/Warnings.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/Warnings.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -18,6 +18,8 @@ #include "Warnings.h" + +namespace NetResponsibility { Warnings::Warnings() { _index = 0; @@ -97,3 +99,6 @@ vector<BlacklistKeyword> Warnings::getKeywords(int index) const { return _blacklistMatches[index].keyword; } + + +} // namespace NetResponsibility Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2012-04-13 22:01:33 UTC (rev 268) +++ trunk/src/main.cpp 2012-04-14 14:17:09 UTC (rev 269) @@ -26,6 +26,6 @@ int main(int argc, char** argv) { - MainApplication mainApp; + NetResponsibility::MainApplication mainApp; return mainApp.run(argc, argv); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-13 22:01:39
|
Revision: 268 http://responsibility.svn.sourceforge.net/responsibility/?rev=268&view=rev Author: roggan87 Date: 2012-04-13 22:01:33 +0000 (Fri, 13 Apr 2012) Log Message: ----------- Replaced the base classes with their explicit names so that PocoDoc understands the relationship. Modified Paths: -------------- trunk/include/MainApplication.h trunk/include/MyXml.h Modified: trunk/include/MainApplication.h =================================================================== --- trunk/include/MainApplication.h 2012-04-13 21:28:36 UTC (rev 267) +++ trunk/include/MainApplication.h 2012-04-13 22:01:33 UTC (rev 268) @@ -87,7 +87,7 @@ using Poco::ProcessHandle; using namespace std; -class MainApplication: public ServerApplication +class MainApplication: public Poco::Util::ServerApplication /// MainApplication is the skeleton of Net Responsibility. This is where all /// Options are processed, the Database loaded, the Logger set up, the signals /// handled and the Subsystems called. Modified: trunk/include/MyXml.h =================================================================== --- trunk/include/MyXml.h 2012-04-13 21:28:36 UTC (rev 267) +++ trunk/include/MyXml.h 2012-04-13 22:01:33 UTC (rev 268) @@ -44,7 +44,7 @@ using Poco::Logger; using namespace std; -class MyXml : public XMLConfiguration +class MyXml : public Poco::Util::XMLConfiguration /// MyXml inherits XMLConfiguration and adds some extra functionality to it. /// It's most important task is to extract and compile the blacklists, as /// well as the txtfile. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-13 21:28:46
|
Revision: 267 http://responsibility.svn.sourceforge.net/responsibility/?rev=267&view=rev Author: roggan87 Date: 2012-04-13 21:28:36 +0000 (Fri, 13 Apr 2012) Log Message: ----------- Created a branch for 3.0.1 in releases Added Paths: ----------- releases/3.0.1/ releases/3.0.1/include/Database.h releases/3.0.1/include/Filter.h releases/3.0.1/include/History.h releases/3.0.1/include/MainApplication.h releases/3.0.1/include/MyXml.h releases/3.0.1/include/Options.h releases/3.0.1/include/Report.h releases/3.0.1/include/ReportBase.h releases/3.0.1/include/ReportSubsystem.h releases/3.0.1/include/Request.h releases/3.0.1/include/Sniffer.h releases/3.0.1/include/SnifferSubsystem.h releases/3.0.1/include/SnifferThread.h releases/3.0.1/include/Warnings.h releases/3.0.1/src/SnifferThread.cpp Removed Paths: ------------- releases/3.0.1/doc/ releases/3.0.1/include/Database.h releases/3.0.1/include/Filter.h releases/3.0.1/include/History.h releases/3.0.1/include/MainApplication.h releases/3.0.1/include/MyXml.h releases/3.0.1/include/Options.h releases/3.0.1/include/Report.h releases/3.0.1/include/ReportBase.h releases/3.0.1/include/ReportSubsystem.h releases/3.0.1/include/Request.h releases/3.0.1/include/Sniffer.h releases/3.0.1/include/SnifferSubsystem.h releases/3.0.1/include/SnifferThread.h releases/3.0.1/include/Warnings.h releases/3.0.1/src/SnifferThread.cpp Deleted: releases/3.0.1/include/Database.h =================================================================== --- trunk/include/Database.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/Database.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,168 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: Database -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <Database> handles all connections from and to the database. - -#ifndef DATABASE_H -#define DATABASE_H - -#include "Poco/Data/Common.h" -#include "Poco/Data/Connector.h" -#include "Poco/Data/SQLite/Connector.h" -#include "Poco/Data/SQLite/SQLiteException.h" -#include "Poco/Exception.h" -#include "Poco/Timestamp.h" -#include "Poco/Tuple.h" -#include "Poco/Logger.h" -#include "Poco/Util/ServerApplication.h" -#include "Poco/Net/HTTPRequest.h" -#include "Poco/Thread.h" -#include "Poco/Process.h" - -#include "Blacklist.h" -#include "Options.h" -#include "History.h" -#include "Warnings.h" -#include "Bypasses.h" -#include "BootHistory.h" - -#include <iostream> -#include <sstream> -#include <vector> -#include <set> - -using Poco::Timestamp; -using Poco::Tuple; -using Poco::Exception; -using Poco::Data::SQLite::DBLockedException; -using Poco::Thread; -using Poco::Net::HTTPRequest; -using namespace Poco::Data; -using namespace std; - -class Database - /// Database handles all connections to the SQLite database. The Database - /// object is instanciated in by MainApplication, and may be accessed by the - /// static method &MainApplication::getDatabase(). - /// - /// The only class allowed to actually store any entries in the database is - /// Sniffer. Other classes may only load data from it. - /// - /// There is no method to write any custom SQLite query. Instead the queries - /// are a little more limited. Most methods that returns data from the - /// database also takes the arguments where and orderBy. With these you may - /// customize the return values. - /// - /// Queries that are done repeatedly are stored inside Statements. This will - /// enchance their speed. -{ - public: - Database(); - Database(Options& options); - ~Database(); - bool isReportTime(int frequency); - /// Check if it's time to send a scheduled report, depending on - /// 'frequency'. - int getCount(string from) const; - /// Return the number of rows found in the table 'from'. - int getLastRowId() const; - vector<string> getDistinctHostnames(string where - = "hostname <> ''", string orderBy = "hostname ASC") const; - /// Return all unique hostnames in a simple vector. By default - /// it will not return hostnames that are empty - /// entries (if found), and the hostnames will be ordered by name. - Bypasses getBypasses(string where = "", string orderBy - = "date, time ASC") const; - /// Return all Bypasses found, in a Bypasses object. - History getHistory(string where = "hostname <> ''", string orderBy - = "hostname ASC") const; - /// Return all History. - Warnings getWarnings(string where = "", string orderBy - = "u.hostname ASC", bool = false) const; - /// Return all Warnings found. - Warnings getWhitelist(string where = "", string orderBy = "u.hostname ASC") const; - /// Return all matches that are whitelisted for some reason. This - /// is wrapped up in a Warnings object, since it's actually - /// the same thing, but the matches are also considered clean. - void logBypass(int type, string details = "", int datetime = 0); - /// Log attempts to bypass the software. You'll need to enter - /// the type (BYPASS_TYPE), and optionally more verbose details. - /// The int datetime is a unix timestamp of when the bypass happened. - /// If 0 the current timestamp will be used. - void logInitBypasses(Bypasses& bypasses); - /// During startup the software makes several sanity checks, to make - /// sure it hasn't been bypassed. Even attempts that fails will be - /// reported. This may be discussed however, if they are redundant - /// and confusing for the accountability partners? - void logReportStart(int& id); - /// Log that the reporting process have started. You'll need the id - /// later to properly "close" the report. - void logReportFinish(int id); - /// Log that the report finished successfully. You'll need to enter the - /// id given by logReportStart(). - void logSessionStart(); - /// Log that this current instance started. This info is used to process - /// if Net Responsibility has been bypassed by shutting it down or - /// omitting it at boot time. The boot time of this specific session is - /// also stored. - void logSessionStop(); - /// Log that the current instance stopped. - void rotateLog(int reportId); - /// This method rotated the database, to clean up everything that have - /// been included. Only entries older than the time for the report with - /// reportId will be deleted. The reportId was given by logReportStart(). - friend class Sniffer; - - protected: - void setStatements(); - void logUrl(HTTPRequest& request); - /// Log a URL that's visited. This may only be done by the Sniffer class. - // This will later be replaced by HTTPHit. - void logWarning(BlacklistMatch match); - /// Log a Warning that is flagged by the Filter. It is connected to - /// the last URL inserted. - void logMatch(BlacklistMatch match); - void logBypassShutdown(int datetime, int gap = 0); - void getMatches(vector<int> urlId, vector<BlacklistMatch>& bm) const; - void processPreviousSessions(); - /// Process the previous sessions, and log any attempts to bypass NR. - - private: - Session *_session; - Timestamp _timestamp; - int _lastRowId; - int _sessionRowId; - int _strength; - int _date; - int _time; - string _hostname; - string _path; - string _keyword; - string _category; - Logger *_logger; - BootHistory *_bootHistory; - BlacklistMatch _blacklistMatch; - Statement *_getLastRowId; - Statement *_logUrlStatement; - Statement *_logWarningStatement; - Statement *_logMatchStatement; -}; - -#endif // DATABASE_H Copied: releases/3.0.1/include/Database.h (from rev 260, trunk/include/Database.h) =================================================================== --- releases/3.0.1/include/Database.h (rev 0) +++ releases/3.0.1/include/Database.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,190 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: Database +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <Database> handles all connections from and to the database. + +#ifndef DATABASE_H +#define DATABASE_H + +#include "Poco/Data/Common.h" +#include "Poco/Data/Connector.h" +#include "Poco/Data/SQLite/Connector.h" +#include "Poco/Data/SQLite/SQLiteException.h" +#include "Poco/Exception.h" +#include "Poco/Timestamp.h" +#include "Poco/Tuple.h" +#include "Poco/Logger.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Thread.h" +#include "Poco/Process.h" + +#include "Blacklist.h" +#include "Options.h" +#include "History.h" +#include "Warnings.h" +#include "Bypasses.h" +#include "BootHistory.h" + +#include <iostream> +#include <sstream> +#include <vector> +#include <set> + +using Poco::Timestamp; +using Poco::Tuple; +using Poco::Exception; +using Poco::Data::SQLite::DBLockedException; +using Poco::Thread; +using Poco::Net::HTTPRequest; +using namespace Poco::Data; +using namespace std; + +class Database + /// Database handles all connections to the SQLite database. The Database + /// object is instanciated in by MainApplication, and may be accessed by the + /// static method &MainApplication::getDatabase(). + /// + /// The only class allowed to actually store any entries in the database is + /// Sniffer. Other classes may only load data from it. + /// + /// There is no method to write any custom SQLite query. Instead the queries + /// are a little more limited. Most methods that returns data from the + /// database also takes the arguments where and orderBy. With these you may + /// customize the return values. + /// + /// Queries that are done repeatedly are stored inside Statements. This will + /// enchance their speed. +{ + public: + Database(); + Database(Options& options); + ~Database(); + + bool isReportTime(int frequency); + /// Check if it's time to send a scheduled report, depending on + /// 'frequency'. + + int getCount(string from) const; + /// Return the number of rows found in the table 'from'. + + int getLastRowId() const; + + vector<string> getDistinctHostnames(string where + = "hostname <> ''", string orderBy = "hostname ASC") const; + /// Return all unique hostnames in a simple vector. By default + /// it will not return hostnames that are empty + /// entries (if found), and the hostnames will be ordered by name. + + Bypasses getBypasses(string where = "", string orderBy + = "date, time ASC") const; + /// Return all Bypasses found, in a Bypasses object. + + History getHistory(string where = "hostname <> ''", string orderBy + = "hostname ASC") const; + /// Return all History. + + Warnings getWarnings(string where = "", string orderBy + = "u.hostname ASC", bool = false) const; + /// Return all Warnings found. + + Warnings getWhitelist(string where = "", string orderBy = "u.hostname ASC") const; + /// Return all matches that are whitelisted for some reason. This + /// is wrapped up in a Warnings object, since it's actually + /// the same thing, but the matches are also considered clean. + + void logBypass(int type, string details = "", int datetime = 0); + /// Log attempts to bypass the software. You'll need to enter + /// the type (BYPASS_TYPE), and optionally more verbose details. + /// The int datetime is a unix timestamp of when the bypass happened. + /// If 0 the current timestamp will be used. + + void logInitBypasses(Bypasses& bypasses); + /// During startup the software makes several sanity checks, to make + /// sure it hasn't been bypassed. Even attempts that fails will be + /// reported. This may be discussed however, if they are redundant + /// and confusing for the accountability partners? + + void logReportStart(int& id); + /// Log that the reporting process have started. You'll need the id + /// later to properly "close" the report. + + void logReportFinish(int id); + /// Log that the report finished successfully. You'll need to enter the + /// id given by logReportStart(). + + void logSessionStart(); + /// Log that this current instance started. This info is used to process + /// if Net Responsibility has been bypassed by shutting it down or + /// omitting it at boot time. The boot time of this specific session is + /// also stored. + + void logSessionStop(); + /// Log that the current instance stopped. + + void rotateLog(int reportId); + /// This method rotated the database, to clean up everything that have + /// been included. Only entries older than the time for the report with + /// reportId will be deleted. The reportId was given by logReportStart(). + + friend class Sniffer; + + protected: + void setStatements(); + + void logUrl(HTTPRequest& request); + /// Log a URL that's visited. This may only be done by the Sniffer class. + // This will later be replaced by HTTPHit. + + void logWarning(BlacklistMatch match); + /// Log a Warning that is flagged by the Filter. It is connected to + /// the last URL inserted. + + void logMatch(BlacklistMatch match); + + void logBypassShutdown(int datetime, int gap = 0); + + void getMatches(vector<int> urlId, vector<BlacklistMatch>& bm) const; + + void processPreviousSessions(); + /// Process the previous sessions, and log any attempts to bypass NR. + + private: + Session *_session; + Timestamp _timestamp; + int _lastRowId; + int _sessionRowId; + int _strength; + int _date; + int _time; + string _hostname; + string _path; + string _keyword; + string _category; + Logger *_logger; + BootHistory *_bootHistory; + BlacklistMatch _blacklistMatch; + Statement *_getLastRowId; + Statement *_logUrlStatement; + Statement *_logWarningStatement; + Statement *_logMatchStatement; +}; + +#endif // DATABASE_H Deleted: releases/3.0.1/include/Filter.h =================================================================== --- trunk/include/Filter.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/Filter.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,93 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: Filter -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <Filter> determines whether the URLs are appropriate or not. - -#ifndef FILTER_H -#define FILTER_H - -#include "Blacklist.h" -#include "MyXml.h" - -#include <iostream> -#include <fstream> -#include <vector> - -#include "Poco/RegularExpression.h" -#include "Poco/SharedPtr.h" -#include "Poco/Exception.h" -#include "Poco/URI.h" -#include "Poco/Net/HTTPRequest.h" -#include "Poco/Util/Application.h" - -using Poco::RegularExpression; -using Poco::SharedPtr; -using Poco::Net::HTTPRequest; -using Poco::Util::Application; -using namespace std; - -class Options; -class Database; - -class Filter - /// This class will run all test to find out if the URLs are appropriate or - /// not. It is done by initially loading the blacklists, and then testing - /// each URL against them. When keywords are found within the given text, - /// Filter thries to determine how strong the match is. This means every - /// match will be given an individual strength to indicate how likely it is - /// to be an inappropriate site. (The higher number, the more likely). - /// - /// The URLs are filtered instantly, rather than at report time, as done in - /// several previous versions. -{ - public: - Filter(); - Filter(string blacklistFile); - /// Load the Filter, given the path to the blacklist. This is - /// especially useful when improvign the algorithms. - Filter(Options* options, Database* db); - /// Load the Filter, given both the options and database. - bool isMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); - /// This is the method used for running a complete scan on the URL. - /// The URL is given as a HTTPRequest, and the result with a formatted - /// URL, strength etc. is returned in blacklistMatch. The return value - /// is true if the URL is considered suspicious, otherwise false. - bool isUrlMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); - bool isTokenMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); - void loadBlacklist(string path); - void loadBlacklist(Options* options, Database* db); - - private: - Blacklist _blacklist; - Extensions _extensions; - SharedPtr<RegularExpression> _splitToken; - SharedPtr<RegularExpression> _splitExtension; - SharedPtr<RegularExpression> _wordDelimiter; - - string abbrUrl(string boldUrl); - void setRegexps(); - float getExtensionFactor(string url); - -}; - -#include "Database.h" -#include "Request.h" -#include "Options.h" -#endif // FILTER_H Copied: releases/3.0.1/include/Filter.h (from rev 260, trunk/include/Filter.h) =================================================================== --- releases/3.0.1/include/Filter.h (rev 0) +++ releases/3.0.1/include/Filter.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,99 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: Filter +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <Filter> determines whether the URLs are appropriate or not. + +#ifndef FILTER_H +#define FILTER_H + +#include "Blacklist.h" +#include "MyXml.h" + +#include <iostream> +#include <fstream> +#include <vector> + +#include "Poco/RegularExpression.h" +#include "Poco/SharedPtr.h" +#include "Poco/Exception.h" +#include "Poco/URI.h" +#include "Poco/Net/HTTPRequest.h" +#include "Poco/Util/Application.h" + +using Poco::RegularExpression; +using Poco::SharedPtr; +using Poco::Net::HTTPRequest; +using Poco::Util::Application; +using namespace std; + +class Options; +class Database; + +class Filter + /// This class will run all test to find out if the URLs are appropriate or + /// not. It is done by initially loading the blacklists, and then testing + /// each URL against them. When keywords are found within the given text, + /// Filter thries to determine how strong the match is. This means every + /// match will be given an individual strength to indicate how likely it is + /// to be an inappropriate site. (The higher number, the more likely). + /// + /// The URLs are filtered instantly, rather than at report time, as done in + /// several previous versions. +{ + public: + Filter(); + Filter(string blacklistFile); + /// Load the Filter, given the path to the blacklist. This is + /// especially useful when improvign the algorithms. + + Filter(Options* options, Database* db); + /// Load the Filter, given both the options and database. + + bool isMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); + /// This is the method used for running a complete scan on the URL. + /// The URL is given as a HTTPRequest, and the result with a formatted + /// URL, strength etc. is returned in blacklistMatch. The return value + /// is true if the URL is considered suspicious, otherwise false. + + bool isUrlMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); + + bool isTokenMatch(HTTPRequest& request, BlacklistMatch& blacklistMatch); + + void loadBlacklist(string path); + + void loadBlacklist(Options* options, Database* db); + + private: + Blacklist _blacklist; + Extensions _extensions; + SharedPtr<RegularExpression> _splitToken; + SharedPtr<RegularExpression> _splitExtension; + SharedPtr<RegularExpression> _wordDelimiter; + + string abbrUrl(string boldUrl); + void setRegexps(); + float getExtensionFactor(string url); + +}; + +#include "Database.h" +#include "Request.h" +#include "Options.h" +#endif // FILTER_H Deleted: releases/3.0.1/include/History.h =================================================================== --- trunk/include/History.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/History.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,187 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: History -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <History> is able to store all visited URLs and useful additional info - - - -#ifndef HISTORY_H -#define HISTORY_H - -#include "Poco/Timestamp.h" -#include "Poco/Data/Common.h" -#include "Poco/Data/Connector.h" -#include "Poco/Data/SQLite/Connector.h" -#include "Poco/DateTimeFormatter.h" - -#include <iostream> -#include <vector> - -using Poco::Timestamp; -using Poco::DateTimeFormatter; -using namespace Poco::Data; -using namespace std; - -struct HistoryRow - /// A struct that contains each row of the urls table. It is actually nothing - /// more than the URL split up in hostname and path, as well as the time, - /// divided in time, date and datetime. -{ - public: - string hostname; - string path; - Timestamp date; - Timestamp time; - Timestamp dateTime; -}; - - -class History - /// The History class is especially important to understand if you're writing - /// a report plugin. When running Database.getHistory(), you'll get the return - /// as a History object. It is designed to be easy to iterate through and - /// holds every URL with some additional info about it. - /// - /// The following is an example of how the History object may be used to - /// iterate through: - /// History history = _db->getHistory(); - /// while (history.hasMore()) { - /// _body <<history.getDateTime("%d/%m - %H:%M:%S")) - /// <<" - " <<history.getUrl() <<endl; - /// history.next(); - /// } - /// - /// Pay extra attention to how the History is recieved from the database, - /// used in a while loop, and the next object is accessed by the next() - /// method. - /// - /// You may also access information about any row in the History object - /// if you have its index. You can get the index of the current URL with - /// the method getIndex(). - -{ - public: - History(); - virtual ~History(); - void setRows(vector<HistoryRow, allocator<HistoryRow> > &rows); - /// This method is used to add all the HistoryRows to History. - void addRow(HistoryRow); - /// Use this method to only add a single HistoryRow. - int getIndex() const; - /// Returns the index of the current row. The index may be used to - /// access a row at any time, without having to use next() and - /// previous(). - string getHostname() const; - /// Returns the current hostname as a string. - string getHostname(int index) const; - /// Returns the hostname of index as a string. - string getPath() const; - /// Returns the current path as a string. In the URL - /// "www.netresponsibility.com/dev/docs", "/dev/docs" is the path. - string getPath(int index) const; - /// Same as getPath() but for the given index. - string getUrl() const; - /// Returns the current URL (both hostname and path) as a string. - string getUrl(int index) const; - /// Returns the URL of index as a string. - string getDateTime(string fmt) const; - /// Returns a formatted date and time as a string. fmt is the format - /// you wish to return. See Poco::DateTimeFormatter::format() for - /// more information on exactly how the format may be written. - string getDateTime(string fmt, int index) const; - Timestamp getDate() const; - /// Get the current date as a Timestamp. - Timestamp getDate(int index) const; - /// Get the date of index as a Timestamp. - Timestamp getTime() const; - /// Get the current time as a Timestamp. - Timestamp getTime(int index) const; - /// Get the time of index as a Timestamp. - Timestamp getDateTime() const; - /// Get the current date and time as a Timestamp. - Timestamp getDateTime(int index) const; - /// Get the date and time of index as a Timestamp. - - bool hasMore() const; - /// Returns true if there are any more rows to iterate through. Very - /// useful to put inside a while condition e.g. - void previous(); - /// Go to the previous row. - void next(); - /// Go to the next row. Useful to put in the end of a while loop. - // Also add the ++ and -- operators to History - - protected: - vector<HistoryRow, allocator<HistoryRow> > _historyRows; - int _index; -}; - - -namespace Poco { -namespace Data { - -template <> -class TypeHandler<class HistoryRow> -{ -public: - static size_t size() - { - return 4; // we handle four columns of the Table! - } - - static void bind(size_t pos, const HistoryRow& obj, AbstractBinder* pBinder) - { - poco_assert_dbg (pBinder != 0); - TypeHandler<string>::bind(pos++, obj.hostname, pBinder); - TypeHandler<string>::bind(pos++, obj.path, pBinder); - TypeHandler<Int64>::bind(pos++, obj.date.epochTime(), pBinder); - TypeHandler<Int64>::bind(pos++, obj.time.epochTime(), pBinder); - } - - static void prepare(size_t pos, const HistoryRow& obj, - AbstractPreparation* pPrepare) - { - poco_assert_dbg (pBinder != 0); - TypeHandler<string>::prepare(pos++, obj.hostname, pPrepare); - TypeHandler<string>::prepare(pos++, obj.path, pPrepare); - TypeHandler<Int64>::prepare(pos++, obj.date.epochTime(), pPrepare); - TypeHandler<Int64>::prepare(pos++, obj.time.epochTime(), pPrepare); - } - - static void extract(size_t pos, HistoryRow& obj, - const HistoryRow& defVal, AbstractExtractor* pExt) - /// obj will contain the result, defVal contains values we should use when one column is NULL - { - poco_assert_dbg (pExt != 0); - Int64 d, t, dt; - TypeHandler<string>::extract(pos++, obj.hostname, defVal.hostname, pExt); - TypeHandler<string>::extract(pos++, obj.path, defVal.path, pExt); - TypeHandler<Int64>::extract(pos++, d, defVal.date.epochTime(), pExt); - TypeHandler<Int64>::extract(pos++, t, defVal.time.epochTime(), pExt); - dt = d + (t % 86400); - obj.date = Timestamp::fromEpochTime(d); - obj.time = Timestamp::fromEpochTime(t); - obj.dateTime = Timestamp::fromEpochTime(dt); - } -}; - -} } // namespace Poco::Data - -#endif // HISTORY_H Copied: releases/3.0.1/include/History.h (from rev 260, trunk/include/History.h) =================================================================== --- releases/3.0.1/include/History.h (rev 0) +++ releases/3.0.1/include/History.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,205 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: History +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <History> is able to store all visited URLs and useful additional info + + + +#ifndef HISTORY_H +#define HISTORY_H + +#include "Poco/Timestamp.h" +#include "Poco/Data/Common.h" +#include "Poco/Data/Connector.h" +#include "Poco/Data/SQLite/Connector.h" +#include "Poco/DateTimeFormatter.h" + +#include <iostream> +#include <vector> + +using Poco::Timestamp; +using Poco::DateTimeFormatter; +using namespace Poco::Data; +using namespace std; + +struct HistoryRow + /// A struct that contains each row of the urls table. It is actually nothing + /// more than the URL split up in hostname and path, as well as the time, + /// divided in time, date and datetime. +{ + public: + string hostname; + string path; + Timestamp date; + Timestamp time; + Timestamp dateTime; +}; + + +class History + /// The History class is especially important to understand if you're writing + /// a report plugin. When running Database.getHistory(), you'll get the return + /// as a History object. It is designed to be easy to iterate through and + /// holds every URL with some additional info about it. + /// + /// The following is an example of how the History object may be used to + /// iterate through: + /// History history = _db->getHistory(); + /// while (history.hasMore()) { + /// _body <<history.getDateTime("%d/%m - %H:%M:%S")) + /// <<" - " <<history.getUrl() <<endl; + /// history.next(); + /// } + /// + /// Pay extra attention to how the History is recieved from the database, + /// used in a while loop, and the next object is accessed by the next() + /// method. + /// + /// You may also access information about any row in the History object + /// if you have its index. You can get the index of the current URL with + /// the method getIndex(). + +{ + public: + History(); + virtual ~History(); + void setRows(vector<HistoryRow, allocator<HistoryRow> > &rows); + /// This method is used to add all the HistoryRows to History. + + void addRow(HistoryRow); + /// Use this method to only add a single HistoryRow. + + int getIndex() const; + /// Returns the index of the current row. The index may be used to + /// access a row at any time, without having to use next() and + /// previous(). + + string getHostname() const; + /// Returns the current hostname as a string. + + string getHostname(int index) const; + /// Returns the hostname of index as a string. + + string getPath() const; + /// Returns the current path as a string. In the URL + /// "www.netresponsibility.com/dev/docs", "/dev/docs" is the path. + + string getPath(int index) const; + /// Same as getPath() but for the given index. + + string getUrl() const; + /// Returns the current URL (both hostname and path) as a string. + + string getUrl(int index) const; + /// Returns the URL of index as a string. + + string getDateTime(string fmt) const; + /// Returns a formatted date and time as a string. fmt is the format + /// you wish to return. See Poco::DateTimeFormatter::format() for + /// more information on exactly how the format may be written. + + string getDateTime(string fmt, int index) const; + + Timestamp getDate() const; + /// Get the current date as a Timestamp. + + Timestamp getDate(int index) const; + /// Get the date of index as a Timestamp. + + Timestamp getTime() const; + /// Get the current time as a Timestamp. + + Timestamp getTime(int index) const; + /// Get the time of index as a Timestamp. + + Timestamp getDateTime() const; + /// Get the current date and time as a Timestamp. + + Timestamp getDateTime(int index) const; + /// Get the date and time of index as a Timestamp. + + bool hasMore() const; + /// Returns true if there are any more rows to iterate through. Very + /// useful to put inside a while condition e.g. + + void previous(); + /// Go to the previous row. + + void next(); + /// Go to the next row. Useful to put in the end of a while loop. + // Also add the ++ and -- operators to History + + protected: + vector<HistoryRow, allocator<HistoryRow> > _historyRows; + int _index; +}; + + +namespace Poco { +namespace Data { + +template <> +class TypeHandler<class HistoryRow> +{ +public: + static size_t size() + { + return 4; // we handle four columns of the Table! + } + + static void bind(size_t pos, const HistoryRow& obj, AbstractBinder* pBinder) + { + poco_assert_dbg (pBinder != 0); + TypeHandler<string>::bind(pos++, obj.hostname, pBinder); + TypeHandler<string>::bind(pos++, obj.path, pBinder); + TypeHandler<Int64>::bind(pos++, obj.date.epochTime(), pBinder); + TypeHandler<Int64>::bind(pos++, obj.time.epochTime(), pBinder); + } + + static void prepare(size_t pos, const HistoryRow& obj, + AbstractPreparation* pPrepare) + { + poco_assert_dbg (pBinder != 0); + TypeHandler<string>::prepare(pos++, obj.hostname, pPrepare); + TypeHandler<string>::prepare(pos++, obj.path, pPrepare); + TypeHandler<Int64>::prepare(pos++, obj.date.epochTime(), pPrepare); + TypeHandler<Int64>::prepare(pos++, obj.time.epochTime(), pPrepare); + } + + static void extract(size_t pos, HistoryRow& obj, + const HistoryRow& defVal, AbstractExtractor* pExt) + /// obj will contain the result, defVal contains values we should use when one column is NULL + { + poco_assert_dbg (pExt != 0); + Int64 d, t, dt; + TypeHandler<string>::extract(pos++, obj.hostname, defVal.hostname, pExt); + TypeHandler<string>::extract(pos++, obj.path, defVal.path, pExt); + TypeHandler<Int64>::extract(pos++, d, defVal.date.epochTime(), pExt); + TypeHandler<Int64>::extract(pos++, t, defVal.time.epochTime(), pExt); + dt = d + (t % 86400); + obj.date = Timestamp::fromEpochTime(d); + obj.time = Timestamp::fromEpochTime(t); + obj.dateTime = Timestamp::fromEpochTime(dt); + } +}; + +} } // namespace Poco::Data + +#endif // HISTORY_H Deleted: releases/3.0.1/include/MainApplication.h =================================================================== --- trunk/include/MainApplication.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/MainApplication.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,159 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: MainApplication -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <MainApplication> is responsibility for making Net Responsibility a -// service/daemon and handle CLI arguments, logging etc. - - - -#ifndef MAINAPPLICATION_H -#define MAINAPPLICATION_H - -#define STRINGIFY(path, file) #path #file -#define CONCAT(x, y) STRINGIFY(x, y) - -#define DEFAULT_LOGFILE CONCAT(PKGDATADIR, /messages.log) - -#include "Options.h" -#include "Database.h" -#include "Request.h" -#include "ConfigSubsystem.h" -#include "ReportSubsystem.h" -#include "SnifferSubsystem.h" - -#include "Poco/Util/Application.h" -#include "Poco/Util/ServerApplication.h" -#include "Poco/Util/Subsystem.h" -#include "Poco/Util/Option.h" -#include "Poco/Util/OptionSet.h" -#include "Poco/Util/HelpFormatter.h" -#include "Poco/DateTimeFormatter.h" -#include "Poco/Platform.h" -#include "Poco/Exception.h" -#include "Poco/Logger.h" -#include "Poco/FileChannel.h" -#include "Poco/ConsoleChannel.h" -#include "Poco/SplitterChannel.h" -#include "Poco/FormattingChannel.h" -#include "Poco/PatternFormatter.h" -#include "Poco/AutoPtr.h" -#include "Poco/Thread.h" -#include "Poco/Process.h" -#include "Poco/PipeStream.h" -#include "Poco/StreamCopier.h" -#include <iostream> -#include <sstream> - -#if defined(POCO_OS_FAMILY_UNIX) -#include "unistd.h" -#include "signal.h" -#include "Poco/SyslogChannel.h" -using Poco::SyslogChannel; -#endif - -using Poco::Logger; -using Poco::FileChannel; -using Poco::ConsoleChannel; -using Poco::SplitterChannel; -using Poco::FormattingChannel; -using Poco::PatternFormatter; -using Poco::Util::Application; -using Poco::Util::ServerApplication; -using Poco::Util::Subsystem; -using Poco::Util::Option; -using Poco::Util::OptionSet; -using Poco::Util::OptionCallback; -using Poco::Util::HelpFormatter; -using Poco::DateTimeFormatter; -using Poco::AutoPtr; -using Poco::Process; -using Poco::ProcessHandle; -using namespace std; - -class MainApplication: public ServerApplication - /// MainApplication is the skeleton of Net Responsibility. This is where all - /// Options are processed, the Database loaded, the Logger set up, the signals - /// handled and the Subsystems called. - /// - /// MainApplication is derived from Poco::Util::ServerApplication, which - /// also takes care of making the instance a daemon or service, if requested. -{ - public: - MainApplication(); - /// Default constructor. Sets some class variables and registers the - /// Subsystems that are to be invoked. - ~MainApplication(); - - static MainApplication &instance(); - /// A public static method to access this very instance from any class. - static Options &getOptions(); - /// A public static method to access the Options object from any class. - static Database &getDatabase(); - /// A public static method to access the Database from any class. - static void terminateNicely(bool deletePidfile= false); - /// Terminate Net Responsibility nicely. This unmasks all singals, - /// deleted the pidfile if told to, and tells the instance to shut down. - - protected: - void initialize(Application& self); - /// Invokes a set of methods and constructs Options and Database. - /// A short glimpse of the actual code will reveal pretty much what it - /// does. - void uninitialize(); - void setupLogger(); - /// Sets up the Logger. This is done differently on on different - /// platforms. Unix platforms will talk to syslog by default. If the - /// instance is not running as a daemon/service, all messages will be - /// sent to stdout instead. If a specific logfile is specified, the - /// messages will go there. - void defineOptions(OptionSet& options); - /// Defines all arguments that are accepted. These must be entered - /// the Unix style: --argument=value or -avalue. - void handleHelp(const string& name, const string& value); - /// This method is called if the --help argument is specified. It will - /// only print out all available arguments with displayHelp() and exit. - void setOption(const string& name, const string& value); - /// The default way that Poco handles configurations is not ideal for - /// our purposes. It's way to flexible for accountability softwares. - /// Therefor the options are processed in Options. However, some global - /// values are specified in the default config system. This is because - /// they're easliy reached from any class. setOption() is used to store - /// these global values. - void displayHelp(); - void checkForRoot(); - /// Checks if the user who started the program is having enough - /// priviligues. In Linux you'll need to be running Net Responsibility - /// as root. - static void signalHandler(int sig = -1); - /// The signal handler. Masks all possible signals, and catches them - /// properly, by logging the shutdown in the Database. - int main(const vector<string>& args); - /// The main method invoked after the Subsystems are run. At this - /// moment it is more or less redundent, since all the actual code - /// is run inside the Subsystems. - - private: - bool _helpRequested; - static MainApplication *_instance; - Options *_options; - Database *_database; -}; - -#endif // MAINAPPLICATION_H Copied: releases/3.0.1/include/MainApplication.h (from rev 260, trunk/include/MainApplication.h) =================================================================== --- releases/3.0.1/include/MainApplication.h (rev 0) +++ releases/3.0.1/include/MainApplication.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,172 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: MainApplication +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <MainApplication> is responsibility for making Net Responsibility a +// service/daemon and handle CLI arguments, logging etc. + + + +#ifndef MAINAPPLICATION_H +#define MAINAPPLICATION_H + +#define STRINGIFY(path, file) #path #file +#define CONCAT(x, y) STRINGIFY(x, y) + +#define DEFAULT_LOGFILE CONCAT(PKGDATADIR, /messages.log) + +#include "Options.h" +#include "Database.h" +#include "Request.h" +#include "ConfigSubsystem.h" +#include "ReportSubsystem.h" +#include "SnifferSubsystem.h" + +#include "Poco/Util/Application.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Subsystem.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/DateTimeFormatter.h" +#include "Poco/Platform.h" +#include "Poco/Exception.h" +#include "Poco/Logger.h" +#include "Poco/FileChannel.h" +#include "Poco/ConsoleChannel.h" +#include "Poco/SplitterChannel.h" +#include "Poco/FormattingChannel.h" +#include "Poco/PatternFormatter.h" +#include "Poco/AutoPtr.h" +#include "Poco/Thread.h" +#include "Poco/Process.h" +#include "Poco/PipeStream.h" +#include "Poco/StreamCopier.h" +#include <iostream> +#include <sstream> + +#if defined(POCO_OS_FAMILY_UNIX) +#include "unistd.h" +#include "signal.h" +#include "Poco/SyslogChannel.h" +using Poco::SyslogChannel; +#endif + +using Poco::Logger; +using Poco::FileChannel; +using Poco::ConsoleChannel; +using Poco::SplitterChannel; +using Poco::FormattingChannel; +using Poco::PatternFormatter; +using Poco::Util::Application; +using Poco::Util::ServerApplication; +using Poco::Util::Subsystem; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::OptionCallback; +using Poco::Util::HelpFormatter; +using Poco::DateTimeFormatter; +using Poco::AutoPtr; +using Poco::Process; +using Poco::ProcessHandle; +using namespace std; + +class MainApplication: public ServerApplication + /// MainApplication is the skeleton of Net Responsibility. This is where all + /// Options are processed, the Database loaded, the Logger set up, the signals + /// handled and the Subsystems called. + /// + /// MainApplication is derived from Poco::Util::ServerApplication, which + /// also takes care of making the instance a daemon or service, if requested. +{ + public: + MainApplication(); + /// Default constructor. Sets some class variables and registers the + /// Subsystems that are to be invoked. + + ~MainApplication(); + + static MainApplication &instance(); + /// A public static method to access this very instance from any class. + + static Options &getOptions(); + /// A public static method to access the Options object from any class. + + static Database &getDatabase(); + /// A public static method to access the Database from any class. + + static void terminateNicely(bool deletePidfile= false); + /// Terminate Net Responsibility nicely. This unmasks all singals, + /// deleted the pidfile if told to, and tells the instance to shut down. + + protected: + void initialize(Application& self); + /// Invokes a set of methods and constructs Options and Database. + /// A short glimpse of the actual code will reveal pretty much what it + /// does. + + void uninitialize(); + + void setupLogger(); + /// Sets up the Logger. This is done differently on on different + /// platforms. Unix platforms will talk to syslog by default. If the + /// instance is not running as a daemon/service, all messages will be + /// sent to stdout instead. If a specific logfile is specified, the + /// messages will go there. + + void defineOptions(OptionSet& options); + /// Defines all arguments that are accepted. These must be entered + /// the Unix style: --argument=value or -avalue. + + void handleHelp(const string& name, const string& value); + /// This method is called if the --help argument is specified. It will + /// only print out all available arguments with displayHelp() and exit. + + void setOption(const string& name, const string& value); + /// The default way that Poco handles configurations is not ideal for + /// our purposes. It's way to flexible for accountability softwares. + /// Therefor the options are processed in Options. However, some global + /// values are specified in the default config system. This is because + /// they're easliy reached from any class. setOption() is used to store + /// these global values. + + void displayHelp(); + + void checkForRoot(); + /// Checks if the user who started the program is having enough + /// priviligues. In Linux you'll need to be running Net Responsibility + /// as root. + + static void signalHandler(int sig = -1); + /// The signal handler. Masks all possible signals, and catches them + /// properly, by logging the shutdown in the Database. + + int main(const vector<string>& args); + /// The main method invoked after the Subsystems are run. At this + /// moment it is more or less redundent, since all the actual code + /// is run inside the Subsystems. + + private: + bool _helpRequested; + static MainApplication *_instance; + Options *_options; + Database *_database; +}; + +#endif // MAINAPPLICATION_H Deleted: releases/3.0.1/include/MyXml.h =================================================================== --- trunk/include/MyXml.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/MyXml.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,68 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: MyXml -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <MyXml> adds extra functionality to XMLConfiguration - - - -#ifndef MYXML_H -#define MYXML_H - -#include <iostream> -#include <vector> -#include <map> -#include "Poco/Util/XMLConfiguration.h" -#include "Poco/Util/Application.h" -#include "Poco/RegularExpression.h" -#include "Poco/AutoPtr.h" -#include "Poco/Exception.h" -#include "Poco/Logger.h" - -#include "Blacklist.h" - -using Poco::AutoPtr; -using Poco::Util::XMLConfiguration; -using Poco::Util::Application; -using Poco::RegularExpression; -using Poco::Logger; -using namespace std; - -class MyXml : public XMLConfiguration - /// MyXml inherits XMLConfiguration and adds some extra functionality to it. - /// It's most important task is to extract and compile the blacklists, as - /// well as the txtfile. -{ - public: - MyXml(); - MyXml(string path); - /// Load the XML file found at path. - vector<string> getStringVector(string key) const; - /// Returns a string vector with the values found at "key". - map<string, string> getStringMap() const; - /// Returns a map<string, string> with all values found in the document. - Blacklist getBlacklist(); - /// Extracts and compiles the keywords in the blacklist file. - Extensions getExtensions(); - /// Extracts every Extension shipped with the blacklists. - protected: - Logger* _logger; -}; - -#endif // MYXML_H Copied: releases/3.0.1/include/MyXml.h (from rev 260, trunk/include/MyXml.h) =================================================================== --- releases/3.0.1/include/MyXml.h (rev 0) +++ releases/3.0.1/include/MyXml.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,74 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: MyXml +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <MyXml> adds extra functionality to XMLConfiguration + + + +#ifndef MYXML_H +#define MYXML_H + +#include <iostream> +#include <vector> +#include <map> +#include "Poco/Util/XMLConfiguration.h" +#include "Poco/Util/Application.h" +#include "Poco/RegularExpression.h" +#include "Poco/AutoPtr.h" +#include "Poco/Exception.h" +#include "Poco/Logger.h" + +#include "Blacklist.h" + +using Poco::AutoPtr; +using Poco::Util::XMLConfiguration; +using Poco::Util::Application; +using Poco::RegularExpression; +using Poco::Logger; +using namespace std; + +class MyXml : public XMLConfiguration + /// MyXml inherits XMLConfiguration and adds some extra functionality to it. + /// It's most important task is to extract and compile the blacklists, as + /// well as the txtfile. +{ + public: + MyXml(); + + MyXml(string path); + /// Load the XML file found at path. + + vector<string> getStringVector(string key) const; + /// Returns a string vector with the values found at "key". + + map<string, string> getStringMap() const; + /// Returns a map<string, string> with all values found in the document. + + Blacklist getBlacklist(); + /// Extracts and compiles the keywords in the blacklist file. + + Extensions getExtensions(); + /// Extracts every Extension shipped with the blacklists. + + protected: + Logger* _logger; +}; + +#endif // MYXML_H Deleted: releases/3.0.1/include/Options.h =================================================================== --- trunk/include/Options.h 2012-03-31 21:40:31 UTC (rev 243) +++ releases/3.0.1/include/Options.h 2012-04-13 21:28:36 UTC (rev 267) @@ -1,171 +0,0 @@ -// -// Library: Net Responsibility -// Package: Core -// Module: Options -// -// This file is part of Net Responsibility. -// -// Net Responsibility 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 2 of the License, or -// (at your option) any later version. -// -// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. -// -// <Options> stores the configurations and other useful variables - - - -#ifndef OPTIONS_H -#define OPTIONS_H - -#include <iostream> -#include <stdio.h> -#include <vector> -#include <map> - -#include "MyXml.h" -#include "Request.h" - -#include "Poco/Exception.h" -#include "Poco/Environment.h" -#include "Poco/Util/Application.h" -#include "Poco/Logger.h" - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#define STRINGIFY(path, file) #path #file -#define CONCAT(x, y) STRINGIFY(x, y) - -#ifndef DATABASEDIR -#define DATABASEDIR /var/log -#endif - -#ifndef PIDDIR -#define PIDDIR /var/run -#endif - -#define DATABASEFILE CONCAT(DATABASEDIR, /net-responsibility.db) -#define PIDFILE CONCAT(PIDDIR, /net-responsibility.pid) -#define CONFIGFILE CONCAT(PKGDATADIR, /config.xml) -#define BLACKLISTFILE CONCAT(PKGDATADIR, /blacklist.xml) -#define TXTFILE CONCAT(PKGDATADIR, /txt.xml) -#define REPORT_DIR CONCAT(PKGDATADIR, /reports/) -#define REPORT_MODULE CONCAT(PKGLIBDIR, /report.so) //Make cross-platform -#define SERVER "www.netresponsibility.com" - -#ifndef VERSION -#define VERSION "0" -#endif //VERSION - -using Poco::Logger; -using Poco::Util::Application; -using namespace std; - -class MainApplication; -class Bypasses; - -class Options - /// Poco::Util::ServerApplication is already handling configurations and - /// arguments, but it's way too flexible for us. This is where the Options - /// class comes in. It processes the config and txt files, and stores all - /// usable values in class members. -{ - public: - Options(); - Options(int argc, char* argv[]); - /// Deprecated, use the default contructor Options() instead. - virtual ~Options(); - - bool doSaveHistory() const; - bool doSendImprovementData() const; - /// Returns true if we're supposed to send the improvement data to - /// the server. - bool doCompressAttachedReport() const; - /// Returns true if the report should be zipped. - bool isReportPart(string part) const; - /// Returns true if the given part should be included in the regular report. - bool isAttachedReportPart(string part) const; - /// Returns true if the given part should be included in the attached report. - string getName() const; - /// Returns the name of the user. This name will be used as sender of - /// the reports. - string getUsername() const; - /// Returns the username, used to communicate with the server. - string getEmailFrom() const; - /// Returns the user's email address. This will be specified as reply-to - /// in the report header, so that accountability partners will reply - /// directly to the user instead of re...@ne.... - string getConfigfile() const; - /// The path to the local config file. - string getServer() const; - /// The server, usually www.netresponsibility.com - string getMacAddress() const; - /// Returns the computer's MAC Address. This is used when communicating - /// with the server. - string getVersion() const; - /// The current version of Net Responsibility. - string getDatabasefile() const; - /// The path to the database. - string getPidfile() const; - /// The path to the pidfile. - string getBlacklistFile() const; - /// The path to the local blacklist file. - string getTxt(string) const; - /// The path to the local txt file. - string getReportModule() const; - /// The path to the report module. - vector<string> getEmailTo() const; - /// Returns all emails to send reports to. - vector<string> getReportParts() const; - /// Returns the report parts. - vector<string> getAttachedReportParts() const; - /// Returns the attached report parts. - int getReportFrequency() const; - /// Returns the number of days between scheduled reports. - int getReportStrengthThreshold() const; - /// Returns the report strength threshold. - Bypasses &getInitBypasses() const; - void setUsername(string); - void loadConfigfile(); - /// Load all options from the local configfile, or download a new one - /// if it's corrupt. - - private: - string _databasefile; - string _pidfile; - string _configfile; - string _txtfile; - string _username; - string _name; - string _emailFrom; - string _blacklistFile; - string _version; - string _server; - string _reportModule; - bool _saveHistory; - bool _sendImprovementData; - bool _compressAttachedReport; - vector<string> _reportParts; - vector<string> _attachedReportParts; - vector<string> _emailTo; - map<string, string> _txt; - int _reportFrequency; - int _reportStrengthThreshold; - Logger *_logger; - Bypasses *_initBypasses; - - void loadDefaultValues(); - void loadTxt(); -}; - -#include "Bypasses.h" -#endif // OPTIONS_H Copied: releases/3.0.1/include/Options.h (from rev 260, trunk/include/Options.h) =================================================================== --- releases/3.0.1/include/Options.h (rev 0) +++ releases/3.0.1/include/Options.h 2012-04-13 21:28:36 UTC (rev 267) @@ -0,0 +1,197 @@ +// +// Library: Net Responsibility +// Package: Core +// Module: Options +// +// This file is part of Net Responsibility. +// +// Net Responsibility 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 2 of the License, or +// (at your option) any later version. +// +// Net Responsibility 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 Net Responsibility. If not, see <http://www.gnu.org/licenses/>. +// +// <Options> stores the configurations and other useful variables + + + +#ifndef OPTIONS_H +#define OPTIONS_H + +#include <iostream> +#include <stdio.h> +#include <vector> +#include <map> + +#include "MyXml.h" +#include "Request.h" + +#include "Poco/Ex... [truncated message content] |
From: <dus...@us...> - 2012-04-12 03:48:04
|
Revision: 266 http://responsibility.svn.sourceforge.net/responsibility/?rev=266&view=rev Author: dustsource Date: 2012-04-12 03:47:57 +0000 (Thu, 12 Apr 2012) Log Message: ----------- Minor edits and additions to "Documentation" page, r265. Revision Links: -------------- http://responsibility.svn.sourceforge.net/responsibility/?rev=265&view=rev Modified Paths: -------------- documentation/pages/5004-Documentation.page Modified: documentation/pages/5004-Documentation.page =================================================================== --- documentation/pages/5004-Documentation.page 2012-04-11 05:51:47 UTC (rev 265) +++ documentation/pages/5004-Documentation.page 2012-04-12 03:47:57 UTC (rev 266) @@ -1,39 +1,38 @@ Documentation A50NR_DevIntro -!!!The need of good documentation +!!!The need for good documentation -Good documentation is crucial for all kind of software. If you're having a -hard time installing and getting the software working, and there's no good -documentation, you'll just give up and go looking for another software, right? +Good documentation is crucial for all kinds of software. If you're having a +hard time installing and getting a program working, and there's no good +documentation, you'll just give up and go looking for a different program, right? On the other hand, if there is good documentation available, you'll likely -manage to set it up and everyone is happy. +manage to set it up and then everyone is happy. -However open source projects tends to lack good documentation, since the +Unfortunately, open source projects tend to lack good documentation, since the programmers are more concerned about the coding. It is also often presumed that the users are comfortable with compiling and have a basic understanding about programming. This is certainly not always the case. -It is actually even better if the documentation writer is <*not the programmer*>. -The more involved you are in the nuts and bolts, the more likely it is that you -neglect important questions that may seem obvious. The ideal documentation -author would be someone not involved in the actual programming, but still having -an ongoing dialogue with those who are. <*However anyone are able to contribute*>, -the goal is to create a documentation as clear and up to date as possible, and +It is actually even better if the creator of the documentation is <*not the programmer*>. +The more involved one is in the nuts and bolts, the more likely it is that important questions will be neglected because they may seem obvious. The ideal documentation +author is often someone not involved in the actual programming, but who still has +an ongoing dialogue with those who are. <*However, anyone is welcome to contribute*>, +since the goal is to create documentation that is as clear and up-to-date as possible, and of course we'd like your help! -!!!Get going +!!!Getting started -Of course you may contact us and say something like "I think you should change +Of course, you may contact us and say something like "I think you should change the words 'blah blah blah' in paragraph 3 in the page called 'Source Code Management', -to 'losum ipsum'." We'll take care of it from there. Even better would be if you -followed these instructions, which will make it easier for all of us in the +to 'losum ipsum'." We can take care of it from there. It would be even better though if you +followed these instructions, since this will make it easier for all of us in the long run. -The documentation is handled like the rest of the source code, by the version -control system Subversion. To get the most up to date version of it, use this -command from a terminal: +The documentation, like the rest of the source code, is handled by the version +control system Subversion. To get the most up-to-date version of the documentation, run this +command in a terminal window: svn checkout https://responsibility.svn.sourceforge.net/svnroot/responsibility/documentation/ ---- @@ -43,20 +42,18 @@ is also described how to commit changes. The same technique applies to the documentation. -When you've executed the "svn checkout" command, you'll have a new folder called -<*documentation*>. It consists of several subfolders. To describe them very -shortly: +When you execute the "svn checkout" command, it will create a new folder called +<*documentation*> in whatever directory (folder) you were in when you ran the command. For many systems, this is the 'home' folder by default. The <*documentation*> folder contains several subfolders, described briefly as follows: -cfg - Config files used when generating the documentation. +cfg - Config (configuration) files (with .xml extension) used when generating the documentation from the page files (with .page extension). -doc - The generated documentation ends up here +doc - When the documentation is 'generated' from the page files, it creates HTML files here that can then be opened with a web browser to see how they will appear to the user. -pages - The raw pages that will be used to generate the documentation. +pages - The raw pages where all writing and editing happens, and that will then be used to generate the documentation. -resources - Images, stylesheets etc. that is included in the documentation. +resources - Images, stylesheets etc. that are used in generating the documentation. -You'll probably want to focus on the pages, since that's where all the editing -happens. +If your primary goal is creating and editing documentation, then you will only need to work with the files in the 'pages' folder, which can be opened and edited in your choice of text editor. However, you may also want to set up your system to generate documents and then access the files in the 'doc' folder to see how the pages you are working on will appear to the user. !!!Guidelines @@ -64,24 +61,24 @@ !!Syntax Once you get going the syntax will be pretty easy to understand. The first two -lines in the document is the title and the category. The title should explain -shortly what the page is all about. The category must follow the guidelines -described above. +lines in the document contain the title and the category. The title should explain +briefly what the page is all about. The category must follow the guidelines +described below. -Next try to divide the page into smaller sections (depending on the size of +Next you can divide the page into smaller sections (depending on the size, of course). Each section should have a large heading (<{!!!Large heading}>), and may also contain smaller headings if appropriate (<{!!Medium heading, !Small heading}>). The headings will also be displayed on top of the page, and serve as a table of -contents. Chose names here carefully. +contents. Choose names here carefully. The paragraphs are divided by blank lines. More examples on how to add links, -images, bold, italic text etc. will be found in the file -<*documentation/pages/samplePage.txt*>. +images, bold, italic text, etc. can be found in the file +<*documentation/pages/samplePage.txt*> or by looking in some of the other 'page' files that include whatever you are wanting to use. !!Bold vs. Italic -Be careful with bold text. If you want to emphasize something, <*please do so in +Be careful with using bold text. If you want to emphasize something, <*please do so in italic*>. This is more natural for the eyes, but the point is still clear. In some cases you may find it more appropriate to use bold text, and it's not forbidden, but be careful with it. @@ -89,8 +86,8 @@ !!Categories -All pages are grouped into categories. The names of the categories are to be -found in the config files. There is a section that looks like this: +All pages are grouped into categories. The names of the categories can be +found in the config files (in the 'cfg' folder), in a section that looks like this: <A01NR_Appetizer>Appetizer</A01NR_Appetizer> <A03NR_Install>Installation and Configuration</A03NR_Install> @@ -100,36 +97,36 @@ ---- You may find the tag names awkward at first, but there is a reason they're -named like this. We want to separate our pages from the POCO guides, and we -want them to show up in the correct order. The beginning A is to put it above -the POCO guides, and because XML doesn't allow us to use a number first. +named like this. We want to separate the Net Responsibility (NR) pages from the POCO-related pages, and we +want them to show up in the correct order. The beginning 'A' is to put it above +the POCO-related pages, and because XML doesn't allow us to use a number first. -The numbers used in the category abbreviation are given a little space between -to make sure there's room to add more categories later on. Every category less -than 50 is considered to be user documentation, and will be found on the regular -website, as well as shipped with the source code tarballs. All categories -from 50 and above is considered to be usable for developers only. These guides -may include a geekier language, and one can take more knowledge for granted. -They are only displayed in the +The numbers used in the category abbreviations have a little gap between them +to make sure there's room to add more categories later on if we want. All categories with a number less +than 50 are considered to be user documentation, and will be found on the regular +website, as well as shipped with the source code tarballs. All categories with a number +of 50 and above are considered to be documentation for developers only. These pages +can include more technical (i.e. 'geekier') language, and writers can take more knowledge for granted. +These pages will only be displayed in the [[http://www.netresponsibility.com/dev/docs/ Developers Documentation]]. -NR in the category name only makes it clear that this is part of the Net +'NR' in the category name just makes it clear that this is part of the Net Responsibility documentation. -Everything right of the underscore is only an abbreviation of the full category -name. It must be obvious which it's supposed to abbreviate. +Everything to the right of the underscore is just an abbreviation of the full category +name. It needs to be obvious what it's supposed to abbreviate. !!Filenames The filenames must follow a certain pattern, like this page that's named -5004-Documentation.page. The first two digits are the category number. Since -this page is a part of A50NR_DevIntro, the number is 50. +'5004-Documentation.page'. The first two digits are the category number. Since +this page is a part of 'A50NR_DevIntro', the number is '50'. -The next two digits makes clear which place the guide should have inside the +The next two digits make it clear what place the page should have in the ordering of pages inside the category. -After the dash comes only an abbreviation of the title. The same thing goes here -as with the category abbreviation explained above, it must be obvious which +After the dash comes an abbreviation of the title. The same thing applies here +as with the category abbreviation explained above -- it needs to be obvious which title it abbreviates, so one can easily find the right file to edit. @@ -137,12 +134,17 @@ Note that <*you may contribute to the documentation without generating it*>. -The documentation is generated with a utility called PocoDoc. To be able to use -it, you'll need to compile it together with the rest of POCO. Do so by extracting -the latest version of POCO, open a terminal and place yourself in the POCO folder. -Next run the following commands to compile POCO, download and compile PocoDoc and -CppParser, install everything. +The documentation is generated (i.e., converted into HTML, making it viewable in a web browser) with a utility called PocoDoc. To be able to use +it, you'll need to compile it together with the rest of POCO. To do this, first extract +the latest version of POCO (the <*basic edition*> is okay to use), putting its contents in a folder of your choice. Then you need to go to that folder, open the file called 'components' in a text editor and add the following two lines to it: + CppParser + PocoDoc +---- + +Once you have done this, save the file. Then open a terminal window and use the <*cd*> command to put yourself in the folder where you put the extracted POCO file contents earlier. For instance, if you put the POCO files in <*/home/name/poco*> then you would use the command <*cd /home/name/poco*> to enter that folder. Once you are in the folder where you put the POCO files, run the following commands to compile POCO, download and compile PocoDoc and +CppParser, and install everything. + export POCO_BASE=$(pwd) svn checkout https://poco.svn.sourceforge.net/svnroot/poco/sandbox/PocoDoc/ ./PocoDoc svn checkout https://poco.svn.sourceforge.net/svnroot/poco/sandbox/CppParser/ ./CppParser @@ -153,18 +155,23 @@ make install ---- -Make sure the last step, make install, is done as root. +Make sure the last command <*make install*> is run as 'root'. In Ubuntu/Debian this means using <*sudo*> and running the command as <*sudo make install*> . Other Linux systems might use <*su*> in the same way. The main thing is that you need to run the command as 'root', however your particular system handles that. -When you've successfully compiled and installed PocoDoc, you may use the -./generate script in the documentation folder. First open it in an editor -and change the three variables, POCO_BASE, DOC_BASE and NR_BASE. Once that's -done you may run the script like this: +Once you've successfully compiled and installed PocoDoc, you may use the +./generate script in the 'documentation' folder to generate documents from the 'page' files. First though, you'll need to open the script file in a text editor +and change the three variables, POCO_BASE, DOC_BASE and NR_BASE, according to wherever you've put the POCO files, the documentation files, and the Net Responsibility files. Once that's +done you can use a terminal window and enter the 'documentation' folder (using the <*cd*> command as shown above) and run the script with the following command: ./generate [cfg file] ---- Where [cfg file] is the name of the config file to use, excluding the file ending. -To use cfg/DevDocs.xml, just run +For instance, to use cfg/DevDocs.xml, just run ./generate DevDocs ---- + +Once you've successfully run the script, you should find the HTML files that were generated in the 'doc' folder, and can open them in a web browser to see what they look like. If you only want to generate documents from 'page' files (it will take less time to run the script, and may be all you need), you can use the 'PagesOnly' config file instead of 'DevDocs' when running the script. + +!!!Troubleshooting +If you are having problems with getting set up to help contribute to the documentation, please [[mailto:res...@li... let us know]], and we'll do our best to help you figure things out. This dialogue may also help us know how we can improve the information and instructions on this page. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-11 05:51:53
|
Revision: 265 http://responsibility.svn.sourceforge.net/responsibility/?rev=265&view=rev Author: roggan87 Date: 2012-04-11 05:51:47 +0000 (Wed, 11 Apr 2012) Log Message: ----------- PagesOnly is a config file for PocoDoc that only generates the pages/guides. Added Paths: ----------- documentation/cfg/PagesOnly.xml Added: documentation/cfg/PagesOnly.xml =================================================================== --- documentation/cfg/PagesOnly.xml (rev 0) +++ documentation/cfg/PagesOnly.xml 2012-04-11 05:51:47 UTC (rev 265) @@ -0,0 +1,103 @@ +<AppConfig> + <PocoBase>${system.env.POCO_BASE}</PocoBase> + <NRBase>${system.env.NR_BASE}</NRBase> + <DocBase>${system.env.DOC_BASE}</DocBase> + <PocoDoc> + <files> + <include> + + </include> + </files> + <pages> + ${DocBase}/pages/*.page, + ${PocoBase}/doc/*.page, + ${PocoBase}/Data/doc/*.page, + ${PocoBase}/Zip/doc/*.page, + </pages> + <resources> + ${DocBase}/resources/css, + ${DocBase}/resources/images, + ${DocBase}/resources/index.html, + ${DocBase}/resources/welcome.thtml, + ${DocBase}/resources/pageIndex.thtml, + </resources> + <compiler> + <exec>g++</exec> + <options> + -E, + -C + </options> + <path></path> + <usePipe>true</usePipe> + </compiler> + <output>${DocBase}/doc/${PocoDoc.version}-PagesOnly</output> + <language>EN</language> + <charset>utf-8</charset> + <software>Net Responsibility</software> + <version>3.0.1</version> + <company>Net Responsibility Team</company> + <companyURI>http://www.netresponsibility.com/</companyURI> + <licenseURI>http://www.gnu.org/licenses/gpl-2.0.html</licenseURI> + </PocoDoc> + <Translations> + <EN> + <All_Base_Classes>All Base Classes</All_Base_Classes> + <All_Symbols>All Symbols</All_Symbols> + <Anonymous>Anonymous</Anonymous> + <Constructors>Constructors</Constructors> + <Class>Class</Class> + <Deprecated>Deprecated</Deprecated> + <Description>Description</Description> + <Destructor>Destructor</Destructor> + <Direct_Base_Classes>Direct Base Classes</Direct_Base_Classes> + <Enumerations>Enumerations</Enumerations> + <Functions>Functions</Functions> + <Header>Header</Header> + <iff>if and only if</iff> + <Inheritance>Inheritance</Inheritance> + <Inherited_Functions>Inherited Functions</Inherited_Functions> + <is_deprecated>is deprecated and should no longer be used</is_deprecated> + <Known_Derived_Classes>Known Derived Classes</Known_Derived_Classes> + <Library>Library</Library> + <License>License</License> + <Member_Functions>Member Functions</Member_Functions> + <Member_Summary>Member Summary</Member_Summary> + <more>more...</more> + <Namespaces>Namespaces</Namespaces> + <Namespace>Namespace</Namespace> + <Nested_Classes>Nested Classes</Nested_Classes> + <Package>Package</Package> + <Packages>Packages</Packages> + <Package_Index>Package Index</Package_Index> + <See_also>See also</See_also> + <Struct>Struct</Struct> + <Symbol_Index>Symbol Index</Symbol_Index> + <This>This</This> + <Types>Types</Types> + <Variables>Variables</Variables> + <TOC>Contents</TOC> + <Guides>User Guides and Tutorials</Guides> + <AAAIntroduction>POCO Introduction</AAAIntroduction> + <A01NR_Appetizer>Appetizer</A01NR_Appetizer> + <A03NR_Install>Installation and Configuration</A03NR_Install> + <A07NR_ForAP>For Accountability Partners</A07NR_ForAP> + <A09NR_FurtherReading>Further Reading</A09NR_FurtherReading> + <A50NR_DevIntro>Development Introduction</A50NR_DevIntro> + </EN> + </Translations> + <logging> + <loggers> + <root> + <channel>c1</channel> + <level>information</level> + </root> + </loggers> + <channels> + <c1> + <class>FileChannel</class> + <path>${DocBase}/PocoDoc.log</path> + <pattern>%s: [%p] %t</pattern> + </c1> + </channels> + </logging> +</AppConfig> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dus...@us...> - 2012-04-11 03:07:54
|
Revision: 264 http://responsibility.svn.sourceforge.net/responsibility/?rev=264&view=rev Author: dustsource Date: 2012-04-11 03:07:48 +0000 (Wed, 11 Apr 2012) Log Message: ----------- Expanded "Compile from Source" page. Modified Paths: -------------- documentation/pages/0305-CompileFromSource.page Modified: documentation/pages/0305-CompileFromSource.page =================================================================== --- documentation/pages/0305-CompileFromSource.page 2012-04-10 15:28:18 UTC (rev 263) +++ documentation/pages/0305-CompileFromSource.page 2012-04-11 03:07:48 UTC (rev 264) @@ -1,3 +1,46 @@ Compile from source A03NR_Install +!!!Introduction +If for some reason you are not able to install Net Responsibility (NR) from a package, you may be able to compile and install it from the source code using the following instructions. + +New to Linux/Ubuntu? Read this article for some helpful info: [[http://www.psychocats.net/ubuntu/terminal Where's the Terminal?]]. <!Warning:!> Read [[http://ubuntuforums.org/announcement.php?f=100 this]] (post by <*jdong*>, Nov 18, 2007 - Jan 31, 2013) before copying/pasting anything into the terminal. Basic rule: Take time to make sure you have at least a basic idea of what and why you are running a certain command in the terminal. + +<!Please note the following:!> + +1. Before installing Net Responsibility (NR), you'll need to [[http://netresponsibility.com/register.php register an account]] if you haven't already. + +2. Older versions are provided but not recommended. [[http://netresponsibility.com/download.php#Older You may find them here]]. + +!!!POCO libraries +You will first need to install the POCO libraries. Note that the version needs to be 1.4 or later. Some platforms have these libraries precompiled and packaged. Otherwise you need to compile them yourself. Start by [[http://sourceforge.net/projects/poco/files/sources/poco-1.4.2/poco-1.4.2p1-all.tar.gz/download downloading the complete edition]] (i.e. not the <*basic edition*>). Unpack (extract) it (on a platform like Ubuntu, this can often be done by right-clicking on the file and choosing the unpack/extract option from the menu), which will result in the creation of a directory (folder) with the same name as the file you downloaded, and which contains other folders and files. If you want, you can unpack the file to one directory and then copy the extracted contents to another directory where you will work with it. Once you have the POCO folders and files in the directory you want them, you then need to open a terminal window and use the <*cd*> command to move yourself to that directory. While there you then need to do three things: configure, compile and install. For a user who has chosen to use the <*/home/name/poco*> directory, the procedure should look like this: + + cd /home/name/poco + ./configure --shared --no-tests --no-samples + make + sudo make install +---- +<!Note:!> If you are not an Ubuntu/Debian user, for the last command you may need to change <*sudo*> to <*su*>. The main thing to know is that the <*make install*> command needs to be run as 'root', however your particular platform handles that. + +!!!Need for libpcap package +You also will need to have <*libpcap*> installed. Many systems either have it installed by default, or provide packages for it that can be installed by the user. + +!!!Net Responsiblity +Once you have the POCO libraries and libpcap successfully installed, you can move on to compiling and installing NR itself, which can be done in a similar way to the process shown above for the POCO libraries. Download and unpack the [[https://sourceforge.net/projects/responsibility/files/latest/download tarball]] (i.e, archive file). Then open a terminal window to configure, compile and install. For a user who has put the unpacked contents of the tarball into the <*/home/name/netresp*> directory, the procedure should look like this: + + cd /home/name/netresp + ./configure + make + sudo make install +---- +<!Note:!> If you are not an Ubuntu/Debian user, for the last command you may need to change <*sudo*> to <*su*>. The main thing to know is that the <*make install*> command needs to be run as 'root', however your particular platform handles that. + +During the last step, you need to enter a username and password. Simply use the same as you did when registering your NR account. + +!!!Testing the installation +If you've successfully worked through the steps above, NR should now be installed. If you want to test to see if it is running as it should, you can run the following command in the terminal: + + ps -ef|grep net-responsibility +---- + +If the only line you see contains <*grep*>, then it's not running as it should. However, if you see an additional line that contains <*net-responsibility --daemon*> then you know it is running as it should. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dus...@us...> - 2012-04-10 15:28:29
|
Revision: 263 http://responsibility.svn.sourceforge.net/responsibility/?rev=263&view=rev Author: dustsource Date: 2012-04-10 15:28:18 +0000 (Tue, 10 Apr 2012) Log Message: ----------- Expanded "Install from Packages" page. Modified Paths: -------------- documentation/pages/0304-InstallFromPackages.page Modified: documentation/pages/0304-InstallFromPackages.page =================================================================== --- documentation/pages/0304-InstallFromPackages.page 2012-04-09 20:14:56 UTC (rev 262) +++ documentation/pages/0304-InstallFromPackages.page 2012-04-10 15:28:18 UTC (rev 263) @@ -1,14 +1,68 @@ Install from packages A03NR_Install +!!!Introduction +New to Linux/Ubuntu? Read these articles for some helpful info: [[http://www.psychocats.net/ubuntu/installingsoftware Installing Software in Ubuntu]] and [[http://www.psychocats.net/ubuntu/terminal Where's the Terminal?]]. <!Warning:!> Read [[http://ubuntuforums.org/announcement.php?f=100 this]] (post by <*jdong*>, Nov 18, 2007 - Jan 31, 2013) before copying/pasting anything into the terminal. Basic rule: Take time to make sure you have at least a basic idea of what and why you are running a certain command in the terminal. + +<!Please note the following:!> + +1. Before installing Net Responsibility (NR), you'll need to [[http://netresponsibility.com/register.php register an account]] if you haven't already. + +2. Older versions are provided but not recommended. [[http://netresponsibility.com/download.php#Older You may find them here]]. + !!!About binary packages +We hope to supply binary packages (installation files) for as many platforms (operating systems) as possible. If there is none for your platform, you'll need to download and compile the [[http://netresponsibility.com/download.php#Source source code]]. If you would be interested in creating such packages for any platform, please [[mailto:res...@li... let us know]]. !!!Ubuntu +<!Note:!> If you have version 2.0.2 or earlier installed, you will need to uninstall it before installing a later version. The older versions are named <*netresponsibility*> (without a dash), whereas the newer ones are named <*net-responsibility*> (with a dash). +There is a PPA (Personal Package Archive) for Ubuntu users. To add the PPA to your system and install the latest version of NR, simply run these commands in a terminal: + + sudo add-apt-repository ppa:roggan87/nr + sudo apt-get update + sudo apt-get install net-responsibility +---- + +During the last step, you need to enter a username and password. Simply use the same as you did when registering your NR account. + +This could also be done through your favorite package manager, such as Synaptic Package Manager or Ubuntu Software Center. If you are interested, you could change <*roggan87/nr*> to <*roggan87/nrdev*>. Then you will also get notified of new beta versions that are not being tested by a wider range of people. + +Alternative manual installation method: Download the [[https://sourceforge.net/projects/responsibility/files/net-responsibility/ DEB (.deb) package]] of the latest version, double-click on it, and follow the on-screen prompts. + !!!Mac OS X +We're working on creating packages for Mac users. It is technically possible to download the [[http://netresponsibility.com/download.php#Source source code]] and compile it. More information about compiling it on Mac can be [[http://netresponsibility.com/forum/index.php?topic=63.0 found here]]. However, the easiest thing would be to wait (or help us out with creating the package). !!!Windows +Our goal is to supply NR for all major platforms, including Windows. There are some important features that are not yet implemented in the Windows version. Therefore we've decided to wait before we release it. Once those things are fixed, we'll create an installation file and post it here. +If you're interested in the Windows development process, we'll keep you updated through [[http://netresponsibility.com/forum/index.php?topic=55.0 this thread]]. When logged in, you may want to click "Notify" for this topic in order to automatically get update emails about new posts. + !!!Arch Linux +If [[http://archlinux.fr/yaourt-en yaourt]] is installed you just run the following command: -!!!Debian packages + yaourt -S net-responsibility +---- + +Otherwise simply follow these instructions: + +1. [[https://aur.archlinux.org/packages/ne/net-responsibility/net-responsibility.tar.gz Download]] the package and extract it. + +2. Open a terminal and use <*cd*> to go to the extracted folder. + +3. Run <*makepkg -s*> + +4. Run <*sudo pacman -U ./net-responsibility-3.0-2-[ i386 or x86_64 ].pkg.tar.xz*> + +(Note that you'll need to edit the portion of the above command that is in [brackets] in order to specify whether your architecture is i386 or x86_64.) + +For more information regarding installation of packages in Arch Linux, [[https://wiki.archlinux.org/index.php/AUR#Installing_packages look here]]. + +!!!Debian-based distributions (distros) other than Ubuntu +<!Note:!> If you have version 2.0.2 or earlier installed, you will need to uninstall it before installing a later version. The older versions are named <*netresponsibility*> (without a dash), whereas the newer ones are named <*net-responsibility*> (with a dash). + +Some Debian-based distros do not support installing from the Ubuntu PPA. In this case, you may try to install [[https://sourceforge.net/projects/responsibility/files/net-responsibility/ our debian packages]] manually. Note that you'll need to install libpoco, version 1.4 or later, first. If your distro does not have libpoco precompiled, you can download [[https://sourceforge.net/projects/responsibility/files/libpoco/ all its packages here]]. + +When installing, you'll have to install the libpoco packages first, in the correct order. After that is done, you can install NR. You should be able to use your favorite package manager, or the command line tool [[http://en.wikipedia.org/wiki/Dpkg dpkg]]. + +During the last step, you need to enter a username and password. Simply use the same as you did when registering your NR account. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-09 20:15:02
|
Revision: 262 http://responsibility.svn.sourceforge.net/responsibility/?rev=262&view=rev Author: roggan87 Date: 2012-04-09 20:14:56 +0000 (Mon, 09 Apr 2012) Log Message: ----------- SnifferThread::openDevice(string device) now returns 0 on success. This closes the bug #3 (I hope). I guess it would be looking better if we didn't return any value by making it a void method, and instead throwed on failure. Modified Paths: -------------- trunk/src/SnifferThread.cpp Modified: trunk/src/SnifferThread.cpp =================================================================== --- trunk/src/SnifferThread.cpp 2012-04-09 20:12:38 UTC (rev 261) +++ trunk/src/SnifferThread.cpp 2012-04-09 20:14:56 UTC (rev 262) @@ -65,7 +65,9 @@ *_logStream <<"Couldn't install sniffPattern " <<_sniffPattern <<": " <<pcap_geterr(_fp) <<endl; return -1; - } + } + else + return 0; // Wouldn't it be better to throw on failure? } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rog...@us...> - 2012-04-09 20:12:45
|
Revision: 261 http://responsibility.svn.sourceforge.net/responsibility/?rev=261&view=rev Author: roggan87 Date: 2012-04-09 20:12:38 +0000 (Mon, 09 Apr 2012) Log Message: ----------- Edited some documentation Modified Paths: -------------- trunk/include/Request.h Modified: trunk/include/Request.h =================================================================== --- trunk/include/Request.h 2012-04-02 20:00:40 UTC (rev 260) +++ trunk/include/Request.h 2012-04-09 20:12:38 UTC (rev 261) @@ -89,7 +89,7 @@ private: static string send(Options *options, string uriPath, - string filePath = "", string morePostVars = "") + string filePath = "", string morePostVars = ""); }; #endif // REQUEST_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |