Merge remote-tracking branch 'origin/PocoCppUnit' into PocoCppUnit

This commit is contained in:
FrancisANDRE 2016-01-06 13:50:45 +01:00
commit 1664b9526a
86 changed files with 1228 additions and 794 deletions

View File

@ -21,21 +21,21 @@ namespace Poco {
namespace Crypto { namespace Crypto {
CipherKey::CipherKey(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, CipherKey::CipherKey(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount,
const std::string &digest): const std::string & rDigest):
_pImpl(new CipherKeyImpl(name, passphrase, salt, iterationCount, digest)) _pImpl(new CipherKeyImpl(rName, passphrase, salt, iterationCount, rDigest))
{ {
} }
CipherKey::CipherKey(const std::string& name, const ByteVec& key, const ByteVec& iv): CipherKey::CipherKey(const std::string& rName, const ByteVec& key, const ByteVec& iv):
_pImpl(new CipherKeyImpl(name, key, iv)) _pImpl(new CipherKeyImpl(rName, key, iv))
{ {
} }
CipherKey::CipherKey(const std::string& name): CipherKey::CipherKey(const std::string& rName):
_pImpl(new CipherKeyImpl(name)) _pImpl(new CipherKeyImpl(rName))
{ {
} }

View File

@ -27,28 +27,28 @@ namespace Poco {
namespace Crypto { namespace Crypto {
CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& rName,
const std::string& passphrase, const std::string& passphrase,
const std::string& salt, const std::string& salt,
int iterationCount, int iterationCount,
const std::string& digest): const std::string& rDigest):
_pCipher(0), _pCipher(0),
_pDigest(0), _pDigest(0),
_name(name), _name(rName),
_key(), _key(),
_iv() _iv()
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) 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) if (!_pDigest)
throw Poco::NotFoundException("Digest " + name + " was not found"); throw Poco::NotFoundException("Digest " + rName + " was not found");
_key = ByteVec(keySize()); _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& key,
const ByteVec& iv): const ByteVec& iv):
_pCipher(0), _pCipher(0),
_name(name), _name(rName),
_key(key), _key(key),
_iv(iv) _iv(iv)
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) 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), _pCipher(0),
_name(name), _name(rName),
_key(), _key(),
_iv() _iv()
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) if (!_pCipher)
throw Poco::NotFoundException("Cipher " + name + " was not found"); throw Poco::NotFoundException("Cipher " + rName + " was not found");
_key = ByteVec(keySize()); _key = ByteVec(keySize());
_iv = ByteVec(ivSize()); _iv = ByteVec(ivSize());
generateKey(); generateKey();
@ -165,7 +165,7 @@ void CipherKeyImpl::generateKey(
} }
// Now create the key and IV, using the digest set in the constructor. // Now create the key and IV, using the digest set in the constructor.
int keySize = EVP_BytesToKey( int cipherKeySize = EVP_BytesToKey(
_pCipher, _pCipher,
_pDigest, _pDigest,
(salt.empty() ? 0 : saltBytes), (salt.empty() ? 0 : saltBytes),
@ -176,7 +176,7 @@ void CipherKeyImpl::generateKey(
ivBytes); ivBytes);
// Copy the buffers to our member byte vectors. // Copy the buffers to our member byte vectors.
_key.assign(keyBytes, keyBytes + keySize); _key.assign(keyBytes, keyBytes + cipherKeySize);
if (ivSize() == 0) if (ivSize() == 0)
_iv.clear(); _iv.clear();

View File

@ -87,10 +87,10 @@ RSAKeyImpl::RSAKeyImpl(
RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0); RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0);
if (!pubKey) 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. // 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. // 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); pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
} }
BIO_free(bio); 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"); throw Poco::WriteFileException("Failed to write public key to stream");
} }
char* pData; char* pData;
long size = BIO_get_mem_data(bio, &pData); long keySize = BIO_get_mem_data(bio, &pData);
pPublicKeyStream->write(pData, static_cast<std::streamsize>(size)); pPublicKeyStream->write(pData, static_cast<std::streamsize>(keySize));
BIO_free(bio); 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"); throw Poco::FileException("Failed to write private key to stream");
} }
char* pData; char* pData;
long size = BIO_get_mem_data(bio, &pData); long keySize = BIO_get_mem_data(bio, &pData);
pPrivateKeyStream->write(pData, static_cast<std::streamsize>(size)); pPrivateKeyStream->write(pData, static_cast<std::streamsize>(keySize));
BIO_free(bio); BIO_free(bio);
} }
} }

View File

@ -109,12 +109,12 @@ public:
/// not found. /// not found.
{ {
typename Container::const_iterator it = _list.begin(); typename Container::const_iterator it = _list.begin();
typename Container::const_iterator end = _list.end(); typename Container::const_iterator itEnd = _list.end();
for(; it != end; ++it) for(; it != itEnd; ++it)
{ {
if (isEqual(it->first, key)) return it; if (isEqual(it->first, key)) return it;
} }
return end; return itEnd;
} }
Iterator find(const KeyType& key) Iterator find(const KeyType& key)
@ -124,12 +124,12 @@ public:
/// not found. /// not found.
{ {
typename Container::iterator it = _list.begin(); typename Container::iterator it = _list.begin();
typename Container::iterator end = _list.end(); typename Container::iterator itEnd = _list.end();
for(; it != end; ++it) for(; it != itEnd; ++it)
{ {
if (isEqual(it->first, key)) return it; if (isEqual(it->first, key)) return it;
} }
return end; return itEnd;
} }
Iterator insert(const ValueType& val) Iterator insert(const ValueType& val)
@ -203,8 +203,8 @@ public:
else else
{ {
ValueType value(key, Mapped()); ValueType value(key, Mapped());
Iterator it = insert(value); Iterator itInsert = insert(value);
return it->second; return itInsert->second;
} }
} }

View File

@ -1511,15 +1511,15 @@ void PathTest::testForDirectory()
void PathTest::testExpand() void PathTest::testExpand()
{ {
#if defined(POCO_OS_FAMILY_UNIX) #if defined(POCO_OS_FAMILY_UNIX)
std::string s = Path::expand("~/.bashrc"); std::string s = Path::expand("~/.profile");
assert (s == Path::expand("$HOME/.bashrc")); assert (s == Path::expand("$HOME/.profile"));
assert (s == Environment::get("HOME") + "/.bashrc" || assert (s == Environment::get("HOME") + "/.profile" ||
s == Environment::get("HOME") + "//.bashrc"); s == Environment::get("HOME") + "//.profile");
Path p(s); Path p(s);
s = Path::expand("$HOME/.bashrc"); s = Path::expand("$HOME/.profile");
assert (s == Path::expand("~/.bashrc")); assert (s == Path::expand("~/.profile"));
s = Path::expand("${HOME}/.bashrc"); s = Path::expand("${HOME}/.profile");
assert (s == Path::expand("~/.bashrc")); assert (s == Path::expand("~/.profile"));
#elif defined(POCO_OS_FAMILY_WINDOWS) #elif defined(POCO_OS_FAMILY_WINDOWS)
std::string s = Path::expand("%TMP%\\foo"); std::string s = Path::expand("%TMP%\\foo");
assert (s == Environment::get("TMP") + "\\foo"); assert (s == Environment::get("TMP") + "\\foo");

View File

@ -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 #ifdef POCO_HAVE_ALIGNMENT
new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier);
#else #else
_pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope); _pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier);
#endif #endif
} }

View File

@ -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;
} }

View File

@ -43,10 +43,10 @@ AbstractHTTPRequestHandler::~AbstractHTTPRequestHandler()
} }
void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& rRequest, HTTPServerResponse& rResponse)
{ {
_pRequest = &request; _pRequest = &rRequest;
_pResponse = &response; _pResponse = &rResponse;
if (authenticate()) if (authenticate())
{ {
try try
@ -55,14 +55,14 @@ void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPS
} }
catch (Poco::Exception& exc) catch (Poco::Exception& exc)
{ {
if (!response.sent()) if (!rResponse.sent())
{ {
sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText()); sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText());
} }
} }
catch (std::exception& exc) catch (std::exception& exc)
{ {
if (!response.sent()) if (!rResponse.sent())
{ {
sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what()); sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what());
} }

View File

@ -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);
} }

View File

@ -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)
{ {
} }

View File

@ -32,8 +32,8 @@ DialogSocket::DialogSocket():
} }
DialogSocket::DialogSocket(const SocketAddress& address): DialogSocket::DialogSocket(const SocketAddress& rAddress):
StreamSocket(address), StreamSocket(rAddress),
_pBuffer(0), _pBuffer(0),
_pNext(0), _pNext(0),
_pEnd(0) _pEnd(0)

View File

@ -38,8 +38,8 @@ FilePartSource::FilePartSource(const std::string& path):
} }
FilePartSource::FilePartSource(const std::string& path, const std::string& mediaType): FilePartSource::FilePartSource(const std::string& path, const std::string& rMediaType):
PartSource(mediaType), PartSource(rMediaType),
_path(path), _path(path),
_istr(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): FilePartSource::FilePartSource(const std::string& path, const std::string& rFilename, const std::string& rMediaType):
PartSource(mediaType), PartSource(rMediaType),
_path(path), _path(path),
_filename(filename), _filename(rFilename),
_istr(path) _istr(path)
{ {
Path p(path); Path p(path);

View File

@ -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) if (_encoding == ENCODING_URL)
{ {
@ -265,7 +265,7 @@ void HTMLForm::write(std::ostream& ostr, const std::string& boundary)
} }
else else
{ {
_boundary = boundary; _boundary = rBoundary;
writeMultipart(ostr); writeMultipart(ostr);
} }
} }
@ -355,12 +355,12 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler)
{ {
std::string name = params["name"]; std::string name = params["name"];
std::string value; std::string value;
std::istream& istr = reader.stream(); std::istream& rIstr = reader.stream();
int ch = istr.get(); int ch = rIstr.get();
while (ch != eof) while (ch != eof)
{ {
value += (char) ch; value += (char) ch;
ch = istr.get(); ch = rIstr.get();
} }
add(name, value); add(name, value);
} }

View File

@ -137,15 +137,15 @@ void HTTPAuthenticationParams::fromResponse(const HTTPResponse& response, const
bool found = false; bool found = false;
while (!found && it != response.end() && icompare(it->first, header) == 0) while (!found && it != response.end() && icompare(it->first, header) == 0)
{ {
const std::string& header = it->second; const std::string& rHeader = it->second;
if (icompare(header, 0, 6, "Basic ") == 0) if (icompare(rHeader, 0, 6, "Basic ") == 0)
{ {
parse(header.begin() + 6, header.end()); parse(rHeader.begin() + 6, rHeader.end());
found = true; 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; found = true;
} }
++it; ++it;

View File

@ -52,8 +52,8 @@ HTTPClientSession::HTTPClientSession():
} }
HTTPClientSession::HTTPClientSession(const StreamSocket& socket): HTTPClientSession::HTTPClientSession(const StreamSocket& rSocket):
HTTPSession(socket), HTTPSession(rSocket),
_port(HTTPSession::HTTP_PORT), _port(HTTPSession::HTTP_PORT),
_proxyConfig(_globalProxyConfig), _proxyConfig(_globalProxyConfig),
_keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0), _keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0),

View File

@ -241,11 +241,11 @@ void HTTPRequest::getCredentials(const std::string& header, std::string& scheme,
{ {
const std::string& auth = get(header); const std::string& auth = get(header);
std::string::const_iterator it = auth.begin(); std::string::const_iterator it = auth.begin();
std::string::const_iterator end = auth.end(); std::string::const_iterator itEnd = auth.end();
while (it != end && Poco::Ascii::isSpace(*it)) ++it; while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it;
while (it != end && !Poco::Ascii::isSpace(*it)) scheme += *it++; while (it != itEnd && !Poco::Ascii::isSpace(*it)) scheme += *it++;
while (it != end && Poco::Ascii::isSpace(*it)) ++it; while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it;
while (it != end) authInfo += *it++; while (it != itEnd) authInfo += *it++;
} }
else throw NotAuthenticatedException(); else throw NotAuthenticatedException();
} }

View File

@ -29,15 +29,15 @@ HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 por
} }
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams): HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams):
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), socket, pParams), TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), rSocket, pParams),
_pFactory(pFactory) _pFactory(pFactory)
{ {
} }
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams): HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams):
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, socket, pParams), TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, rSocket, pParams),
_pFactory(pFactory) _pFactory(pFactory)
{ {
} }

View File

@ -31,8 +31,8 @@ namespace Poco {
namespace Net { namespace Net {
HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory): HTTPServerConnection::HTTPServerConnection(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory):
TCPServerConnection(socket), TCPServerConnection(rSocket),
_pParams(pParams), _pParams(pParams),
_pFactory(pFactory), _pFactory(pFactory),
_stopped(false) _stopped(false)

View File

@ -33,13 +33,13 @@ namespace Poco {
namespace Net { namespace Net {
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& response, HTTPServerSession& session, HTTPServerParams* pParams): HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& rResponse, HTTPServerSession& session, HTTPServerParams* pParams):
_response(response), _response(rResponse),
_session(session), _session(session),
_pStream(0), _pStream(0),
_pParams(pParams, true) _pParams(pParams, true)
{ {
response.attachRequest(this); rResponse.attachRequest(this);
HTTPHeaderInputStream hs(session); HTTPHeaderInputStream hs(session);
read(hs); read(hs);

View File

@ -21,14 +21,14 @@ namespace Poco {
namespace Net { namespace Net {
HTTPServerSession::HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams): HTTPServerSession::HTTPServerSession(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams):
HTTPSession(socket, pParams->getKeepAlive()), HTTPSession(rSocket, pParams->getKeepAlive()),
_firstRequest(true), _firstRequest(true),
_keepAliveTimeout(pParams->getKeepAliveTimeout()), _keepAliveTimeout(pParams->getKeepAliveTimeout()),
_maxKeepAliveRequests(pParams->getMaxKeepAliveRequests()) _maxKeepAliveRequests(pParams->getMaxKeepAliveRequests())
{ {
setTimeout(pParams->getTimeout()); setTimeout(pParams->getTimeout());
this->socket().setReceiveTimeout(pParams->getTimeout()); socket().setReceiveTimeout(pParams->getTimeout());
} }

View File

@ -38,8 +38,8 @@ HTTPSession::HTTPSession():
} }
HTTPSession::HTTPSession(const StreamSocket& socket): HTTPSession::HTTPSession(const StreamSocket& rSocket):
_socket(socket), _socket(rSocket),
_pBuffer(0), _pBuffer(0),
_pCurrent(0), _pCurrent(0),
_pEnd(0), _pEnd(0),
@ -50,8 +50,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket):
} }
HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive): HTTPSession::HTTPSession(const StreamSocket& rSocket, bool keepAlive):
_socket(socket), _socket(rSocket),
_pBuffer(0), _pBuffer(0),
_pCurrent(0), _pCurrent(0),
_pEnd(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;
} }

View File

@ -35,9 +35,9 @@ HTTPSessionFactory::HTTPSessionFactory():
} }
HTTPSessionFactory::HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort): HTTPSessionFactory::HTTPSessionFactory(const std::string& rProxyHost, Poco::UInt16 port):
_proxyHost(proxyHost), _proxyHost(rProxyHost),
_proxyPort(proxyPort) _proxyPort(port)
{ {
} }

View File

@ -32,13 +32,13 @@ namespace Poco {
namespace Net { 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), _address(address),
_sent(0), _sent(0),
_dataSize(dataSize), _dataSize(dataSizeInBytes),
_ttl(ttl), _ttl(operationTtl),
_rtt(repetitions, 0), _rtt(operationRepetitions, 0),
_errors(repetitions) _errors(operationRepetitions)
{ {
} }
@ -76,11 +76,11 @@ std::string ICMPEventArgs::hostAddress() const
} }
void ICMPEventArgs::setRepetitions(int repetitions) void ICMPEventArgs::setRepetitions(int operationRepetitions)
{ {
_rtt.clear(); _rtt.clear();
_rtt.resize(repetitions, 0); _rtt.resize(operationRepetitions, 0);
_errors.assign(repetitions, ""); _errors.assign(operationRepetitions, "");
} }
@ -101,13 +101,13 @@ ICMPEventArgs ICMPEventArgs::operator ++ (int)
int ICMPEventArgs::received() const int ICMPEventArgs::received() const
{ {
int received = 0; int ret = 0;
for (int i = 0; i < _rtt.size(); ++i) for (int i = 0; i < _rtt.size(); ++i)
{ {
if (_rtt[i]) ++received; if (_rtt[i]) ++ret;
} }
return received; return ret;
} }

View File

@ -26,11 +26,11 @@ namespace Poco {
namespace Net { namespace Net {
ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSize, int ttl, int timeout): ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSizeInBytes, int ttlValue, int socketTimeout):
Socket(new ICMPSocketImpl(family, dataSize, ttl, timeout)), Socket(new ICMPSocketImpl(family, dataSizeInBytes, ttlValue, socketTimeout)),
_dataSize(dataSize), _dataSize(dataSizeInBytes),
_ttl(ttl), _ttl(ttlValue),
_timeout(timeout) _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);
} }

View File

@ -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; return n;
} }
int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags) int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& rAddress, int flags)
{ {
int maxPacketSize = _icmpPacket.maxPacketSize(); int maxPacketSize = _icmpPacket.maxPacketSize();
unsigned char* buffer = new unsigned char[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. // fake ping responses will cause an endless loop.
throw TimeoutException(); throw TimeoutException();
} }
SocketImpl::receiveFrom(buffer, maxPacketSize, address, flags); SocketImpl::receiveFrom(buffer, maxPacketSize, rAddress, flags);
} }
while (!_icmpPacket.validReplyID(buffer, maxPacketSize)); while (!_icmpPacket.validReplyID(buffer, maxPacketSize));
} }

View File

@ -60,39 +60,39 @@ IPAddress::IPAddress()
} }
IPAddress::IPAddress(const IPAddress& addr) IPAddress::IPAddress(const IPAddress& rAddr)
{ {
if (addr.family() == IPv4) if (rAddr.family() == IPv4)
newIPv4(addr.addr()); newIPv4(rAddr.addr());
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else else
newIPv6(addr.addr(), addr.scope()); newIPv6(rAddr.addr(), rAddr.scope());
#endif #endif
} }
IPAddress::IPAddress(Family family) IPAddress::IPAddress(Family addressFamily)
{ {
if (family == IPv4) if (addressFamily == IPv4)
newIPv4(); newIPv4();
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (family == IPv6) else if (addressFamily == IPv6)
newIPv6(); newIPv6();
#endif #endif
else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()"); 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(); IPv4AddressImpl empty4 = IPv4AddressImpl();
if (addr.empty() || trim(addr) == "0.0.0.0") if (rAddr.empty() || trim(rAddr) == "0.0.0.0")
{ {
newIPv4(empty4.addr()); newIPv4(empty4.addr());
return; return;
} }
IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr)); IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr));
if (addr4 != empty4) if (addr4 != empty4)
{ {
newIPv4(addr4.addr()); newIPv4(addr4.addr());
@ -101,13 +101,13 @@ IPAddress::IPAddress(const std::string& addr)
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
IPv6AddressImpl empty6 = IPv6AddressImpl(); IPv6AddressImpl empty6 = IPv6AddressImpl();
if (addr.empty() || trim(addr) == "::") if (rAddr.empty() || trim(rAddr) == "::")
{ {
newIPv6(empty6.addr()); newIPv6(empty6.addr());
return; return;
} }
IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr)); IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr));
if (addr6 != IPv6AddressImpl()) if (addr6 != IPv6AddressImpl())
{ {
newIPv6(addr6.addr(), addr6.scope()); newIPv6(addr6.addr(), addr6.scope());
@ -115,22 +115,22 @@ IPAddress::IPAddress(const std::string& addr)
} }
#endif #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()); newIPv4(addr4.addr());
return; return;
} }
#if defined(POCO_HAVE_IPv6) #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()); newIPv6(addr6.addr(), addr6.scope());
return; 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 #ifndef POCO_HAVE_ALIGNMENT
: _pImpl(0) : _pImpl(0)
#endif #endif
{ {
if (length == sizeof(struct in_addr)) if (addressLength == sizeof(struct in_addr))
newIPv4(addr); newIPv4(pAddr);
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (length == sizeof(struct in6_addr)) else if (addressLength == sizeof(struct in6_addr))
newIPv6(addr); newIPv6(pAddr);
#endif #endif
else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); 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)) if (addressLength == sizeof(struct in_addr))
newIPv4(addr); newIPv4(pAddr);
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (length == sizeof(struct in6_addr)) else if (addressLength == sizeof(struct in6_addr))
newIPv6(addr, scope); newIPv6(pAddr, scopeIdentifier);
#endif #endif
else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()"); 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) if (prefix <= 32)
newIPv4(prefix); newIPv4(prefix);
@ -176,7 +176,7 @@ IPAddress::IPAddress(unsigned prefix, Family family)
throw Poco::InvalidArgumentException("Invalid prefix length passed to IPAddress()"); throw Poco::InvalidArgumentException("Invalid prefix length passed to IPAddress()");
} }
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (family == IPv6) else if (addressFamily == IPv6)
{ {
if (prefix <= 128) if (prefix <= 128)
newIPv6(prefix); newIPv6(prefix);
@ -209,11 +209,11 @@ IPAddress::IPAddress(const SOCKET_ADDRESS& socket_address)
IPAddress::IPAddress(const struct sockaddr& sockaddr) IPAddress::IPAddress(const struct sockaddr& sockaddr)
{ {
unsigned short family = sockaddr.sa_family; unsigned short addressFamily = sockaddr.sa_family;
if (family == AF_INET) if (addressFamily == AF_INET)
newIPv4(&reinterpret_cast<const struct sockaddr_in*>(&sockaddr)->sin_addr); newIPv4(&reinterpret_cast<const struct sockaddr_in*>(&sockaddr)->sin_addr);
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (family == AF_INET6) else if (addressFamily == AF_INET6)
newIPv6(&reinterpret_cast<const struct sockaddr_in6*>(&sockaddr)->sin6_addr, newIPv6(&reinterpret_cast<const struct sockaddr_in6*>(&sockaddr)->sin6_addr,
reinterpret_cast<const struct sockaddr_in6*>(&sockaddr)->sin6_scope_id); reinterpret_cast<const struct sockaddr_in6*>(&sockaddr)->sin6_scope_id);
#endif #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(); destruct();
if (addr.family() == IPAddress::IPv4) if (rAddr.family() == IPAddress::IPv4)
newIPv4(addr.addr()); newIPv4(rAddr.addr());
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
else if (addr.family() == IPAddress::IPv6) else if (rAddr.family() == IPAddress::IPv6)
newIPv6(addr.addr(), addr.scope()); newIPv6(rAddr.addr(), rAddr.scope());
#endif #endif
else else
throw Poco::InvalidArgumentException("Invalid or unsupported address family"); 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; 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());
} }

View File

@ -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) IPv4AddressImpl::IPv4AddressImpl(unsigned prefix)
{ {
UInt32 addr = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix); UInt32 address = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix);
_addr.s_addr = ByteOrder::toNetwork(addr); _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; return *this;
std::memcpy(&_addr, &addr._addr, sizeof(_addr)); std::memcpy(&_addr, &rAddr._addr, sizeof(_addr));
return *this; return *this;
} }
@ -199,10 +199,10 @@ bool IPv4AddressImpl::isLinkLocal() const
bool IPv4AddressImpl::isSiteLocal() const bool IPv4AddressImpl::isSiteLocal() const
{ {
UInt32 addr = ntohl(_addr.s_addr); UInt32 address = ntohl(_addr.s_addr);
return (addr & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24 return (address & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24
(addr & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16 (address & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16
(addr >= 0xAC100000 && addr <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255 (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 bool IPv4AddressImpl::isGlobalMC() const
{ {
UInt32 addr = ntohl(_addr.s_addr); UInt32 address = ntohl(_addr.s_addr);
return addr >= 0xE0000100 && addr <= 0xEE000000; // 224.0.1.0 to 238.255.255.255 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); IPv4AddressImpl result(&_addr);
result._addr.s_addr &= addr._addr.s_addr; result._addr.s_addr &= rAddr._addr.s_addr;
return result; return result;
} }
IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& addr) const IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& rAddr) const
{ {
IPv4AddressImpl result(&_addr); IPv4AddressImpl result(&_addr);
result._addr.s_addr |= addr._addr.s_addr; result._addr.s_addr |= rAddr._addr.s_addr;
return result; return result;
} }
IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& addr) const IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& rAddr) const
{ {
IPv4AddressImpl result(&_addr); IPv4AddressImpl result(&_addr);
result._addr.s_addr ^= addr._addr.s_addr; result._addr.s_addr ^= rAddr._addr.s_addr;
return result; 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; return *this;
_scope = addr._scope; _scope = rAddr._scope;
std::memcpy(&_addr, &addr._addr, sizeof(_addr)); std::memcpy(&_addr, &rAddr._addr, sizeof(_addr));
return *this; return *this;
} }
@ -516,16 +516,16 @@ unsigned IPv6AddressImpl::prefixLength() const
#if defined(POCO_OS_FAMILY_UNIX) #if defined(POCO_OS_FAMILY_UNIX)
for (int i = 3; i >= 0; --i) for (int i = 3; i >= 0; --i)
{ {
unsigned addr = ntohl(_addr.s6_addr32[i]); unsigned address = ntohl(_addr.s6_addr32[i]);
if ((bits = maskBits(addr, 32))) return (bitPos - (32 - bits)); if ((bits = maskBits(address, 32))) return (bitPos - (32 - bits));
bitPos -= 32; bitPos -= 32;
} }
return 0; return 0;
#elif defined(POCO_OS_FAMILY_WINDOWS) #elif defined(POCO_OS_FAMILY_WINDOWS)
for (int i = 7; i >= 0; --i) for (int i = 7; i >= 0; --i)
{ {
unsigned short addr = ByteOrder::fromNetwork(_addr.s6_addr16[i]); unsigned short address = ByteOrder::fromNetwork(_addr.s6_addr16[i]);
if ((bits = maskBits(addr, 16))) return (bitPos - (16 - bits)); if ((bits = maskBits(address, 16))) return (bitPos - (16 - bits));
bitPos -= 16; bitPos -= 16;
} }
return 0; 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."); throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
IPv6AddressImpl result(*this); IPv6AddressImpl result(*this);
#ifdef POCO_OS_FAMILY_WINDOWS #ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] &= addr._addr.s6_addr16[0]; result._addr.s6_addr16[0] &= rAddr._addr.s6_addr16[0];
result._addr.s6_addr16[1] &= addr._addr.s6_addr16[1]; result._addr.s6_addr16[1] &= rAddr._addr.s6_addr16[1];
result._addr.s6_addr16[2] &= addr._addr.s6_addr16[2]; result._addr.s6_addr16[2] &= rAddr._addr.s6_addr16[2];
result._addr.s6_addr16[3] &= addr._addr.s6_addr16[3]; result._addr.s6_addr16[3] &= rAddr._addr.s6_addr16[3];
result._addr.s6_addr16[4] &= addr._addr.s6_addr16[4]; result._addr.s6_addr16[4] &= rAddr._addr.s6_addr16[4];
result._addr.s6_addr16[5] &= addr._addr.s6_addr16[5]; result._addr.s6_addr16[5] &= rAddr._addr.s6_addr16[5];
result._addr.s6_addr16[6] &= addr._addr.s6_addr16[6]; result._addr.s6_addr16[6] &= rAddr._addr.s6_addr16[6];
result._addr.s6_addr16[7] &= addr._addr.s6_addr16[7]; result._addr.s6_addr16[7] &= rAddr._addr.s6_addr16[7];
#else #else
result._addr.s6_addr32[0] &= addr._addr.s6_addr32[0]; result._addr.s6_addr32[0] &= rAddr._addr.s6_addr32[0];
result._addr.s6_addr32[1] &= addr._addr.s6_addr32[1]; result._addr.s6_addr32[1] &= rAddr._addr.s6_addr32[1];
result._addr.s6_addr32[2] &= addr._addr.s6_addr32[2]; result._addr.s6_addr32[2] &= rAddr._addr.s6_addr32[2];
result._addr.s6_addr32[3] &= addr._addr.s6_addr32[3]; result._addr.s6_addr32[3] &= rAddr._addr.s6_addr32[3];
#endif #endif
return result; 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."); throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
IPv6AddressImpl result(*this); IPv6AddressImpl result(*this);
#ifdef POCO_OS_FAMILY_WINDOWS #ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] |= addr._addr.s6_addr16[0]; result._addr.s6_addr16[0] |= rAddr._addr.s6_addr16[0];
result._addr.s6_addr16[1] |= addr._addr.s6_addr16[1]; result._addr.s6_addr16[1] |= rAddr._addr.s6_addr16[1];
result._addr.s6_addr16[2] |= addr._addr.s6_addr16[2]; result._addr.s6_addr16[2] |= rAddr._addr.s6_addr16[2];
result._addr.s6_addr16[3] |= addr._addr.s6_addr16[3]; result._addr.s6_addr16[3] |= rAddr._addr.s6_addr16[3];
result._addr.s6_addr16[4] |= addr._addr.s6_addr16[4]; result._addr.s6_addr16[4] |= rAddr._addr.s6_addr16[4];
result._addr.s6_addr16[5] |= addr._addr.s6_addr16[5]; result._addr.s6_addr16[5] |= rAddr._addr.s6_addr16[5];
result._addr.s6_addr16[6] |= addr._addr.s6_addr16[6]; result._addr.s6_addr16[6] |= rAddr._addr.s6_addr16[6];
result._addr.s6_addr16[7] |= addr._addr.s6_addr16[7]; result._addr.s6_addr16[7] |= rAddr._addr.s6_addr16[7];
#else #else
result._addr.s6_addr32[0] |= addr._addr.s6_addr32[0]; result._addr.s6_addr32[0] |= rAddr._addr.s6_addr32[0];
result._addr.s6_addr32[1] |= addr._addr.s6_addr32[1]; result._addr.s6_addr32[1] |= rAddr._addr.s6_addr32[1];
result._addr.s6_addr32[2] |= addr._addr.s6_addr32[2]; result._addr.s6_addr32[2] |= rAddr._addr.s6_addr32[2];
result._addr.s6_addr32[3] |= addr._addr.s6_addr32[3]; result._addr.s6_addr32[3] |= rAddr._addr.s6_addr32[3];
#endif #endif
return result; 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."); throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
IPv6AddressImpl result(*this); IPv6AddressImpl result(*this);
#ifdef POCO_OS_FAMILY_WINDOWS #ifdef POCO_OS_FAMILY_WINDOWS
result._addr.s6_addr16[0] ^= addr._addr.s6_addr16[0]; result._addr.s6_addr16[0] ^= rAddr._addr.s6_addr16[0];
result._addr.s6_addr16[1] ^= addr._addr.s6_addr16[1]; result._addr.s6_addr16[1] ^= rAddr._addr.s6_addr16[1];
result._addr.s6_addr16[2] ^= addr._addr.s6_addr16[2]; result._addr.s6_addr16[2] ^= rAddr._addr.s6_addr16[2];
result._addr.s6_addr16[3] ^= addr._addr.s6_addr16[3]; result._addr.s6_addr16[3] ^= rAddr._addr.s6_addr16[3];
result._addr.s6_addr16[4] ^= addr._addr.s6_addr16[4]; result._addr.s6_addr16[4] ^= rAddr._addr.s6_addr16[4];
result._addr.s6_addr16[5] ^= addr._addr.s6_addr16[5]; result._addr.s6_addr16[5] ^= rAddr._addr.s6_addr16[5];
result._addr.s6_addr16[6] ^= addr._addr.s6_addr16[6]; result._addr.s6_addr16[6] ^= rAddr._addr.s6_addr16[6];
result._addr.s6_addr16[7] ^= addr._addr.s6_addr16[7]; result._addr.s6_addr16[7] ^= rAddr._addr.s6_addr16[7];
#else #else
result._addr.s6_addr32[0] ^= addr._addr.s6_addr32[0]; result._addr.s6_addr32[0] ^= rAddr._addr.s6_addr32[0];
result._addr.s6_addr32[1] ^= addr._addr.s6_addr32[1]; result._addr.s6_addr32[1] ^= rAddr._addr.s6_addr32[1];
result._addr.s6_addr32[2] ^= addr._addr.s6_addr32[2]; result._addr.s6_addr32[2] ^= rAddr._addr.s6_addr32[2];
result._addr.s6_addr32[3] ^= addr._addr.s6_addr32[3]; result._addr.s6_addr32[3] ^= rAddr._addr.s6_addr32[3];
#endif #endif
return result; 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);
} }

View File

@ -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); readHeader(istr);
if (isMultipart()) if (isMultipart())
{ {
readMultipart(istr, handler); readMultipart(istr, rHandler);
} }
else else
{ {

View File

@ -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)
{ {
} }

View File

@ -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), _istr(istr),
_boundary(boundary), _boundary(rBoundary),
_pMPI(0) _pMPI(0)
{ {
} }

View File

@ -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), _ostr(ostr),
_boundary(boundary), _boundary(rBoundary),
_firstPart(true) _firstPart(true)
{ {
if (_boundary.empty()) if (_boundary.empty())

View File

@ -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->li = _leapIndicator;
p->vn = _version; 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; _leapIndicator = p->li;
_version = p->vn; _version = p->vn;

View File

@ -75,14 +75,14 @@ public:
typedef NetworkInterface::Type Type; typedef NetworkInterface::Type Type;
NetworkInterfaceImpl(unsigned index); 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& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, 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& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0);
NetworkInterfaceImpl(const std::string& name, NetworkInterfaceImpl(const std::string& rName,
const std::string& displayName, const std::string& rDisplayName,
const std::string& adapterName, const std::string& rAdapterName,
const IPAddress& address, const IPAddress& rAddress,
const IPAddress& subnetMask, const IPAddress& subnetMask,
const IPAddress& broadcastAddress, const IPAddress& rBroadcastAddress,
unsigned index, unsigned index,
NetworkInterface::MACAddress* pMACAddress = 0); NetworkInterface::MACAddress* pMACAddress = 0);
@ -91,10 +91,10 @@ public:
const std::string& displayName() const; const std::string& displayName() const;
const std::string& adapterName() const; const std::string& adapterName() const;
const IPAddress& firstAddress(IPAddress::Family family) 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 IPAddress& address(unsigned index) const;
const NetworkInterface::AddressList& addressList() 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& subnetMask(unsigned index) const;
const IPAddress& broadcastAddress(unsigned index) const; const IPAddress& broadcastAddress(unsigned index) const;
const IPAddress& destAddress(unsigned index) const; const IPAddress& destAddress(unsigned index) const;
@ -102,9 +102,9 @@ public:
bool supportsIPv4() const; bool supportsIPv4() const;
bool supportsIPv6() const; bool supportsIPv6() const;
void setName(const std::string& name); void setName(const std::string& rName);
void setDisplayName(const std::string& name); void setDisplayName(const std::string& rName);
void setAdapterName(const std::string& name); void setAdapterName(const std::string& rName);
void addAddress(const IPAddress& addr); void addAddress(const IPAddress& addr);
void setMACAddress(const NetworkInterface::MACAddress& addr); void setMACAddress(const NetworkInterface::MACAddress& addr);
void setMACAddress(const void *addr, std::size_t len); void setMACAddress(const void *addr, std::size_t len);
@ -157,8 +157,8 @@ private:
}; };
NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index): NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned interfaceIndex):
_index(index), _index(interfaceIndex),
_broadcast(false), _broadcast(false),
_loopback(false), _loopback(false),
_multicast(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): NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress):
_name(name), _name(rName),
_displayName(displayName), _displayName(rDisplayName),
_adapterName(adapterName), _adapterName(rAdapterName),
_index(index), _index(interfaceIndex),
_broadcast(false), _broadcast(false),
_loopback(false), _loopback(false),
_multicast(false), _multicast(false),
@ -185,17 +185,17 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s
_mtu(0), _mtu(0),
_type(NetworkInterface::NI_TYPE_OTHER) _type(NetworkInterface::NI_TYPE_OTHER)
{ {
_addressList.push_back(AddressTuple(address, IPAddress(), IPAddress())); _addressList.push_back(AddressTuple(rAddress, IPAddress(), IPAddress()));
setPhyParams(); setPhyParams();
if (pMACAddress) setMACAddress(*pMACAddress); if (pMACAddress) setMACAddress(*pMACAddress);
} }
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, NetworkInterface::MACAddress* pMACAddress): NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress):
_name(name), _name(rName),
_displayName(displayName), _displayName(rDisplayName),
_adapterName(adapterName), _adapterName(rAdapterName),
_index(index), _index(interfaceIndex),
_broadcast(false), _broadcast(false),
_loopback(false), _loopback(false),
_multicast(false), _multicast(false),
@ -210,18 +210,18 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s
} }
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName,
const std::string& displayName, const std::string& rDisplayName,
const std::string& adapterName, const std::string& rAdapterName,
const IPAddress& address, const IPAddress& rAddress,
const IPAddress& subnetMask, const IPAddress& rSubnetMask,
const IPAddress& broadcastAddress, const IPAddress& rBroadcastAddress,
unsigned index, unsigned interfaceIndex,
NetworkInterface::MACAddress* pMACAddress): NetworkInterface::MACAddress* pMACAddress):
_name(name), _name(rName),
_displayName(displayName), _displayName(rDisplayName),
_adapterName(adapterName), _adapterName(rAdapterName),
_index(index), _index(interfaceIndex),
_broadcast(false), _broadcast(false),
_loopback(false), _loopback(false),
_multicast(false), _multicast(false),
@ -230,7 +230,7 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name,
_running(false), _running(false),
_mtu(0) _mtu(0)
{ {
_addressList.push_back(AddressTuple(address, subnetMask, broadcastAddress)); _addressList.push_back(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress));
setPhyParams(); setPhyParams();
if (pMACAddress) setMACAddress(*pMACAddress); 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 it = _addressList.begin();
NetworkInterface::ConstAddressIterator end = _addressList.end(); NetworkInterface::ConstAddressIterator end = _addressList.end();
for (; it != end; ++it) for (; it != end; ++it)
{ {
if (it->get<NetworkInterface::IP_ADDRESS>() == address) if (it->get<NetworkInterface::IP_ADDRESS>() == rAddress)
return true; return true;
} }
return false; 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<NetworkInterface::IP_ADDRESS>(); if (interfaceIndex < _addressList.size()) return _addressList[interfaceIndex].get<NetworkInterface::IP_ADDRESS>();
else throw NotFoundException(Poco::format("No address with index %u.", index)); 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()) if (interfaceIndex < _addressList.size())
return _addressList[index].get<NetworkInterface::SUBNET_MASK>(); return _addressList[interfaceIndex].get<NetworkInterface::SUBNET_MASK>();
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()) if (interfaceIndex < _addressList.size())
return _addressList[index].get<NetworkInterface::BROADCAST_ADDRESS>(); return _addressList[interfaceIndex].get<NetworkInterface::BROADCAST_ADDRESS>();
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()) if (!pointToPoint())
throw InvalidAccessException("Only PPP addresses have destination address."); throw InvalidAccessException("Only PPP addresses have destination address.");
else if (index < _addressList.size()) else if (interfaceIndex < _addressList.size())
return _addressList[index].get<NetworkInterface::BROADCAST_ADDRESS>(); return _addressList[interfaceIndex].get<NetworkInterface::BROADCAST_ADDRESS>();
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 #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; FastMutex NetworkInterface::_mutex;
NetworkInterface::NetworkInterface(unsigned index): NetworkInterface::NetworkInterface(unsigned interfaceIndex):
_pImpl(new NetworkInterfaceImpl(index)) _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): NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress):
_pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, index, 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): NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, MACAddress* pMACAddress):
_pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, index, pMACAddress)) _pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, interfaceIndex, pMACAddress))
{ {
} }
NetworkInterface::NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress): NetworkInterface::NetworkInterface(const std::string& rName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress):
_pImpl(new NetworkInterfaceImpl(name, name, name, address, index, pMACAddress)) _pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, interfaceIndex, pMACAddress))
{ {
} }
NetworkInterface::NetworkInterface(const std::string& name, NetworkInterface::NetworkInterface(const std::string& rName,
const std::string& displayName, const std::string& rDisplayName,
const std::string& adapterName, const std::string& rAdapterName,
const IPAddress& address, const IPAddress& rAddress,
const IPAddress& subnetMask, const IPAddress& rSubnetMask,
const IPAddress& broadcastAddress, const IPAddress& rBroadcastAddress,
unsigned index, unsigned interfaceIndex,
MACAddress* pMACAddress): 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, NetworkInterface::NetworkInterface(const std::string& rName,
const IPAddress& address, const IPAddress& rAddress,
const IPAddress& subnetMask, const IPAddress& rSubnetMask,
const IPAddress& broadcastAddress, const IPAddress& rBroadcastAddress,
unsigned index, unsigned interfaceIndex,
MACAddress* pMACAddress): 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); if (requireIPv6) return forName(rName, IPv6_ONLY);
else return forName(name, IPv4_OR_IPv6); 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 map = NetworkInterface::map(false, false);
Map::const_iterator it = map.begin(); Map::const_iterator it = map.begin();
@ -808,7 +808,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip
for (; it != end; ++it) for (; it != end; ++it)
{ {
if (it->second.name() == name) if (it->second.name() == rName)
{ {
if (ipVersion == IPv4_ONLY && it->second.supportsIPv4()) if (ipVersion == IPv4_ONLY && it->second.supportsIPv4())
return it->second; return it->second;
@ -818,7 +818,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip
return it->second; 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(); NetworkInterface::Map::const_iterator end = m.end();
for (; it != end; ++it) for (; it != end; ++it)
{ {
int index = it->second.index(); int interfaceIndex = it->second.index();
std::string name = it->second.name(); std::string interfaceName = it->second.name();
std::string displayName = it->second.displayName(); std::string interfaceDisplayName = it->second.displayName();
std::string adapterName = it->second.adapterName(); std::string interfaceAdapterName = it->second.adapterName();
NetworkInterface::MACAddress mac = it->second.macAddress(); NetworkInterface::MACAddress mac = it->second.macAddress();
typedef NetworkInterface::AddressList List; typedef NetworkInterface::AddressList List;
@ -881,12 +881,12 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly)
NetworkInterface ni; NetworkInterface ni;
if (mask.isWildcard()) if (mask.isWildcard())
{ {
ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac); ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, interfaceIndex, &mac);
} }
else else
{ {
IPAddress broadcast = ipIt->get<NetworkInterface::BROADCAST_ADDRESS>(); IPAddress broadcast = ipIt->get<NetworkInterface::BROADCAST_ADDRESS>();
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; 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) if (isLoopback)
{ {
@ -994,7 +994,7 @@ IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback)
{ {
#if !defined(_WIN32_WCE) #if !defined(_WIN32_WCE)
std::string subKey("SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\"); std::string subKey("SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\");
subKey += name; subKey += rName;
std::string netmask; std::string netmask;
HKEY hKey; HKEY hKey;
#if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING) #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); poco_assert (NO_ERROR == dwRetVal);
for (; pAddress; pAddress = pAddress->Next) for (; pAddress; pAddress = pAddress->Next)
{ {
IPAddress address; IPAddress ipAddress;
IPAddress subnetMask; IPAddress ipSubnetMask;
IPAddress broadcastAddress; IPAddress ipBroadcastAddress;
unsigned ifIndex = 0; unsigned ifIndex = 0;
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
@ -1138,26 +1138,26 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#endif #endif
if (ifIndex == 0) continue; if (ifIndex == 0) continue;
std::string name; std::string interfaceName;
std::string displayName; std::string interfaceDisplayName;
std::string adapterName(pAddress->AdapterName); std::string interfaceAdapterName(pAddress->AdapterName);
#ifdef POCO_WIN32_UTF8 #ifdef POCO_WIN32_UTF8
Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, name); Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, interfaceName);
Poco::UnicodeConverter::toUTF8(pAddress->Description, displayName); Poco::UnicodeConverter::toUTF8(pAddress->Description, interfaceDisplayName);
#else #else
char nameBuffer[1024]; char nameBuffer[1024];
int rc = WideCharToMultiByte(CP_ACP, 0, pAddress->FriendlyName, -1, nameBuffer, sizeof(nameBuffer), NULL, NULL); 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]; char displayNameBuffer[1024];
rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL); rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL);
if (rc) displayName = displayNameBuffer; if (rc) interfaceDisplayName = displayNameBuffer;
#endif #endif
bool isUp = (pAddress->OperStatus == IfOperStatusUp); bool isUp = (pAddress->OperStatus == IfOperStatusUp);
bool isIP = (0 != pAddress->FirstUnicastAddress); bool isIP = (0 != pAddress->FirstUnicastAddress);
if (((ipOnly && isIP) || !ipOnly) && ((upOnly && isUp) || !upOnly)) 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 // Create interface even if it has an empty list of addresses; also, set
// physical attributes which are protocol independent (name, media type, // physical attributes which are protocol independent (name, media type,
// MAC address, MTU, operational status, etc). // MAC address, MTU, operational status, etc).
@ -1184,7 +1184,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
pUniAddr; pUniAddr;
pUniAddr = pUniAddr->Next) pUniAddr = pUniAddr->Next)
{ {
address = IPAddress(pUniAddr->Address); ipAddress = IPAddress(pUniAddr->Address);
ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family; ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family;
switch (family) switch (family)
{ {
@ -1201,67 +1201,67 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
#if _WIN32_WCE >= 0x0800 #if _WIN32_WCE >= 0x0800
prefixLength = pUniAddr->OnLinkPrefixLength; prefixLength = pUniAddr->OnLinkPrefixLength;
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress);
#else #else
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
#endif #endif
// if previous call did not do it, make last-ditch attempt for prefix and broadcast // if previous call did not do it, make last-ditch attempt for prefix and broadcast
if (prefixLength == 0 && pAddress->FirstPrefix) if (prefixLength == 0 && pAddress->FirstPrefix)
prefixLength = pAddress->FirstPrefix->PrefixLength; prefixLength = pAddress->FirstPrefix->PrefixLength;
poco_assert (prefixLength <= 32); poco_assert (prefixLength <= 32);
if (broadcastAddress.isWildcard()) if (ipBroadcastAddress.isWildcard())
{ {
IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4); IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4);
IPAddress host(mask & address); IPAddress host(mask & ipAddress);
broadcastAddress = host | ~mask; ipBroadcastAddress = host | ~mask;
} }
#elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1 #elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
#if (_WIN32_WINNT >= 0x0600) // Vista and newer #if (_WIN32_WINNT >= 0x0600) // Vista and newer
if (osvi.dwMajorVersion >= 6) if (osvi.dwMajorVersion >= 6)
{ {
prefixLength = pUniAddr->OnLinkPrefixLength; prefixLength = pUniAddr->OnLinkPrefixLength;
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress);
} }
else else
{ {
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
} }
#else #else
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
#endif #endif
poco_assert (prefixLength <= 32); poco_assert (prefixLength <= 32);
if (broadcastAddress.isWildcard()) if (ipBroadcastAddress.isWildcard())
{ {
IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4); IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4);
IPAddress host(mask & address); IPAddress host(mask & ipAddress);
broadcastAddress = host | ~mask; ipBroadcastAddress = host | ~mask;
} }
#endif // (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) #endif // (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100)
if (prefixLength) if (prefixLength)
{ {
subnetMask = IPAddress(static_cast<unsigned>(prefixLength), IPAddress::IPv4); ipSubnetMask = IPAddress(static_cast<unsigned>(prefixLength), IPAddress::IPv4);
} }
else // if all of the above fails, look up the subnet mask in the registry else // if all of the above fails, look up the subnet mask in the registry
{ {
address = IPAddress(&reinterpret_cast<struct sockaddr_in*>(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr)); ipAddress = IPAddress(&reinterpret_cast<struct sockaddr_in*>(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr));
subnetMask = subnetMaskForInterface(name, address.isLoopback()); ipSubnetMask = subnetMaskForInterface(interfaceName, ipAddress.isLoopback());
if (!address.isLoopback()) if (!ipAddress.isLoopback())
{ {
broadcastAddress = address; ipBroadcastAddress = ipAddress;
broadcastAddress.mask(subnetMask, IPAddress::broadcast()); ipBroadcastAddress.mask(ipSubnetMask, IPAddress::broadcast());
} }
} }
ifIt->second.addAddress(address, subnetMask, broadcastAddress); ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress);
} }
else else
{ {
ifIt->second.addAddress(address); ifIt->second.addAddress(ipAddress);
} }
} }
break; break;
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
case AF_INET6: case AF_INET6:
ifIt->second.addAddress(address); ifIt->second.addAddress(ipAddress);
break; break;
#endif #endif
} // switch family } // switch family
@ -1408,7 +1408,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
{ {
if (!currIface->ifa_addr) continue; if (!currIface->ifa_addr) continue;
IPAddress address, subnetMask, broadcastAddress; IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress;
unsigned family = currIface->ifa_addr->sa_family; unsigned family = currIface->ifa_addr->sa_family;
switch (family) switch (family)
{ {
@ -1432,17 +1432,17 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
ifIt = result.insert(Map::value_type(ifIndex, intf)).first; 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) 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) 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) else if (currIface->ifa_flags & IFF_POINTOPOINT && currIface->ifa_dstaddr)
broadcastAddress = IPAddress(*(currIface->ifa_dstaddr)); ipBroadcastAddress = IPAddress(*(currIface->ifa_dstaddr));
else else
broadcastAddress = IPAddress(); ipBroadcastAddress = IPAddress();
break; break;
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
case AF_INET6: case AF_INET6:
@ -1453,10 +1453,10 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
ifIt = result.insert(Map::value_type(ifIndex, intf)).first; ifIt = result.insert(Map::value_type(ifIndex, intf)).first;
address = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(currIface->ifa_addr)->sin6_addr, ipAddress = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(currIface->ifa_addr)->sin6_addr,
sizeof(struct in6_addr), ifIndex); sizeof(struct in6_addr), ifIndex);
subnetMask = IPAddress(*(currIface->ifa_netmask)); ipSubnetMask = IPAddress(*(currIface->ifa_netmask));
broadcastAddress = IPAddress(); ipBroadcastAddress = IPAddress();
break; break;
#endif #endif
default: default:
@ -1472,7 +1472,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if ((upOnly && intf.isUp()) || !upOnly) if ((upOnly && intf.isUp()) || !upOnly)
{ {
if ((ifIt = result.find(ifIndex)) != result.end()) 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; if (!iface->ifa_addr) continue;
IPAddress address, subnetMask, broadcastAddress; IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress;
unsigned family = iface->ifa_addr->sa_family; unsigned family = iface->ifa_addr->sa_family;
switch (family) switch (family)
{ {
@ -1607,15 +1607,15 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly)) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
ifIt = result.insert(Map::value_type(ifIndex, intf)).first; ifIt = result.insert(Map::value_type(ifIndex, intf)).first;
address = IPAddress(*(iface->ifa_addr)); ipAddress = IPAddress(*(iface->ifa_addr));
subnetMask = IPAddress(*(iface->ifa_netmask)); ipSubnetMask = IPAddress(*(iface->ifa_netmask));
if (iface->ifa_flags & IFF_BROADCAST && iface->ifa_broadaddr) 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) else if (iface->ifa_flags & IFF_POINTOPOINT && iface->ifa_dstaddr)
broadcastAddress = IPAddress(*(iface->ifa_dstaddr)); ipBroadcastAddress = IPAddress(*(iface->ifa_dstaddr));
else else
broadcastAddress = IPAddress(); ipBroadcastAddress = IPAddress();
break; break;
#if defined(POCO_HAVE_IPv6) #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)) if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
result.insert(Map::value_type(ifIndex, intf)); result.insert(Map::value_type(ifIndex, intf));
address = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex); ipAddress = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex);
subnetMask = IPAddress(*(iface->ifa_netmask)); ipSubnetMask = IPAddress(*(iface->ifa_netmask));
broadcastAddress = IPAddress(); ipBroadcastAddress = IPAddress();
break; break;
#endif #endif
@ -1644,11 +1644,11 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#endif #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 ((upOnly && intf.isUp()) || !upOnly)
{ {
if ((ifIt = result.find(ifIndex)) != result.end()) if ((ifIt = result.find(ifIndex)) != result.end())
ifIt->second.addAddress(address, subnetMask, broadcastAddress); ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress);
} }
} }
} // for interface } // for interface

View File

@ -30,8 +30,8 @@ PartSource::PartSource():
} }
PartSource::PartSource(const std::string& mediaType): PartSource::PartSource(const std::string& rMediaType):
_mediaType(mediaType) _mediaType(rMediaType)
{ {
} }

View File

@ -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): FilePartStore::FilePartStore(const std::string& content, const std::string& rMediaType, const std::string& rFilename):
PartStore(mediaType), PartStore(rMediaType),
_filename(filename), _filename(rFilename),
_path(TemporaryFile::tempName()), _path(TemporaryFile::tempName()),
_fstr(_path) _fstr(_path)
{ {

View File

@ -38,10 +38,10 @@ RawSocket::RawSocket(SocketAddress::Family family, int proto):
} }
RawSocket::RawSocket(const SocketAddress& address, bool reuseAddress): RawSocket::RawSocket(const SocketAddress& rAddress, bool reuseAddress):
Socket(new RawSocketImpl(address.family())) 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);
} }

View File

@ -44,8 +44,8 @@ RawSocketImpl::RawSocketImpl(SocketAddress::Family family, int proto)
} }
RawSocketImpl::RawSocketImpl(poco_socket_t sockfd): RawSocketImpl::RawSocketImpl(poco_socket_t socketfd):
SocketImpl(sockfd) SocketImpl(socketfd)
{ {
} }

View File

@ -43,15 +43,15 @@ namespace Net {
class MessageNotification: public Poco::Notification class MessageNotification: public Poco::Notification
{ {
public: 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), _message(buffer, length),
_sourceAddress(sourceAddress) _sourceAddress(rSourceAddress)
{ {
} }
MessageNotification(const std::string& message, const Poco::Net::SocketAddress& sourceAddress): MessageNotification(const std::string& rMessage, const Poco::Net::SocketAddress& rSourceAddress):
_message(message), _message(rMessage),
_sourceAddress(sourceAddress) _sourceAddress(rSourceAddress)
{ {
} }

View File

@ -51,8 +51,8 @@ namespace Poco {
namespace Net { namespace Net {
SMTPClientSession::SMTPClientSession(const StreamSocket& socket): SMTPClientSession::SMTPClientSession(const StreamSocket& rSocket):
_socket(socket), _socket(rSocket),
_isOpen(false) _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) for (Recipients::const_iterator it = pRecipients->begin(); it != pRecipients->end(); ++it)
{ {
recipient << '<' << *it << '>'; recipient << '<' << *it << '>';
int status = sendCommand("RCPT TO:", recipient.str(), response); int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
recipient.str(""); 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) for (MailMessage::Recipients::const_iterator it = message.recipients().begin(); it != message.recipients().end(); ++it)
{ {
recipient << '<' << it->getAddress() << '>'; recipient << '<' << it->getAddress() << '>';
int status = sendCommand("RCPT TO:", recipient.str(), response); int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
recipient.str(""); recipient.str("");
} }
} }
@ -393,8 +393,8 @@ void SMTPClientSession::sendAddresses(const std::string& from, const Recipients&
{ {
recipient << '<' << *it << '>'; recipient << '<' << *it << '>';
int status = sendCommand("RCPT TO:", recipient.str(), response); int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status); if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
recipient.str(""); recipient.str("");
} }
} }

View File

@ -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); 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) ServerSocket::ServerSocket(Poco::UInt16 port, int backlog): Socket(new ServerSocketImpl)
{ {
IPAddress wildcardAddr; IPAddress wildcardAddr;
SocketAddress address(wildcardAddr, port); SocketAddress socketAddress(wildcardAddr, port);
impl()->bind(address, true); impl()->bind(socketAddress, true);
impl()->listen(backlog); 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) void ServerSocket::bind(Poco::UInt16 port, bool reuseAddress)
{ {
IPAddress wildcardAddr; IPAddress wildcardAddr;
SocketAddress address(wildcardAddr, port); SocketAddress socketAddress(wildcardAddr, port);
impl()->bind(address, reuseAddress); 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) #if defined(POCO_HAVE_IPv6)
IPAddress wildcardAddr(IPAddress::IPv6); IPAddress wildcardAddr(IPAddress::IPv6);
SocketAddress address(wildcardAddr, port); SocketAddress socketAddress(wildcardAddr, port);
impl()->bind6(address, reuseAddress, ipV6Only); impl()->bind6(socketAddress, reuseAddress, ipV6Only);
#else #else
throw Poco::NotImplementedException("No IPv6 support available"); throw Poco::NotImplementedException("No IPv6 support available");
#endif // POCO_HAVE_IPv6 #endif // POCO_HAVE_IPv6

View File

@ -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<const struct sockaddr_in*>(sockAddr)); newIPv4(reinterpret_cast<const struct sockaddr_in*>(sockAddr));
#if defined(POCO_HAVE_IPv6) #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<const struct sockaddr_in6*>(sockAddr)); newIPv6(reinterpret_cast<const struct sockaddr_in6*>(sockAddr));
#endif #endif
#if defined(POCO_OS_FAMILY_UNIX) #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<const sockaddr_un*>(sockAddr)); newLocal(reinterpret_cast<const sockaddr_un*>(sockAddr));
#endif #endif
else throw Poco::InvalidArgumentException("Invalid address length or family passed to SocketAddress()"); 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()); poco_assert (!hostAndPort.empty());
std::string host; std::string socketHost;
std::string port; std::string socketPort;
std::string::const_iterator it = hostAndPort.begin(); std::string::const_iterator it = hostAndPort.begin();
std::string::const_iterator end = hostAndPort.end(); std::string::const_iterator end = hostAndPort.end();
@ -296,30 +296,30 @@ void SocketAddress::init(const std::string& hostAndPort)
if (*it == '[') if (*it == '[')
{ {
++it; ++it;
while (it != end && *it != ']') host += *it++; while (it != end && *it != ']') socketHost += *it++;
if (it == end) throw InvalidArgumentException("Malformed IPv6 address"); if (it == end) throw InvalidArgumentException("Malformed IPv6 address");
++it; ++it;
} }
else else
{ {
while (it != end && *it != ':') host += *it++; while (it != end && *it != ':') socketHost += *it++;
} }
if (it != end && *it == ':') if (it != end && *it == ':')
{ {
++it; ++it;
while (it != end) port += *it++; while (it != end) socketPort += *it++;
} }
else throw InvalidArgumentException("Missing port number"); else throw InvalidArgumentException("Missing port number");
init(host, resolveService(port)); init(socketHost, resolveService(socketPort));
} }
Poco::UInt16 SocketAddress::resolveService(const std::string& service) Poco::UInt16 SocketAddress::resolveService(const std::string& service)
{ {
unsigned port; unsigned socketPort;
if (NumberParser::tryParseUnsigned(service, port) && port <= 0xFFFF) if (NumberParser::tryParseUnsigned(service, socketPort) && socketPort <= 0xFFFF)
{ {
return (UInt16) port; return (UInt16) socketPort;
} }
else else
{ {

View File

@ -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)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin_family = AF_INET; _addr.sin_family = AF_INET;
poco_set_sin_len(&_addr); poco_set_sin_len(&_addr);
std::memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr)); std::memcpy(&_addr.sin_addr, pAddr, sizeof(_addr.sin_addr));
_addr.sin_port = port; _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)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin6_family = AF_INET6; _addr.sin6_family = AF_INET6;
poco_set_sin6_len(&_addr); poco_set_sin6_len(&_addr);
std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr));
_addr.sin6_port = port; _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)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin6_family = AF_INET6; _addr.sin6_family = AF_INET6;
poco_set_sin6_len(&_addr); poco_set_sin6_len(&_addr);
std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr));
_addr.sin6_port = port; _addr.sin6_port = socketPort;
_addr.sin6_scope_id = scope; _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; _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; _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; _pAddr->sun_family = AF_UNIX;
std::strcpy(_pAddr->sun_path, path); std::strcpy(_pAddr->sun_path, pPath);
} }

View File

@ -73,8 +73,8 @@ SocketImpl::SocketImpl():
} }
SocketImpl::SocketImpl(poco_socket_t sockfd): SocketImpl::SocketImpl(poco_socket_t socketfd):
_sockfd(sockfd), _sockfd(socketfd),
_blocking(true), _blocking(true),
_isBrokenTimeout(checkIsBrokenTimeout()) _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) if (_sockfd == POCO_INVALID_SOCKET)
{ {
init(address.af()); init(rAddress.af());
} }
int rc; int rc;
do do
{ {
#if defined(POCO_VXWORKS) #if defined(POCO_VXWORKS)
rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
#else #else
rc = ::connect(_sockfd, address.addr(), address.length()); rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
#endif #endif
} }
while (rc != 0 && lastError() == POCO_EINTR); while (rc != 0 && lastError() == POCO_EINTR);
if (rc != 0) if (rc != 0)
{ {
int err = lastError(); 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) if (_sockfd == POCO_INVALID_SOCKET)
{ {
init(address.af()); init(rAddress.af());
} }
setBlocking(false); setBlocking(false);
try try
{ {
#if defined(POCO_VXWORKS) #if defined(POCO_VXWORKS)
int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
#else #else
int rc = ::connect(_sockfd, address.addr(), address.length()); int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
#endif #endif
if (rc != 0) if (rc != 0)
{ {
int err = lastError(); int err = lastError();
if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK)
error(err, address.toString()); error(err, rAddress.toString());
if (!poll(timeout, SELECT_READ | SELECT_WRITE | SELECT_ERROR)) 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(); err = socketError();
if (err != 0) error(err); 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) if (_sockfd == POCO_INVALID_SOCKET)
{ {
init(address.af()); init(rAddress.af());
} }
setBlocking(false); setBlocking(false);
#if defined(POCO_VXWORKS) #if defined(POCO_VXWORKS)
int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length()); int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
#else #else
int rc = ::connect(_sockfd, address.addr(), address.length()); int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
#endif #endif
if (rc != 0) if (rc != 0)
{ {
int err = lastError(); int err = lastError();
if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK) 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) if (_sockfd == POCO_INVALID_SOCKET)
{ {
init(address.af()); init(rAddress.af());
} }
if (reuseAddress) if (reuseAddress)
{ {
@ -201,23 +201,23 @@ void SocketImpl::bind(const SocketAddress& address, bool reuseAddress)
setReusePort(true); setReusePort(true);
} }
#if defined(POCO_VXWORKS) #if defined(POCO_VXWORKS)
int rc = ::bind(_sockfd, (sockaddr*) address.addr(), address.length()); int rc = ::bind(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
#else #else
int rc = ::bind(_sockfd, address.addr(), address.length()); int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length());
#endif #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 defined(POCO_HAVE_IPv6)
if (address.family() != SocketAddress::IPv6) if (rAddress.family() != SocketAddress::IPv6)
throw Poco::InvalidArgumentException("SocketAddress must be an IPv6 address"); throw Poco::InvalidArgumentException("SocketAddress must be an IPv6 address");
if (_sockfd == POCO_INVALID_SOCKET) if (_sockfd == POCO_INVALID_SOCKET)
{ {
init(address.af()); init(rAddress.af());
} }
#ifdef IPV6_V6ONLY #ifdef IPV6_V6ONLY
setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0); setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0);
@ -229,8 +229,8 @@ void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV
setReuseAddress(true); setReuseAddress(true);
setReusePort(true); setReusePort(true);
} }
int rc = ::bind(_sockfd, address.addr(), address.length()); int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length());
if (rc != 0) error(address.toString()); if (rc != 0) error(rAddress.toString());
#else #else
throw Poco::NotImplementedException("No IPv6 support available"); throw Poco::NotImplementedException("No IPv6 support available");
#endif #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; int rc;
do do
{ {
if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
#if defined(POCO_VXWORKS) #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 #else
rc = ::sendto(_sockfd, reinterpret_cast<const char*>(buffer), length, flags, address.addr(), address.length()); rc = ::sendto(_sockfd, reinterpret_cast<const char*>(buffer), length, flags, rAddress.addr(), rAddress.length());
#endif #endif
} }
while (_blocking && rc < 0 && lastError() == POCO_EINTR); 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) if (_isBrokenTimeout)
{ {
@ -379,7 +379,7 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, in
while (_blocking && rc < 0 && lastError() == POCO_EINTR); while (_blocking && rc < 0 && lastError() == POCO_EINTR);
if (rc >= 0) if (rc >= 0)
{ {
address = SocketAddress(pSA, saLen); rAddress = SocketAddress(pSA, saLen);
} }
else else
{ {
@ -420,8 +420,8 @@ bool SocketImpl::secure() const
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
{ {
poco_socket_t sockfd = _sockfd; poco_socket_t socketfd = _sockfd;
if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); if (socketfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
#if defined(POCO_HAVE_FD_EPOLL) #if defined(POCO_HAVE_FD_EPOLL)
@ -443,7 +443,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
if (mode & SELECT_ERROR) if (mode & SELECT_ERROR)
evin.events |= EPOLLERR; 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]; char buf[1024];
strerror_r(errno, buf, sizeof(buf)); strerror_r(errno, buf, sizeof(buf));
@ -516,15 +516,15 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
FD_ZERO(&fdExcept); FD_ZERO(&fdExcept);
if (mode & SELECT_READ) if (mode & SELECT_READ)
{ {
FD_SET(sockfd, &fdRead); FD_SET(socketfd, &fdRead);
} }
if (mode & SELECT_WRITE) if (mode & SELECT_WRITE)
{ {
FD_SET(sockfd, &fdWrite); FD_SET(socketfd, &fdWrite);
} }
if (mode & SELECT_ERROR) if (mode & SELECT_ERROR)
{ {
FD_SET(sockfd, &fdExcept); FD_SET(socketfd, &fdExcept);
} }
Poco::Timespan remainingTime(timeout); Poco::Timespan remainingTime(timeout);
int errorCode = POCO_ENOERR; 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_sec = (long) remainingTime.totalSeconds();
tv.tv_usec = (long) remainingTime.useconds(); tv.tv_usec = (long) remainingTime.useconds();
Poco::Timestamp start; 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) if (rc < 0 && (errorCode = lastError()) == POCO_EINTR)
{ {
Poco::Timestamp end; Poco::Timestamp end;

View File

@ -32,9 +32,9 @@ SocketNotification::~SocketNotification()
} }
void SocketNotification::setSocket(const Socket& socket) void SocketNotification::setSocket(const Socket& rSocket)
{ {
_socket = socket; _socket = rSocket;
} }

View File

@ -66,8 +66,8 @@ int SocketStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
// //
SocketIOS::SocketIOS(const Socket& socket): SocketIOS::SocketIOS(const Socket& rSocket):
_buf(socket) _buf(rSocket)
{ {
poco_ios_init(&_buf); poco_ios_init(&_buf);
} }
@ -109,8 +109,8 @@ StreamSocket SocketIOS::socket() const
// //
SocketOutputStream::SocketOutputStream(const Socket& socket): SocketOutputStream::SocketOutputStream(const Socket& rSocket):
SocketIOS(socket), SocketIOS(rSocket),
std::ostream(&_buf) std::ostream(&_buf)
{ {
} }
@ -126,8 +126,8 @@ SocketOutputStream::~SocketOutputStream()
// //
SocketInputStream::SocketInputStream(const Socket& socket): SocketInputStream::SocketInputStream(const Socket& rSocket):
SocketIOS(socket), SocketIOS(rSocket),
std::istream(&_buf) std::istream(&_buf)
{ {
} }
@ -143,8 +143,8 @@ SocketInputStream::~SocketInputStream()
// //
SocketStream::SocketStream(const Socket& socket): SocketStream::SocketStream(const Socket& rSocket):
SocketIOS(socket), SocketIOS(rSocket),
std::iostream(&_buf) std::iostream(&_buf)
{ {
} }

View File

@ -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);
} }

View File

@ -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)
{ {
} }

View File

@ -28,17 +28,17 @@ StringPartSource::StringPartSource(const std::string& str):
} }
StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType): StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType):
PartSource(mediaType), PartSource(rMediaType),
_istr(str) _istr(str)
{ {
} }
StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType, const std::string& filename): StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType, const std::string& rFilename):
PartSource(mediaType), PartSource(rMediaType),
_istr(str), _istr(str),
_filename(filename) _filename(rFilename)
{ {
} }

View File

@ -46,9 +46,9 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port
} }
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams): TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& rSocket, TCPServerParams::Ptr pParams):
_socket(socket), _socket(rSocket),
_thread(threadName(socket)), _thread(threadName(rSocket)),
_stopped(true) _stopped(true)
{ {
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool(); 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): TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, TCPServerParams::Ptr pParams):
_socket(socket), _socket(rSocket),
_pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)), _pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)),
_thread(threadName(socket)), _thread(threadName(rSocket)),
_stopped(true) _stopped(true)
{ {
} }

View File

@ -27,8 +27,8 @@ namespace Poco {
namespace Net { namespace Net {
TCPServerConnection::TCPServerConnection(const StreamSocket& socket): TCPServerConnection::TCPServerConnection(const StreamSocket& rSocket):
_socket(socket) _socket(rSocket)
{ {
} }

View File

@ -33,8 +33,8 @@ namespace Net {
class TCPConnectionNotification: public Notification class TCPConnectionNotification: public Notification
{ {
public: public:
TCPConnectionNotification(const StreamSocket& socket): TCPConnectionNotification(const StreamSocket& rSocket):
_socket(socket) _socket(rSocket)
{ {
} }

View File

@ -29,11 +29,11 @@ namespace Poco {
namespace Net { namespace Net {
WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload): WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool isMustMaskPayload):
StreamSocketImpl(pStreamSocketImpl->sockfd()), StreamSocketImpl(pStreamSocketImpl->sockfd()),
_pStreamSocketImpl(pStreamSocketImpl), _pStreamSocketImpl(pStreamSocketImpl),
_frameFlags(0), _frameFlags(0),
_mustMaskPayload(mustMaskPayload) _mustMaskPayload(isMustMaskPayload)
{ {
poco_check_ptr(pStreamSocketImpl); poco_check_ptr(pStreamSocketImpl);
_pStreamSocketImpl->duplicate(); _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"); 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"); 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"); 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"); 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"); 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"); 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"); throw Poco::InvalidAccessException("Cannot receiveFrom() on a WebSocketImpl");
} }

View File

@ -551,6 +551,23 @@
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="WebSocket">
<Filter
Name="Header Files">
<File
RelativePath=".\src\WebSocketTest.h"/>
<File
RelativePath=".\src\WebSocketTestSuite.h"/>
</Filter>
<Filter
Name="Source Files">
<File
RelativePath=".\src\WebSocketTest.cpp"/>
<File
RelativePath=".\src\WebSocketTestSuite.cpp"/>
</Filter>
</Filter>
</Files> </Files>
<Globals/> <Globals/>
</VisualStudioProject> </VisualStudioProject>

View File

@ -316,6 +316,8 @@
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h"/>
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h"/>
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp"/>
@ -328,6 +330,8 @@
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -316,6 +316,8 @@
<ClInclude Include="src\NetSSLTestSuite.h"/> <ClInclude Include="src\NetSSLTestSuite.h"/>
<ClInclude Include="src\TCPServerTest.h"/> <ClInclude Include="src\TCPServerTest.h"/>
<ClInclude Include="src\TCPServerTestSuite.h"/> <ClInclude Include="src\TCPServerTestSuite.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
@ -328,6 +330,8 @@
<ClCompile Include="src\TCPServerTest.cpp"/> <ClCompile Include="src\TCPServerTest.cpp"/>
<ClCompile Include="src\TCPServerTestSuite.cpp"/> <ClCompile Include="src\TCPServerTestSuite.cpp"/>
<ClCompile Include="src\WinCEDriver.cpp"/> <ClCompile Include="src\WinCEDriver.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -321,6 +321,8 @@
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h"/>
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h"/>
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp"/>
@ -333,6 +335,8 @@
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -321,6 +321,8 @@
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h"/>
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h"/>
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp"/>
@ -333,6 +335,8 @@
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|Win32"> <ProjectConfiguration Include="debug_shared|Win32">
@ -32,7 +32,7 @@
<RootNamespace>TestSuite</RootNamespace> <RootNamespace>TestSuite</RootNamespace>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
@ -63,27 +63,27 @@
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"/> <ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros"/> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName>
@ -136,7 +136,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -167,9 +167,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -196,7 +196,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -227,9 +227,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -256,7 +256,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -287,9 +287,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -304,28 +304,32 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h" />
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h" />
<ClInclude Include="src\HTTPSServerTest.h"/> <ClInclude Include="src\HTTPSServerTest.h" />
<ClInclude Include="src\HTTPSServerTestSuite.h"/> <ClInclude Include="src\HTTPSServerTestSuite.h" />
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h" />
<ClInclude Include="src\HTTPSTestServer.h"/> <ClInclude Include="src\HTTPSTestServer.h" />
<ClInclude Include="src\NetSSLTestSuite.h"/> <ClInclude Include="src\NetSSLTestSuite.h" />
<ClInclude Include="src\TCPServerTest.h"/> <ClInclude Include="src\TCPServerTest.h" />
<ClInclude Include="src\TCPServerTestSuite.h"/> <ClInclude Include="src\TCPServerTestSuite.h" />
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Driver.cpp"/> <ClCompile Include="src\Driver.cpp" />
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp" />
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp" />
<ClCompile Include="src\HTTPSServerTest.cpp"/> <ClCompile Include="src\HTTPSServerTest.cpp" />
<ClCompile Include="src\HTTPSServerTestSuite.cpp"/> <ClCompile Include="src\HTTPSServerTestSuite.cpp" />
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp" />
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp" />
<ClCompile Include="src\NetSSLTestSuite.cpp"/> <ClCompile Include="src\NetSSLTestSuite.cpp" />
<ClCompile Include="src\TCPServerTest.cpp"/> <ClCompile Include="src\TCPServerTest.cpp" />
<ClCompile Include="src\TCPServerTestSuite.cpp"/> <ClCompile Include="src\TCPServerTestSuite.cpp" />
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets" />
</Project> </Project>

View File

@ -52,6 +52,9 @@
<Filter Include="HTTPSClient\Source Files"> <Filter Include="HTTPSClient\Source Files">
<UniqueIdentifier>{40e36c0c-5808-4c87-aa2e-04c0ffa6f35e}</UniqueIdentifier> <UniqueIdentifier>{40e36c0c-5808-4c87-aa2e-04c0ffa6f35e}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Websocket">
<UniqueIdentifier>{9243a946-e87f-42f5-adba-efbb4823f93c}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\HTTPSTestServer.h"> <ClInclude Include="src\HTTPSTestServer.h">
@ -81,6 +84,12 @@
<ClInclude Include="src\HTTPSStreamFactoryTest.h"> <ClInclude Include="src\HTTPSStreamFactoryTest.h">
<Filter>HTTPSClient\Header Files</Filter> <Filter>HTTPSClient\Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\WebSocketTest.h">
<Filter>Websocket</Filter>
</ClInclude>
<ClInclude Include="src\WebSocketTestSuite.h">
<Filter>Websocket</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"> <ClCompile Include="src\HTTPSTestServer.cpp">
@ -113,5 +122,11 @@
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
<Filter>HTTPSClient\Source Files</Filter> <Filter>HTTPSClient\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\WebSocketTest.cpp">
<Filter>Websocket</Filter>
</ClCompile>
<ClCompile Include="src\WebSocketTestSuite.cpp">
<Filter>Websocket</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -313,6 +313,8 @@
<ClInclude Include="src\NetSSLTestSuite.h"/> <ClInclude Include="src\NetSSLTestSuite.h"/>
<ClInclude Include="src\TCPServerTest.h"/> <ClInclude Include="src\TCPServerTest.h"/>
<ClInclude Include="src\TCPServerTestSuite.h"/> <ClInclude Include="src\TCPServerTestSuite.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Driver.cpp"/> <ClCompile Include="src\Driver.cpp"/>
@ -325,6 +327,8 @@
<ClCompile Include="src\NetSSLTestSuite.cpp"/> <ClCompile Include="src\NetSSLTestSuite.cpp"/>
<ClCompile Include="src\TCPServerTest.cpp"/> <ClCompile Include="src\TCPServerTest.cpp"/>
<ClCompile Include="src\TCPServerTestSuite.cpp"/> <ClCompile Include="src\TCPServerTestSuite.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -532,6 +532,23 @@
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="WebSocket">
<Filter
Name="Header Files">
<File
RelativePath=".\src\WebSocketTest.h"/>
<File
RelativePath=".\src\WebSocketTestSuite.h"/>
</Filter>
<Filter
Name="Source Files">
<File
RelativePath=".\src\WebSocketTest.cpp"/>
<File
RelativePath=".\src\WebSocketTestSuite.cpp"/>
</Filter>
</Filter>
</Files> </Files>
<Globals/> <Globals/>
</VisualStudioProject> </VisualStudioProject>

View File

@ -321,6 +321,8 @@
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h"/>
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h"/>
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp"/>
@ -333,6 +335,8 @@
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -321,6 +321,8 @@
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h"/>
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h"/>
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp"/>
@ -333,6 +335,8 @@
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|x64"> <ProjectConfiguration Include="debug_shared|x64">
@ -32,7 +32,7 @@
<RootNamespace>TestSuite</RootNamespace> <RootNamespace>TestSuite</RootNamespace>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
@ -63,27 +63,27 @@
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"/> <ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'" Label="PropertySheets"> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/> <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros"/> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion> <_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">TestSuited</TargetName> <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">TestSuited</TargetName>
@ -136,7 +136,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -167,9 +167,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -196,7 +196,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -227,9 +227,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -256,7 +256,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -287,9 +287,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope> <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/> <DebugInformationFormat />
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
</ClCompile> </ClCompile>
<Link> <Link>
@ -304,28 +304,32 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\HTTPSClientSessionTest.h"/> <ClInclude Include="src\HTTPSClientSessionTest.h" />
<ClInclude Include="src\HTTPSClientTestSuite.h"/> <ClInclude Include="src\HTTPSClientTestSuite.h" />
<ClInclude Include="src\HTTPSServerTest.h"/> <ClInclude Include="src\HTTPSServerTest.h" />
<ClInclude Include="src\HTTPSServerTestSuite.h"/> <ClInclude Include="src\HTTPSServerTestSuite.h" />
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/> <ClInclude Include="src\HTTPSStreamFactoryTest.h" />
<ClInclude Include="src\HTTPSTestServer.h"/> <ClInclude Include="src\HTTPSTestServer.h" />
<ClInclude Include="src\NetSSLTestSuite.h"/> <ClInclude Include="src\NetSSLTestSuite.h" />
<ClInclude Include="src\TCPServerTest.h"/> <ClInclude Include="src\TCPServerTest.h" />
<ClInclude Include="src\TCPServerTestSuite.h"/> <ClInclude Include="src\TCPServerTestSuite.h" />
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Driver.cpp"/> <ClCompile Include="src\Driver.cpp" />
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/> <ClCompile Include="src\HTTPSClientSessionTest.cpp" />
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/> <ClCompile Include="src\HTTPSClientTestSuite.cpp" />
<ClCompile Include="src\HTTPSServerTest.cpp"/> <ClCompile Include="src\HTTPSServerTest.cpp" />
<ClCompile Include="src\HTTPSServerTestSuite.cpp"/> <ClCompile Include="src\HTTPSServerTestSuite.cpp" />
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp" />
<ClCompile Include="src\HTTPSTestServer.cpp"/> <ClCompile Include="src\HTTPSTestServer.cpp" />
<ClCompile Include="src\NetSSLTestSuite.cpp"/> <ClCompile Include="src\NetSSLTestSuite.cpp" />
<ClCompile Include="src\TCPServerTest.cpp"/> <ClCompile Include="src\TCPServerTest.cpp" />
<ClCompile Include="src\TCPServerTestSuite.cpp"/> <ClCompile Include="src\TCPServerTestSuite.cpp" />
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets" />
</Project> </Project>

View File

@ -52,6 +52,9 @@
<Filter Include="HTTPSClient\Source Files"> <Filter Include="HTTPSClient\Source Files">
<UniqueIdentifier>{363ebde9-9367-44b7-aa1b-dcb421bb759c}</UniqueIdentifier> <UniqueIdentifier>{363ebde9-9367-44b7-aa1b-dcb421bb759c}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="WebSocket">
<UniqueIdentifier>{14c12fc4-d7e0-4311-a59e-f499f1993c3b}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\HTTPSTestServer.h"> <ClInclude Include="src\HTTPSTestServer.h">
@ -81,6 +84,12 @@
<ClInclude Include="src\HTTPSStreamFactoryTest.h"> <ClInclude Include="src\HTTPSStreamFactoryTest.h">
<Filter>HTTPSClient\Header Files</Filter> <Filter>HTTPSClient\Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\WebSocketTest.h">
<Filter>WebSocket</Filter>
</ClInclude>
<ClInclude Include="src\WebSocketTestSuite.h">
<Filter>WebSocket</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\HTTPSTestServer.cpp"> <ClCompile Include="src\HTTPSTestServer.cpp">
@ -113,5 +122,11 @@
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"> <ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
<Filter>HTTPSClient\Source Files</Filter> <Filter>HTTPSClient\Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\WebSocketTest.cpp">
<Filter>WebSocket</Filter>
</ClCompile>
<ClCompile Include="src\WebSocketTestSuite.cpp">
<Filter>WebSocket</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -313,6 +313,8 @@
<ClInclude Include="src\NetSSLTestSuite.h"/> <ClInclude Include="src\NetSSLTestSuite.h"/>
<ClInclude Include="src\TCPServerTest.h"/> <ClInclude Include="src\TCPServerTest.h"/>
<ClInclude Include="src\TCPServerTestSuite.h"/> <ClInclude Include="src\TCPServerTestSuite.h"/>
<ClInclude Include="src\WebSocketTest.h" />
<ClInclude Include="src\WebSocketTestSuite.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Driver.cpp"/> <ClCompile Include="src\Driver.cpp"/>
@ -325,6 +327,8 @@
<ClCompile Include="src\NetSSLTestSuite.cpp"/> <ClCompile Include="src\NetSSLTestSuite.cpp"/>
<ClCompile Include="src\TCPServerTest.cpp"/> <ClCompile Include="src\TCPServerTest.cpp"/>
<ClCompile Include="src\TCPServerTestSuite.cpp"/> <ClCompile Include="src\TCPServerTestSuite.cpp"/>
<ClCompile Include="src\WebSocketTest.cpp" />
<ClCompile Include="src\WebSocketTestSuite.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/> <ImportGroup Label="ExtensionTargets"/>

View File

@ -532,6 +532,23 @@
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/> RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="WebSocket">
<Filter
Name="Header Files">
<File
RelativePath=".\src\WebSocketTest.h"/>
<File
RelativePath=".\src\WebSocketTestSuite.h"/>
</Filter>
<Filter
Name="Source Files">
<File
RelativePath=".\src\WebSocketTest.cpp"/>
<File
RelativePath=".\src\WebSocketTestSuite.cpp"/>
</Filter>
</Filter>
</Files> </Files>
<Globals/> <Globals/>
</VisualStudioProject> </VisualStudioProject>

View File

@ -15,6 +15,7 @@
#include "HTTPSClientTestSuite.h" #include "HTTPSClientTestSuite.h"
#include "TCPServerTestSuite.h" #include "TCPServerTestSuite.h"
#include "HTTPSServerTestSuite.h" #include "HTTPSServerTestSuite.h"
#include "WebSocketTestSuite.h"
CppUnit::Test* NetSSLTestSuite::suite() CppUnit::Test* NetSSLTestSuite::suite()
@ -24,6 +25,7 @@ CppUnit::Test* NetSSLTestSuite::suite()
pSuite->addTest(HTTPSClientTestSuite::suite()); pSuite->addTest(HTTPSClientTestSuite::suite());
pSuite->addTest(TCPServerTestSuite::suite()); pSuite->addTest(TCPServerTestSuite::suite());
pSuite->addTest(HTTPSServerTestSuite::suite()); pSuite->addTest(HTTPSServerTestSuite::suite());
pSuite->addTest(WebSocketTestSuite::suite());
return pSuite; return pSuite;
} }

View File

@ -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<char> 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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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 "TimeHandler.h"
#include "Poco/Net/HTTPServerRequest.h" #include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h" #include "Poco/Net/HTTPServerResponse.h"
@ -28,7 +21,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net
responseStream << "\n"; responseStream << "\n";
responseStream << "\n"; responseStream << "\n";
responseStream << ""; 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; Poco::DateTime now;
std::string dt(Poco::DateTimeFormatter::format(now, "%W, %e %b %y %H:%M:%S %Z")); 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 << "</head>\n"; responseStream << "</head>\n";
responseStream << "<body>\n"; responseStream << "<body>\n";
responseStream << "<p style=\"text-align: center; font-size: 48px;\">"; responseStream << "<p style=\"text-align: center; font-size: 48px;\">";
#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 << ( dt );
responseStream << "</p>\n"; responseStream << "</p>\n";
responseStream << "</body>\n"; responseStream << "</body>\n";

View File

@ -1,10 +1,3 @@
//
// TimeHandler.h
//
// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54.
//
#ifndef TimeHandler_INCLUDED #ifndef TimeHandler_INCLUDED
#define TimeHandler_INCLUDED #define TimeHandler_INCLUDED

View File

@ -54,9 +54,9 @@ public:
/// A key-value pair, used as event argument. /// A key-value pair, used as event argument.
{ {
public: public:
KeyValue(const std::string& key, std::string& value): KeyValue(const std::string& rKey, std::string& rValue):
_key(key), _key(rKey),
_value(value) _value(rValue)
{ {
} }

View File

@ -471,9 +471,9 @@ inline const Poco::Timestamp& Application::startTime() const
inline Poco::Timespan Application::uptime() const inline Poco::Timespan Application::uptime() const
{ {
Poco::Timestamp now; Poco::Timestamp now;
Poco::Timespan uptime = now - _startTime; Poco::Timespan ret = now - _startTime;
return uptime; return ret;
} }

View File

@ -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 result;
std::string::const_iterator it = value.begin(); std::string::const_iterator it = rValue.begin();
std::string::const_iterator end = value.end(); std::string::const_iterator end = rValue.end();
while (it != end) while (it != end)
{ {
if (*it == '$') if (*it == '$')

View File

@ -78,7 +78,7 @@ Application::Application():
} }
Application::Application(int argc, char* argv[]): Application::Application(int argc, char* pArgv[]):
_pConfig(new LayeredConfiguration), _pConfig(new LayeredConfiguration),
_initialized(false), _initialized(false),
_unixOptions(true), _unixOptions(true),
@ -87,7 +87,7 @@ Application::Application(int argc, char* argv[]):
_loadedConfigs(0) _loadedConfigs(0)
{ {
setup(); 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(); 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); _pConfig->setInt("application.argc", argc);
_unprocessedArgs.reserve(argc); _unprocessedArgs.reserve(argc);
std::string argvKey = "application.argv["; std::string argvKey = "application.argv[";
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
{ {
std::string arg(argv[i]); std::string arg(pArgv[i]);
_pConfig->setString(argvKey + NumberFormatter::format(i) + "]", arg); _pConfig->setString(argvKey + NumberFormatter::format(i) + "]", arg);
_unprocessedArgs.push_back(arg); _unprocessedArgs.push_back(arg);
} }
@ -403,13 +403,13 @@ void Application::processOptions()
ArgVec::iterator it = _unprocessedArgs.begin(); ArgVec::iterator it = _unprocessedArgs.begin();
while (it != _unprocessedArgs.end() && !_stopOptionsProcessing) while (it != _unprocessedArgs.end() && !_stopOptionsProcessing)
{ {
std::string name; std::string argName;
std::string value; 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); 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) 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()) if (option.validator())
{ {
option.validator()->validate(option, value); option.validator()->validate(option, value);
@ -560,14 +560,14 @@ void Application::handleOption(const std::string& name, const std::string& value
} }
if (option.callback()) 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;
} }

View File

@ -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 void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
{ {
std::set<std::string> keys; std::set<std::string> keySet;
std::string prefix = key; std::string prefix = key;
if (!prefix.empty()) prefix += '.'; if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size(); 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); subKey = it->first.substr(psize);
else else
subKey = it->first.substr(psize, end - psize); subKey = it->first.substr(psize, end - psize);
if (keys.find(subKey) == keys.end()) if (keySet.find(subKey) == keySet.end())
{ {
range.push_back(subKey); range.push_back(subKey);
keys.insert(subKey); keySet.insert(subKey);
} }
} }
} }

View File

@ -167,7 +167,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri
parentArray->add(newArray); parentArray->add(newArray);
} }
for(int i = 0; i <= *it - 1; ++i) for(int j = 0; j <= *it - 1; ++j)
{ {
Poco::DynamicAny nullValue; Poco::DynamicAny nullValue;
newArray->add(nullValue); newArray->add(nullValue);

View File

@ -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 void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const
{ {
std::set<std::string> keys; std::set<std::string> keySet;
for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc) for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc)
{ {
Keys partRange; Keys partRange;
itc->pConfig->enumerate(key, partRange); itc->pConfig->enumerate(key, partRange);
for (Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr) 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); range.push_back(*itr);
keys.insert(*itr); keySet.insert(*itr);
} }
} }
} }

View File

@ -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 void MapConfiguration::enumerate(const std::string& key, Keys& range) const
{ {
std::set<std::string> keys; std::set<std::string> keySet;
std::string prefix = key; std::string prefix = key;
if (!prefix.empty()) prefix += '.'; if (!prefix.empty()) prefix += '.';
std::string::size_type psize = prefix.size(); 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) if (it->first.compare(0, psize, prefix) == 0)
{ {
std::string subKey; std::string subKey;
std::string::size_type end = it->first.find('.', psize); std::string::size_type pos = it->first.find('.', psize);
if (end == std::string::npos) if (pos == std::string::npos)
subKey = it->first.substr(psize); subKey = it->first.substr(psize);
else else
subKey = it->first.substr(psize, end - psize); subKey = it->first.substr(psize, pos - psize);
if (keys.find(subKey) == keys.end()) if (keySet.find(subKey) == keySet.end())
{ {
range.push_back(subKey); range.push_back(subKey);
keys.insert(subKey); keySet.insert(subKey);
} }
} }
} }

View File

@ -60,9 +60,9 @@ Option::Option(const Option& option):
} }
Option::Option(const std::string& fullName, const std::string& shortName): Option::Option(const std::string& rFullName, const std::string& rShortName):
_shortName(shortName), _shortName(rShortName),
_fullName(fullName), _fullName(rFullName),
_required(false), _required(false),
_repeatable(false), _repeatable(false),
_argRequired(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): Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired):
_shortName(shortName), _shortName(rShortName),
_fullName(fullName), _fullName(rFullName),
_description(description), _description(rDescription),
_required(required), _required(isRequired),
_repeatable(false), _repeatable(false),
_argRequired(false), _argRequired(false),
_pValidator(0), _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): Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired, const std::string& argName, bool argRequired):
_shortName(shortName), _shortName(rShortName),
_fullName(fullName), _fullName(rFullName),
_description(description), _description(rDescription),
_required(required), _required(isRequired),
_repeatable(false), _repeatable(false),
_argName(argName), _argName(argName),
_argRequired(argRequired), _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; _argName = name;
_argRequired = required; _argRequired = isRequired;
return *this; 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; return *this;
} }

View File

@ -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) if (runAsDaemon)
{ {
beDaemon(); beDaemon();
} }
try try
{ {
init(argc, argv); init(argc, pArgv);
if (runAsDaemon) if (runAsDaemon)
{ {
int rc = chdir("/"); int rc = chdir("/");
@ -668,12 +668,12 @@ int ServerApplication::run(const std::vector<std::string>& args)
} }
bool ServerApplication::isDaemon(int argc, char** argv) bool ServerApplication::isDaemon(int argc, char** pArgv)
{ {
std::string option("--daemon"); std::string option("--daemon");
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
if (option == argv[i]) if (option == pArgv[i])
return true; return true;
} }
return false; 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.") Option("daemon", "", "Run application as a daemon.")
.required(false) .required(false)
.repeatable(false) .repeatable(false)
.callback(OptionCallback<ServerApplication>(this, &ServerApplication::handleDaemon))); .callback(OptionCallback<ServerApplication>(this, &ServerApplication::handleDaemon)));
options.addOption( rOptions.addOption(
Option("pidfile", "", "Write the process ID of the application to given file.") Option("pidfile", "", "Write the process ID of the application to given file.")
.required(false) .required(false)
.repeatable(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); 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()); std::ofstream ostr(value.c_str());
if (ostr.good()) if (ostr.good())

View File

@ -30,8 +30,8 @@ namespace Util {
class TimerNotification: public Poco::Notification class TimerNotification: public Poco::Notification
{ {
public: public:
TimerNotification(Poco::TimedNotificationQueue& queue): TimerNotification(Poco::TimedNotificationQueue& rQueue):
_queue(queue) _queue(rQueue)
{ {
} }
@ -54,8 +54,8 @@ private:
class StopNotification: public TimerNotification class StopNotification: public TimerNotification
{ {
public: public:
StopNotification(Poco::TimedNotificationQueue& queue): StopNotification(Poco::TimedNotificationQueue& rQueue):
TimerNotification(queue) TimerNotification(rQueue)
{ {
} }
@ -74,8 +74,8 @@ public:
class CancelNotification: public TimerNotification class CancelNotification: public TimerNotification
{ {
public: public:
CancelNotification(Poco::TimedNotificationQueue& queue): CancelNotification(Poco::TimedNotificationQueue& rQueue):
TimerNotification(queue) TimerNotification(rQueue)
{ {
} }
@ -103,8 +103,8 @@ private:
class TaskNotification: public TimerNotification class TaskNotification: public TimerNotification
{ {
public: public:
TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask): TaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask):
TimerNotification(queue), TimerNotification(rQueue),
_pTask(pTask) _pTask(pTask)
{ {
} }
@ -151,8 +151,8 @@ private:
class PeriodicTaskNotification: public TaskNotification class PeriodicTaskNotification: public TaskNotification
{ {
public: public:
PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval): PeriodicTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval):
TaskNotification(queue, pTask), TaskNotification(rQueue, pTask),
_interval(interval) _interval(interval)
{ {
} }
@ -185,8 +185,8 @@ private:
class FixedRateTaskNotification: public TaskNotification class FixedRateTaskNotification: public TaskNotification
{ {
public: public:
FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval, Poco::Clock clock): FixedRateTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval, Poco::Clock clock):
TaskNotification(queue, pTask), TaskNotification(rQueue, pTask),
_interval(interval), _interval(interval),
_nextExecution(clock) _nextExecution(clock)
{ {

View File

@ -260,7 +260,7 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
{ {
using Poco::NumberFormatter; using Poco::NumberFormatter;
std::multiset<std::string> keys; std::multiset<std::string> keySet;
const Poco::XML::Node* pNode = findNode(key); const Poco::XML::Node* pNode = findNode(key);
if (pNode) if (pNode)
{ {
@ -270,12 +270,12 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE) if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE)
{ {
const std::string& nodeName = pChild->nodeName(); const std::string& nodeName = pChild->nodeName();
int n = (int) keys.count(nodeName); int n = (int) keySet.count(nodeName);
if (n) if (n)
range.push_back(nodeName + "[" + NumberFormatter::format(n) + "]"); range.push_back(nodeName + "[" + NumberFormatter::format(n) + "]");
else else
range.push_back(nodeName); range.push_back(nodeName);
keys.insert(nodeName); keySet.insert(nodeName);
} }
pChild = pChild->nextSibling(); pChild = pChild->nextSibling();
} }