From 873c4714279ff34d4dace1228f8e48e776e386ac Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 21 Dec 2015 09:05:00 +0100 Subject: [PATCH 1/8] GH #1050 Util: fix gcc -Wshadow warnings --- .../include/Poco/Util/AbstractConfiguration.h | 6 ++-- Util/include/Poco/Util/Application.h | 4 +-- Util/src/AbstractConfiguration.cpp | 6 ++-- Util/src/Application.cpp | 36 +++++++++---------- Util/src/IniFileConfiguration.cpp | 8 ++--- Util/src/JSONConfiguration.cpp | 2 +- Util/src/LayeredConfiguration.cpp | 6 ++-- Util/src/MapConfiguration.cpp | 12 +++---- Util/src/Option.cpp | 34 +++++++++--------- Util/src/ServerApplication.cpp | 22 ++++++------ Util/src/Timer.cpp | 24 ++++++------- Util/src/XMLConfiguration.cpp | 6 ++-- 12 files changed, 83 insertions(+), 83 deletions(-) diff --git a/Util/include/Poco/Util/AbstractConfiguration.h b/Util/include/Poco/Util/AbstractConfiguration.h index 4bbfbc187..6085219cb 100644 --- a/Util/include/Poco/Util/AbstractConfiguration.h +++ b/Util/include/Poco/Util/AbstractConfiguration.h @@ -54,9 +54,9 @@ public: /// A key-value pair, used as event argument. { public: - KeyValue(const std::string& key, std::string& value): - _key(key), - _value(value) + KeyValue(const std::string& rKey, std::string& rValue): + _key(rKey), + _value(rValue) { } diff --git a/Util/include/Poco/Util/Application.h b/Util/include/Poco/Util/Application.h index 596b01ac2..36e164e8a 100644 --- a/Util/include/Poco/Util/Application.h +++ b/Util/include/Poco/Util/Application.h @@ -471,9 +471,9 @@ inline const Poco::Timestamp& Application::startTime() const inline Poco::Timespan Application::uptime() const { Poco::Timestamp now; - Poco::Timespan uptime = now - _startTime; + Poco::Timespan ret = now - _startTime; - return uptime; + return ret; } diff --git a/Util/src/AbstractConfiguration.cpp b/Util/src/AbstractConfiguration.cpp index d9981ead2..5f8ab3016 100644 --- a/Util/src/AbstractConfiguration.cpp +++ b/Util/src/AbstractConfiguration.cpp @@ -423,11 +423,11 @@ std::string AbstractConfiguration::internalExpand(const std::string& value) cons } -std::string AbstractConfiguration::uncheckedExpand(const std::string& value) const +std::string AbstractConfiguration::uncheckedExpand(const std::string& rValue) const { std::string result; - std::string::const_iterator it = value.begin(); - std::string::const_iterator end = value.end(); + std::string::const_iterator it = rValue.begin(); + std::string::const_iterator end = rValue.end(); while (it != end) { if (*it == '$') diff --git a/Util/src/Application.cpp b/Util/src/Application.cpp index 731c84da8..96d79aaf6 100644 --- a/Util/src/Application.cpp +++ b/Util/src/Application.cpp @@ -78,7 +78,7 @@ Application::Application(): } -Application::Application(int argc, char* argv[]): +Application::Application(int argc, char* pArgv[]): _pConfig(new LayeredConfiguration), _initialized(false), _unixOptions(true), @@ -87,7 +87,7 @@ Application::Application(int argc, char* argv[]): _loadedConfigs(0) { setup(); - init(argc, argv); + init(argc, pArgv); } @@ -131,9 +131,9 @@ void Application::addSubsystem(Subsystem* pSubsystem) } -void Application::init(int argc, char* argv[]) +void Application::init(int argc, char* pArgv[]) { - setArgs(argc, argv); + setArgs(argc, pArgv); init(); } @@ -363,15 +363,15 @@ int Application::main(const ArgVec& args) } -void Application::setArgs(int argc, char* argv[]) +void Application::setArgs(int argc, char* pArgv[]) { - _command = argv[0]; + _command = pArgv[0]; _pConfig->setInt("application.argc", argc); _unprocessedArgs.reserve(argc); std::string argvKey = "application.argv["; for (int i = 0; i < argc; ++i) { - std::string arg(argv[i]); + std::string arg(pArgv[i]); _pConfig->setString(argvKey + NumberFormatter::format(i) + "]", arg); _unprocessedArgs.push_back(arg); } @@ -403,13 +403,13 @@ void Application::processOptions() ArgVec::iterator it = _unprocessedArgs.begin(); while (it != _unprocessedArgs.end() && !_stopOptionsProcessing) { - std::string name; + std::string argName; std::string value; - if (processor.process(*it, name, value)) + if (processor.process(*it, argName, value)) { - if (!name.empty()) // "--" option to end options processing or deferred argument + if (!argName.empty()) // "--" option to end options processing or deferred argument { - handleOption(name, value); + handleOption(argName, value); } it = _unprocessedArgs.erase(it); } @@ -536,18 +536,18 @@ bool Application::findAppConfigFile(const Path& basePath, const std::string& app } -void Application::defineOptions(OptionSet& options) +void Application::defineOptions(OptionSet& rOptions) { for (SubsystemVec::iterator it = _subsystems.begin(); it != _subsystems.end(); ++it) { - (*it)->defineOptions(options); + (*it)->defineOptions(rOptions); } } -void Application::handleOption(const std::string& name, const std::string& value) +void Application::handleOption(const std::string& rName, const std::string& value) { - const Option& option = _options.getOption(name); + const Option& option = _options.getOption(rName); if (option.validator()) { option.validator()->validate(option, value); @@ -560,14 +560,14 @@ void Application::handleOption(const std::string& name, const std::string& value } if (option.callback()) { - option.callback()->invoke(name, value); + option.callback()->invoke(rName, value); } } -void Application::setLogger(Logger& logger) +void Application::setLogger(Logger& rLogger) { - _pLogger = &logger; + _pLogger = &rLogger; } diff --git a/Util/src/IniFileConfiguration.cpp b/Util/src/IniFileConfiguration.cpp index 45d371492..3ce411c22 100644 --- a/Util/src/IniFileConfiguration.cpp +++ b/Util/src/IniFileConfiguration.cpp @@ -100,7 +100,7 @@ void IniFileConfiguration::setRaw(const std::string& key, const std::string& val void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const { - std::set keys; + std::set keySet; std::string prefix = key; if (!prefix.empty()) prefix += '.'; std::string::size_type psize = prefix.size(); @@ -114,10 +114,10 @@ void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const subKey = it->first.substr(psize); else subKey = it->first.substr(psize, end - psize); - if (keys.find(subKey) == keys.end()) + if (keySet.find(subKey) == keySet.end()) { range.push_back(subKey); - keys.insert(subKey); + keySet.insert(subKey); } } } @@ -189,4 +189,4 @@ void IniFileConfiguration::parseLine(std::istream& istr) } } // namespace Poco::Util -#endif // POCO_UTIL_NO_INIFILECONFIGURATION \ No newline at end of file +#endif // POCO_UTIL_NO_INIFILECONFIGURATION diff --git a/Util/src/JSONConfiguration.cpp b/Util/src/JSONConfiguration.cpp index 2cb912077..d75a0c47b 100644 --- a/Util/src/JSONConfiguration.cpp +++ b/Util/src/JSONConfiguration.cpp @@ -167,7 +167,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri parentArray->add(newArray); } - for(int i = 0; i <= *it - 1; ++i) + for(int j = 0; j <= *it - 1; ++j) { Poco::DynamicAny nullValue; newArray->add(nullValue); diff --git a/Util/src/LayeredConfiguration.cpp b/Util/src/LayeredConfiguration.cpp index 14bbeea1e..959cc237c 100644 --- a/Util/src/LayeredConfiguration.cpp +++ b/Util/src/LayeredConfiguration.cpp @@ -140,17 +140,17 @@ void LayeredConfiguration::setRaw(const std::string& key, const std::string& val void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const { - std::set keys; + std::set keySet; for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc) { Keys partRange; itc->pConfig->enumerate(key, partRange); for (Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr) { - if (keys.find(*itr) == keys.end()) + if (keySet.find(*itr) == keySet.end()) { range.push_back(*itr); - keys.insert(*itr); + keySet.insert(*itr); } } } diff --git a/Util/src/MapConfiguration.cpp b/Util/src/MapConfiguration.cpp index a5ef5dade..53140f271 100644 --- a/Util/src/MapConfiguration.cpp +++ b/Util/src/MapConfiguration.cpp @@ -58,7 +58,7 @@ void MapConfiguration::setRaw(const std::string& key, const std::string& value) void MapConfiguration::enumerate(const std::string& key, Keys& range) const { - std::set keys; + std::set keySet; std::string prefix = key; if (!prefix.empty()) prefix += '.'; std::string::size_type psize = prefix.size(); @@ -67,15 +67,15 @@ void MapConfiguration::enumerate(const std::string& key, Keys& range) const if (it->first.compare(0, psize, prefix) == 0) { std::string subKey; - std::string::size_type end = it->first.find('.', psize); - if (end == std::string::npos) + std::string::size_type pos = it->first.find('.', psize); + if (pos == std::string::npos) subKey = it->first.substr(psize); else - subKey = it->first.substr(psize, end - psize); - if (keys.find(subKey) == keys.end()) + subKey = it->first.substr(psize, pos - psize); + if (keySet.find(subKey) == keySet.end()) { range.push_back(subKey); - keys.insert(subKey); + keySet.insert(subKey); } } } diff --git a/Util/src/Option.cpp b/Util/src/Option.cpp index 1d316aa0d..9ef2db5f8 100644 --- a/Util/src/Option.cpp +++ b/Util/src/Option.cpp @@ -60,9 +60,9 @@ Option::Option(const Option& option): } -Option::Option(const std::string& fullName, const std::string& shortName): - _shortName(shortName), - _fullName(fullName), +Option::Option(const std::string& rFullName, const std::string& rShortName): + _shortName(rShortName), + _fullName(rFullName), _required(false), _repeatable(false), _argRequired(false), @@ -73,11 +73,11 @@ Option::Option(const std::string& fullName, const std::string& shortName): } -Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required): - _shortName(shortName), - _fullName(fullName), - _description(description), - _required(required), +Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired): + _shortName(rShortName), + _fullName(rFullName), + _description(rDescription), + _required(isRequired), _repeatable(false), _argRequired(false), _pValidator(0), @@ -87,11 +87,11 @@ Option::Option(const std::string& fullName, const std::string& shortName, const } -Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required, const std::string& argName, bool argRequired): - _shortName(shortName), - _fullName(fullName), - _description(description), - _required(required), +Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired, const std::string& argName, bool argRequired): + _shortName(rShortName), + _fullName(rFullName), + _description(rDescription), + _required(isRequired), _repeatable(false), _argName(argName), _argRequired(argRequired), @@ -173,10 +173,10 @@ Option& Option::repeatable(bool flag) } -Option& Option::argument(const std::string& name, bool required) +Option& Option::argument(const std::string& name, bool isRequired) { _argName = name; - _argRequired = required; + _argRequired = isRequired; return *this; } @@ -189,9 +189,9 @@ Option& Option::noArgument() } -Option& Option::group(const std::string& group) +Option& Option::group(const std::string& rGroup) { - _group = group; + _group = rGroup; return *this; } diff --git a/Util/src/ServerApplication.cpp b/Util/src/ServerApplication.cpp index 2555f2f56..3a40cf490 100644 --- a/Util/src/ServerApplication.cpp +++ b/Util/src/ServerApplication.cpp @@ -610,16 +610,16 @@ void ServerApplication::waitForTerminationRequest() } -int ServerApplication::run(int argc, char** argv) +int ServerApplication::run(int argc, char** pArgv) { - bool runAsDaemon = isDaemon(argc, argv); + bool runAsDaemon = isDaemon(argc, pArgv); if (runAsDaemon) { beDaemon(); } try { - init(argc, argv); + init(argc, pArgv); if (runAsDaemon) { int rc = chdir("/"); @@ -668,12 +668,12 @@ int ServerApplication::run(const std::vector& args) } -bool ServerApplication::isDaemon(int argc, char** argv) +bool ServerApplication::isDaemon(int argc, char** pArgv) { std::string option("--daemon"); for (int i = 1; i < argc; ++i) { - if (option == argv[i]) + if (option == pArgv[i]) return true; } return false; @@ -708,17 +708,17 @@ void ServerApplication::beDaemon() } -void ServerApplication::defineOptions(OptionSet& options) +void ServerApplication::defineOptions(OptionSet& rOptions) { - Application::defineOptions(options); + Application::defineOptions(rOptions); - options.addOption( + rOptions.addOption( Option("daemon", "", "Run application as a daemon.") .required(false) .repeatable(false) .callback(OptionCallback(this, &ServerApplication::handleDaemon))); - options.addOption( + rOptions.addOption( Option("pidfile", "", "Write the process ID of the application to given file.") .required(false) .repeatable(false) @@ -727,13 +727,13 @@ void ServerApplication::defineOptions(OptionSet& options) } -void ServerApplication::handleDaemon(const std::string& name, const std::string& value) +void ServerApplication::handleDaemon(const std::string& rName, const std::string& Value) { config().setBool("application.runAsDaemon", true); } -void ServerApplication::handlePidFile(const std::string& name, const std::string& value) +void ServerApplication::handlePidFile(const std::string& rName, const std::string& value) { std::ofstream ostr(value.c_str()); if (ostr.good()) diff --git a/Util/src/Timer.cpp b/Util/src/Timer.cpp index 479645eb5..93c3210a0 100644 --- a/Util/src/Timer.cpp +++ b/Util/src/Timer.cpp @@ -30,8 +30,8 @@ namespace Util { class TimerNotification: public Poco::Notification { public: - TimerNotification(Poco::TimedNotificationQueue& queue): - _queue(queue) + TimerNotification(Poco::TimedNotificationQueue& rQueue): + _queue(rQueue) { } @@ -54,8 +54,8 @@ private: class StopNotification: public TimerNotification { public: - StopNotification(Poco::TimedNotificationQueue& queue): - TimerNotification(queue) + StopNotification(Poco::TimedNotificationQueue& rQueue): + TimerNotification(rQueue) { } @@ -74,8 +74,8 @@ public: class CancelNotification: public TimerNotification { public: - CancelNotification(Poco::TimedNotificationQueue& queue): - TimerNotification(queue) + CancelNotification(Poco::TimedNotificationQueue& rQueue): + TimerNotification(rQueue) { } @@ -103,8 +103,8 @@ private: class TaskNotification: public TimerNotification { public: - TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask): - TimerNotification(queue), + TaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask): + TimerNotification(rQueue), _pTask(pTask) { } @@ -151,8 +151,8 @@ private: class PeriodicTaskNotification: public TaskNotification { public: - PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval): - TaskNotification(queue, pTask), + PeriodicTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval): + TaskNotification(rQueue, pTask), _interval(interval) { } @@ -185,8 +185,8 @@ private: class FixedRateTaskNotification: public TaskNotification { public: - FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval, Poco::Clock clock): - TaskNotification(queue, pTask), + FixedRateTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval, Poco::Clock clock): + TaskNotification(rQueue, pTask), _interval(interval), _nextExecution(clock) { diff --git a/Util/src/XMLConfiguration.cpp b/Util/src/XMLConfiguration.cpp index b039da783..9bdbe5a90 100644 --- a/Util/src/XMLConfiguration.cpp +++ b/Util/src/XMLConfiguration.cpp @@ -260,7 +260,7 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const { using Poco::NumberFormatter; - std::multiset keys; + std::multiset keySet; const Poco::XML::Node* pNode = findNode(key); if (pNode) { @@ -270,12 +270,12 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE) { const std::string& nodeName = pChild->nodeName(); - int n = (int) keys.count(nodeName); + int n = (int) keySet.count(nodeName); if (n) range.push_back(nodeName + "[" + NumberFormatter::format(n) + "]"); else range.push_back(nodeName); - keys.insert(nodeName); + keySet.insert(nodeName); } pChild = pChild->nextSibling(); } From 3ef803d40ba574288865e9bdd5239822632a487f Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Tue, 29 Dec 2015 19:46:18 +0100 Subject: [PATCH 2/8] Add WebSocketTestSuite Signed-off-by: FrancisANDRE --- NetSSL_Win/testsuite/TestSuite_vs120.vcxproj | 88 ++++++++++--------- .../testsuite/TestSuite_vs120.vcxproj.filters | 15 ++++ NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp | 2 + .../HTTPTimeServer/src/TimeHandler.cpp | 11 +-- .../samples/HTTPTimeServer/src/TimeHandler.h | 7 -- 5 files changed, 65 insertions(+), 58 deletions(-) diff --git a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj index c64c28740..55cb0766c 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ TestSuite Win32Proj - + Application MultiByte @@ -63,27 +63,27 @@ MultiByte v120 - - + + - + - + - + - + - + - + - + <_ProjectFileVersion>12.0.30501.0 TestSuited @@ -136,7 +136,7 @@ true true true - + Level3 ProgramDatabase Default @@ -167,9 +167,9 @@ true true true - + Level3 - + Default @@ -196,7 +196,7 @@ true true true - + Level3 ProgramDatabase Default @@ -227,9 +227,9 @@ true true true - + Level3 - + Default @@ -256,7 +256,7 @@ true true true - + Level3 ProgramDatabase Default @@ -287,9 +287,9 @@ true true true - + Level3 - + Default @@ -304,28 +304,32 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters index bd3bc66f1..7e0c821b6 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters +++ b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters @@ -52,6 +52,9 @@ {40e36c0c-5808-4c87-aa2e-04c0ffa6f35e} + + {9243a946-e87f-42f5-adba-efbb4823f93c} + @@ -81,6 +84,12 @@ HTTPSClient\Header Files + + Websocket + + + Websocket + @@ -113,5 +122,11 @@ HTTPSClient\Source Files + + Websocket + + + Websocket + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp b/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp index 7fddff713..b2aa5303a 100644 --- a/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp +++ b/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp @@ -15,6 +15,7 @@ #include "HTTPSClientTestSuite.h" #include "TCPServerTestSuite.h" #include "HTTPSServerTestSuite.h" +#include "WebSocketTestSuite.h" CppUnit::Test* NetSSLTestSuite::suite() @@ -24,6 +25,7 @@ CppUnit::Test* NetSSLTestSuite::suite() pSuite->addTest(HTTPSClientTestSuite::suite()); pSuite->addTest(TCPServerTestSuite::suite()); pSuite->addTest(HTTPSServerTestSuite::suite()); + pSuite->addTest(WebSocketTestSuite::suite()); return pSuite; } diff --git a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp index 3ec7a9bb7..ddd7a079e 100644 --- a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp +++ b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp @@ -1,10 +1,3 @@ -// -// TimeHandler.cpp -// -// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54. -// - - #include "TimeHandler.h" #include "Poco/Net/HTTPServerRequest.h" #include "Poco/Net/HTTPServerResponse.h" @@ -28,7 +21,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net responseStream << "\n"; responseStream << "\n"; responseStream << ""; -#line 6 "/ws/poco-1.3/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" +#line 6 "/cygdrive/z/git/poco/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" Poco::DateTime now; std::string dt(Poco::DateTimeFormatter::format(now, "%W, %e %b %y %H:%M:%S %Z")); @@ -40,7 +33,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net responseStream << "\n"; responseStream << "\n"; responseStream << "

"; -#line 16 "/ws/poco-1.3/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" +#line 16 "/cygdrive/z/git/poco/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" responseStream << ( dt ); responseStream << "

\n"; responseStream << "\n"; diff --git a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h index e1ac5474d..c301516d0 100644 --- a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h +++ b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h @@ -1,10 +1,3 @@ -// -// TimeHandler.h -// -// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54. -// - - #ifndef TimeHandler_INCLUDED #define TimeHandler_INCLUDED From 12d0699b5be3d0498c2688b7b96f45fddf9c334f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 28 Dec 2015 09:29:26 +0100 Subject: [PATCH 3/8] GH #1050 Net: fix gcc -Wshadow warnings --- Foundation/include/Poco/ListMap.h | 16 +- Net/include/Poco/Net/IPAddress.h | 6 +- Net/include/Poco/Net/NTPEventArgs.h | 4 +- Net/src/AbstractHTTPRequestHandler.cpp | 10 +- Net/src/DatagramSocket.cpp | 20 +- Net/src/DatagramSocketImpl.cpp | 2 +- Net/src/DialogSocket.cpp | 4 +- Net/src/FilePartSource.cpp | 10 +- Net/src/HTMLForm.cpp | 10 +- Net/src/HTTPAuthenticationParams.cpp | 10 +- Net/src/HTTPClientSession.cpp | 4 +- Net/src/HTTPRequest.cpp | 10 +- Net/src/HTTPServer.cpp | 8 +- Net/src/HTTPServerConnection.cpp | 4 +- Net/src/HTTPServerRequestImpl.cpp | 6 +- Net/src/HTTPServerSession.cpp | 6 +- Net/src/HTTPSession.cpp | 12 +- Net/src/HTTPSessionFactory.cpp | 6 +- Net/src/ICMPEventArgs.cpp | 22 +- Net/src/ICMPSocket.cpp | 18 +- Net/src/ICMPSocketImpl.cpp | 8 +- Net/src/IPAddress.cpp | 88 +++---- Net/src/IPAddressImpl.cpp | 170 ++++++------ Net/src/MailMessage.cpp | 8 +- Net/src/MulticastSocket.cpp | 2 +- Net/src/MultipartReader.cpp | 4 +- Net/src/MultipartWriter.cpp | 4 +- Net/src/NTPPacket.cpp | 12 +- Net/src/NetworkInterface.cpp | 342 ++++++++++++------------- Net/src/PartSource.cpp | 4 +- Net/src/PartStore.cpp | 8 +- Net/src/RawSocket.cpp | 22 +- Net/src/RawSocketImpl.cpp | 4 +- Net/src/RemoteSyslogListener.cpp | 10 +- Net/src/SMTPClientSession.cpp | 16 +- Net/src/ServerSocket.cpp | 24 +- Net/src/SocketAddress.cpp | 30 +-- Net/src/SocketAddressImpl.cpp | 36 +-- Net/src/SocketImpl.cpp | 80 +++--- Net/src/SocketNotification.cpp | 4 +- Net/src/SocketStream.cpp | 16 +- Net/src/StreamSocket.cpp | 16 +- Net/src/StreamSocketImpl.cpp | 2 +- Net/src/StringPartSource.cpp | 10 +- Net/src/TCPServer.cpp | 12 +- Net/src/TCPServerConnection.cpp | 4 +- Net/src/TCPServerDispatcher.cpp | 4 +- Net/src/WebSocketImpl.cpp | 18 +- 48 files changed, 573 insertions(+), 573 deletions(-) diff --git a/Foundation/include/Poco/ListMap.h b/Foundation/include/Poco/ListMap.h index f4efa1ab3..932e6f6b0 100644 --- a/Foundation/include/Poco/ListMap.h +++ b/Foundation/include/Poco/ListMap.h @@ -109,12 +109,12 @@ public: /// not found. { typename Container::const_iterator it = _list.begin(); - typename Container::const_iterator end = _list.end(); - for(; it != end; ++it) + typename Container::const_iterator itEnd = _list.end(); + for(; it != itEnd; ++it) { if (isEqual(it->first, key)) return it; } - return end; + return itEnd; } Iterator find(const KeyType& key) @@ -124,12 +124,12 @@ public: /// not found. { typename Container::iterator it = _list.begin(); - typename Container::iterator end = _list.end(); - for(; it != end; ++it) + typename Container::iterator itEnd = _list.end(); + for(; it != itEnd; ++it) { if (isEqual(it->first, key)) return it; } - return end; + return itEnd; } Iterator insert(const ValueType& val) @@ -203,8 +203,8 @@ public: else { ValueType value(key, Mapped()); - Iterator it = insert(value); - return it->second; + Iterator itInsert = insert(value); + return itInsert->second; } } diff --git a/Net/include/Poco/Net/IPAddress.h b/Net/include/Poco/Net/IPAddress.h index a8ae5e672..4dc15751d 100644 --- a/Net/include/Poco/Net/IPAddress.h +++ b/Net/include/Poco/Net/IPAddress.h @@ -489,12 +489,12 @@ inline void IPAddress::newIPv6(const void* hostAddr) } -inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scope) +inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scopeIdentifier) { #ifdef POCO_HAVE_ALIGNMENT - new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); + new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier); #else - _pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); + _pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier); #endif } diff --git a/Net/include/Poco/Net/NTPEventArgs.h b/Net/include/Poco/Net/NTPEventArgs.h index 6c2c5cba8..3e0320577 100644 --- a/Net/include/Poco/Net/NTPEventArgs.h +++ b/Net/include/Poco/Net/NTPEventArgs.h @@ -74,9 +74,9 @@ inline const NTPPacket &NTPEventArgs::packet() } -inline void NTPEventArgs::setPacket(NTPPacket &packet) +inline void NTPEventArgs::setPacket(NTPPacket &rPacket) { - _packet = packet; + _packet = rPacket; } diff --git a/Net/src/AbstractHTTPRequestHandler.cpp b/Net/src/AbstractHTTPRequestHandler.cpp index 378374411..fa5411723 100644 --- a/Net/src/AbstractHTTPRequestHandler.cpp +++ b/Net/src/AbstractHTTPRequestHandler.cpp @@ -43,10 +43,10 @@ AbstractHTTPRequestHandler::~AbstractHTTPRequestHandler() } -void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) +void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& rRequest, HTTPServerResponse& rResponse) { - _pRequest = &request; - _pResponse = &response; + _pRequest = &rRequest; + _pResponse = &rResponse; if (authenticate()) { try @@ -55,14 +55,14 @@ void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPS } catch (Poco::Exception& exc) { - if (!response.sent()) + if (!rResponse.sent()) { sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText()); } } catch (std::exception& exc) { - if (!response.sent()) + if (!rResponse.sent()) { sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what()); } diff --git a/Net/src/DatagramSocket.cpp b/Net/src/DatagramSocket.cpp index ce5d6b7ee..c050f5b47 100644 --- a/Net/src/DatagramSocket.cpp +++ b/Net/src/DatagramSocket.cpp @@ -36,9 +36,9 @@ DatagramSocket::DatagramSocket(SocketAddress::Family family): Socket(new Datagra } -DatagramSocket::DatagramSocket(const SocketAddress& address, bool reuseAddress): Socket(new DatagramSocketImpl(address.family())) +DatagramSocket::DatagramSocket(const SocketAddress& rAddress, bool reuseAddress): Socket(new DatagramSocketImpl(rAddress.family())) { - bind(address, reuseAddress); + bind(rAddress, reuseAddress); } @@ -71,15 +71,15 @@ DatagramSocket& DatagramSocket::operator = (const Socket& socket) } -void DatagramSocket::connect(const SocketAddress& address) +void DatagramSocket::connect(const SocketAddress& rAddress) { - impl()->connect(address); + impl()->connect(rAddress); } -void DatagramSocket::bind(const SocketAddress& address, bool reuseAddress) +void DatagramSocket::bind(const SocketAddress& rAddress, bool reuseAddress) { - impl()->bind(address, reuseAddress); + impl()->bind(rAddress, reuseAddress); } @@ -95,15 +95,15 @@ int DatagramSocket::receiveBytes(void* buffer, int length, int flags) } -int DatagramSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) +int DatagramSocket::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) { - return impl()->sendTo(buffer, length, address, flags); + return impl()->sendTo(buffer, length, rAddress, flags); } -int DatagramSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) +int DatagramSocket::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) { - return impl()->receiveFrom(buffer, length, address, flags); + return impl()->receiveFrom(buffer, length, rAddress, flags); } diff --git a/Net/src/DatagramSocketImpl.cpp b/Net/src/DatagramSocketImpl.cpp index ef2b50881..e42f75c08 100644 --- a/Net/src/DatagramSocketImpl.cpp +++ b/Net/src/DatagramSocketImpl.cpp @@ -47,7 +47,7 @@ DatagramSocketImpl::DatagramSocketImpl(SocketAddress::Family family) } -DatagramSocketImpl::DatagramSocketImpl(poco_socket_t sockfd): SocketImpl(sockfd) +DatagramSocketImpl::DatagramSocketImpl(poco_socket_t socketfd): SocketImpl(socketfd) { } diff --git a/Net/src/DialogSocket.cpp b/Net/src/DialogSocket.cpp index 6f60777d3..7fd4b6427 100644 --- a/Net/src/DialogSocket.cpp +++ b/Net/src/DialogSocket.cpp @@ -32,8 +32,8 @@ DialogSocket::DialogSocket(): } -DialogSocket::DialogSocket(const SocketAddress& address): - StreamSocket(address), +DialogSocket::DialogSocket(const SocketAddress& rAddress): + StreamSocket(rAddress), _pBuffer(0), _pNext(0), _pEnd(0) diff --git a/Net/src/FilePartSource.cpp b/Net/src/FilePartSource.cpp index fda00e8f0..cf2cdb76f 100644 --- a/Net/src/FilePartSource.cpp +++ b/Net/src/FilePartSource.cpp @@ -38,8 +38,8 @@ FilePartSource::FilePartSource(const std::string& path): } -FilePartSource::FilePartSource(const std::string& path, const std::string& mediaType): - PartSource(mediaType), +FilePartSource::FilePartSource(const std::string& path, const std::string& rMediaType): + PartSource(rMediaType), _path(path), _istr(path) { @@ -50,10 +50,10 @@ FilePartSource::FilePartSource(const std::string& path, const std::string& media } -FilePartSource::FilePartSource(const std::string& path, const std::string& filename, const std::string& mediaType): - PartSource(mediaType), +FilePartSource::FilePartSource(const std::string& path, const std::string& rFilename, const std::string& rMediaType): + PartSource(rMediaType), _path(path), - _filename(filename), + _filename(rFilename), _istr(path) { Path p(path); diff --git a/Net/src/HTMLForm.cpp b/Net/src/HTMLForm.cpp index 24ee4a60b..e3cd94ad4 100644 --- a/Net/src/HTMLForm.cpp +++ b/Net/src/HTMLForm.cpp @@ -257,7 +257,7 @@ std::streamsize HTMLForm::calculateContentLength() } -void HTMLForm::write(std::ostream& ostr, const std::string& boundary) +void HTMLForm::write(std::ostream& ostr, const std::string& rBoundary) { if (_encoding == ENCODING_URL) { @@ -265,7 +265,7 @@ void HTMLForm::write(std::ostream& ostr, const std::string& boundary) } else { - _boundary = boundary; + _boundary = rBoundary; writeMultipart(ostr); } } @@ -355,12 +355,12 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler) { std::string name = params["name"]; std::string value; - std::istream& istr = reader.stream(); - int ch = istr.get(); + std::istream& rIstr = reader.stream(); + int ch = rIstr.get(); while (ch != eof) { value += (char) ch; - ch = istr.get(); + ch = rIstr.get(); } add(name, value); } diff --git a/Net/src/HTTPAuthenticationParams.cpp b/Net/src/HTTPAuthenticationParams.cpp index 29ed198a0..bb89fee68 100644 --- a/Net/src/HTTPAuthenticationParams.cpp +++ b/Net/src/HTTPAuthenticationParams.cpp @@ -137,15 +137,15 @@ void HTTPAuthenticationParams::fromResponse(const HTTPResponse& response, const bool found = false; while (!found && it != response.end() && icompare(it->first, header) == 0) { - const std::string& header = it->second; - if (icompare(header, 0, 6, "Basic ") == 0) + const std::string& rHeader = it->second; + if (icompare(rHeader, 0, 6, "Basic ") == 0) { - parse(header.begin() + 6, header.end()); + parse(rHeader.begin() + 6, rHeader.end()); found = true; } - else if (icompare(header, 0, 7, "Digest ") == 0) + else if (icompare(rHeader, 0, 7, "Digest ") == 0) { - parse(header.begin() + 7, header.end()); + parse(rHeader.begin() + 7, rHeader.end()); found = true; } ++it; diff --git a/Net/src/HTTPClientSession.cpp b/Net/src/HTTPClientSession.cpp index de510925e..b1954b084 100644 --- a/Net/src/HTTPClientSession.cpp +++ b/Net/src/HTTPClientSession.cpp @@ -52,8 +52,8 @@ HTTPClientSession::HTTPClientSession(): } -HTTPClientSession::HTTPClientSession(const StreamSocket& socket): - HTTPSession(socket), +HTTPClientSession::HTTPClientSession(const StreamSocket& rSocket): + HTTPSession(rSocket), _port(HTTPSession::HTTP_PORT), _proxyConfig(_globalProxyConfig), _keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0), diff --git a/Net/src/HTTPRequest.cpp b/Net/src/HTTPRequest.cpp index f1e63ab73..15440f812 100644 --- a/Net/src/HTTPRequest.cpp +++ b/Net/src/HTTPRequest.cpp @@ -241,11 +241,11 @@ void HTTPRequest::getCredentials(const std::string& header, std::string& scheme, { const std::string& auth = get(header); std::string::const_iterator it = auth.begin(); - std::string::const_iterator end = auth.end(); - while (it != end && Poco::Ascii::isSpace(*it)) ++it; - while (it != end && !Poco::Ascii::isSpace(*it)) scheme += *it++; - while (it != end && Poco::Ascii::isSpace(*it)) ++it; - while (it != end) authInfo += *it++; + std::string::const_iterator itEnd = auth.end(); + while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it; + while (it != itEnd && !Poco::Ascii::isSpace(*it)) scheme += *it++; + while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it; + while (it != itEnd) authInfo += *it++; } else throw NotAuthenticatedException(); } diff --git a/Net/src/HTTPServer.cpp b/Net/src/HTTPServer.cpp index ce2b4ec0b..9a90ef2d5 100644 --- a/Net/src/HTTPServer.cpp +++ b/Net/src/HTTPServer.cpp @@ -29,15 +29,15 @@ HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 por } -HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams): - TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), socket, pParams), +HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams): + TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), rSocket, pParams), _pFactory(pFactory) { } -HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams): - TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, socket, pParams), +HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams): + TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, rSocket, pParams), _pFactory(pFactory) { } diff --git a/Net/src/HTTPServerConnection.cpp b/Net/src/HTTPServerConnection.cpp index 4166f26c8..aad8a6a7a 100644 --- a/Net/src/HTTPServerConnection.cpp +++ b/Net/src/HTTPServerConnection.cpp @@ -31,8 +31,8 @@ namespace Poco { namespace Net { -HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory): - TCPServerConnection(socket), +HTTPServerConnection::HTTPServerConnection(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory): + TCPServerConnection(rSocket), _pParams(pParams), _pFactory(pFactory), _stopped(false) diff --git a/Net/src/HTTPServerRequestImpl.cpp b/Net/src/HTTPServerRequestImpl.cpp index c363cd7ba..4760e4a96 100644 --- a/Net/src/HTTPServerRequestImpl.cpp +++ b/Net/src/HTTPServerRequestImpl.cpp @@ -33,13 +33,13 @@ namespace Poco { namespace Net { -HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& response, HTTPServerSession& session, HTTPServerParams* pParams): - _response(response), +HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& rResponse, HTTPServerSession& session, HTTPServerParams* pParams): + _response(rResponse), _session(session), _pStream(0), _pParams(pParams, true) { - response.attachRequest(this); + rResponse.attachRequest(this); HTTPHeaderInputStream hs(session); read(hs); diff --git a/Net/src/HTTPServerSession.cpp b/Net/src/HTTPServerSession.cpp index 2852fa04e..0da5f7ca1 100644 --- a/Net/src/HTTPServerSession.cpp +++ b/Net/src/HTTPServerSession.cpp @@ -21,14 +21,14 @@ namespace Poco { namespace Net { -HTTPServerSession::HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams): - HTTPSession(socket, pParams->getKeepAlive()), +HTTPServerSession::HTTPServerSession(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams): + HTTPSession(rSocket, pParams->getKeepAlive()), _firstRequest(true), _keepAliveTimeout(pParams->getKeepAliveTimeout()), _maxKeepAliveRequests(pParams->getMaxKeepAliveRequests()) { setTimeout(pParams->getTimeout()); - this->socket().setReceiveTimeout(pParams->getTimeout()); + socket().setReceiveTimeout(pParams->getTimeout()); } diff --git a/Net/src/HTTPSession.cpp b/Net/src/HTTPSession.cpp index 030ec7246..ebf52c5a8 100644 --- a/Net/src/HTTPSession.cpp +++ b/Net/src/HTTPSession.cpp @@ -38,8 +38,8 @@ HTTPSession::HTTPSession(): } -HTTPSession::HTTPSession(const StreamSocket& socket): - _socket(socket), +HTTPSession::HTTPSession(const StreamSocket& rSocket): + _socket(rSocket), _pBuffer(0), _pCurrent(0), _pEnd(0), @@ -50,8 +50,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket): } -HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive): - _socket(socket), +HTTPSession::HTTPSession(const StreamSocket& rSocket, bool keepAlive): + _socket(rSocket), _pBuffer(0), _pCurrent(0), _pEnd(0), @@ -226,9 +226,9 @@ StreamSocket HTTPSession::detachSocket() } -void HTTPSession::attachSocket(const StreamSocket& socket) +void HTTPSession::attachSocket(const StreamSocket& rSocket) { - _socket = socket; + _socket = rSocket; } diff --git a/Net/src/HTTPSessionFactory.cpp b/Net/src/HTTPSessionFactory.cpp index 0e77f4549..62ad34c86 100644 --- a/Net/src/HTTPSessionFactory.cpp +++ b/Net/src/HTTPSessionFactory.cpp @@ -35,9 +35,9 @@ HTTPSessionFactory::HTTPSessionFactory(): } -HTTPSessionFactory::HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort): - _proxyHost(proxyHost), - _proxyPort(proxyPort) +HTTPSessionFactory::HTTPSessionFactory(const std::string& rProxyHost, Poco::UInt16 port): + _proxyHost(rProxyHost), + _proxyPort(port) { } diff --git a/Net/src/ICMPEventArgs.cpp b/Net/src/ICMPEventArgs.cpp index fe051f122..40b6ade57 100644 --- a/Net/src/ICMPEventArgs.cpp +++ b/Net/src/ICMPEventArgs.cpp @@ -32,13 +32,13 @@ namespace Poco { namespace Net { -ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl): +ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int operationRepetitions, int dataSizeInBytes, int operationTtl): _address(address), _sent(0), - _dataSize(dataSize), - _ttl(ttl), - _rtt(repetitions, 0), - _errors(repetitions) + _dataSize(dataSizeInBytes), + _ttl(operationTtl), + _rtt(operationRepetitions, 0), + _errors(operationRepetitions) { } @@ -76,11 +76,11 @@ std::string ICMPEventArgs::hostAddress() const } -void ICMPEventArgs::setRepetitions(int repetitions) +void ICMPEventArgs::setRepetitions(int operationRepetitions) { _rtt.clear(); - _rtt.resize(repetitions, 0); - _errors.assign(repetitions, ""); + _rtt.resize(operationRepetitions, 0); + _errors.assign(operationRepetitions, ""); } @@ -101,13 +101,13 @@ ICMPEventArgs ICMPEventArgs::operator ++ (int) int ICMPEventArgs::received() const { - int received = 0; + int ret = 0; for (int i = 0; i < _rtt.size(); ++i) { - if (_rtt[i]) ++received; + if (_rtt[i]) ++ret; } - return received; + return ret; } diff --git a/Net/src/ICMPSocket.cpp b/Net/src/ICMPSocket.cpp index ece9871c3..e69e97b7f 100644 --- a/Net/src/ICMPSocket.cpp +++ b/Net/src/ICMPSocket.cpp @@ -26,11 +26,11 @@ namespace Poco { namespace Net { -ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSize, int ttl, int timeout): - Socket(new ICMPSocketImpl(family, dataSize, ttl, timeout)), - _dataSize(dataSize), - _ttl(ttl), - _timeout(timeout) +ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSizeInBytes, int ttlValue, int socketTimeout): + Socket(new ICMPSocketImpl(family, dataSizeInBytes, ttlValue, socketTimeout)), + _dataSize(dataSizeInBytes), + _ttl(ttlValue), + _timeout(socketTimeout) { } @@ -66,15 +66,15 @@ ICMPSocket& ICMPSocket::operator = (const Socket& socket) } -int ICMPSocket::sendTo(const SocketAddress& address, int flags) +int ICMPSocket::sendTo(const SocketAddress& rAddress, int flags) { - return impl()->sendTo(0, 0, address, flags); + return impl()->sendTo(0, 0, rAddress, flags); } -int ICMPSocket::receiveFrom(SocketAddress& address, int flags) +int ICMPSocket::receiveFrom(SocketAddress& rAddress, int flags) { - return impl()->receiveFrom(0, 0, address, flags); + return impl()->receiveFrom(0, 0, rAddress, flags); } diff --git a/Net/src/ICMPSocketImpl.cpp b/Net/src/ICMPSocketImpl.cpp index 2deefbaae..bfd04b71b 100644 --- a/Net/src/ICMPSocketImpl.cpp +++ b/Net/src/ICMPSocketImpl.cpp @@ -45,14 +45,14 @@ ICMPSocketImpl::~ICMPSocketImpl() } -int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& address, int flags) +int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& rAddress, int flags) { - int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), address, flags); + int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), rAddress, flags); return n; } -int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags) +int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& rAddress, int flags) { int maxPacketSize = _icmpPacket.maxPacketSize(); unsigned char* buffer = new unsigned char[maxPacketSize]; @@ -68,7 +68,7 @@ int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags) // fake ping responses will cause an endless loop. throw TimeoutException(); } - SocketImpl::receiveFrom(buffer, maxPacketSize, address, flags); + SocketImpl::receiveFrom(buffer, maxPacketSize, rAddress, flags); } while (!_icmpPacket.validReplyID(buffer, maxPacketSize)); } diff --git a/Net/src/IPAddress.cpp b/Net/src/IPAddress.cpp index 69dc5ab3f..f2b052362 100644 --- a/Net/src/IPAddress.cpp +++ b/Net/src/IPAddress.cpp @@ -60,39 +60,39 @@ IPAddress::IPAddress() } -IPAddress::IPAddress(const IPAddress& addr) +IPAddress::IPAddress(const IPAddress& rAddr) { - if (addr.family() == IPv4) - newIPv4(addr.addr()); + if (rAddr.family() == IPv4) + newIPv4(rAddr.addr()); #if defined(POCO_HAVE_IPv6) else - newIPv6(addr.addr(), addr.scope()); + newIPv6(rAddr.addr(), rAddr.scope()); #endif } -IPAddress::IPAddress(Family family) +IPAddress::IPAddress(Family addressFamily) { - if (family == IPv4) + if (addressFamily == IPv4) newIPv4(); #if defined(POCO_HAVE_IPv6) - else if (family == IPv6) + else if (addressFamily == IPv6) newIPv6(); #endif else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); } -IPAddress::IPAddress(const std::string& addr) +IPAddress::IPAddress(const std::string& rAddr) { IPv4AddressImpl empty4 = IPv4AddressImpl(); - if (addr.empty() || trim(addr) == "0.0.0.0") + if (rAddr.empty() || trim(rAddr) == "0.0.0.0") { newIPv4(empty4.addr()); return; } - IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr)); + IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr)); if (addr4 != empty4) { newIPv4(addr4.addr()); @@ -101,13 +101,13 @@ IPAddress::IPAddress(const std::string& addr) #if defined(POCO_HAVE_IPv6) IPv6AddressImpl empty6 = IPv6AddressImpl(); - if (addr.empty() || trim(addr) == "::") + if (rAddr.empty() || trim(rAddr) == "::") { newIPv6(empty6.addr()); return; } - IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr)); + IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr)); if (addr6 != IPv6AddressImpl()) { newIPv6(addr6.addr(), addr6.scope()); @@ -115,22 +115,22 @@ IPAddress::IPAddress(const std::string& addr) } #endif - throw InvalidAddressException(addr); + throw InvalidAddressException(rAddr); } -IPAddress::IPAddress(const std::string& addr, Family family) +IPAddress::IPAddress(const std::string& rAddr, Family addressFamily) { - if (family == IPv4) + if (addressFamily == IPv4) { - IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr)); + IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr)); newIPv4(addr4.addr()); return; } #if defined(POCO_HAVE_IPv6) - else if (family == IPv6) + else if (addressFamily == IPv6) { - IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr)); + IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr)); newIPv6(addr6.addr(), addr6.scope()); return; } @@ -139,36 +139,36 @@ IPAddress::IPAddress(const std::string& addr, Family family) } -IPAddress::IPAddress(const void* addr, poco_socklen_t length) +IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength) #ifndef POCO_HAVE_ALIGNMENT : _pImpl(0) #endif { - if (length == sizeof(struct in_addr)) - newIPv4(addr); + if (addressLength == sizeof(struct in_addr)) + newIPv4(pAddr); #if defined(POCO_HAVE_IPv6) - else if (length == sizeof(struct in6_addr)) - newIPv6(addr); + else if (addressLength == sizeof(struct in6_addr)) + newIPv6(pAddr); #endif else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); } -IPAddress::IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scope) +IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength, Poco::UInt32 scopeIdentifier) { - if (length == sizeof(struct in_addr)) - newIPv4(addr); + if (addressLength == sizeof(struct in_addr)) + newIPv4(pAddr); #if defined(POCO_HAVE_IPv6) - else if (length == sizeof(struct in6_addr)) - newIPv6(addr, scope); + else if (addressLength == sizeof(struct in6_addr)) + newIPv6(pAddr, scopeIdentifier); #endif else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); } -IPAddress::IPAddress(unsigned prefix, Family family) +IPAddress::IPAddress(unsigned prefix, Family addressFamily) { - if (family == IPv4) + if (addressFamily == IPv4) { if (prefix <= 32) newIPv4(prefix); @@ -176,7 +176,7 @@ IPAddress::IPAddress(unsigned prefix, Family family) throw Poco::InvalidArgumentException("Invalid prefix length passed to IPAddress()"); } #if defined(POCO_HAVE_IPv6) - else if (family == IPv6) + else if (addressFamily == IPv6) { if (prefix <= 128) newIPv6(prefix); @@ -209,11 +209,11 @@ IPAddress::IPAddress(const SOCKET_ADDRESS& socket_address) IPAddress::IPAddress(const struct sockaddr& sockaddr) { - unsigned short family = sockaddr.sa_family; - if (family == AF_INET) + unsigned short addressFamily = sockaddr.sa_family; + if (addressFamily == AF_INET) newIPv4(&reinterpret_cast(&sockaddr)->sin_addr); #if defined(POCO_HAVE_IPv6) - else if (family == AF_INET6) + else if (addressFamily == AF_INET6) newIPv6(&reinterpret_cast(&sockaddr)->sin6_addr, reinterpret_cast(&sockaddr)->sin6_scope_id); #endif @@ -227,16 +227,16 @@ IPAddress::~IPAddress() } -IPAddress& IPAddress::operator = (const IPAddress& addr) +IPAddress& IPAddress::operator = (const IPAddress& rAddr) { - if (&addr != this) + if (&rAddr != this) { destruct(); - if (addr.family() == IPAddress::IPv4) - newIPv4(addr.addr()); + if (rAddr.family() == IPAddress::IPv4) + newIPv4(rAddr.addr()); #if defined(POCO_HAVE_IPv6) - else if (addr.family() == IPAddress::IPv6) - newIPv6(addr.addr(), addr.scope()); + else if (rAddr.family() == IPAddress::IPv6) + newIPv6(rAddr.addr(), rAddr.scope()); #endif else throw Poco::InvalidArgumentException("Invalid or unsupported address family"); @@ -553,16 +553,16 @@ bool IPAddress::tryParse(const std::string& addr, IPAddress& result) } -void IPAddress::mask(const IPAddress& mask) +void IPAddress::mask(const IPAddress& rMask) { IPAddress null; - pImpl()->mask(mask.pImpl(), null.pImpl()); + pImpl()->mask(rMask.pImpl(), null.pImpl()); } -void IPAddress::mask(const IPAddress& mask, const IPAddress& set) +void IPAddress::mask(const IPAddress& rMask, const IPAddress& set) { - pImpl()->mask(mask.pImpl(), set.pImpl()); + pImpl()->mask(rMask.pImpl(), set.pImpl()); } diff --git a/Net/src/IPAddressImpl.cpp b/Net/src/IPAddressImpl.cpp index dd20bd052..0440f49cd 100644 --- a/Net/src/IPAddressImpl.cpp +++ b/Net/src/IPAddressImpl.cpp @@ -86,31 +86,31 @@ IPv4AddressImpl::IPv4AddressImpl() } -IPv4AddressImpl::IPv4AddressImpl(const void* addr) +IPv4AddressImpl::IPv4AddressImpl(const void* pAddr) { - std::memcpy(&_addr, addr, sizeof(_addr)); + std::memcpy(&_addr, pAddr, sizeof(_addr)); } IPv4AddressImpl::IPv4AddressImpl(unsigned prefix) { - UInt32 addr = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix); - _addr.s_addr = ByteOrder::toNetwork(addr); + UInt32 address = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix); + _addr.s_addr = ByteOrder::toNetwork(address); } -IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& addr) +IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& rAddr) { - std::memcpy(&_addr, &addr._addr, sizeof(_addr)); + std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); } -IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& addr) +IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& rAddr) { - if (this == &addr) + if (this == &rAddr) return *this; - std::memcpy(&_addr, &addr._addr, sizeof(_addr)); + std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); return *this; } @@ -199,10 +199,10 @@ bool IPv4AddressImpl::isLinkLocal() const bool IPv4AddressImpl::isSiteLocal() const { - UInt32 addr = ntohl(_addr.s_addr); - return (addr & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24 - (addr & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16 - (addr >= 0xAC100000 && addr <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255 + UInt32 address = ntohl(_addr.s_addr); + return (address & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24 + (address & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16 + (address >= 0xAC100000 && address <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255 } @@ -250,8 +250,8 @@ bool IPv4AddressImpl::isOrgLocalMC() const bool IPv4AddressImpl::isGlobalMC() const { - UInt32 addr = ntohl(_addr.s_addr); - return addr >= 0xE0000100 && addr <= 0xEE000000; // 224.0.1.0 to 238.255.255.255 + UInt32 address = ntohl(_addr.s_addr); + return address >= 0xE0000100 && address <= 0xEE000000; // 224.0.1.0 to 238.255.255.255 } @@ -299,26 +299,26 @@ IPAddressImpl* IPv4AddressImpl::clone() const } -IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& addr) const +IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& rAddr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr &= addr._addr.s_addr; + result._addr.s_addr &= rAddr._addr.s_addr; return result; } -IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& addr) const +IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& rAddr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr |= addr._addr.s_addr; + result._addr.s_addr |= rAddr._addr.s_addr; return result; } -IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& addr) const +IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& rAddr) const { IPv4AddressImpl result(&_addr); - result._addr.s_addr ^= addr._addr.s_addr; + result._addr.s_addr ^= rAddr._addr.s_addr; return result; } @@ -331,15 +331,15 @@ IPv4AddressImpl result(&_addr); } -bool IPv4AddressImpl::operator == (const IPv4AddressImpl& addr) const +bool IPv4AddressImpl::operator == (const IPv4AddressImpl& rAddr) const { - return 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr)); + return 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr)); } -bool IPv4AddressImpl::operator != (const IPv4AddressImpl& addr) const +bool IPv4AddressImpl::operator != (const IPv4AddressImpl& rAddr) const { - return !(*this == addr); + return !(*this == rAddr); } @@ -357,31 +357,31 @@ IPv6AddressImpl::IPv6AddressImpl(): _scope(0) } -IPv6AddressImpl::IPv6AddressImpl(const void* addr): _scope(0) +IPv6AddressImpl::IPv6AddressImpl(const void* pAddr): _scope(0) { - std::memcpy(&_addr, addr, sizeof(_addr)); + std::memcpy(&_addr, pAddr, sizeof(_addr)); } -IPv6AddressImpl::IPv6AddressImpl(const void* addr, Poco::UInt32 scope): _scope(scope) +IPv6AddressImpl::IPv6AddressImpl(const void* pAddr, Poco::UInt32 scopeIdentifier): _scope(scopeIdentifier) { - std::memcpy(&_addr, addr, sizeof(_addr)); + std::memcpy(&_addr, pAddr, sizeof(_addr)); } -IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& addr): _scope(addr._scope) +IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& rAddr): _scope(rAddr._scope) { - std::memcpy((void*) &_addr, (void*) &addr._addr, sizeof(_addr)); + std::memcpy((void*) &_addr, (void*) &rAddr._addr, sizeof(_addr)); } -IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& addr) +IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& rAddr) { - if (this == &addr) + if (this == &rAddr) return *this; - _scope = addr._scope; - std::memcpy(&_addr, &addr._addr, sizeof(_addr)); + _scope = rAddr._scope; + std::memcpy(&_addr, &rAddr._addr, sizeof(_addr)); return *this; } @@ -516,16 +516,16 @@ unsigned IPv6AddressImpl::prefixLength() const #if defined(POCO_OS_FAMILY_UNIX) for (int i = 3; i >= 0; --i) { - unsigned addr = ntohl(_addr.s6_addr32[i]); - if ((bits = maskBits(addr, 32))) return (bitPos - (32 - bits)); + unsigned address = ntohl(_addr.s6_addr32[i]); + if ((bits = maskBits(address, 32))) return (bitPos - (32 - bits)); bitPos -= 32; } return 0; #elif defined(POCO_OS_FAMILY_WINDOWS) for (int i = 7; i >= 0; --i) { - unsigned short addr = ByteOrder::fromNetwork(_addr.s6_addr16[i]); - if ((bits = maskBits(addr, 16))) return (bitPos - (16 - bits)); + unsigned short address = ByteOrder::fromNetwork(_addr.s6_addr16[i]); + if ((bits = maskBits(address, 16))) return (bitPos - (16 - bits)); bitPos -= 16; } return 0; @@ -696,77 +696,77 @@ IPAddressImpl* IPv6AddressImpl::clone() const } -IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& addr) const +IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& rAddr) const { - if (_scope != addr._scope) + if (_scope != rAddr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] &= addr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] &= addr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] &= addr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] &= addr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] &= addr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] &= addr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] &= addr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] &= addr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] &= rAddr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] &= rAddr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] &= rAddr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] &= rAddr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] &= rAddr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] &= rAddr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] &= rAddr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] &= rAddr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] &= addr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] &= addr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] &= addr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] &= addr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] &= rAddr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] &= rAddr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] &= rAddr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] &= rAddr._addr.s6_addr32[3]; #endif return result; } -IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& addr) const +IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& rAddr) const { - if (_scope != addr._scope) + if (_scope != rAddr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] |= addr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] |= addr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] |= addr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] |= addr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] |= addr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] |= addr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] |= addr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] |= addr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] |= rAddr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] |= rAddr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] |= rAddr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] |= rAddr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] |= rAddr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] |= rAddr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] |= rAddr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] |= rAddr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] |= addr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] |= addr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] |= addr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] |= addr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] |= rAddr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] |= rAddr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] |= rAddr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] |= rAddr._addr.s6_addr32[3]; #endif return result; } -IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& addr) const +IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& rAddr) const { - if (_scope != addr._scope) + if (_scope != rAddr._scope) throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one."); IPv6AddressImpl result(*this); #ifdef POCO_OS_FAMILY_WINDOWS - result._addr.s6_addr16[0] ^= addr._addr.s6_addr16[0]; - result._addr.s6_addr16[1] ^= addr._addr.s6_addr16[1]; - result._addr.s6_addr16[2] ^= addr._addr.s6_addr16[2]; - result._addr.s6_addr16[3] ^= addr._addr.s6_addr16[3]; - result._addr.s6_addr16[4] ^= addr._addr.s6_addr16[4]; - result._addr.s6_addr16[5] ^= addr._addr.s6_addr16[5]; - result._addr.s6_addr16[6] ^= addr._addr.s6_addr16[6]; - result._addr.s6_addr16[7] ^= addr._addr.s6_addr16[7]; + result._addr.s6_addr16[0] ^= rAddr._addr.s6_addr16[0]; + result._addr.s6_addr16[1] ^= rAddr._addr.s6_addr16[1]; + result._addr.s6_addr16[2] ^= rAddr._addr.s6_addr16[2]; + result._addr.s6_addr16[3] ^= rAddr._addr.s6_addr16[3]; + result._addr.s6_addr16[4] ^= rAddr._addr.s6_addr16[4]; + result._addr.s6_addr16[5] ^= rAddr._addr.s6_addr16[5]; + result._addr.s6_addr16[6] ^= rAddr._addr.s6_addr16[6]; + result._addr.s6_addr16[7] ^= rAddr._addr.s6_addr16[7]; #else - result._addr.s6_addr32[0] ^= addr._addr.s6_addr32[0]; - result._addr.s6_addr32[1] ^= addr._addr.s6_addr32[1]; - result._addr.s6_addr32[2] ^= addr._addr.s6_addr32[2]; - result._addr.s6_addr32[3] ^= addr._addr.s6_addr32[3]; + result._addr.s6_addr32[0] ^= rAddr._addr.s6_addr32[0]; + result._addr.s6_addr32[1] ^= rAddr._addr.s6_addr32[1]; + result._addr.s6_addr32[2] ^= rAddr._addr.s6_addr32[2]; + result._addr.s6_addr32[3] ^= rAddr._addr.s6_addr32[3]; #endif return result; } @@ -794,15 +794,15 @@ IPv6AddressImpl IPv6AddressImpl::operator ~ () const } -bool IPv6AddressImpl::operator == (const IPv6AddressImpl& addr) const +bool IPv6AddressImpl::operator == (const IPv6AddressImpl& rAddr) const { - return _scope == addr._scope && 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr)); + return _scope == rAddr._scope && 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr)); } -bool IPv6AddressImpl::operator != (const IPv6AddressImpl& addr) const +bool IPv6AddressImpl::operator != (const IPv6AddressImpl& rAddr) const { - return !(*this == addr); + return !(*this == rAddr); } diff --git a/Net/src/MailMessage.cpp b/Net/src/MailMessage.cpp index ca268f2f4..23ae25500 100644 --- a/Net/src/MailMessage.cpp +++ b/Net/src/MailMessage.cpp @@ -206,9 +206,9 @@ void MailMessage::addRecipient(const MailRecipient& recipient) } -void MailMessage::setRecipients(const Recipients& recipients) +void MailMessage::setRecipients(const Recipients& rRecipients) { - _recipients.assign(recipients.begin(), recipients.end()); + _recipients.assign(rRecipients.begin(), rRecipients.end()); } @@ -318,12 +318,12 @@ void MailMessage::addAttachment(const std::string& name, PartSource* pSource, Co } -void MailMessage::read(std::istream& istr, PartHandler& handler) +void MailMessage::read(std::istream& istr, PartHandler& rHandler) { readHeader(istr); if (isMultipart()) { - readMultipart(istr, handler); + readMultipart(istr, rHandler); } else { diff --git a/Net/src/MulticastSocket.cpp b/Net/src/MulticastSocket.cpp index 5dcd9a8e8..26a0aabc0 100644 --- a/Net/src/MulticastSocket.cpp +++ b/Net/src/MulticastSocket.cpp @@ -62,7 +62,7 @@ MulticastSocket::MulticastSocket(SocketAddress::Family family): DatagramSocket(f } -MulticastSocket::MulticastSocket(const SocketAddress& address, bool reuseAddress): DatagramSocket(address, reuseAddress) +MulticastSocket::MulticastSocket(const SocketAddress& rAddress, bool reuseAddress): DatagramSocket(rAddress, reuseAddress) { } diff --git a/Net/src/MultipartReader.cpp b/Net/src/MultipartReader.cpp index 1ee9a98e5..be9a2ece2 100644 --- a/Net/src/MultipartReader.cpp +++ b/Net/src/MultipartReader.cpp @@ -182,9 +182,9 @@ MultipartReader::MultipartReader(std::istream& istr): } -MultipartReader::MultipartReader(std::istream& istr, const std::string& boundary): +MultipartReader::MultipartReader(std::istream& istr, const std::string& rBoundary): _istr(istr), - _boundary(boundary), + _boundary(rBoundary), _pMPI(0) { } diff --git a/Net/src/MultipartWriter.cpp b/Net/src/MultipartWriter.cpp index 0d863d996..21c572ce4 100644 --- a/Net/src/MultipartWriter.cpp +++ b/Net/src/MultipartWriter.cpp @@ -36,9 +36,9 @@ MultipartWriter::MultipartWriter(std::ostream& ostr): } -MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& boundary): +MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& rBoundary): _ostr(ostr), - _boundary(boundary), + _boundary(rBoundary), _firstPart(true) { if (_boundary.empty()) diff --git a/Net/src/NTPPacket.cpp b/Net/src/NTPPacket.cpp index d3cde72e3..9892d7074 100644 --- a/Net/src/NTPPacket.cpp +++ b/Net/src/NTPPacket.cpp @@ -73,9 +73,9 @@ NTPPacket::NTPPacket() : } -NTPPacket::NTPPacket(Poco::UInt8 *packet) +NTPPacket::NTPPacket(Poco::UInt8 *pPacket) { - setPacket(packet); + setPacket(pPacket); } @@ -84,9 +84,9 @@ NTPPacket::~NTPPacket() } -void NTPPacket::packet(Poco::UInt8 *packet) const +void NTPPacket::packet(Poco::UInt8 *pPacket) const { - NTPPacketData *p = (NTPPacketData*)packet; + NTPPacketData *p = (NTPPacketData*)pPacket; p->li = _leapIndicator; p->vn = _version; @@ -104,9 +104,9 @@ void NTPPacket::packet(Poco::UInt8 *packet) const } -void NTPPacket::setPacket(Poco::UInt8 *packet) +void NTPPacket::setPacket(Poco::UInt8 *pPacket) { - NTPPacketData *p = (NTPPacketData*)packet; + NTPPacketData *p = (NTPPacketData*)pPacket; _leapIndicator = p->li; _version = p->vn; diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index e84b49d3b..988099c9d 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -75,14 +75,14 @@ public: typedef NetworkInterface::Type Type; NetworkInterfaceImpl(unsigned index); - NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); - NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0); - NetworkInterfaceImpl(const std::string& name, - const std::string& displayName, - const std::string& adapterName, - const IPAddress& address, + NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); + NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0); + NetworkInterfaceImpl(const std::string& rName, + const std::string& rDisplayName, + const std::string& rAdapterName, + const IPAddress& rAddress, const IPAddress& subnetMask, - const IPAddress& broadcastAddress, + const IPAddress& rBroadcastAddress, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0); @@ -91,10 +91,10 @@ public: const std::string& displayName() const; const std::string& adapterName() const; const IPAddress& firstAddress(IPAddress::Family family) const; - void addAddress(const AddressTuple& address); + void addAddress(const AddressTuple& rAddress); const IPAddress& address(unsigned index) const; const NetworkInterface::AddressList& addressList() const; - bool hasAddress(const IPAddress& address) const; + bool hasAddress(const IPAddress& rAddress) const; const IPAddress& subnetMask(unsigned index) const; const IPAddress& broadcastAddress(unsigned index) const; const IPAddress& destAddress(unsigned index) const; @@ -102,9 +102,9 @@ public: bool supportsIPv4() const; bool supportsIPv6() const; - void setName(const std::string& name); - void setDisplayName(const std::string& name); - void setAdapterName(const std::string& name); + void setName(const std::string& rName); + void setDisplayName(const std::string& rName); + void setAdapterName(const std::string& rName); void addAddress(const IPAddress& addr); void setMACAddress(const NetworkInterface::MACAddress& addr); void setMACAddress(const void *addr, std::size_t len); @@ -157,8 +157,8 @@ private: }; -NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index): - _index(index), +NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned interfaceIndex): + _index(interfaceIndex), _broadcast(false), _loopback(false), _multicast(false), @@ -171,11 +171,11 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index): } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress): - _name(name), - _displayName(displayName), - _adapterName(adapterName), - _index(index), +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress): + _name(rName), + _displayName(rDisplayName), + _adapterName(rAdapterName), + _index(interfaceIndex), _broadcast(false), _loopback(false), _multicast(false), @@ -185,17 +185,17 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s _mtu(0), _type(NetworkInterface::NI_TYPE_OTHER) { - _addressList.push_back(AddressTuple(address, IPAddress(), IPAddress())); + _addressList.push_back(AddressTuple(rAddress, IPAddress(), IPAddress())); setPhyParams(); if (pMACAddress) setMACAddress(*pMACAddress); } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, NetworkInterface::MACAddress* pMACAddress): - _name(name), - _displayName(displayName), - _adapterName(adapterName), - _index(index), +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress): + _name(rName), + _displayName(rDisplayName), + _adapterName(rAdapterName), + _index(interfaceIndex), _broadcast(false), _loopback(false), _multicast(false), @@ -210,18 +210,18 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s } -NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, - const std::string& displayName, - const std::string& adapterName, - const IPAddress& address, - const IPAddress& subnetMask, - const IPAddress& broadcastAddress, - unsigned index, +NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, + const std::string& rDisplayName, + const std::string& rAdapterName, + const IPAddress& rAddress, + const IPAddress& rSubnetMask, + const IPAddress& rBroadcastAddress, + unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress): - _name(name), - _displayName(displayName), - _adapterName(adapterName), - _index(index), + _name(rName), + _displayName(rDisplayName), + _adapterName(rAdapterName), + _index(interfaceIndex), _broadcast(false), _loopback(false), _multicast(false), @@ -230,7 +230,7 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, _running(false), _mtu(0) { - _addressList.push_back(AddressTuple(address, subnetMask, broadcastAddress)); + _addressList.push_back(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress)); setPhyParams(); if (pMACAddress) setMACAddress(*pMACAddress); } @@ -324,29 +324,29 @@ const IPAddress& NetworkInterfaceImpl::firstAddress(IPAddress::Family family) co } -inline void NetworkInterfaceImpl::addAddress(const AddressTuple& address) +inline void NetworkInterfaceImpl::addAddress(const AddressTuple& rAddress) { - _addressList.push_back(address); + _addressList.push_back(rAddress); } -bool NetworkInterfaceImpl::hasAddress(const IPAddress& address) const +bool NetworkInterfaceImpl::hasAddress(const IPAddress& rAddress) const { NetworkInterface::ConstAddressIterator it = _addressList.begin(); NetworkInterface::ConstAddressIterator end = _addressList.end(); for (; it != end; ++it) { - if (it->get() == address) + if (it->get() == rAddress) return true; } return false; } -inline const IPAddress& NetworkInterfaceImpl::address(unsigned index) const +inline const IPAddress& NetworkInterfaceImpl::address(unsigned interfaceIndex) const { - if (index < _addressList.size()) return _addressList[index].get(); - else throw NotFoundException(Poco::format("No address with index %u.", index)); + if (interfaceIndex < _addressList.size()) return _addressList[interfaceIndex].get(); + else throw NotFoundException(Poco::format("No address with index %u.", interfaceIndex)); } @@ -356,32 +356,32 @@ inline const NetworkInterface::AddressList& NetworkInterfaceImpl::addressList() } -const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned index) const +const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned interfaceIndex) const { - if (index < _addressList.size()) - return _addressList[index].get(); + if (interfaceIndex < _addressList.size()) + return _addressList[interfaceIndex].get(); - throw NotFoundException(Poco::format("No subnet mask with index %u.", index)); + throw NotFoundException(Poco::format("No subnet mask with index %u.", interfaceIndex)); } -const IPAddress& NetworkInterfaceImpl::broadcastAddress(unsigned index) const +const IPAddress& NetworkInterfaceImpl::broadcastAddress(unsigned interfaceIndex) const { - if (index < _addressList.size()) - return _addressList[index].get(); + if (interfaceIndex < _addressList.size()) + return _addressList[interfaceIndex].get(); - throw NotFoundException(Poco::format("No subnet mask with index %u.", index)); + throw NotFoundException(Poco::format("No subnet mask with index %u.", interfaceIndex)); } -const IPAddress& NetworkInterfaceImpl::destAddress(unsigned index) const +const IPAddress& NetworkInterfaceImpl::destAddress(unsigned interfaceIndex) const { if (!pointToPoint()) throw InvalidAccessException("Only PPP addresses have destination address."); - else if (index < _addressList.size()) - return _addressList[index].get(); + else if (interfaceIndex < _addressList.size()) + return _addressList[interfaceIndex].get(); - throw NotFoundException(Poco::format("No address with index %u.", index)); + throw NotFoundException(Poco::format("No address with index %u.", interfaceIndex)); } @@ -491,45 +491,45 @@ void NetworkInterfaceImpl::setFlags(short flags) #endif -inline void NetworkInterfaceImpl::setUp(bool up) +inline void NetworkInterfaceImpl::setUp(bool isUp) { - _up = up; + _up = isUp; } -inline void NetworkInterfaceImpl::setMTU(unsigned mtu) +inline void NetworkInterfaceImpl::setMTU(unsigned interfaceMTU) { - _mtu = mtu; + _mtu = interfaceMTU; } -inline void NetworkInterfaceImpl::setType(Type type) +inline void NetworkInterfaceImpl::setType(Type interfaceType) { - _type = type; + _type = interfaceType; } -inline void NetworkInterfaceImpl::setIndex(unsigned index) +inline void NetworkInterfaceImpl::setIndex(unsigned interfaceIndex) { - _index = index; + _index = interfaceIndex; } -inline void NetworkInterfaceImpl::setName(const std::string& name) +inline void NetworkInterfaceImpl::setName(const std::string& rName) { - _name = name; + _name = rName; } -inline void NetworkInterfaceImpl::setDisplayName(const std::string& name) +inline void NetworkInterfaceImpl::setDisplayName(const std::string& rName) { - _displayName = name; + _displayName = rName; } -inline void NetworkInterfaceImpl::setAdapterName(const std::string& name) +inline void NetworkInterfaceImpl::setAdapterName(const std::string& rName) { - _adapterName = name; + _adapterName = rName; } @@ -560,8 +560,8 @@ inline void NetworkInterfaceImpl::setMACAddress(const void *addr, std::size_t le FastMutex NetworkInterface::_mutex; -NetworkInterface::NetworkInterface(unsigned index): - _pImpl(new NetworkInterfaceImpl(index)) +NetworkInterface::NetworkInterface(unsigned interfaceIndex): + _pImpl(new NetworkInterfaceImpl(interfaceIndex)) { } @@ -573,44 +573,44 @@ NetworkInterface::NetworkInterface(const NetworkInterface& interfc): } -NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, index, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, interfaceIndex, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, index, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, interfaceIndex, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(name, name, name, address, index, pMACAddress)) +NetworkInterface::NetworkInterface(const std::string& rName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress): + _pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, interfaceIndex, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& name, - const std::string& displayName, - const std::string& adapterName, - const IPAddress& address, - const IPAddress& subnetMask, - const IPAddress& broadcastAddress, - unsigned index, +NetworkInterface::NetworkInterface(const std::string& rName, + const std::string& rDisplayName, + const std::string& rAdapterName, + const IPAddress& rAddress, + const IPAddress& rSubnetMask, + const IPAddress& rBroadcastAddress, + unsigned interfaceIndex, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, subnetMask, broadcastAddress, index, pMACAddress)) + _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress)) { } -NetworkInterface::NetworkInterface(const std::string& name, - const IPAddress& address, - const IPAddress& subnetMask, - const IPAddress& broadcastAddress, - unsigned index, +NetworkInterface::NetworkInterface(const std::string& rName, + const IPAddress& rAddress, + const IPAddress& rSubnetMask, + const IPAddress& rBroadcastAddress, + unsigned interfaceIndex, MACAddress* pMACAddress): - _pImpl(new NetworkInterfaceImpl(name, name, name, address, subnetMask, broadcastAddress, index, pMACAddress)) + _pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress)) { } @@ -679,21 +679,21 @@ void NetworkInterface::firstAddress(IPAddress& addr, IPAddress::Family family) c } -void NetworkInterface::addAddress(const IPAddress& address) +void NetworkInterface::addAddress(const IPAddress& rAddress) { - _pImpl->addAddress(AddressTuple(address, IPAddress(), IPAddress())); + _pImpl->addAddress(AddressTuple(rAddress, IPAddress(), IPAddress())); } -void NetworkInterface::addAddress(const IPAddress& address, const IPAddress& subnetMask, const IPAddress& broadcastAddress) +void NetworkInterface::addAddress(const IPAddress& rAddress, const IPAddress& rSubnetMask, const IPAddress& rBroadcastAddress) { - _pImpl->addAddress(AddressTuple(address, subnetMask, broadcastAddress)); + _pImpl->addAddress(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress)); } -const IPAddress& NetworkInterface::address(unsigned index) const +const IPAddress& NetworkInterface::address(unsigned interfaceIndex) const { - return _pImpl->address(index); + return _pImpl->address(interfaceIndex); } @@ -703,15 +703,15 @@ const NetworkInterface::AddressList& NetworkInterface::addressList() const } -const IPAddress& NetworkInterface::subnetMask(unsigned index) const +const IPAddress& NetworkInterface::subnetMask(unsigned interfaceIndex) const { - return _pImpl->subnetMask(index); + return _pImpl->subnetMask(interfaceIndex); } -const IPAddress& NetworkInterface::broadcastAddress(unsigned index) const +const IPAddress& NetworkInterface::broadcastAddress(unsigned interfaceIndex) const { - return _pImpl->broadcastAddress(index); + return _pImpl->broadcastAddress(interfaceIndex); } @@ -721,9 +721,9 @@ const NetworkInterface::MACAddress& NetworkInterface::macAddress() const } -const IPAddress& NetworkInterface::destAddress(unsigned index) const +const IPAddress& NetworkInterface::destAddress(unsigned interfaceIndex) const { - return _pImpl->destAddress(index); + return _pImpl->destAddress(interfaceIndex); } @@ -793,14 +793,14 @@ bool NetworkInterface::isUp() const } -NetworkInterface NetworkInterface::forName(const std::string& name, bool requireIPv6) +NetworkInterface NetworkInterface::forName(const std::string& rName, bool requireIPv6) { - if (requireIPv6) return forName(name, IPv6_ONLY); - else return forName(name, IPv4_OR_IPv6); + if (requireIPv6) return forName(rName, IPv6_ONLY); + else return forName(rName, IPv4_OR_IPv6); } -NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ipVersion) +NetworkInterface NetworkInterface::forName(const std::string& rName, IPVersion ipVersion) { Map map = NetworkInterface::map(false, false); Map::const_iterator it = map.begin(); @@ -808,7 +808,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip for (; it != end; ++it) { - if (it->second.name() == name) + if (it->second.name() == rName) { if (ipVersion == IPv4_ONLY && it->second.supportsIPv4()) return it->second; @@ -818,7 +818,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip return it->second; } } - throw InterfaceNotFoundException(name); + throw InterfaceNotFoundException(rName); } @@ -864,10 +864,10 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly) NetworkInterface::Map::const_iterator end = m.end(); for (; it != end; ++it) { - int index = it->second.index(); - std::string name = it->second.name(); - std::string displayName = it->second.displayName(); - std::string adapterName = it->second.adapterName(); + int interfaceIndex = it->second.index(); + std::string interfaceName = it->second.name(); + std::string interfaceDisplayName = it->second.displayName(); + std::string interfaceAdapterName = it->second.adapterName(); NetworkInterface::MACAddress mac = it->second.macAddress(); typedef NetworkInterface::AddressList List; @@ -881,12 +881,12 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly) NetworkInterface ni; if (mask.isWildcard()) { - ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac); + ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, interfaceIndex, &mac); } else { IPAddress broadcast = ipIt->get(); - ni = NetworkInterface(name, displayName, adapterName, addr, mask, broadcast, index, &mac); + ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, mask, broadcast, interfaceIndex, &mac); } ni._pImpl->_broadcast = it->second._pImpl->_broadcast; @@ -984,7 +984,7 @@ NetworkInterface::Type fromNative(DWORD type) } -IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback) +IPAddress subnetMaskForInterface(const std::string& rName, bool isLoopback) { if (isLoopback) { @@ -994,7 +994,7 @@ IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback) { #if !defined(_WIN32_WCE) std::string subKey("SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\"); - subKey += name; + subKey += rName; std::string netmask; HKEY hKey; #if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) @@ -1081,9 +1081,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) poco_assert (NO_ERROR == dwRetVal); for (; pAddress; pAddress = pAddress->Next) { - IPAddress address; - IPAddress subnetMask; - IPAddress broadcastAddress; + IPAddress ipAddress; + IPAddress ipSubnetMask; + IPAddress ipBroadcastAddress; unsigned ifIndex = 0; #if defined(POCO_HAVE_IPv6) @@ -1138,26 +1138,26 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #endif if (ifIndex == 0) continue; - std::string name; - std::string displayName; - std::string adapterName(pAddress->AdapterName); + std::string interfaceName; + std::string interfaceDisplayName; + std::string interfaceAdapterName(pAddress->AdapterName); #ifdef POCO_WIN32_UTF8 - Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, name); - Poco::UnicodeConverter::toUTF8(pAddress->Description, displayName); + Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, interfaceName); + Poco::UnicodeConverter::toUTF8(pAddress->Description, interfaceDisplayName); #else char nameBuffer[1024]; int rc = WideCharToMultiByte(CP_ACP, 0, pAddress->FriendlyName, -1, nameBuffer, sizeof(nameBuffer), NULL, NULL); - if (rc) name = nameBuffer; + if (rc) interfaceName = nameBuffer; char displayNameBuffer[1024]; rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL); - if (rc) displayName = displayNameBuffer; + if (rc) interfaceDisplayName = displayNameBuffer; #endif bool isUp = (pAddress->OperStatus == IfOperStatusUp); bool isIP = (0 != pAddress->FirstUnicastAddress); if (((ipOnly && isIP) || !ipOnly) && ((upOnly && isUp) || !upOnly)) { - NetworkInterface ni(name, displayName, adapterName, ifIndex); + NetworkInterface ni(interfaceName, interfaceDisplayName, interfaceAdapterName, ifIndex); // Create interface even if it has an empty list of addresses; also, set // physical attributes which are protocol independent (name, media type, // MAC address, MTU, operational status, etc). @@ -1184,7 +1184,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) pUniAddr; pUniAddr = pUniAddr->Next) { - address = IPAddress(pUniAddr->Address); + ipAddress = IPAddress(pUniAddr->Address); ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family; switch (family) { @@ -1201,67 +1201,67 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #if defined(_WIN32_WCE) #if _WIN32_WCE >= 0x0800 prefixLength = pUniAddr->OnLinkPrefixLength; - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); + ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress); #else - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); + ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); #endif // if previous call did not do it, make last-ditch attempt for prefix and broadcast if (prefixLength == 0 && pAddress->FirstPrefix) prefixLength = pAddress->FirstPrefix->PrefixLength; poco_assert (prefixLength <= 32); - if (broadcastAddress.isWildcard()) + if (ipBroadcastAddress.isWildcard()) { IPAddress mask(static_cast(prefixLength), IPAddress::IPv4); - IPAddress host(mask & address); - broadcastAddress = host | ~mask; + IPAddress host(mask & ipAddress); + ipBroadcastAddress = host | ~mask; } #elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1 #if (_WIN32_WINNT >= 0x0600) // Vista and newer if (osvi.dwMajorVersion >= 6) { prefixLength = pUniAddr->OnLinkPrefixLength; - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); + ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress); } else { - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); + ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); } #else - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); + ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength); #endif poco_assert (prefixLength <= 32); - if (broadcastAddress.isWildcard()) + if (ipBroadcastAddress.isWildcard()) { IPAddress mask(static_cast(prefixLength), IPAddress::IPv4); - IPAddress host(mask & address); - broadcastAddress = host | ~mask; + IPAddress host(mask & ipAddress); + ipBroadcastAddress = host | ~mask; } #endif // (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) if (prefixLength) { - subnetMask = IPAddress(static_cast(prefixLength), IPAddress::IPv4); + ipSubnetMask = IPAddress(static_cast(prefixLength), IPAddress::IPv4); } else // if all of the above fails, look up the subnet mask in the registry { - address = IPAddress(&reinterpret_cast(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr)); - subnetMask = subnetMaskForInterface(name, address.isLoopback()); - if (!address.isLoopback()) + ipAddress = IPAddress(&reinterpret_cast(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr)); + ipSubnetMask = subnetMaskForInterface(interfaceName, ipAddress.isLoopback()); + if (!ipAddress.isLoopback()) { - broadcastAddress = address; - broadcastAddress.mask(subnetMask, IPAddress::broadcast()); + ipBroadcastAddress = ipAddress; + ipBroadcastAddress.mask(ipSubnetMask, IPAddress::broadcast()); } } - ifIt->second.addAddress(address, subnetMask, broadcastAddress); + ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); } else { - ifIt->second.addAddress(address); + ifIt->second.addAddress(ipAddress); } } break; #if defined(POCO_HAVE_IPv6) case AF_INET6: - ifIt->second.addAddress(address); + ifIt->second.addAddress(ipAddress); break; #endif } // switch family @@ -1408,7 +1408,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { if (!currIface->ifa_addr) continue; - IPAddress address, subnetMask, broadcastAddress; + IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress; unsigned family = currIface->ifa_addr->sa_family; switch (family) { @@ -1432,17 +1432,17 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - address = IPAddress(*(currIface->ifa_addr)); + ipAddress = IPAddress(*(currIface->ifa_addr)); if (( currIface->ifa_flags & IFF_LOOPBACK ) == 0 && currIface->ifa_netmask) - subnetMask = IPAddress(*(currIface->ifa_netmask)); + ipSubnetMask = IPAddress(*(currIface->ifa_netmask)); if (currIface->ifa_flags & IFF_BROADCAST && currIface->ifa_broadaddr) - broadcastAddress = IPAddress(*(currIface->ifa_broadaddr)); + ipBroadcastAddress = IPAddress(*(currIface->ifa_broadaddr)); else if (currIface->ifa_flags & IFF_POINTOPOINT && currIface->ifa_dstaddr) - broadcastAddress = IPAddress(*(currIface->ifa_dstaddr)); + ipBroadcastAddress = IPAddress(*(currIface->ifa_dstaddr)); else - broadcastAddress = IPAddress(); + ipBroadcastAddress = IPAddress(); break; #if defined(POCO_HAVE_IPv6) case AF_INET6: @@ -1453,10 +1453,10 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - address = IPAddress(&reinterpret_cast(currIface->ifa_addr)->sin6_addr, + ipAddress = IPAddress(&reinterpret_cast(currIface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); - subnetMask = IPAddress(*(currIface->ifa_netmask)); - broadcastAddress = IPAddress(); + ipSubnetMask = IPAddress(*(currIface->ifa_netmask)); + ipBroadcastAddress = IPAddress(); break; #endif default: @@ -1472,7 +1472,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((upOnly && intf.isUp()) || !upOnly) { if ((ifIt = result.find(ifIndex)) != result.end()) - ifIt->second.addAddress(address, subnetMask, broadcastAddress); + ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); } } } @@ -1582,7 +1582,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { if (!iface->ifa_addr) continue; - IPAddress address, subnetMask, broadcastAddress; + IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress; unsigned family = iface->ifa_addr->sa_family; switch (family) { @@ -1607,15 +1607,15 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) ifIt = result.insert(Map::value_type(ifIndex, intf)).first; - address = IPAddress(*(iface->ifa_addr)); - subnetMask = IPAddress(*(iface->ifa_netmask)); + ipAddress = IPAddress(*(iface->ifa_addr)); + ipSubnetMask = IPAddress(*(iface->ifa_netmask)); if (iface->ifa_flags & IFF_BROADCAST && iface->ifa_broadaddr) - broadcastAddress = IPAddress(*(iface->ifa_broadaddr)); + ipBroadcastAddress = IPAddress(*(iface->ifa_broadaddr)); else if (iface->ifa_flags & IFF_POINTOPOINT && iface->ifa_dstaddr) - broadcastAddress = IPAddress(*(iface->ifa_dstaddr)); + ipBroadcastAddress = IPAddress(*(iface->ifa_dstaddr)); else - broadcastAddress = IPAddress(); + ipBroadcastAddress = IPAddress(); break; #if defined(POCO_HAVE_IPv6) @@ -1628,9 +1628,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) result.insert(Map::value_type(ifIndex, intf)); - address = IPAddress(&reinterpret_cast(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); - subnetMask = IPAddress(*(iface->ifa_netmask)); - broadcastAddress = IPAddress(); + ipAddress = IPAddress(&reinterpret_cast(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); + ipSubnetMask = IPAddress(*(iface->ifa_netmask)); + ipBroadcastAddress = IPAddress(); break; #endif @@ -1644,11 +1644,11 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #endif ) { - intf = NetworkInterface(std::string(iface->ifa_name), address, subnetMask, broadcastAddress, ifIndex); + intf = NetworkInterface(std::string(iface->ifa_name), ipAddress, ipSubnetMask, ipBroadcastAddress, ifIndex); if ((upOnly && intf.isUp()) || !upOnly) { if ((ifIt = result.find(ifIndex)) != result.end()) - ifIt->second.addAddress(address, subnetMask, broadcastAddress); + ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress); } } } // for interface diff --git a/Net/src/PartSource.cpp b/Net/src/PartSource.cpp index 63b032c27..5f036f2f2 100644 --- a/Net/src/PartSource.cpp +++ b/Net/src/PartSource.cpp @@ -30,8 +30,8 @@ PartSource::PartSource(): } -PartSource::PartSource(const std::string& mediaType): - _mediaType(mediaType) +PartSource::PartSource(const std::string& rMediaType): + _mediaType(rMediaType) { } diff --git a/Net/src/PartStore.cpp b/Net/src/PartStore.cpp index 0ad723d9b..cc27d371d 100644 --- a/Net/src/PartStore.cpp +++ b/Net/src/PartStore.cpp @@ -29,7 +29,7 @@ namespace Net { // -PartStore::PartStore(const std::string& mediaType): PartSource(mediaType) +PartStore::PartStore(const std::string& rMediaType): PartSource(rMediaType) { } @@ -44,9 +44,9 @@ PartStore::~PartStore() // -FilePartStore::FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename): - PartStore(mediaType), - _filename(filename), +FilePartStore::FilePartStore(const std::string& content, const std::string& rMediaType, const std::string& rFilename): + PartStore(rMediaType), + _filename(rFilename), _path(TemporaryFile::tempName()), _fstr(_path) { diff --git a/Net/src/RawSocket.cpp b/Net/src/RawSocket.cpp index 2f35c3027..96f4e2624 100644 --- a/Net/src/RawSocket.cpp +++ b/Net/src/RawSocket.cpp @@ -38,10 +38,10 @@ RawSocket::RawSocket(SocketAddress::Family family, int proto): } -RawSocket::RawSocket(const SocketAddress& address, bool reuseAddress): - Socket(new RawSocketImpl(address.family())) +RawSocket::RawSocket(const SocketAddress& rAddress, bool reuseAddress): + Socket(new RawSocketImpl(rAddress.family())) { - bind(address, reuseAddress); + bind(rAddress, reuseAddress); } @@ -74,15 +74,15 @@ RawSocket& RawSocket::operator = (const Socket& socket) } -void RawSocket::connect(const SocketAddress& address) +void RawSocket::connect(const SocketAddress& rAddress) { - impl()->connect(address); + impl()->connect(rAddress); } -void RawSocket::bind(const SocketAddress& address, bool reuseAddress) +void RawSocket::bind(const SocketAddress& rAddress, bool reuseAddress) { - impl()->bind(address, reuseAddress); + impl()->bind(rAddress, reuseAddress); } @@ -98,15 +98,15 @@ int RawSocket::receiveBytes(void* buffer, int length, int flags) } -int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) +int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) { - return impl()->sendTo(buffer, length, address, flags); + return impl()->sendTo(buffer, length, rAddress, flags); } -int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) +int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) { - return impl()->receiveFrom(buffer, length, address, flags); + return impl()->receiveFrom(buffer, length, rAddress, flags); } diff --git a/Net/src/RawSocketImpl.cpp b/Net/src/RawSocketImpl.cpp index 0377a08c1..7cf235156 100644 --- a/Net/src/RawSocketImpl.cpp +++ b/Net/src/RawSocketImpl.cpp @@ -44,8 +44,8 @@ RawSocketImpl::RawSocketImpl(SocketAddress::Family family, int proto) } -RawSocketImpl::RawSocketImpl(poco_socket_t sockfd): - SocketImpl(sockfd) +RawSocketImpl::RawSocketImpl(poco_socket_t socketfd): + SocketImpl(socketfd) { } diff --git a/Net/src/RemoteSyslogListener.cpp b/Net/src/RemoteSyslogListener.cpp index 633b1e1c8..73070bc3e 100644 --- a/Net/src/RemoteSyslogListener.cpp +++ b/Net/src/RemoteSyslogListener.cpp @@ -43,15 +43,15 @@ namespace Net { class MessageNotification: public Poco::Notification { public: - MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& sourceAddress): + MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& rSourceAddress): _message(buffer, length), - _sourceAddress(sourceAddress) + _sourceAddress(rSourceAddress) { } - MessageNotification(const std::string& message, const Poco::Net::SocketAddress& sourceAddress): - _message(message), - _sourceAddress(sourceAddress) + MessageNotification(const std::string& rMessage, const Poco::Net::SocketAddress& rSourceAddress): + _message(rMessage), + _sourceAddress(rSourceAddress) { } diff --git a/Net/src/SMTPClientSession.cpp b/Net/src/SMTPClientSession.cpp index f72b4b3a5..2c2bf26f1 100644 --- a/Net/src/SMTPClientSession.cpp +++ b/Net/src/SMTPClientSession.cpp @@ -51,8 +51,8 @@ namespace Poco { namespace Net { -SMTPClientSession::SMTPClientSession(const StreamSocket& socket): - _socket(socket), +SMTPClientSession::SMTPClientSession(const StreamSocket& rSocket): + _socket(rSocket), _isOpen(false) { } @@ -346,8 +346,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient for (Recipients::const_iterator it = pRecipients->begin(); it != pRecipients->end(); ++it) { recipient << '<' << *it << '>'; - int status = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); + int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); recipient.str(""); } } @@ -356,8 +356,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient for (MailMessage::Recipients::const_iterator it = message.recipients().begin(); it != message.recipients().end(); ++it) { recipient << '<' << it->getAddress() << '>'; - int status = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); + int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); recipient.str(""); } } @@ -393,8 +393,8 @@ void SMTPClientSession::sendAddresses(const std::string& from, const Recipients& { recipient << '<' << *it << '>'; - int status = sendCommand("RCPT TO:", recipient.str(), response); - if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); + int commandStatus = sendCommand("RCPT TO:", recipient.str(), response); + if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus); recipient.str(""); } } diff --git a/Net/src/ServerSocket.cpp b/Net/src/ServerSocket.cpp index d52e5977a..0ebca76d1 100644 --- a/Net/src/ServerSocket.cpp +++ b/Net/src/ServerSocket.cpp @@ -38,9 +38,9 @@ ServerSocket::ServerSocket(const Socket& socket): Socket(socket) } -ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(new ServerSocketImpl) +ServerSocket::ServerSocket(const SocketAddress& rAddress, int backlog): Socket(new ServerSocketImpl) { - impl()->bind(address, true); + impl()->bind(rAddress, true); impl()->listen(backlog); } @@ -48,8 +48,8 @@ ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(ne ServerSocket::ServerSocket(Poco::UInt16 port, int backlog): Socket(new ServerSocketImpl) { IPAddress wildcardAddr; - SocketAddress address(wildcardAddr, port); - impl()->bind(address, true); + SocketAddress socketAddress(wildcardAddr, port); + impl()->bind(socketAddress, true); impl()->listen(backlog); } @@ -74,23 +74,23 @@ ServerSocket& ServerSocket::operator = (const Socket& socket) } -void ServerSocket::bind(const SocketAddress& address, bool reuseAddress) +void ServerSocket::bind(const SocketAddress& rAddress, bool reuseAddress) { - impl()->bind(address, reuseAddress); + impl()->bind(rAddress, reuseAddress); } void ServerSocket::bind(Poco::UInt16 port, bool reuseAddress) { IPAddress wildcardAddr; - SocketAddress address(wildcardAddr, port); - impl()->bind(address, reuseAddress); + SocketAddress socketAddress(wildcardAddr, port); + impl()->bind(socketAddress, reuseAddress); } -void ServerSocket::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) +void ServerSocket::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) { - impl()->bind6(address, reuseAddress, ipV6Only); + impl()->bind6(rAddress, reuseAddress, ipV6Only); } @@ -98,8 +98,8 @@ void ServerSocket::bind6(Poco::UInt16 port, bool reuseAddress, bool ipV6Only) { #if defined(POCO_HAVE_IPv6) IPAddress wildcardAddr(IPAddress::IPv6); - SocketAddress address(wildcardAddr, port); - impl()->bind6(address, reuseAddress, ipV6Only); + SocketAddress socketAddress(wildcardAddr, port); + impl()->bind6(socketAddress, reuseAddress, ipV6Only); #else throw Poco::NotImplementedException("No IPv6 support available"); #endif // POCO_HAVE_IPv6 diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index 1c2608394..c377b1517 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -101,9 +101,9 @@ SocketAddress::SocketAddress(const std::string& hostAddress, const std::string& } -SocketAddress::SocketAddress(Family family, const std::string& addr) +SocketAddress::SocketAddress(Family addressFamily, const std::string& rAddr) { - init(family, addr); + init(addressFamily, rAddr); } @@ -128,16 +128,16 @@ SocketAddress::SocketAddress(const SocketAddress& socketAddress) } -SocketAddress::SocketAddress(const struct sockaddr* sockAddr, poco_socklen_t length) +SocketAddress::SocketAddress(const struct sockaddr* sockAddr, poco_socklen_t addressLength) { - if (length == sizeof(struct sockaddr_in) && sockAddr->sa_family == AF_INET) + if (addressLength == sizeof(struct sockaddr_in) && sockAddr->sa_family == AF_INET) newIPv4(reinterpret_cast(sockAddr)); #if defined(POCO_HAVE_IPv6) - else if (length == sizeof(struct sockaddr_in6) && sockAddr->sa_family == AF_INET6) + else if (addressLength == sizeof(struct sockaddr_in6) && sockAddr->sa_family == AF_INET6) newIPv6(reinterpret_cast(sockAddr)); #endif #if defined(POCO_OS_FAMILY_UNIX) - else if (length > 0 && length <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX) + else if (addressLength > 0 && addressLength <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX) newLocal(reinterpret_cast(sockAddr)); #endif else throw Poco::InvalidArgumentException("Invalid address length or family passed to SocketAddress()"); @@ -281,8 +281,8 @@ void SocketAddress::init(const std::string& hostAndPort) { poco_assert (!hostAndPort.empty()); - std::string host; - std::string port; + std::string socketHost; + std::string socketPort; std::string::const_iterator it = hostAndPort.begin(); std::string::const_iterator end = hostAndPort.end(); @@ -296,30 +296,30 @@ void SocketAddress::init(const std::string& hostAndPort) if (*it == '[') { ++it; - while (it != end && *it != ']') host += *it++; + while (it != end && *it != ']') socketHost += *it++; if (it == end) throw InvalidArgumentException("Malformed IPv6 address"); ++it; } else { - while (it != end && *it != ':') host += *it++; + while (it != end && *it != ':') socketHost += *it++; } if (it != end && *it == ':') { ++it; - while (it != end) port += *it++; + while (it != end) socketPort += *it++; } else throw InvalidArgumentException("Missing port number"); - init(host, resolveService(port)); + init(socketHost, resolveService(socketPort)); } Poco::UInt16 SocketAddress::resolveService(const std::string& service) { - unsigned port; - if (NumberParser::tryParseUnsigned(service, port) && port <= 0xFFFF) + unsigned socketPort; + if (NumberParser::tryParseUnsigned(service, socketPort) && socketPort <= 0xFFFF) { - return (UInt16) port; + return (UInt16) socketPort; } else { diff --git a/Net/src/SocketAddressImpl.cpp b/Net/src/SocketAddressImpl.cpp index 02715af8b..1e1fa47ab 100644 --- a/Net/src/SocketAddressImpl.cpp +++ b/Net/src/SocketAddressImpl.cpp @@ -53,19 +53,19 @@ IPv4SocketAddressImpl::IPv4SocketAddressImpl() } -IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* addr) +IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* pAddr) { - std::memcpy(&_addr, addr, sizeof(_addr)); + std::memcpy(&_addr, pAddr, sizeof(_addr)); } -IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* addr, UInt16 port) +IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* pAddr, UInt16 socketPort) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin_family = AF_INET; poco_set_sin_len(&_addr); - std::memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr)); - _addr.sin_port = port; + std::memcpy(&_addr.sin_addr, pAddr, sizeof(_addr.sin_addr)); + _addr.sin_port = socketPort; } @@ -87,29 +87,29 @@ std::string IPv4SocketAddressImpl::toString() const // -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* addr) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* pAddr) { - std::memcpy(&_addr, addr, sizeof(_addr)); + std::memcpy(&_addr, pAddr, sizeof(_addr)); } -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin6_family = AF_INET6; poco_set_sin6_len(&_addr); - std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); - _addr.sin6_port = port; + std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr)); + _addr.sin6_port = socketPort; } -IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port, UInt32 scope) +IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort, UInt32 scope) { std::memset(&_addr, 0, sizeof(_addr)); _addr.sin6_family = AF_INET6; poco_set_sin6_len(&_addr); - std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); - _addr.sin6_port = port; + std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr)); + _addr.sin6_port = socketPort; _addr.sin6_scope_id = scope; } @@ -137,19 +137,19 @@ std::string IPv6SocketAddressImpl::toString() const // -LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* addr) +LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* pAddr) { _pAddr = new sockaddr_un; - std::memcpy(_pAddr, addr, sizeof(struct sockaddr_un)); + std::memcpy(_pAddr, pAddr, sizeof(struct sockaddr_un)); } -LocalSocketAddressImpl::LocalSocketAddressImpl(const char* path) +LocalSocketAddressImpl::LocalSocketAddressImpl(const char* pPath) { _pAddr = new sockaddr_un; - poco_set_sun_len(_pAddr, std::strlen(path) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1); + poco_set_sun_len(_pAddr, std::strlen(pPath) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1); _pAddr->sun_family = AF_UNIX; - std::strcpy(_pAddr->sun_path, path); + std::strcpy(_pAddr->sun_path, pPath); } diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 40bda76a2..a14280775 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -73,8 +73,8 @@ SocketImpl::SocketImpl(): } -SocketImpl::SocketImpl(poco_socket_t sockfd): - _sockfd(sockfd), +SocketImpl::SocketImpl(poco_socket_t socketfd): + _sockfd(socketfd), _blocking(true), _isBrokenTimeout(checkIsBrokenTimeout()) { @@ -110,51 +110,51 @@ SocketImpl* SocketImpl::acceptConnection(SocketAddress& clientAddr) } -void SocketImpl::connect(const SocketAddress& address) +void SocketImpl::connect(const SocketAddress& rAddress) { if (_sockfd == POCO_INVALID_SOCKET) { - init(address.af()); + init(rAddress.af()); } int rc; do { #if defined(POCO_VXWORKS) - rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); + rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); #else - rc = ::connect(_sockfd, address.addr(), address.length()); + rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); #endif } while (rc != 0 && lastError() == POCO_EINTR); if (rc != 0) { int err = lastError(); - error(err, address.toString()); + error(err, rAddress.toString()); } } -void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) +void SocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) { if (_sockfd == POCO_INVALID_SOCKET) { - init(address.af()); + init(rAddress.af()); } setBlocking(false); try { #if defined(POCO_VXWORKS) - int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); + int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); #else - int rc = ::connect(_sockfd, address.addr(), address.length()); + int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); #endif if (rc != 0) { int err = lastError(); if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) - error(err, address.toString()); + error(err, rAddress.toString()); if (!poll(timeout, SELECT_READ | SELECT_WRITE | SELECT_ERROR)) - throw Poco::TimeoutException("connect timed out", address.toString()); + throw Poco::TimeoutException("connect timed out", rAddress.toString()); err = socketError(); if (err != 0) error(err); } @@ -168,32 +168,32 @@ void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& tim } -void SocketImpl::connectNB(const SocketAddress& address) +void SocketImpl::connectNB(const SocketAddress& rAddress) { if (_sockfd == POCO_INVALID_SOCKET) { - init(address.af()); + init(rAddress.af()); } setBlocking(false); #if defined(POCO_VXWORKS) - int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); + int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); #else - int rc = ::connect(_sockfd, address.addr(), address.length()); + int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length()); #endif if (rc != 0) { int err = lastError(); if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) - error(err, address.toString()); + error(err, rAddress.toString()); } } -void SocketImpl::bind(const SocketAddress& address, bool reuseAddress) +void SocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) { if (_sockfd == POCO_INVALID_SOCKET) { - init(address.af()); + init(rAddress.af()); } if (reuseAddress) { @@ -201,23 +201,23 @@ void SocketImpl::bind(const SocketAddress& address, bool reuseAddress) setReusePort(true); } #if defined(POCO_VXWORKS) - int rc = ::bind(_sockfd, (sockaddr*) address.addr(), address.length()); + int rc = ::bind(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length()); #else - int rc = ::bind(_sockfd, address.addr(), address.length()); + int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length()); #endif - if (rc != 0) error(address.toString()); + if (rc != 0) error(rAddress.toString()); } -void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) +void SocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) { #if defined(POCO_HAVE_IPv6) - if (address.family() != SocketAddress::IPv6) + if (rAddress.family() != SocketAddress::IPv6) throw Poco::InvalidArgumentException("SocketAddress must be an IPv6 address"); if (_sockfd == POCO_INVALID_SOCKET) { - init(address.af()); + init(rAddress.af()); } #ifdef IPV6_V6ONLY setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0); @@ -229,8 +229,8 @@ void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV setReuseAddress(true); setReusePort(true); } - int rc = ::bind(_sockfd, address.addr(), address.length()); - if (rc != 0) error(address.toString()); + int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length()); + if (rc != 0) error(rAddress.toString()); #else throw Poco::NotImplementedException("No IPv6 support available"); #endif @@ -338,16 +338,16 @@ int SocketImpl::receiveBytes(void* buffer, int length, int flags) } -int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) +int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) { int rc; do { if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); #if defined(POCO_VXWORKS) - rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) address.addr(), address.length()); + rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) rAddress.addr(), rAddress.length()); #else - rc = ::sendto(_sockfd, reinterpret_cast(buffer), length, flags, address.addr(), address.length()); + rc = ::sendto(_sockfd, reinterpret_cast(buffer), length, flags, rAddress.addr(), rAddress.length()); #endif } while (_blocking && rc < 0 && lastError() == POCO_EINTR); @@ -356,7 +356,7 @@ int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& addr } -int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) +int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) { if (_isBrokenTimeout) { @@ -379,7 +379,7 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, in while (_blocking && rc < 0 && lastError() == POCO_EINTR); if (rc >= 0) { - address = SocketAddress(pSA, saLen); + rAddress = SocketAddress(pSA, saLen); } else { @@ -420,8 +420,8 @@ bool SocketImpl::secure() const bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) { - poco_socket_t sockfd = _sockfd; - if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); + poco_socket_t socketfd = _sockfd; + if (socketfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); #if defined(POCO_HAVE_FD_EPOLL) @@ -443,7 +443,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) if (mode & SELECT_ERROR) evin.events |= EPOLLERR; - if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0) + if (epoll_ctl(epollfd, EPOLL_CTL_ADD, socketfd, &evin) < 0) { char buf[1024]; strerror_r(errno, buf, sizeof(buf)); @@ -516,15 +516,15 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) FD_ZERO(&fdExcept); if (mode & SELECT_READ) { - FD_SET(sockfd, &fdRead); + FD_SET(socketfd, &fdRead); } if (mode & SELECT_WRITE) { - FD_SET(sockfd, &fdWrite); + FD_SET(socketfd, &fdWrite); } if (mode & SELECT_ERROR) { - FD_SET(sockfd, &fdExcept); + FD_SET(socketfd, &fdExcept); } Poco::Timespan remainingTime(timeout); int errorCode = POCO_ENOERR; @@ -535,7 +535,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) tv.tv_sec = (long) remainingTime.totalSeconds(); tv.tv_usec = (long) remainingTime.useconds(); Poco::Timestamp start; - rc = ::select(int(sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); + rc = ::select(int(socketfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv); if (rc < 0 && (errorCode = lastError()) == POCO_EINTR) { Poco::Timestamp end; diff --git a/Net/src/SocketNotification.cpp b/Net/src/SocketNotification.cpp index d29a2203c..f444158c6 100644 --- a/Net/src/SocketNotification.cpp +++ b/Net/src/SocketNotification.cpp @@ -32,9 +32,9 @@ SocketNotification::~SocketNotification() } -void SocketNotification::setSocket(const Socket& socket) +void SocketNotification::setSocket(const Socket& rSocket) { - _socket = socket; + _socket = rSocket; } diff --git a/Net/src/SocketStream.cpp b/Net/src/SocketStream.cpp index 1649253b5..01988e300 100644 --- a/Net/src/SocketStream.cpp +++ b/Net/src/SocketStream.cpp @@ -66,8 +66,8 @@ int SocketStreamBuf::writeToDevice(const char* buffer, std::streamsize length) // -SocketIOS::SocketIOS(const Socket& socket): - _buf(socket) +SocketIOS::SocketIOS(const Socket& rSocket): + _buf(rSocket) { poco_ios_init(&_buf); } @@ -109,8 +109,8 @@ StreamSocket SocketIOS::socket() const // -SocketOutputStream::SocketOutputStream(const Socket& socket): - SocketIOS(socket), +SocketOutputStream::SocketOutputStream(const Socket& rSocket): + SocketIOS(rSocket), std::ostream(&_buf) { } @@ -126,8 +126,8 @@ SocketOutputStream::~SocketOutputStream() // -SocketInputStream::SocketInputStream(const Socket& socket): - SocketIOS(socket), +SocketInputStream::SocketInputStream(const Socket& rSocket): + SocketIOS(rSocket), std::istream(&_buf) { } @@ -143,8 +143,8 @@ SocketInputStream::~SocketInputStream() // -SocketStream::SocketStream(const Socket& socket): - SocketIOS(socket), +SocketStream::SocketStream(const Socket& rSocket): + SocketIOS(rSocket), std::iostream(&_buf) { } diff --git a/Net/src/StreamSocket.cpp b/Net/src/StreamSocket.cpp index ba35a9aff..d695e9eaf 100644 --- a/Net/src/StreamSocket.cpp +++ b/Net/src/StreamSocket.cpp @@ -35,9 +35,9 @@ StreamSocket::StreamSocket(): Socket(new StreamSocketImpl) } -StreamSocket::StreamSocket(const SocketAddress& address): Socket(new StreamSocketImpl(address.family())) +StreamSocket::StreamSocket(const SocketAddress& rAddress): Socket(new StreamSocketImpl(rAddress.family())) { - connect(address); + connect(rAddress); } @@ -75,21 +75,21 @@ StreamSocket& StreamSocket::operator = (const Socket& socket) } -void StreamSocket::connect(const SocketAddress& address) +void StreamSocket::connect(const SocketAddress& rAddress) { - impl()->connect(address); + impl()->connect(rAddress); } -void StreamSocket::connect(const SocketAddress& address, const Poco::Timespan& timeout) +void StreamSocket::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) { - impl()->connect(address, timeout); + impl()->connect(rAddress, timeout); } -void StreamSocket::connectNB(const SocketAddress& address) +void StreamSocket::connectNB(const SocketAddress& rAddress) { - impl()->connectNB(address); + impl()->connectNB(rAddress); } diff --git a/Net/src/StreamSocketImpl.cpp b/Net/src/StreamSocketImpl.cpp index 06b736fa7..fba8727ec 100644 --- a/Net/src/StreamSocketImpl.cpp +++ b/Net/src/StreamSocketImpl.cpp @@ -44,7 +44,7 @@ StreamSocketImpl::StreamSocketImpl(SocketAddress::Family family) } -StreamSocketImpl::StreamSocketImpl(poco_socket_t sockfd): SocketImpl(sockfd) +StreamSocketImpl::StreamSocketImpl(poco_socket_t socketfd): SocketImpl(socketfd) { } diff --git a/Net/src/StringPartSource.cpp b/Net/src/StringPartSource.cpp index 62831f16e..e61e8b3ed 100644 --- a/Net/src/StringPartSource.cpp +++ b/Net/src/StringPartSource.cpp @@ -28,17 +28,17 @@ StringPartSource::StringPartSource(const std::string& str): } -StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType): - PartSource(mediaType), +StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType): + PartSource(rMediaType), _istr(str) { } -StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType, const std::string& filename): - PartSource(mediaType), +StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType, const std::string& rFilename): + PartSource(rMediaType), _istr(str), - _filename(filename) + _filename(rFilename) { } diff --git a/Net/src/TCPServer.cpp b/Net/src/TCPServer.cpp index ca4bef5b3..201890969 100644 --- a/Net/src/TCPServer.cpp +++ b/Net/src/TCPServer.cpp @@ -46,9 +46,9 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port } -TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams): - _socket(socket), - _thread(threadName(socket)), +TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& rSocket, TCPServerParams::Ptr pParams): + _socket(rSocket), + _thread(threadName(rSocket)), _stopped(true) { Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool(); @@ -61,10 +61,10 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke } -TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams): - _socket(socket), +TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, TCPServerParams::Ptr pParams): + _socket(rSocket), _pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)), - _thread(threadName(socket)), + _thread(threadName(rSocket)), _stopped(true) { } diff --git a/Net/src/TCPServerConnection.cpp b/Net/src/TCPServerConnection.cpp index 08dc1b0d9..fad30cccf 100644 --- a/Net/src/TCPServerConnection.cpp +++ b/Net/src/TCPServerConnection.cpp @@ -27,8 +27,8 @@ namespace Poco { namespace Net { -TCPServerConnection::TCPServerConnection(const StreamSocket& socket): - _socket(socket) +TCPServerConnection::TCPServerConnection(const StreamSocket& rSocket): + _socket(rSocket) { } diff --git a/Net/src/TCPServerDispatcher.cpp b/Net/src/TCPServerDispatcher.cpp index a5f2de3c6..b9ad20969 100644 --- a/Net/src/TCPServerDispatcher.cpp +++ b/Net/src/TCPServerDispatcher.cpp @@ -33,8 +33,8 @@ namespace Net { class TCPConnectionNotification: public Notification { public: - TCPConnectionNotification(const StreamSocket& socket): - _socket(socket) + TCPConnectionNotification(const StreamSocket& rSocket): + _socket(rSocket) { } diff --git a/Net/src/WebSocketImpl.cpp b/Net/src/WebSocketImpl.cpp index 4b351fec5..4d20cb44c 100644 --- a/Net/src/WebSocketImpl.cpp +++ b/Net/src/WebSocketImpl.cpp @@ -29,11 +29,11 @@ namespace Poco { namespace Net { -WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload): +WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool isMustMaskPayload): StreamSocketImpl(pStreamSocketImpl->sockfd()), _pStreamSocketImpl(pStreamSocketImpl), _frameFlags(0), - _mustMaskPayload(mustMaskPayload) + _mustMaskPayload(isMustMaskPayload) { poco_check_ptr(pStreamSocketImpl); _pStreamSocketImpl->duplicate(); @@ -232,31 +232,31 @@ SocketImpl* WebSocketImpl::acceptConnection(SocketAddress& clientAddr) } -void WebSocketImpl::connect(const SocketAddress& address) +void WebSocketImpl::connect(const SocketAddress& rAddress) { throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl"); } -void WebSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout) +void WebSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout) { throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl"); } -void WebSocketImpl::connectNB(const SocketAddress& address) +void WebSocketImpl::connectNB(const SocketAddress& rAddress) { throw Poco::InvalidAccessException("Cannot connectNB() a WebSocketImpl"); } -void WebSocketImpl::bind(const SocketAddress& address, bool reuseAddress) +void WebSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress) { throw Poco::InvalidAccessException("Cannot bind() a WebSocketImpl"); } -void WebSocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only) +void WebSocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only) { throw Poco::InvalidAccessException("Cannot bind6() a WebSocketImpl"); } @@ -293,13 +293,13 @@ void WebSocketImpl::shutdown() } -int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags) +int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags) { throw Poco::InvalidAccessException("Cannot sendTo() on a WebSocketImpl"); } -int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags) +int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags) { throw Poco::InvalidAccessException("Cannot receiveFrom() on a WebSocketImpl"); } From e62744e74c36037eecdaf36966624e55941f0909 Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Tue, 29 Dec 2015 19:46:18 +0100 Subject: [PATCH 4/8] Add WebSocketTestSuite Signed-off-by: FrancisANDRE --- NetSSL_Win/testsuite/TestSuite_vs120.vcxproj | 88 ++++++++++--------- .../testsuite/TestSuite_vs120.vcxproj.filters | 15 ++++ .../testsuite/TestSuite_x64_vs120.vcxproj | 88 ++++++++++--------- .../TestSuite_x64_vs120.vcxproj.filters | 15 ++++ NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp | 2 + .../HTTPTimeServer/src/TimeHandler.cpp | 11 +-- .../samples/HTTPTimeServer/src/TimeHandler.h | 7 -- 7 files changed, 126 insertions(+), 100 deletions(-) diff --git a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj index c64c28740..55cb0766c 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ TestSuite Win32Proj - + Application MultiByte @@ -63,27 +63,27 @@ MultiByte v120 - - + + - + - + - + - + - + - + - + <_ProjectFileVersion>12.0.30501.0 TestSuited @@ -136,7 +136,7 @@ true true true - + Level3 ProgramDatabase Default @@ -167,9 +167,9 @@ true true true - + Level3 - + Default @@ -196,7 +196,7 @@ true true true - + Level3 ProgramDatabase Default @@ -227,9 +227,9 @@ true true true - + Level3 - + Default @@ -256,7 +256,7 @@ true true true - + Level3 ProgramDatabase Default @@ -287,9 +287,9 @@ true true true - + Level3 - + Default @@ -304,28 +304,32 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters index bd3bc66f1..7e0c821b6 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters +++ b/NetSSL_Win/testsuite/TestSuite_vs120.vcxproj.filters @@ -52,6 +52,9 @@ {40e36c0c-5808-4c87-aa2e-04c0ffa6f35e} + + {9243a946-e87f-42f5-adba-efbb4823f93c} + @@ -81,6 +84,12 @@ HTTPSClient\Header Files + + Websocket + + + Websocket + @@ -113,5 +122,11 @@ HTTPSClient\Source Files + + Websocket + + + Websocket + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj b/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj index c0539df28..20c95e0b3 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj @@ -1,4 +1,4 @@ - + @@ -32,7 +32,7 @@ TestSuite Win32Proj - + Application MultiByte @@ -63,27 +63,27 @@ MultiByte v120 - - + + - + - + - + - + - + - + - + <_ProjectFileVersion>12.0.30501.0 TestSuited @@ -136,7 +136,7 @@ true true true - + Level3 ProgramDatabase Default @@ -167,9 +167,9 @@ true true true - + Level3 - + Default @@ -196,7 +196,7 @@ true true true - + Level3 ProgramDatabase Default @@ -227,9 +227,9 @@ true true true - + Level3 - + Default @@ -256,7 +256,7 @@ true true true - + Level3 ProgramDatabase Default @@ -287,9 +287,9 @@ true true true - + Level3 - + Default @@ -304,28 +304,32 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj.filters b/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj.filters index 69c90dee5..9de71608d 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj.filters +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs120.vcxproj.filters @@ -52,6 +52,9 @@ {363ebde9-9367-44b7-aa1b-dcb421bb759c} + + {14c12fc4-d7e0-4311-a59e-f499f1993c3b} + @@ -81,6 +84,12 @@ HTTPSClient\Header Files + + WebSocket + + + WebSocket + @@ -113,5 +122,11 @@ HTTPSClient\Source Files + + WebSocket + + + WebSocket + \ No newline at end of file diff --git a/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp b/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp index 7fddff713..b2aa5303a 100644 --- a/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp +++ b/NetSSL_Win/testsuite/src/NetSSLTestSuite.cpp @@ -15,6 +15,7 @@ #include "HTTPSClientTestSuite.h" #include "TCPServerTestSuite.h" #include "HTTPSServerTestSuite.h" +#include "WebSocketTestSuite.h" CppUnit::Test* NetSSLTestSuite::suite() @@ -24,6 +25,7 @@ CppUnit::Test* NetSSLTestSuite::suite() pSuite->addTest(HTTPSClientTestSuite::suite()); pSuite->addTest(TCPServerTestSuite::suite()); pSuite->addTest(HTTPSServerTestSuite::suite()); + pSuite->addTest(WebSocketTestSuite::suite()); return pSuite; } diff --git a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp index 3ec7a9bb7..ddd7a079e 100644 --- a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp +++ b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpp @@ -1,10 +1,3 @@ -// -// TimeHandler.cpp -// -// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54. -// - - #include "TimeHandler.h" #include "Poco/Net/HTTPServerRequest.h" #include "Poco/Net/HTTPServerResponse.h" @@ -28,7 +21,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net responseStream << "\n"; responseStream << "\n"; responseStream << ""; -#line 6 "/ws/poco-1.3/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" +#line 6 "/cygdrive/z/git/poco/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" Poco::DateTime now; std::string dt(Poco::DateTimeFormatter::format(now, "%W, %e %b %y %H:%M:%S %Z")); @@ -40,7 +33,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net responseStream << "\n"; responseStream << "\n"; responseStream << "

"; -#line 16 "/ws/poco-1.3/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" +#line 16 "/cygdrive/z/git/poco/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp" responseStream << ( dt ); responseStream << "

\n"; responseStream << "\n"; diff --git a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h index e1ac5474d..c301516d0 100644 --- a/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h +++ b/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.h @@ -1,10 +1,3 @@ -// -// TimeHandler.h -// -// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54. -// - - #ifndef TimeHandler_INCLUDED #define TimeHandler_INCLUDED From 1ce36ad5692962eacd3f68574360ee1db5fd9566 Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Tue, 29 Dec 2015 21:40:25 +0100 Subject: [PATCH 5/8] Add WebSocketTestSuite sources Signed-off-by: FrancisANDRE --- NetSSL_Win/testsuite/src/WebSocketTest.cpp | 231 ++++++++++++++++++ NetSSL_Win/testsuite/src/WebSocketTest.h | 41 ++++ .../testsuite/src/WebSocketTestSuite.cpp | 24 ++ NetSSL_Win/testsuite/src/WebSocketTestSuite.h | 29 +++ 4 files changed, 325 insertions(+) create mode 100644 NetSSL_Win/testsuite/src/WebSocketTest.cpp create mode 100644 NetSSL_Win/testsuite/src/WebSocketTest.h create mode 100644 NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp create mode 100644 NetSSL_Win/testsuite/src/WebSocketTestSuite.h diff --git a/NetSSL_Win/testsuite/src/WebSocketTest.cpp b/NetSSL_Win/testsuite/src/WebSocketTest.cpp new file mode 100644 index 000000000..1555d687b --- /dev/null +++ b/NetSSL_Win/testsuite/src/WebSocketTest.cpp @@ -0,0 +1,231 @@ +// +// WebSocketTest.cpp +// +// $Id: //poco/1.4/Net/testsuite/src/WebSocketTest.cpp#3 $ +// +// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "WebSocketTest.h" +#include "CppUnit/TestCaller.h" +#include "CppUnit/TestSuite.h" +#include "Poco/Net/WebSocket.h" +#include "Poco/Net/SocketStream.h" +#include "Poco/Net/HTTPSClientSession.h" +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/SecureServerSocket.h" +#include "Poco/Net/NetException.h" +#include "Poco/Thread.h" + + +using Poco::Net::HTTPSClientSession; +using Poco::Net::HTTPRequest; +using Poco::Net::HTTPResponse; +using Poco::Net::HTTPServerRequest; +using Poco::Net::HTTPServerResponse; +using Poco::Net::SocketStream; +using Poco::Net::WebSocket; +using Poco::Net::WebSocketException; + + +namespace +{ + class WebSocketRequestHandler: public Poco::Net::HTTPRequestHandler + { + public: + WebSocketRequestHandler(std::size_t bufSize = 1024): _bufSize(bufSize) + { + } + + void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) + { + try + { + WebSocket ws(request, response); + std::auto_ptr pBuffer(new char[_bufSize]); + int flags; + int n; + do + { + n = ws.receiveFrame(pBuffer.get(), _bufSize, flags); + ws.sendFrame(pBuffer.get(), n, flags); + } + while (n > 0 || (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE); + } + catch (WebSocketException& exc) + { + switch (exc.code()) + { + case WebSocket::WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION: + response.set("Sec-WebSocket-Version", WebSocket::WEBSOCKET_VERSION); + // fallthrough + case WebSocket::WS_ERR_NO_HANDSHAKE: + case WebSocket::WS_ERR_HANDSHAKE_NO_VERSION: + case WebSocket::WS_ERR_HANDSHAKE_NO_KEY: + response.setStatusAndReason(HTTPResponse::HTTP_BAD_REQUEST); + response.setContentLength(0); + response.send(); + break; + } + } + } + + private: + std::size_t _bufSize; + }; + + class WebSocketRequestHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory + { + public: + WebSocketRequestHandlerFactory(std::size_t bufSize = 1024): _bufSize(bufSize) + { + } + + Poco::Net::HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) + { + return new WebSocketRequestHandler(_bufSize); + } + + private: + std::size_t _bufSize; + }; +} + + +WebSocketTest::WebSocketTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +WebSocketTest::~WebSocketTest() +{ +} + + +void WebSocketTest::testWebSocket() +{ + Poco::Net::SecureServerSocket ss(0); + Poco::Net::HTTPServer server(new WebSocketRequestHandlerFactory, ss, new Poco::Net::HTTPServerParams); + server.start(); + + Poco::Thread::sleep(200); + + HTTPSClientSession cs("localhost", ss.address().port()); + HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); + HTTPResponse response; + WebSocket ws(cs, request, response); + + std::string payload("x"); + ws.sendFrame(payload.data(), (int) payload.size()); + char buffer[1024]; + int flags; + int n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assert (flags == WebSocket::FRAME_TEXT); + + for (int i = 2; i < 20; i++) + { + payload.assign(i, 'x'); + ws.sendFrame(payload.data(), (int) payload.size()); + n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assert (flags == WebSocket::FRAME_TEXT); + } + + for (int i = 125; i < 129; i++) + { + payload.assign(i, 'x'); + ws.sendFrame(payload.data(), (int) payload.size()); + n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assert (flags == WebSocket::FRAME_TEXT); + } + + payload = "Hello, world!"; + ws.sendFrame(payload.data(), (int) payload.size()); + n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assert (flags == WebSocket::FRAME_TEXT); + + payload = "Hello, universe!"; + ws.sendFrame(payload.data(), (int) payload.size(), WebSocket::FRAME_BINARY); + n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); + assert (flags == WebSocket::FRAME_BINARY); + + ws.shutdown(); + n = ws.receiveFrame(buffer, sizeof(buffer), flags); + assert (n == 2); + assert ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); + + server.stop(); +} + + +void WebSocketTest::testWebSocketLarge() +{ + const int msgSize = 64000; + + Poco::Net::SecureServerSocket ss(0); + Poco::Net::HTTPServer server(new WebSocketRequestHandlerFactory(msgSize), ss, new Poco::Net::HTTPServerParams); + server.start(); + + Poco::Thread::sleep(200); + + HTTPSClientSession cs("localhost", ss.address().port()); + HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); + HTTPResponse response; + WebSocket ws(cs, request, response); + ws.setSendBufferSize(msgSize); + ws.setReceiveBufferSize(msgSize); + std::string payload(msgSize, 'x'); + SocketStream sstr(ws); + sstr << payload; + sstr.flush(); + + char buffer[msgSize + 1]; + int flags; + int n = 0; + do + { + n += ws.receiveFrame(buffer + n, sizeof(buffer) - n, flags); + } while (n > 0 && n < msgSize); + + assert (n == payload.size()); + assert (payload.compare(0, payload.size(), buffer, 0, n) == 0); +} + + +void WebSocketTest::setUp() +{ +} + + +void WebSocketTest::tearDown() +{ +} + + +CppUnit::Test* WebSocketTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("WebSocketTest"); + + CppUnit_addTest(pSuite, WebSocketTest, testWebSocket); + CppUnit_addTest(pSuite, WebSocketTest, testWebSocketLarge); + + return pSuite; +} diff --git a/NetSSL_Win/testsuite/src/WebSocketTest.h b/NetSSL_Win/testsuite/src/WebSocketTest.h new file mode 100644 index 000000000..939acf630 --- /dev/null +++ b/NetSSL_Win/testsuite/src/WebSocketTest.h @@ -0,0 +1,41 @@ +// +// WebSocketTest.h +// +// $Id: //poco/1.4/Net/testsuite/src/WebSocketTest.h#1 $ +// +// Definition of the WebSocketTest class. +// +// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef WebSocketTest_INCLUDED +#define WebSocketTest_INCLUDED + + +#include "Poco/Net/Net.h" +#include "CppUnit/TestCase.h" + + +class WebSocketTest: public CppUnit::TestCase +{ +public: + WebSocketTest(const std::string& name); + ~WebSocketTest(); + + void testWebSocket(); + void testWebSocketLarge(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); + +private: +}; + + +#endif // WebSocketTest_INCLUDED diff --git a/NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp b/NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp new file mode 100644 index 000000000..162eb38aa --- /dev/null +++ b/NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp @@ -0,0 +1,24 @@ +// +// WebSocketTestSuite.cpp +// +// $Id: //poco/1.4/Net/testsuite/src/WebSocketTestSuite.cpp#1 $ +// +// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "WebSocketTestSuite.h" +#include "WebSocketTest.h" + + +CppUnit::Test* WebSocketTestSuite::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("WebSocketTestSuite"); + + pSuite->addTest(WebSocketTest::suite()); + + return pSuite; +} diff --git a/NetSSL_Win/testsuite/src/WebSocketTestSuite.h b/NetSSL_Win/testsuite/src/WebSocketTestSuite.h new file mode 100644 index 000000000..83b5dbb81 --- /dev/null +++ b/NetSSL_Win/testsuite/src/WebSocketTestSuite.h @@ -0,0 +1,29 @@ +// +// WebSocketTestSuite.h +// +// $Id: //poco/1.4/Net/testsuite/src/WebSocketTestSuite.h#1 $ +// +// Definition of the WebSocketTestSuite class. +// +// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef WebSocketTestSuite_INCLUDED +#define WebSocketTestSuite_INCLUDED + + +#include "CppUnit/TestSuite.h" + + +class WebSocketTestSuite +{ +public: + static CppUnit::Test* suite(); +}; + + +#endif // WebSocketTestSuite_INCLUDED From c27be50917bc490dc8f9c89a8c40e0a11a051ee3 Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Wed, 30 Dec 2015 10:49:37 +0100 Subject: [PATCH 6/8] Update VisualStudio projects to include WebSocket sources Signed-off-by: FrancisANDRE --- NetSSL_Win/testsuite/TestSuite_CE_vs90.vcproj | 17 +++++++++++++++++ .../testsuite/TestSuite_WEC2013_vs110.vcxproj | 4 ++++ .../testsuite/TestSuite_WEC2013_vs120.vcxproj | 4 ++++ NetSSL_Win/testsuite/TestSuite_vs100.vcxproj | 4 ++++ NetSSL_Win/testsuite/TestSuite_vs110.vcxproj | 4 ++++ NetSSL_Win/testsuite/TestSuite_vs140.vcxproj | 4 ++++ NetSSL_Win/testsuite/TestSuite_vs90.vcproj | 17 +++++++++++++++++ .../testsuite/TestSuite_x64_vs100.vcxproj | 4 ++++ .../testsuite/TestSuite_x64_vs110.vcxproj | 4 ++++ .../testsuite/TestSuite_x64_vs140.vcxproj | 4 ++++ NetSSL_Win/testsuite/TestSuite_x64_vs90.vcproj | 17 +++++++++++++++++ 11 files changed, 83 insertions(+) diff --git a/NetSSL_Win/testsuite/TestSuite_CE_vs90.vcproj b/NetSSL_Win/testsuite/TestSuite_CE_vs90.vcproj index e7952fcd5..4f59bdd4c 100644 --- a/NetSSL_Win/testsuite/TestSuite_CE_vs90.vcproj +++ b/NetSSL_Win/testsuite/TestSuite_CE_vs90.vcproj @@ -551,6 +551,23 @@ RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> + + + + + + + + + + diff --git a/NetSSL_Win/testsuite/TestSuite_WEC2013_vs110.vcxproj b/NetSSL_Win/testsuite/TestSuite_WEC2013_vs110.vcxproj index eceff2c80..2eae66f90 100644 --- a/NetSSL_Win/testsuite/TestSuite_WEC2013_vs110.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_WEC2013_vs110.vcxproj @@ -316,6 +316,8 @@ + + @@ -328,6 +330,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_WEC2013_vs120.vcxproj b/NetSSL_Win/testsuite/TestSuite_WEC2013_vs120.vcxproj index 53e831b75..34fb61761 100644 --- a/NetSSL_Win/testsuite/TestSuite_WEC2013_vs120.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_WEC2013_vs120.vcxproj @@ -316,6 +316,8 @@ + + @@ -328,6 +330,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_vs100.vcxproj b/NetSSL_Win/testsuite/TestSuite_vs100.vcxproj index 1c5a7691c..70ae89f37 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs100.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_vs100.vcxproj @@ -321,6 +321,8 @@ + + @@ -333,6 +335,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_vs110.vcxproj b/NetSSL_Win/testsuite/TestSuite_vs110.vcxproj index ff8ef1737..5a3e63afa 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs110.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_vs110.vcxproj @@ -321,6 +321,8 @@ + + @@ -333,6 +335,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_vs140.vcxproj b/NetSSL_Win/testsuite/TestSuite_vs140.vcxproj index 32545771c..6b06655ae 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs140.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_vs140.vcxproj @@ -313,6 +313,8 @@ + + @@ -325,6 +327,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_vs90.vcproj b/NetSSL_Win/testsuite/TestSuite_vs90.vcproj index ab941c65d..5f9a968d7 100644 --- a/NetSSL_Win/testsuite/TestSuite_vs90.vcproj +++ b/NetSSL_Win/testsuite/TestSuite_vs90.vcproj @@ -532,6 +532,23 @@ RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> + + + + + + + + + + diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs100.vcxproj b/NetSSL_Win/testsuite/TestSuite_x64_vs100.vcxproj index 7e924fda7..f6bec29ea 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs100.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs100.vcxproj @@ -321,6 +321,8 @@ + + @@ -333,6 +335,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs110.vcxproj b/NetSSL_Win/testsuite/TestSuite_x64_vs110.vcxproj index ce11429b5..29ccd2bd3 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs110.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs110.vcxproj @@ -321,6 +321,8 @@ + + @@ -333,6 +335,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs140.vcxproj b/NetSSL_Win/testsuite/TestSuite_x64_vs140.vcxproj index 90138be0a..3d24283dc 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs140.vcxproj +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs140.vcxproj @@ -313,6 +313,8 @@ + + @@ -325,6 +327,8 @@ + + diff --git a/NetSSL_Win/testsuite/TestSuite_x64_vs90.vcproj b/NetSSL_Win/testsuite/TestSuite_x64_vs90.vcproj index 473d7737d..1698914ec 100644 --- a/NetSSL_Win/testsuite/TestSuite_x64_vs90.vcproj +++ b/NetSSL_Win/testsuite/TestSuite_x64_vs90.vcproj @@ -532,6 +532,23 @@ RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> + + + + + + + + + + From eccab535b59d0459d64983a00b13450cde9d3e88 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 4 Jan 2016 17:56:13 +0100 Subject: [PATCH 7/8] GH #1050 Crypto: fix gcc -Wshadow warnings --- Crypto/src/CipherKey.cpp | 14 +++++++------- Crypto/src/CipherKeyImpl.cpp | 34 +++++++++++++++++----------------- Crypto/src/RSAKeyImpl.cpp | 12 ++++++------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Crypto/src/CipherKey.cpp b/Crypto/src/CipherKey.cpp index 82a099776..43af25827 100644 --- a/Crypto/src/CipherKey.cpp +++ b/Crypto/src/CipherKey.cpp @@ -21,21 +21,21 @@ namespace Poco { namespace Crypto { -CipherKey::CipherKey(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, - const std::string &digest): - _pImpl(new CipherKeyImpl(name, passphrase, salt, iterationCount, digest)) +CipherKey::CipherKey(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount, + const std::string & rDigest): + _pImpl(new CipherKeyImpl(rName, passphrase, salt, iterationCount, rDigest)) { } -CipherKey::CipherKey(const std::string& name, const ByteVec& key, const ByteVec& iv): - _pImpl(new CipherKeyImpl(name, key, iv)) +CipherKey::CipherKey(const std::string& rName, const ByteVec& key, const ByteVec& iv): + _pImpl(new CipherKeyImpl(rName, key, iv)) { } -CipherKey::CipherKey(const std::string& name): - _pImpl(new CipherKeyImpl(name)) +CipherKey::CipherKey(const std::string& rName): + _pImpl(new CipherKeyImpl(rName)) { } diff --git a/Crypto/src/CipherKeyImpl.cpp b/Crypto/src/CipherKeyImpl.cpp index 7f496aa07..cac2df8c6 100644 --- a/Crypto/src/CipherKeyImpl.cpp +++ b/Crypto/src/CipherKeyImpl.cpp @@ -27,28 +27,28 @@ namespace Poco { namespace Crypto { -CipherKeyImpl::CipherKeyImpl(const std::string& name, +CipherKeyImpl::CipherKeyImpl(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount, - const std::string& digest): + const std::string& rDigest): _pCipher(0), _pDigest(0), - _name(name), + _name(rName), _key(), _iv() { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(name.c_str()); + _pCipher = EVP_get_cipherbyname(rName.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + name + " was not found"); + throw Poco::NotFoundException("Cipher " + rName + " was not found"); - _pDigest = EVP_get_digestbyname(digest.c_str()); + _pDigest = EVP_get_digestbyname(rDigest.c_str()); if (!_pDigest) - throw Poco::NotFoundException("Digest " + name + " was not found"); + throw Poco::NotFoundException("Digest " + rName + " was not found"); _key = ByteVec(keySize()); @@ -57,35 +57,35 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name, } -CipherKeyImpl::CipherKeyImpl(const std::string& name, +CipherKeyImpl::CipherKeyImpl(const std::string& rName, const ByteVec& key, const ByteVec& iv): _pCipher(0), - _name(name), + _name(rName), _key(key), _iv(iv) { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(name.c_str()); + _pCipher = EVP_get_cipherbyname(rName.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + name + " was not found"); + throw Poco::NotFoundException("Cipher " + rName + " was not found"); } -CipherKeyImpl::CipherKeyImpl(const std::string& name): +CipherKeyImpl::CipherKeyImpl(const std::string& rName): _pCipher(0), - _name(name), + _name(rName), _key(), _iv() { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); - _pCipher = EVP_get_cipherbyname(name.c_str()); + _pCipher = EVP_get_cipherbyname(rName.c_str()); if (!_pCipher) - throw Poco::NotFoundException("Cipher " + name + " was not found"); + throw Poco::NotFoundException("Cipher " + rName + " was not found"); _key = ByteVec(keySize()); _iv = ByteVec(ivSize()); generateKey(); @@ -165,7 +165,7 @@ void CipherKeyImpl::generateKey( } // Now create the key and IV, using the digest set in the constructor. - int keySize = EVP_BytesToKey( + int cipherKeySize = EVP_BytesToKey( _pCipher, _pDigest, (salt.empty() ? 0 : saltBytes), @@ -176,7 +176,7 @@ void CipherKeyImpl::generateKey( ivBytes); // Copy the buffers to our member byte vectors. - _key.assign(keyBytes, keyBytes + keySize); + _key.assign(keyBytes, keyBytes + cipherKeySize); if (ivSize() == 0) _iv.clear(); diff --git a/Crypto/src/RSAKeyImpl.cpp b/Crypto/src/RSAKeyImpl.cpp index 8333453ce..8c917497c 100644 --- a/Crypto/src/RSAKeyImpl.cpp +++ b/Crypto/src/RSAKeyImpl.cpp @@ -87,10 +87,10 @@ RSAKeyImpl::RSAKeyImpl( RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0); if (!pubKey) { - int rc = BIO_reset(bio); + int ret = BIO_reset(bio); // BIO_reset() normally returns 1 for success and 0 or -1 for failure. // File BIOs are an exception, they return 0 for success and -1 for failure. - if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); + if (ret != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0); } BIO_free(bio); @@ -287,8 +287,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS throw Poco::WriteFileException("Failed to write public key to stream"); } char* pData; - long size = BIO_get_mem_data(bio, &pData); - pPublicKeyStream->write(pData, static_cast(size)); + long keySize = BIO_get_mem_data(bio, &pData); + pPublicKeyStream->write(pData, static_cast(keySize)); BIO_free(bio); } @@ -309,8 +309,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS throw Poco::FileException("Failed to write private key to stream"); } char* pData; - long size = BIO_get_mem_data(bio, &pData); - pPrivateKeyStream->write(pData, static_cast(size)); + long keySize = BIO_get_mem_data(bio, &pData); + pPrivateKeyStream->write(pData, static_cast(keySize)); BIO_free(bio); } } From bc22588895834760c750e7ec75a7ae09ecdd58ea Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Tue, 5 Jan 2016 05:20:40 +0100 Subject: [PATCH 8/8] .bashrc exists only with bash shell while .profile exists always Signed-off-by: FrancisANDRE --- Foundation/testsuite/src/PathTest.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Foundation/testsuite/src/PathTest.cpp b/Foundation/testsuite/src/PathTest.cpp index 2e5c563c2..a601e8067 100644 --- a/Foundation/testsuite/src/PathTest.cpp +++ b/Foundation/testsuite/src/PathTest.cpp @@ -1511,15 +1511,15 @@ void PathTest::testForDirectory() void PathTest::testExpand() { #if defined(POCO_OS_FAMILY_UNIX) - std::string s = Path::expand("~/.bashrc"); - assert (s == Path::expand("$HOME/.bashrc")); - assert (s == Environment::get("HOME") + "/.bashrc" || - s == Environment::get("HOME") + "//.bashrc"); + std::string s = Path::expand("~/.profile"); + assert (s == Path::expand("$HOME/.profile")); + assert (s == Environment::get("HOME") + "/.profile" || + s == Environment::get("HOME") + "//.profile"); Path p(s); - s = Path::expand("$HOME/.bashrc"); - assert (s == Path::expand("~/.bashrc")); - s = Path::expand("${HOME}/.bashrc"); - assert (s == Path::expand("~/.bashrc")); + s = Path::expand("$HOME/.profile"); + assert (s == Path::expand("~/.profile")); + s = Path::expand("${HOME}/.profile"); + assert (s == Path::expand("~/.profile")); #elif defined(POCO_OS_FAMILY_WINDOWS) std::string s = Path::expand("%TMP%\\foo"); assert (s == Environment::get("TMP") + "\\foo");