mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-05 16:26:27 +01:00
Merge remote-tracking branch 'origin/PocoCppUnit' into PocoCppUnit
This commit is contained in:
commit
1664b9526a
@ -21,21 +21,21 @@ namespace Poco {
|
||||
namespace Crypto {
|
||||
|
||||
|
||||
CipherKey::CipherKey(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount,
|
||||
const std::string &digest):
|
||||
_pImpl(new CipherKeyImpl(name, passphrase, salt, iterationCount, digest))
|
||||
CipherKey::CipherKey(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount,
|
||||
const std::string & rDigest):
|
||||
_pImpl(new CipherKeyImpl(rName, passphrase, salt, iterationCount, rDigest))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CipherKey::CipherKey(const std::string& name, const ByteVec& key, const ByteVec& iv):
|
||||
_pImpl(new CipherKeyImpl(name, key, iv))
|
||||
CipherKey::CipherKey(const std::string& rName, const ByteVec& key, const ByteVec& iv):
|
||||
_pImpl(new CipherKeyImpl(rName, key, iv))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CipherKey::CipherKey(const std::string& name):
|
||||
_pImpl(new CipherKeyImpl(name))
|
||||
CipherKey::CipherKey(const std::string& rName):
|
||||
_pImpl(new CipherKeyImpl(rName))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -27,28 +27,28 @@ namespace Poco {
|
||||
namespace Crypto {
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& rName,
|
||||
const std::string& passphrase,
|
||||
const std::string& salt,
|
||||
int iterationCount,
|
||||
const std::string& digest):
|
||||
const std::string& rDigest):
|
||||
_pCipher(0),
|
||||
_pDigest(0),
|
||||
_name(name),
|
||||
_name(rName),
|
||||
_key(),
|
||||
_iv()
|
||||
{
|
||||
// dummy access to Cipherfactory so that the EVP lib is initilaized
|
||||
CipherFactory::defaultFactory();
|
||||
_pCipher = EVP_get_cipherbyname(name.c_str());
|
||||
_pCipher = EVP_get_cipherbyname(rName.c_str());
|
||||
|
||||
if (!_pCipher)
|
||||
throw Poco::NotFoundException("Cipher " + name + " was not found");
|
||||
throw Poco::NotFoundException("Cipher " + rName + " was not found");
|
||||
|
||||
_pDigest = EVP_get_digestbyname(digest.c_str());
|
||||
_pDigest = EVP_get_digestbyname(rDigest.c_str());
|
||||
|
||||
if (!_pDigest)
|
||||
throw Poco::NotFoundException("Digest " + name + " was not found");
|
||||
throw Poco::NotFoundException("Digest " + rName + " was not found");
|
||||
|
||||
|
||||
_key = ByteVec(keySize());
|
||||
@ -57,35 +57,35 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
}
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name,
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& rName,
|
||||
const ByteVec& key,
|
||||
const ByteVec& iv):
|
||||
_pCipher(0),
|
||||
_name(name),
|
||||
_name(rName),
|
||||
_key(key),
|
||||
_iv(iv)
|
||||
{
|
||||
// dummy access to Cipherfactory so that the EVP lib is initilaized
|
||||
CipherFactory::defaultFactory();
|
||||
_pCipher = EVP_get_cipherbyname(name.c_str());
|
||||
_pCipher = EVP_get_cipherbyname(rName.c_str());
|
||||
|
||||
if (!_pCipher)
|
||||
throw Poco::NotFoundException("Cipher " + name + " was not found");
|
||||
throw Poco::NotFoundException("Cipher " + rName + " was not found");
|
||||
}
|
||||
|
||||
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& name):
|
||||
CipherKeyImpl::CipherKeyImpl(const std::string& rName):
|
||||
_pCipher(0),
|
||||
_name(name),
|
||||
_name(rName),
|
||||
_key(),
|
||||
_iv()
|
||||
{
|
||||
// dummy access to Cipherfactory so that the EVP lib is initilaized
|
||||
CipherFactory::defaultFactory();
|
||||
_pCipher = EVP_get_cipherbyname(name.c_str());
|
||||
_pCipher = EVP_get_cipherbyname(rName.c_str());
|
||||
|
||||
if (!_pCipher)
|
||||
throw Poco::NotFoundException("Cipher " + name + " was not found");
|
||||
throw Poco::NotFoundException("Cipher " + rName + " was not found");
|
||||
_key = ByteVec(keySize());
|
||||
_iv = ByteVec(ivSize());
|
||||
generateKey();
|
||||
@ -165,7 +165,7 @@ void CipherKeyImpl::generateKey(
|
||||
}
|
||||
|
||||
// Now create the key and IV, using the digest set in the constructor.
|
||||
int keySize = EVP_BytesToKey(
|
||||
int cipherKeySize = EVP_BytesToKey(
|
||||
_pCipher,
|
||||
_pDigest,
|
||||
(salt.empty() ? 0 : saltBytes),
|
||||
@ -176,7 +176,7 @@ void CipherKeyImpl::generateKey(
|
||||
ivBytes);
|
||||
|
||||
// Copy the buffers to our member byte vectors.
|
||||
_key.assign(keyBytes, keyBytes + keySize);
|
||||
_key.assign(keyBytes, keyBytes + cipherKeySize);
|
||||
|
||||
if (ivSize() == 0)
|
||||
_iv.clear();
|
||||
|
@ -87,10 +87,10 @@ RSAKeyImpl::RSAKeyImpl(
|
||||
RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0);
|
||||
if (!pubKey)
|
||||
{
|
||||
int rc = BIO_reset(bio);
|
||||
int ret = BIO_reset(bio);
|
||||
// BIO_reset() normally returns 1 for success and 0 or -1 for failure.
|
||||
// File BIOs are an exception, they return 0 for success and -1 for failure.
|
||||
if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
|
||||
if (ret != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
|
||||
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
|
||||
}
|
||||
BIO_free(bio);
|
||||
@ -287,8 +287,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS
|
||||
throw Poco::WriteFileException("Failed to write public key to stream");
|
||||
}
|
||||
char* pData;
|
||||
long size = BIO_get_mem_data(bio, &pData);
|
||||
pPublicKeyStream->write(pData, static_cast<std::streamsize>(size));
|
||||
long keySize = BIO_get_mem_data(bio, &pData);
|
||||
pPublicKeyStream->write(pData, static_cast<std::streamsize>(keySize));
|
||||
BIO_free(bio);
|
||||
}
|
||||
|
||||
@ -309,8 +309,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS
|
||||
throw Poco::FileException("Failed to write private key to stream");
|
||||
}
|
||||
char* pData;
|
||||
long size = BIO_get_mem_data(bio, &pData);
|
||||
pPrivateKeyStream->write(pData, static_cast<std::streamsize>(size));
|
||||
long keySize = BIO_get_mem_data(bio, &pData);
|
||||
pPrivateKeyStream->write(pData, static_cast<std::streamsize>(keySize));
|
||||
BIO_free(bio);
|
||||
}
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ public:
|
||||
/// not found.
|
||||
{
|
||||
typename Container::const_iterator it = _list.begin();
|
||||
typename Container::const_iterator end = _list.end();
|
||||
for(; it != end; ++it)
|
||||
typename Container::const_iterator itEnd = _list.end();
|
||||
for(; it != itEnd; ++it)
|
||||
{
|
||||
if (isEqual(it->first, key)) return it;
|
||||
}
|
||||
return end;
|
||||
return itEnd;
|
||||
}
|
||||
|
||||
Iterator find(const KeyType& key)
|
||||
@ -124,12 +124,12 @@ public:
|
||||
/// not found.
|
||||
{
|
||||
typename Container::iterator it = _list.begin();
|
||||
typename Container::iterator end = _list.end();
|
||||
for(; it != end; ++it)
|
||||
typename Container::iterator itEnd = _list.end();
|
||||
for(; it != itEnd; ++it)
|
||||
{
|
||||
if (isEqual(it->first, key)) return it;
|
||||
}
|
||||
return end;
|
||||
return itEnd;
|
||||
}
|
||||
|
||||
Iterator insert(const ValueType& val)
|
||||
@ -203,8 +203,8 @@ public:
|
||||
else
|
||||
{
|
||||
ValueType value(key, Mapped());
|
||||
Iterator it = insert(value);
|
||||
return it->second;
|
||||
Iterator itInsert = insert(value);
|
||||
return itInsert->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1511,15 +1511,15 @@ void PathTest::testForDirectory()
|
||||
void PathTest::testExpand()
|
||||
{
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
std::string s = Path::expand("~/.bashrc");
|
||||
assert (s == Path::expand("$HOME/.bashrc"));
|
||||
assert (s == Environment::get("HOME") + "/.bashrc" ||
|
||||
s == Environment::get("HOME") + "//.bashrc");
|
||||
std::string s = Path::expand("~/.profile");
|
||||
assert (s == Path::expand("$HOME/.profile"));
|
||||
assert (s == Environment::get("HOME") + "/.profile" ||
|
||||
s == Environment::get("HOME") + "//.profile");
|
||||
Path p(s);
|
||||
s = Path::expand("$HOME/.bashrc");
|
||||
assert (s == Path::expand("~/.bashrc"));
|
||||
s = Path::expand("${HOME}/.bashrc");
|
||||
assert (s == Path::expand("~/.bashrc"));
|
||||
s = Path::expand("$HOME/.profile");
|
||||
assert (s == Path::expand("~/.profile"));
|
||||
s = Path::expand("${HOME}/.profile");
|
||||
assert (s == Path::expand("~/.profile"));
|
||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||
std::string s = Path::expand("%TMP%\\foo");
|
||||
assert (s == Environment::get("TMP") + "\\foo");
|
||||
|
@ -489,12 +489,12 @@ inline void IPAddress::newIPv6(const void* hostAddr)
|
||||
}
|
||||
|
||||
|
||||
inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scope)
|
||||
inline void IPAddress::newIPv6(const void* hostAddr, Poco::UInt32 scopeIdentifier)
|
||||
{
|
||||
#ifdef POCO_HAVE_ALIGNMENT
|
||||
new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope);
|
||||
new (storage()) Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier);
|
||||
#else
|
||||
_pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scope);
|
||||
_pImpl = new Poco::Net::Impl::IPv6AddressImpl(hostAddr, scopeIdentifier);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,10 +43,10 @@ AbstractHTTPRequestHandler::~AbstractHTTPRequestHandler()
|
||||
}
|
||||
|
||||
|
||||
void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
|
||||
void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& rRequest, HTTPServerResponse& rResponse)
|
||||
{
|
||||
_pRequest = &request;
|
||||
_pResponse = &response;
|
||||
_pRequest = &rRequest;
|
||||
_pResponse = &rResponse;
|
||||
if (authenticate())
|
||||
{
|
||||
try
|
||||
@ -55,14 +55,14 @@ void AbstractHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPS
|
||||
}
|
||||
catch (Poco::Exception& exc)
|
||||
{
|
||||
if (!response.sent())
|
||||
if (!rResponse.sent())
|
||||
{
|
||||
sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.displayText());
|
||||
}
|
||||
}
|
||||
catch (std::exception& exc)
|
||||
{
|
||||
if (!response.sent())
|
||||
if (!rResponse.sent())
|
||||
{
|
||||
sendErrorResponse(HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, exc.what());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ DialogSocket::DialogSocket():
|
||||
}
|
||||
|
||||
|
||||
DialogSocket::DialogSocket(const SocketAddress& address):
|
||||
StreamSocket(address),
|
||||
DialogSocket::DialogSocket(const SocketAddress& rAddress):
|
||||
StreamSocket(rAddress),
|
||||
_pBuffer(0),
|
||||
_pNext(0),
|
||||
_pEnd(0)
|
||||
|
@ -38,8 +38,8 @@ FilePartSource::FilePartSource(const std::string& path):
|
||||
}
|
||||
|
||||
|
||||
FilePartSource::FilePartSource(const std::string& path, const std::string& mediaType):
|
||||
PartSource(mediaType),
|
||||
FilePartSource::FilePartSource(const std::string& path, const std::string& rMediaType):
|
||||
PartSource(rMediaType),
|
||||
_path(path),
|
||||
_istr(path)
|
||||
{
|
||||
@ -50,10 +50,10 @@ FilePartSource::FilePartSource(const std::string& path, const std::string& media
|
||||
}
|
||||
|
||||
|
||||
FilePartSource::FilePartSource(const std::string& path, const std::string& filename, const std::string& mediaType):
|
||||
PartSource(mediaType),
|
||||
FilePartSource::FilePartSource(const std::string& path, const std::string& rFilename, const std::string& rMediaType):
|
||||
PartSource(rMediaType),
|
||||
_path(path),
|
||||
_filename(filename),
|
||||
_filename(rFilename),
|
||||
_istr(path)
|
||||
{
|
||||
Path p(path);
|
||||
|
@ -257,7 +257,7 @@ std::streamsize HTMLForm::calculateContentLength()
|
||||
}
|
||||
|
||||
|
||||
void HTMLForm::write(std::ostream& ostr, const std::string& boundary)
|
||||
void HTMLForm::write(std::ostream& ostr, const std::string& rBoundary)
|
||||
{
|
||||
if (_encoding == ENCODING_URL)
|
||||
{
|
||||
@ -265,7 +265,7 @@ void HTMLForm::write(std::ostream& ostr, const std::string& boundary)
|
||||
}
|
||||
else
|
||||
{
|
||||
_boundary = boundary;
|
||||
_boundary = rBoundary;
|
||||
writeMultipart(ostr);
|
||||
}
|
||||
}
|
||||
@ -355,12 +355,12 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler)
|
||||
{
|
||||
std::string name = params["name"];
|
||||
std::string value;
|
||||
std::istream& istr = reader.stream();
|
||||
int ch = istr.get();
|
||||
std::istream& rIstr = reader.stream();
|
||||
int ch = rIstr.get();
|
||||
while (ch != eof)
|
||||
{
|
||||
value += (char) ch;
|
||||
ch = istr.get();
|
||||
ch = rIstr.get();
|
||||
}
|
||||
add(name, value);
|
||||
}
|
||||
|
@ -137,15 +137,15 @@ void HTTPAuthenticationParams::fromResponse(const HTTPResponse& response, const
|
||||
bool found = false;
|
||||
while (!found && it != response.end() && icompare(it->first, header) == 0)
|
||||
{
|
||||
const std::string& header = it->second;
|
||||
if (icompare(header, 0, 6, "Basic ") == 0)
|
||||
const std::string& rHeader = it->second;
|
||||
if (icompare(rHeader, 0, 6, "Basic ") == 0)
|
||||
{
|
||||
parse(header.begin() + 6, header.end());
|
||||
parse(rHeader.begin() + 6, rHeader.end());
|
||||
found = true;
|
||||
}
|
||||
else if (icompare(header, 0, 7, "Digest ") == 0)
|
||||
else if (icompare(rHeader, 0, 7, "Digest ") == 0)
|
||||
{
|
||||
parse(header.begin() + 7, header.end());
|
||||
parse(rHeader.begin() + 7, rHeader.end());
|
||||
found = true;
|
||||
}
|
||||
++it;
|
||||
|
@ -52,8 +52,8 @@ HTTPClientSession::HTTPClientSession():
|
||||
}
|
||||
|
||||
|
||||
HTTPClientSession::HTTPClientSession(const StreamSocket& socket):
|
||||
HTTPSession(socket),
|
||||
HTTPClientSession::HTTPClientSession(const StreamSocket& rSocket):
|
||||
HTTPSession(rSocket),
|
||||
_port(HTTPSession::HTTP_PORT),
|
||||
_proxyConfig(_globalProxyConfig),
|
||||
_keepAliveTimeout(DEFAULT_KEEP_ALIVE_TIMEOUT, 0),
|
||||
|
@ -241,11 +241,11 @@ void HTTPRequest::getCredentials(const std::string& header, std::string& scheme,
|
||||
{
|
||||
const std::string& auth = get(header);
|
||||
std::string::const_iterator it = auth.begin();
|
||||
std::string::const_iterator end = auth.end();
|
||||
while (it != end && Poco::Ascii::isSpace(*it)) ++it;
|
||||
while (it != end && !Poco::Ascii::isSpace(*it)) scheme += *it++;
|
||||
while (it != end && Poco::Ascii::isSpace(*it)) ++it;
|
||||
while (it != end) authInfo += *it++;
|
||||
std::string::const_iterator itEnd = auth.end();
|
||||
while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it;
|
||||
while (it != itEnd && !Poco::Ascii::isSpace(*it)) scheme += *it++;
|
||||
while (it != itEnd && Poco::Ascii::isSpace(*it)) ++it;
|
||||
while (it != itEnd) authInfo += *it++;
|
||||
}
|
||||
else throw NotAuthenticatedException();
|
||||
}
|
||||
|
@ -29,15 +29,15 @@ HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 por
|
||||
}
|
||||
|
||||
|
||||
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams):
|
||||
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), socket, pParams),
|
||||
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams):
|
||||
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), rSocket, pParams),
|
||||
_pFactory(pFactory)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams):
|
||||
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, socket, pParams),
|
||||
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, HTTPServerParams::Ptr pParams):
|
||||
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), threadPool, rSocket, pParams),
|
||||
_pFactory(pFactory)
|
||||
{
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
HTTPServerConnection::HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory):
|
||||
TCPServerConnection(socket),
|
||||
HTTPServerConnection::HTTPServerConnection(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory):
|
||||
TCPServerConnection(rSocket),
|
||||
_pParams(pParams),
|
||||
_pFactory(pFactory),
|
||||
_stopped(false)
|
||||
|
@ -33,13 +33,13 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& response, HTTPServerSession& session, HTTPServerParams* pParams):
|
||||
_response(response),
|
||||
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponseImpl& rResponse, HTTPServerSession& session, HTTPServerParams* pParams):
|
||||
_response(rResponse),
|
||||
_session(session),
|
||||
_pStream(0),
|
||||
_pParams(pParams, true)
|
||||
{
|
||||
response.attachRequest(this);
|
||||
rResponse.attachRequest(this);
|
||||
|
||||
HTTPHeaderInputStream hs(session);
|
||||
read(hs);
|
||||
|
@ -21,14 +21,14 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
HTTPServerSession::HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams):
|
||||
HTTPSession(socket, pParams->getKeepAlive()),
|
||||
HTTPServerSession::HTTPServerSession(const StreamSocket& rSocket, HTTPServerParams::Ptr pParams):
|
||||
HTTPSession(rSocket, pParams->getKeepAlive()),
|
||||
_firstRequest(true),
|
||||
_keepAliveTimeout(pParams->getKeepAliveTimeout()),
|
||||
_maxKeepAliveRequests(pParams->getMaxKeepAliveRequests())
|
||||
{
|
||||
setTimeout(pParams->getTimeout());
|
||||
this->socket().setReceiveTimeout(pParams->getTimeout());
|
||||
socket().setReceiveTimeout(pParams->getTimeout());
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,8 +38,8 @@ HTTPSession::HTTPSession():
|
||||
}
|
||||
|
||||
|
||||
HTTPSession::HTTPSession(const StreamSocket& socket):
|
||||
_socket(socket),
|
||||
HTTPSession::HTTPSession(const StreamSocket& rSocket):
|
||||
_socket(rSocket),
|
||||
_pBuffer(0),
|
||||
_pCurrent(0),
|
||||
_pEnd(0),
|
||||
@ -50,8 +50,8 @@ HTTPSession::HTTPSession(const StreamSocket& socket):
|
||||
}
|
||||
|
||||
|
||||
HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive):
|
||||
_socket(socket),
|
||||
HTTPSession::HTTPSession(const StreamSocket& rSocket, bool keepAlive):
|
||||
_socket(rSocket),
|
||||
_pBuffer(0),
|
||||
_pCurrent(0),
|
||||
_pEnd(0),
|
||||
@ -226,9 +226,9 @@ StreamSocket HTTPSession::detachSocket()
|
||||
}
|
||||
|
||||
|
||||
void HTTPSession::attachSocket(const StreamSocket& socket)
|
||||
void HTTPSession::attachSocket(const StreamSocket& rSocket)
|
||||
{
|
||||
_socket = socket;
|
||||
_socket = rSocket;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,9 +35,9 @@ HTTPSessionFactory::HTTPSessionFactory():
|
||||
}
|
||||
|
||||
|
||||
HTTPSessionFactory::HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort):
|
||||
_proxyHost(proxyHost),
|
||||
_proxyPort(proxyPort)
|
||||
HTTPSessionFactory::HTTPSessionFactory(const std::string& rProxyHost, Poco::UInt16 port):
|
||||
_proxyHost(rProxyHost),
|
||||
_proxyPort(port)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,13 +32,13 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int repetitions, int dataSize, int ttl):
|
||||
ICMPEventArgs::ICMPEventArgs(const SocketAddress& address, int operationRepetitions, int dataSizeInBytes, int operationTtl):
|
||||
_address(address),
|
||||
_sent(0),
|
||||
_dataSize(dataSize),
|
||||
_ttl(ttl),
|
||||
_rtt(repetitions, 0),
|
||||
_errors(repetitions)
|
||||
_dataSize(dataSizeInBytes),
|
||||
_ttl(operationTtl),
|
||||
_rtt(operationRepetitions, 0),
|
||||
_errors(operationRepetitions)
|
||||
{
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ std::string ICMPEventArgs::hostAddress() const
|
||||
}
|
||||
|
||||
|
||||
void ICMPEventArgs::setRepetitions(int repetitions)
|
||||
void ICMPEventArgs::setRepetitions(int operationRepetitions)
|
||||
{
|
||||
_rtt.clear();
|
||||
_rtt.resize(repetitions, 0);
|
||||
_errors.assign(repetitions, "");
|
||||
_rtt.resize(operationRepetitions, 0);
|
||||
_errors.assign(operationRepetitions, "");
|
||||
}
|
||||
|
||||
|
||||
@ -101,13 +101,13 @@ ICMPEventArgs ICMPEventArgs::operator ++ (int)
|
||||
|
||||
int ICMPEventArgs::received() const
|
||||
{
|
||||
int received = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < _rtt.size(); ++i)
|
||||
{
|
||||
if (_rtt[i]) ++received;
|
||||
if (_rtt[i]) ++ret;
|
||||
}
|
||||
return received;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,11 +26,11 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSize, int ttl, int timeout):
|
||||
Socket(new ICMPSocketImpl(family, dataSize, ttl, timeout)),
|
||||
_dataSize(dataSize),
|
||||
_ttl(ttl),
|
||||
_timeout(timeout)
|
||||
ICMPSocket::ICMPSocket(IPAddress::Family family, int dataSizeInBytes, int ttlValue, int socketTimeout):
|
||||
Socket(new ICMPSocketImpl(family, dataSizeInBytes, ttlValue, socketTimeout)),
|
||||
_dataSize(dataSizeInBytes),
|
||||
_ttl(ttlValue),
|
||||
_timeout(socketTimeout)
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,15 +66,15 @@ ICMPSocket& ICMPSocket::operator = (const Socket& socket)
|
||||
}
|
||||
|
||||
|
||||
int ICMPSocket::sendTo(const SocketAddress& address, int flags)
|
||||
int ICMPSocket::sendTo(const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
return impl()->sendTo(0, 0, address, flags);
|
||||
return impl()->sendTo(0, 0, rAddress, flags);
|
||||
}
|
||||
|
||||
|
||||
int ICMPSocket::receiveFrom(SocketAddress& address, int flags)
|
||||
int ICMPSocket::receiveFrom(SocketAddress& rAddress, int flags)
|
||||
{
|
||||
return impl()->receiveFrom(0, 0, address, flags);
|
||||
return impl()->receiveFrom(0, 0, rAddress, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,14 +45,14 @@ ICMPSocketImpl::~ICMPSocketImpl()
|
||||
}
|
||||
|
||||
|
||||
int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& address, int flags)
|
||||
int ICMPSocketImpl::sendTo(const void*, int, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), address, flags);
|
||||
int n = SocketImpl::sendTo(_icmpPacket.packet(), _icmpPacket.packetSize(), rAddress, flags);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags)
|
||||
int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
int maxPacketSize = _icmpPacket.maxPacketSize();
|
||||
unsigned char* buffer = new unsigned char[maxPacketSize];
|
||||
@ -68,7 +68,7 @@ int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags)
|
||||
// fake ping responses will cause an endless loop.
|
||||
throw TimeoutException();
|
||||
}
|
||||
SocketImpl::receiveFrom(buffer, maxPacketSize, address, flags);
|
||||
SocketImpl::receiveFrom(buffer, maxPacketSize, rAddress, flags);
|
||||
}
|
||||
while (!_icmpPacket.validReplyID(buffer, maxPacketSize));
|
||||
}
|
||||
|
@ -60,39 +60,39 @@ IPAddress::IPAddress()
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(const IPAddress& addr)
|
||||
IPAddress::IPAddress(const IPAddress& rAddr)
|
||||
{
|
||||
if (addr.family() == IPv4)
|
||||
newIPv4(addr.addr());
|
||||
if (rAddr.family() == IPv4)
|
||||
newIPv4(rAddr.addr());
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else
|
||||
newIPv6(addr.addr(), addr.scope());
|
||||
newIPv6(rAddr.addr(), rAddr.scope());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(Family family)
|
||||
IPAddress::IPAddress(Family addressFamily)
|
||||
{
|
||||
if (family == IPv4)
|
||||
if (addressFamily == IPv4)
|
||||
newIPv4();
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (family == IPv6)
|
||||
else if (addressFamily == IPv6)
|
||||
newIPv6();
|
||||
#endif
|
||||
else throw Poco::InvalidArgumentException("Invalid or unsupported address family passed to IPAddress()");
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(const std::string& addr)
|
||||
IPAddress::IPAddress(const std::string& rAddr)
|
||||
{
|
||||
IPv4AddressImpl empty4 = IPv4AddressImpl();
|
||||
if (addr.empty() || trim(addr) == "0.0.0.0")
|
||||
if (rAddr.empty() || trim(rAddr) == "0.0.0.0")
|
||||
{
|
||||
newIPv4(empty4.addr());
|
||||
return;
|
||||
}
|
||||
|
||||
IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr));
|
||||
IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr));
|
||||
if (addr4 != empty4)
|
||||
{
|
||||
newIPv4(addr4.addr());
|
||||
@ -101,13 +101,13 @@ IPAddress::IPAddress(const std::string& addr)
|
||||
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
IPv6AddressImpl empty6 = IPv6AddressImpl();
|
||||
if (addr.empty() || trim(addr) == "::")
|
||||
if (rAddr.empty() || trim(rAddr) == "::")
|
||||
{
|
||||
newIPv6(empty6.addr());
|
||||
return;
|
||||
}
|
||||
|
||||
IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr));
|
||||
IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr));
|
||||
if (addr6 != IPv6AddressImpl())
|
||||
{
|
||||
newIPv6(addr6.addr(), addr6.scope());
|
||||
@ -115,22 +115,22 @@ IPAddress::IPAddress(const std::string& addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
throw InvalidAddressException(addr);
|
||||
throw InvalidAddressException(rAddr);
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(const std::string& addr, Family family)
|
||||
IPAddress::IPAddress(const std::string& rAddr, Family addressFamily)
|
||||
{
|
||||
if (family == IPv4)
|
||||
if (addressFamily == IPv4)
|
||||
{
|
||||
IPv4AddressImpl addr4(IPv4AddressImpl::parse(addr));
|
||||
IPv4AddressImpl addr4(IPv4AddressImpl::parse(rAddr));
|
||||
newIPv4(addr4.addr());
|
||||
return;
|
||||
}
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (family == IPv6)
|
||||
else if (addressFamily == IPv6)
|
||||
{
|
||||
IPv6AddressImpl addr6(IPv6AddressImpl::parse(addr));
|
||||
IPv6AddressImpl addr6(IPv6AddressImpl::parse(rAddr));
|
||||
newIPv6(addr6.addr(), addr6.scope());
|
||||
return;
|
||||
}
|
||||
@ -139,36 +139,36 @@ IPAddress::IPAddress(const std::string& addr, Family family)
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(const void* addr, poco_socklen_t length)
|
||||
IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength)
|
||||
#ifndef POCO_HAVE_ALIGNMENT
|
||||
: _pImpl(0)
|
||||
#endif
|
||||
{
|
||||
if (length == sizeof(struct in_addr))
|
||||
newIPv4(addr);
|
||||
if (addressLength == sizeof(struct in_addr))
|
||||
newIPv4(pAddr);
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (length == sizeof(struct in6_addr))
|
||||
newIPv6(addr);
|
||||
else if (addressLength == sizeof(struct in6_addr))
|
||||
newIPv6(pAddr);
|
||||
#endif
|
||||
else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()");
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(const void* addr, poco_socklen_t length, Poco::UInt32 scope)
|
||||
IPAddress::IPAddress(const void* pAddr, poco_socklen_t addressLength, Poco::UInt32 scopeIdentifier)
|
||||
{
|
||||
if (length == sizeof(struct in_addr))
|
||||
newIPv4(addr);
|
||||
if (addressLength == sizeof(struct in_addr))
|
||||
newIPv4(pAddr);
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (length == sizeof(struct in6_addr))
|
||||
newIPv6(addr, scope);
|
||||
else if (addressLength == sizeof(struct in6_addr))
|
||||
newIPv6(pAddr, scopeIdentifier);
|
||||
#endif
|
||||
else throw Poco::InvalidArgumentException("Invalid address length passed to IPAddress()");
|
||||
}
|
||||
|
||||
|
||||
IPAddress::IPAddress(unsigned prefix, Family family)
|
||||
IPAddress::IPAddress(unsigned prefix, Family addressFamily)
|
||||
{
|
||||
if (family == IPv4)
|
||||
if (addressFamily == IPv4)
|
||||
{
|
||||
if (prefix <= 32)
|
||||
newIPv4(prefix);
|
||||
@ -176,7 +176,7 @@ IPAddress::IPAddress(unsigned prefix, Family family)
|
||||
throw Poco::InvalidArgumentException("Invalid prefix length passed to IPAddress()");
|
||||
}
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (family == IPv6)
|
||||
else if (addressFamily == IPv6)
|
||||
{
|
||||
if (prefix <= 128)
|
||||
newIPv6(prefix);
|
||||
@ -209,11 +209,11 @@ IPAddress::IPAddress(const SOCKET_ADDRESS& socket_address)
|
||||
|
||||
IPAddress::IPAddress(const struct sockaddr& sockaddr)
|
||||
{
|
||||
unsigned short family = sockaddr.sa_family;
|
||||
if (family == AF_INET)
|
||||
unsigned short addressFamily = sockaddr.sa_family;
|
||||
if (addressFamily == AF_INET)
|
||||
newIPv4(&reinterpret_cast<const struct sockaddr_in*>(&sockaddr)->sin_addr);
|
||||
#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,
|
||||
reinterpret_cast<const struct sockaddr_in6*>(&sockaddr)->sin6_scope_id);
|
||||
#endif
|
||||
@ -227,16 +227,16 @@ IPAddress::~IPAddress()
|
||||
}
|
||||
|
||||
|
||||
IPAddress& IPAddress::operator = (const IPAddress& addr)
|
||||
IPAddress& IPAddress::operator = (const IPAddress& rAddr)
|
||||
{
|
||||
if (&addr != this)
|
||||
if (&rAddr != this)
|
||||
{
|
||||
destruct();
|
||||
if (addr.family() == IPAddress::IPv4)
|
||||
newIPv4(addr.addr());
|
||||
if (rAddr.family() == IPAddress::IPv4)
|
||||
newIPv4(rAddr.addr());
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
else if (addr.family() == IPAddress::IPv6)
|
||||
newIPv6(addr.addr(), addr.scope());
|
||||
else if (rAddr.family() == IPAddress::IPv6)
|
||||
newIPv6(rAddr.addr(), rAddr.scope());
|
||||
#endif
|
||||
else
|
||||
throw Poco::InvalidArgumentException("Invalid or unsupported address family");
|
||||
@ -553,16 +553,16 @@ bool IPAddress::tryParse(const std::string& addr, IPAddress& result)
|
||||
}
|
||||
|
||||
|
||||
void IPAddress::mask(const IPAddress& mask)
|
||||
void IPAddress::mask(const IPAddress& rMask)
|
||||
{
|
||||
IPAddress null;
|
||||
pImpl()->mask(mask.pImpl(), null.pImpl());
|
||||
pImpl()->mask(rMask.pImpl(), null.pImpl());
|
||||
}
|
||||
|
||||
|
||||
void IPAddress::mask(const IPAddress& mask, const IPAddress& set)
|
||||
void IPAddress::mask(const IPAddress& rMask, const IPAddress& set)
|
||||
{
|
||||
pImpl()->mask(mask.pImpl(), set.pImpl());
|
||||
pImpl()->mask(rMask.pImpl(), set.pImpl());
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,31 +86,31 @@ IPv4AddressImpl::IPv4AddressImpl()
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl::IPv4AddressImpl(const void* addr)
|
||||
IPv4AddressImpl::IPv4AddressImpl(const void* pAddr)
|
||||
{
|
||||
std::memcpy(&_addr, addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, pAddr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl::IPv4AddressImpl(unsigned prefix)
|
||||
{
|
||||
UInt32 addr = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix);
|
||||
_addr.s_addr = ByteOrder::toNetwork(addr);
|
||||
UInt32 address = (prefix == 32) ? 0xffffffff : ~(0xffffffff >> prefix);
|
||||
_addr.s_addr = ByteOrder::toNetwork(address);
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& addr)
|
||||
IPv4AddressImpl::IPv4AddressImpl(const IPv4AddressImpl& rAddr)
|
||||
{
|
||||
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, &rAddr._addr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& addr)
|
||||
IPv4AddressImpl& IPv4AddressImpl::operator = (const IPv4AddressImpl& rAddr)
|
||||
{
|
||||
if (this == &addr)
|
||||
if (this == &rAddr)
|
||||
return *this;
|
||||
|
||||
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, &rAddr._addr, sizeof(_addr));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -199,10 +199,10 @@ bool IPv4AddressImpl::isLinkLocal() const
|
||||
|
||||
bool IPv4AddressImpl::isSiteLocal() const
|
||||
{
|
||||
UInt32 addr = ntohl(_addr.s_addr);
|
||||
return (addr & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24
|
||||
(addr & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16
|
||||
(addr >= 0xAC100000 && addr <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255
|
||||
UInt32 address = ntohl(_addr.s_addr);
|
||||
return (address & 0xFF000000) == 0x0A000000 || // 10.0.0.0/24
|
||||
(address & 0xFFFF0000) == 0xC0A80000 || // 192.68.0.0/16
|
||||
(address >= 0xAC100000 && address <= 0xAC1FFFFF); // 172.16.0.0 to 172.31.255.255
|
||||
}
|
||||
|
||||
|
||||
@ -250,8 +250,8 @@ bool IPv4AddressImpl::isOrgLocalMC() const
|
||||
|
||||
bool IPv4AddressImpl::isGlobalMC() const
|
||||
{
|
||||
UInt32 addr = ntohl(_addr.s_addr);
|
||||
return addr >= 0xE0000100 && addr <= 0xEE000000; // 224.0.1.0 to 238.255.255.255
|
||||
UInt32 address = ntohl(_addr.s_addr);
|
||||
return address >= 0xE0000100 && address <= 0xEE000000; // 224.0.1.0 to 238.255.255.255
|
||||
}
|
||||
|
||||
|
||||
@ -299,26 +299,26 @@ IPAddressImpl* IPv4AddressImpl::clone() const
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& addr) const
|
||||
IPv4AddressImpl IPv4AddressImpl::operator & (const IPv4AddressImpl& rAddr) const
|
||||
{
|
||||
IPv4AddressImpl result(&_addr);
|
||||
result._addr.s_addr &= addr._addr.s_addr;
|
||||
result._addr.s_addr &= rAddr._addr.s_addr;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& addr) const
|
||||
IPv4AddressImpl IPv4AddressImpl::operator | (const IPv4AddressImpl& rAddr) const
|
||||
{
|
||||
IPv4AddressImpl result(&_addr);
|
||||
result._addr.s_addr |= addr._addr.s_addr;
|
||||
result._addr.s_addr |= rAddr._addr.s_addr;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& addr) const
|
||||
IPv4AddressImpl IPv4AddressImpl::operator ^ (const IPv4AddressImpl& rAddr) const
|
||||
{
|
||||
IPv4AddressImpl result(&_addr);
|
||||
result._addr.s_addr ^= addr._addr.s_addr;
|
||||
result._addr.s_addr ^= rAddr._addr.s_addr;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -331,15 +331,15 @@ IPv4AddressImpl result(&_addr);
|
||||
}
|
||||
|
||||
|
||||
bool IPv4AddressImpl::operator == (const IPv4AddressImpl& addr) const
|
||||
bool IPv4AddressImpl::operator == (const IPv4AddressImpl& rAddr) const
|
||||
{
|
||||
return 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr));
|
||||
return 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
bool IPv4AddressImpl::operator != (const IPv4AddressImpl& addr) const
|
||||
bool IPv4AddressImpl::operator != (const IPv4AddressImpl& rAddr) const
|
||||
{
|
||||
return !(*this == addr);
|
||||
return !(*this == rAddr);
|
||||
}
|
||||
|
||||
|
||||
@ -357,31 +357,31 @@ IPv6AddressImpl::IPv6AddressImpl(): _scope(0)
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl::IPv6AddressImpl(const void* addr): _scope(0)
|
||||
IPv6AddressImpl::IPv6AddressImpl(const void* pAddr): _scope(0)
|
||||
{
|
||||
std::memcpy(&_addr, addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, pAddr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl::IPv6AddressImpl(const void* addr, Poco::UInt32 scope): _scope(scope)
|
||||
IPv6AddressImpl::IPv6AddressImpl(const void* pAddr, Poco::UInt32 scopeIdentifier): _scope(scopeIdentifier)
|
||||
{
|
||||
std::memcpy(&_addr, addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, pAddr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& addr): _scope(addr._scope)
|
||||
IPv6AddressImpl::IPv6AddressImpl(const IPv6AddressImpl& rAddr): _scope(rAddr._scope)
|
||||
{
|
||||
std::memcpy((void*) &_addr, (void*) &addr._addr, sizeof(_addr));
|
||||
std::memcpy((void*) &_addr, (void*) &rAddr._addr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& addr)
|
||||
IPv6AddressImpl& IPv6AddressImpl::operator = (const IPv6AddressImpl& rAddr)
|
||||
{
|
||||
if (this == &addr)
|
||||
if (this == &rAddr)
|
||||
return *this;
|
||||
|
||||
_scope = addr._scope;
|
||||
std::memcpy(&_addr, &addr._addr, sizeof(_addr));
|
||||
_scope = rAddr._scope;
|
||||
std::memcpy(&_addr, &rAddr._addr, sizeof(_addr));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -516,16 +516,16 @@ unsigned IPv6AddressImpl::prefixLength() const
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
for (int i = 3; i >= 0; --i)
|
||||
{
|
||||
unsigned addr = ntohl(_addr.s6_addr32[i]);
|
||||
if ((bits = maskBits(addr, 32))) return (bitPos - (32 - bits));
|
||||
unsigned address = ntohl(_addr.s6_addr32[i]);
|
||||
if ((bits = maskBits(address, 32))) return (bitPos - (32 - bits));
|
||||
bitPos -= 32;
|
||||
}
|
||||
return 0;
|
||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||
for (int i = 7; i >= 0; --i)
|
||||
{
|
||||
unsigned short addr = ByteOrder::fromNetwork(_addr.s6_addr16[i]);
|
||||
if ((bits = maskBits(addr, 16))) return (bitPos - (16 - bits));
|
||||
unsigned short address = ByteOrder::fromNetwork(_addr.s6_addr16[i]);
|
||||
if ((bits = maskBits(address, 16))) return (bitPos - (16 - bits));
|
||||
bitPos -= 16;
|
||||
}
|
||||
return 0;
|
||||
@ -696,77 +696,77 @@ IPAddressImpl* IPv6AddressImpl::clone() const
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& addr) const
|
||||
IPv6AddressImpl IPv6AddressImpl::operator & (const IPv6AddressImpl& rAddr) const
|
||||
{
|
||||
if (_scope != addr._scope)
|
||||
if (_scope != rAddr._scope)
|
||||
throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
|
||||
|
||||
IPv6AddressImpl result(*this);
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
result._addr.s6_addr16[0] &= addr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] &= addr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] &= addr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] &= addr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] &= addr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] &= addr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] &= addr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] &= addr._addr.s6_addr16[7];
|
||||
result._addr.s6_addr16[0] &= rAddr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] &= rAddr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] &= rAddr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] &= rAddr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] &= rAddr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] &= rAddr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] &= rAddr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] &= rAddr._addr.s6_addr16[7];
|
||||
#else
|
||||
result._addr.s6_addr32[0] &= addr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] &= addr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] &= addr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] &= addr._addr.s6_addr32[3];
|
||||
result._addr.s6_addr32[0] &= rAddr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] &= rAddr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] &= rAddr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] &= rAddr._addr.s6_addr32[3];
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& addr) const
|
||||
IPv6AddressImpl IPv6AddressImpl::operator | (const IPv6AddressImpl& rAddr) const
|
||||
{
|
||||
if (_scope != addr._scope)
|
||||
if (_scope != rAddr._scope)
|
||||
throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
|
||||
|
||||
IPv6AddressImpl result(*this);
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
result._addr.s6_addr16[0] |= addr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] |= addr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] |= addr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] |= addr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] |= addr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] |= addr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] |= addr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] |= addr._addr.s6_addr16[7];
|
||||
result._addr.s6_addr16[0] |= rAddr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] |= rAddr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] |= rAddr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] |= rAddr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] |= rAddr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] |= rAddr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] |= rAddr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] |= rAddr._addr.s6_addr16[7];
|
||||
#else
|
||||
result._addr.s6_addr32[0] |= addr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] |= addr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] |= addr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] |= addr._addr.s6_addr32[3];
|
||||
result._addr.s6_addr32[0] |= rAddr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] |= rAddr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] |= rAddr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] |= rAddr._addr.s6_addr32[3];
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& addr) const
|
||||
IPv6AddressImpl IPv6AddressImpl::operator ^ (const IPv6AddressImpl& rAddr) const
|
||||
{
|
||||
if (_scope != addr._scope)
|
||||
if (_scope != rAddr._scope)
|
||||
throw Poco::InvalidArgumentException("Scope ID of passed IPv6 address does not match with the source one.");
|
||||
|
||||
IPv6AddressImpl result(*this);
|
||||
|
||||
#ifdef POCO_OS_FAMILY_WINDOWS
|
||||
result._addr.s6_addr16[0] ^= addr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] ^= addr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] ^= addr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] ^= addr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] ^= addr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] ^= addr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] ^= addr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] ^= addr._addr.s6_addr16[7];
|
||||
result._addr.s6_addr16[0] ^= rAddr._addr.s6_addr16[0];
|
||||
result._addr.s6_addr16[1] ^= rAddr._addr.s6_addr16[1];
|
||||
result._addr.s6_addr16[2] ^= rAddr._addr.s6_addr16[2];
|
||||
result._addr.s6_addr16[3] ^= rAddr._addr.s6_addr16[3];
|
||||
result._addr.s6_addr16[4] ^= rAddr._addr.s6_addr16[4];
|
||||
result._addr.s6_addr16[5] ^= rAddr._addr.s6_addr16[5];
|
||||
result._addr.s6_addr16[6] ^= rAddr._addr.s6_addr16[6];
|
||||
result._addr.s6_addr16[7] ^= rAddr._addr.s6_addr16[7];
|
||||
#else
|
||||
result._addr.s6_addr32[0] ^= addr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] ^= addr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] ^= addr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] ^= addr._addr.s6_addr32[3];
|
||||
result._addr.s6_addr32[0] ^= rAddr._addr.s6_addr32[0];
|
||||
result._addr.s6_addr32[1] ^= rAddr._addr.s6_addr32[1];
|
||||
result._addr.s6_addr32[2] ^= rAddr._addr.s6_addr32[2];
|
||||
result._addr.s6_addr32[3] ^= rAddr._addr.s6_addr32[3];
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
@ -794,15 +794,15 @@ IPv6AddressImpl IPv6AddressImpl::operator ~ () const
|
||||
}
|
||||
|
||||
|
||||
bool IPv6AddressImpl::operator == (const IPv6AddressImpl& addr) const
|
||||
bool IPv6AddressImpl::operator == (const IPv6AddressImpl& rAddr) const
|
||||
{
|
||||
return _scope == addr._scope && 0 == std::memcmp(&addr._addr, &_addr, sizeof(_addr));
|
||||
return _scope == rAddr._scope && 0 == std::memcmp(&rAddr._addr, &_addr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
bool IPv6AddressImpl::operator != (const IPv6AddressImpl& addr) const
|
||||
bool IPv6AddressImpl::operator != (const IPv6AddressImpl& rAddr) const
|
||||
{
|
||||
return !(*this == addr);
|
||||
return !(*this == rAddr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,9 +206,9 @@ void MailMessage::addRecipient(const MailRecipient& recipient)
|
||||
}
|
||||
|
||||
|
||||
void MailMessage::setRecipients(const Recipients& recipients)
|
||||
void MailMessage::setRecipients(const Recipients& rRecipients)
|
||||
{
|
||||
_recipients.assign(recipients.begin(), recipients.end());
|
||||
_recipients.assign(rRecipients.begin(), rRecipients.end());
|
||||
}
|
||||
|
||||
|
||||
@ -318,12 +318,12 @@ void MailMessage::addAttachment(const std::string& name, PartSource* pSource, Co
|
||||
}
|
||||
|
||||
|
||||
void MailMessage::read(std::istream& istr, PartHandler& handler)
|
||||
void MailMessage::read(std::istream& istr, PartHandler& rHandler)
|
||||
{
|
||||
readHeader(istr);
|
||||
if (isMultipart())
|
||||
{
|
||||
readMultipart(istr, handler);
|
||||
readMultipart(istr, rHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -182,9 +182,9 @@ MultipartReader::MultipartReader(std::istream& istr):
|
||||
}
|
||||
|
||||
|
||||
MultipartReader::MultipartReader(std::istream& istr, const std::string& boundary):
|
||||
MultipartReader::MultipartReader(std::istream& istr, const std::string& rBoundary):
|
||||
_istr(istr),
|
||||
_boundary(boundary),
|
||||
_boundary(rBoundary),
|
||||
_pMPI(0)
|
||||
{
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ MultipartWriter::MultipartWriter(std::ostream& ostr):
|
||||
}
|
||||
|
||||
|
||||
MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& boundary):
|
||||
MultipartWriter::MultipartWriter(std::ostream& ostr, const std::string& rBoundary):
|
||||
_ostr(ostr),
|
||||
_boundary(boundary),
|
||||
_boundary(rBoundary),
|
||||
_firstPart(true)
|
||||
{
|
||||
if (_boundary.empty())
|
||||
|
@ -73,9 +73,9 @@ NTPPacket::NTPPacket() :
|
||||
}
|
||||
|
||||
|
||||
NTPPacket::NTPPacket(Poco::UInt8 *packet)
|
||||
NTPPacket::NTPPacket(Poco::UInt8 *pPacket)
|
||||
{
|
||||
setPacket(packet);
|
||||
setPacket(pPacket);
|
||||
}
|
||||
|
||||
|
||||
@ -84,9 +84,9 @@ NTPPacket::~NTPPacket()
|
||||
}
|
||||
|
||||
|
||||
void NTPPacket::packet(Poco::UInt8 *packet) const
|
||||
void NTPPacket::packet(Poco::UInt8 *pPacket) const
|
||||
{
|
||||
NTPPacketData *p = (NTPPacketData*)packet;
|
||||
NTPPacketData *p = (NTPPacketData*)pPacket;
|
||||
|
||||
p->li = _leapIndicator;
|
||||
p->vn = _version;
|
||||
@ -104,9 +104,9 @@ void NTPPacket::packet(Poco::UInt8 *packet) const
|
||||
}
|
||||
|
||||
|
||||
void NTPPacket::setPacket(Poco::UInt8 *packet)
|
||||
void NTPPacket::setPacket(Poco::UInt8 *pPacket)
|
||||
{
|
||||
NTPPacketData *p = (NTPPacketData*)packet;
|
||||
NTPPacketData *p = (NTPPacketData*)pPacket;
|
||||
|
||||
_leapIndicator = p->li;
|
||||
_version = p->vn;
|
||||
|
@ -75,14 +75,14 @@ public:
|
||||
typedef NetworkInterface::Type Type;
|
||||
|
||||
NetworkInterfaceImpl(unsigned index);
|
||||
NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0);
|
||||
NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0);
|
||||
NetworkInterfaceImpl(const std::string& name,
|
||||
const std::string& displayName,
|
||||
const std::string& adapterName,
|
||||
const IPAddress& address,
|
||||
NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned index, NetworkInterface::MACAddress* pMACAddress = 0);
|
||||
NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned index = 0, NetworkInterface::MACAddress* pMACAddress = 0);
|
||||
NetworkInterfaceImpl(const std::string& rName,
|
||||
const std::string& rDisplayName,
|
||||
const std::string& rAdapterName,
|
||||
const IPAddress& rAddress,
|
||||
const IPAddress& subnetMask,
|
||||
const IPAddress& broadcastAddress,
|
||||
const IPAddress& rBroadcastAddress,
|
||||
unsigned index,
|
||||
NetworkInterface::MACAddress* pMACAddress = 0);
|
||||
|
||||
@ -91,10 +91,10 @@ public:
|
||||
const std::string& displayName() const;
|
||||
const std::string& adapterName() const;
|
||||
const IPAddress& firstAddress(IPAddress::Family family) const;
|
||||
void addAddress(const AddressTuple& address);
|
||||
void addAddress(const AddressTuple& rAddress);
|
||||
const IPAddress& address(unsigned index) const;
|
||||
const NetworkInterface::AddressList& addressList() const;
|
||||
bool hasAddress(const IPAddress& address) const;
|
||||
bool hasAddress(const IPAddress& rAddress) const;
|
||||
const IPAddress& subnetMask(unsigned index) const;
|
||||
const IPAddress& broadcastAddress(unsigned index) const;
|
||||
const IPAddress& destAddress(unsigned index) const;
|
||||
@ -102,9 +102,9 @@ public:
|
||||
bool supportsIPv4() const;
|
||||
bool supportsIPv6() const;
|
||||
|
||||
void setName(const std::string& name);
|
||||
void setDisplayName(const std::string& name);
|
||||
void setAdapterName(const std::string& name);
|
||||
void setName(const std::string& rName);
|
||||
void setDisplayName(const std::string& rName);
|
||||
void setAdapterName(const std::string& rName);
|
||||
void addAddress(const IPAddress& addr);
|
||||
void setMACAddress(const NetworkInterface::MACAddress& addr);
|
||||
void setMACAddress(const void *addr, std::size_t len);
|
||||
@ -157,8 +157,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index):
|
||||
_index(index),
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned interfaceIndex):
|
||||
_index(interfaceIndex),
|
||||
_broadcast(false),
|
||||
_loopback(false),
|
||||
_multicast(false),
|
||||
@ -171,11 +171,11 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(unsigned index):
|
||||
}
|
||||
|
||||
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, NetworkInterface::MACAddress* pMACAddress):
|
||||
_name(name),
|
||||
_displayName(displayName),
|
||||
_adapterName(adapterName),
|
||||
_index(index),
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress):
|
||||
_name(rName),
|
||||
_displayName(rDisplayName),
|
||||
_adapterName(rAdapterName),
|
||||
_index(interfaceIndex),
|
||||
_broadcast(false),
|
||||
_loopback(false),
|
||||
_multicast(false),
|
||||
@ -185,17 +185,17 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s
|
||||
_mtu(0),
|
||||
_type(NetworkInterface::NI_TYPE_OTHER)
|
||||
{
|
||||
_addressList.push_back(AddressTuple(address, IPAddress(), IPAddress()));
|
||||
_addressList.push_back(AddressTuple(rAddress, IPAddress(), IPAddress()));
|
||||
setPhyParams();
|
||||
if (pMACAddress) setMACAddress(*pMACAddress);
|
||||
}
|
||||
|
||||
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, NetworkInterface::MACAddress* pMACAddress):
|
||||
_name(name),
|
||||
_displayName(displayName),
|
||||
_adapterName(adapterName),
|
||||
_index(index),
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, NetworkInterface::MACAddress* pMACAddress):
|
||||
_name(rName),
|
||||
_displayName(rDisplayName),
|
||||
_adapterName(rAdapterName),
|
||||
_index(interfaceIndex),
|
||||
_broadcast(false),
|
||||
_loopback(false),
|
||||
_multicast(false),
|
||||
@ -210,18 +210,18 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const std::s
|
||||
}
|
||||
|
||||
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name,
|
||||
const std::string& displayName,
|
||||
const std::string& adapterName,
|
||||
const IPAddress& address,
|
||||
const IPAddress& subnetMask,
|
||||
const IPAddress& broadcastAddress,
|
||||
unsigned index,
|
||||
NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& rName,
|
||||
const std::string& rDisplayName,
|
||||
const std::string& rAdapterName,
|
||||
const IPAddress& rAddress,
|
||||
const IPAddress& rSubnetMask,
|
||||
const IPAddress& rBroadcastAddress,
|
||||
unsigned interfaceIndex,
|
||||
NetworkInterface::MACAddress* pMACAddress):
|
||||
_name(name),
|
||||
_displayName(displayName),
|
||||
_adapterName(adapterName),
|
||||
_index(index),
|
||||
_name(rName),
|
||||
_displayName(rDisplayName),
|
||||
_adapterName(rAdapterName),
|
||||
_index(interfaceIndex),
|
||||
_broadcast(false),
|
||||
_loopback(false),
|
||||
_multicast(false),
|
||||
@ -230,7 +230,7 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name,
|
||||
_running(false),
|
||||
_mtu(0)
|
||||
{
|
||||
_addressList.push_back(AddressTuple(address, subnetMask, broadcastAddress));
|
||||
_addressList.push_back(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress));
|
||||
setPhyParams();
|
||||
if (pMACAddress) setMACAddress(*pMACAddress);
|
||||
}
|
||||
@ -324,29 +324,29 @@ const IPAddress& NetworkInterfaceImpl::firstAddress(IPAddress::Family family) co
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::addAddress(const AddressTuple& address)
|
||||
inline void NetworkInterfaceImpl::addAddress(const AddressTuple& rAddress)
|
||||
{
|
||||
_addressList.push_back(address);
|
||||
_addressList.push_back(rAddress);
|
||||
}
|
||||
|
||||
|
||||
bool NetworkInterfaceImpl::hasAddress(const IPAddress& address) const
|
||||
bool NetworkInterfaceImpl::hasAddress(const IPAddress& rAddress) const
|
||||
{
|
||||
NetworkInterface::ConstAddressIterator it = _addressList.begin();
|
||||
NetworkInterface::ConstAddressIterator end = _addressList.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
if (it->get<NetworkInterface::IP_ADDRESS>() == address)
|
||||
if (it->get<NetworkInterface::IP_ADDRESS>() == rAddress)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline const IPAddress& NetworkInterfaceImpl::address(unsigned index) const
|
||||
inline const IPAddress& NetworkInterfaceImpl::address(unsigned interfaceIndex) const
|
||||
{
|
||||
if (index < _addressList.size()) return _addressList[index].get<NetworkInterface::IP_ADDRESS>();
|
||||
else throw NotFoundException(Poco::format("No address with index %u.", index));
|
||||
if (interfaceIndex < _addressList.size()) return _addressList[interfaceIndex].get<NetworkInterface::IP_ADDRESS>();
|
||||
else throw NotFoundException(Poco::format("No address with index %u.", interfaceIndex));
|
||||
}
|
||||
|
||||
|
||||
@ -356,32 +356,32 @@ inline const NetworkInterface::AddressList& NetworkInterfaceImpl::addressList()
|
||||
}
|
||||
|
||||
|
||||
const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned index) const
|
||||
const IPAddress& NetworkInterfaceImpl::subnetMask(unsigned interfaceIndex) const
|
||||
{
|
||||
if (index < _addressList.size())
|
||||
return _addressList[index].get<NetworkInterface::SUBNET_MASK>();
|
||||
if (interfaceIndex < _addressList.size())
|
||||
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())
|
||||
return _addressList[index].get<NetworkInterface::BROADCAST_ADDRESS>();
|
||||
if (interfaceIndex < _addressList.size())
|
||||
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())
|
||||
throw InvalidAccessException("Only PPP addresses have destination address.");
|
||||
else if (index < _addressList.size())
|
||||
return _addressList[index].get<NetworkInterface::BROADCAST_ADDRESS>();
|
||||
else if (interfaceIndex < _addressList.size())
|
||||
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
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setUp(bool up)
|
||||
inline void NetworkInterfaceImpl::setUp(bool isUp)
|
||||
{
|
||||
_up = up;
|
||||
_up = isUp;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setMTU(unsigned mtu)
|
||||
inline void NetworkInterfaceImpl::setMTU(unsigned interfaceMTU)
|
||||
{
|
||||
_mtu = mtu;
|
||||
_mtu = interfaceMTU;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setType(Type type)
|
||||
inline void NetworkInterfaceImpl::setType(Type interfaceType)
|
||||
{
|
||||
_type = type;
|
||||
_type = interfaceType;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setIndex(unsigned index)
|
||||
inline void NetworkInterfaceImpl::setIndex(unsigned interfaceIndex)
|
||||
{
|
||||
_index = index;
|
||||
_index = interfaceIndex;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setName(const std::string& name)
|
||||
inline void NetworkInterfaceImpl::setName(const std::string& rName)
|
||||
{
|
||||
_name = name;
|
||||
_name = rName;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setDisplayName(const std::string& name)
|
||||
inline void NetworkInterfaceImpl::setDisplayName(const std::string& rName)
|
||||
{
|
||||
_displayName = name;
|
||||
_displayName = rName;
|
||||
}
|
||||
|
||||
|
||||
inline void NetworkInterfaceImpl::setAdapterName(const std::string& name)
|
||||
inline void NetworkInterfaceImpl::setAdapterName(const std::string& rName)
|
||||
{
|
||||
_adapterName = name;
|
||||
_adapterName = rName;
|
||||
}
|
||||
|
||||
|
||||
@ -560,8 +560,8 @@ inline void NetworkInterfaceImpl::setMACAddress(const void *addr, std::size_t le
|
||||
FastMutex NetworkInterface::_mutex;
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(unsigned index):
|
||||
_pImpl(new NetworkInterfaceImpl(index))
|
||||
NetworkInterface::NetworkInterface(unsigned interfaceIndex):
|
||||
_pImpl(new NetworkInterfaceImpl(interfaceIndex))
|
||||
{
|
||||
}
|
||||
|
||||
@ -573,44 +573,44 @@ NetworkInterface::NetworkInterface(const NetworkInterface& interfc):
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, const IPAddress& address, unsigned index, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, index, pMACAddress))
|
||||
NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, interfaceIndex, pMACAddress))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(const std::string& name, const std::string& displayName, const std::string& adapterName, unsigned index, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, index, pMACAddress))
|
||||
NetworkInterface::NetworkInterface(const std::string& rName, const std::string& rDisplayName, const std::string& rAdapterName, unsigned interfaceIndex, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, interfaceIndex, pMACAddress))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(const std::string& name, const IPAddress& address, unsigned index, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(name, name, name, address, index, pMACAddress))
|
||||
NetworkInterface::NetworkInterface(const std::string& rName, const IPAddress& rAddress, unsigned interfaceIndex, MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, interfaceIndex, pMACAddress))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(const std::string& name,
|
||||
const std::string& displayName,
|
||||
const std::string& adapterName,
|
||||
const IPAddress& address,
|
||||
const IPAddress& subnetMask,
|
||||
const IPAddress& broadcastAddress,
|
||||
unsigned index,
|
||||
NetworkInterface::NetworkInterface(const std::string& rName,
|
||||
const std::string& rDisplayName,
|
||||
const std::string& rAdapterName,
|
||||
const IPAddress& rAddress,
|
||||
const IPAddress& rSubnetMask,
|
||||
const IPAddress& rBroadcastAddress,
|
||||
unsigned interfaceIndex,
|
||||
MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(name, displayName, adapterName, address, subnetMask, broadcastAddress, index, pMACAddress))
|
||||
_pImpl(new NetworkInterfaceImpl(rName, rDisplayName, rAdapterName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface::NetworkInterface(const std::string& name,
|
||||
const IPAddress& address,
|
||||
const IPAddress& subnetMask,
|
||||
const IPAddress& broadcastAddress,
|
||||
unsigned index,
|
||||
NetworkInterface::NetworkInterface(const std::string& rName,
|
||||
const IPAddress& rAddress,
|
||||
const IPAddress& rSubnetMask,
|
||||
const IPAddress& rBroadcastAddress,
|
||||
unsigned interfaceIndex,
|
||||
MACAddress* pMACAddress):
|
||||
_pImpl(new NetworkInterfaceImpl(name, name, name, address, subnetMask, broadcastAddress, index, pMACAddress))
|
||||
_pImpl(new NetworkInterfaceImpl(rName, rName, rName, rAddress, rSubnetMask, rBroadcastAddress, interfaceIndex, pMACAddress))
|
||||
{
|
||||
}
|
||||
|
||||
@ -679,21 +679,21 @@ void NetworkInterface::firstAddress(IPAddress& addr, IPAddress::Family family) c
|
||||
}
|
||||
|
||||
|
||||
void NetworkInterface::addAddress(const IPAddress& address)
|
||||
void NetworkInterface::addAddress(const IPAddress& rAddress)
|
||||
{
|
||||
_pImpl->addAddress(AddressTuple(address, IPAddress(), IPAddress()));
|
||||
_pImpl->addAddress(AddressTuple(rAddress, IPAddress(), IPAddress()));
|
||||
}
|
||||
|
||||
|
||||
void NetworkInterface::addAddress(const IPAddress& address, const IPAddress& subnetMask, const IPAddress& broadcastAddress)
|
||||
void NetworkInterface::addAddress(const IPAddress& rAddress, const IPAddress& rSubnetMask, const IPAddress& rBroadcastAddress)
|
||||
{
|
||||
_pImpl->addAddress(AddressTuple(address, subnetMask, broadcastAddress));
|
||||
_pImpl->addAddress(AddressTuple(rAddress, rSubnetMask, rBroadcastAddress));
|
||||
}
|
||||
|
||||
|
||||
const IPAddress& NetworkInterface::address(unsigned index) const
|
||||
const IPAddress& NetworkInterface::address(unsigned interfaceIndex) const
|
||||
{
|
||||
return _pImpl->address(index);
|
||||
return _pImpl->address(interfaceIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -703,15 +703,15 @@ const NetworkInterface::AddressList& NetworkInterface::addressList() const
|
||||
}
|
||||
|
||||
|
||||
const IPAddress& NetworkInterface::subnetMask(unsigned index) const
|
||||
const IPAddress& NetworkInterface::subnetMask(unsigned interfaceIndex) const
|
||||
{
|
||||
return _pImpl->subnetMask(index);
|
||||
return _pImpl->subnetMask(interfaceIndex);
|
||||
}
|
||||
|
||||
|
||||
const IPAddress& NetworkInterface::broadcastAddress(unsigned index) const
|
||||
const IPAddress& NetworkInterface::broadcastAddress(unsigned interfaceIndex) const
|
||||
{
|
||||
return _pImpl->broadcastAddress(index);
|
||||
return _pImpl->broadcastAddress(interfaceIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -721,9 +721,9 @@ const NetworkInterface::MACAddress& NetworkInterface::macAddress() const
|
||||
}
|
||||
|
||||
|
||||
const IPAddress& NetworkInterface::destAddress(unsigned index) const
|
||||
const IPAddress& NetworkInterface::destAddress(unsigned interfaceIndex) const
|
||||
{
|
||||
return _pImpl->destAddress(index);
|
||||
return _pImpl->destAddress(interfaceIndex);
|
||||
}
|
||||
|
||||
|
||||
@ -793,14 +793,14 @@ bool NetworkInterface::isUp() const
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface NetworkInterface::forName(const std::string& name, bool requireIPv6)
|
||||
NetworkInterface NetworkInterface::forName(const std::string& rName, bool requireIPv6)
|
||||
{
|
||||
if (requireIPv6) return forName(name, IPv6_ONLY);
|
||||
else return forName(name, IPv4_OR_IPv6);
|
||||
if (requireIPv6) return forName(rName, IPv6_ONLY);
|
||||
else return forName(rName, IPv4_OR_IPv6);
|
||||
}
|
||||
|
||||
|
||||
NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ipVersion)
|
||||
NetworkInterface NetworkInterface::forName(const std::string& rName, IPVersion ipVersion)
|
||||
{
|
||||
Map map = NetworkInterface::map(false, false);
|
||||
Map::const_iterator it = map.begin();
|
||||
@ -808,7 +808,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip
|
||||
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
if (it->second.name() == name)
|
||||
if (it->second.name() == rName)
|
||||
{
|
||||
if (ipVersion == IPv4_ONLY && it->second.supportsIPv4())
|
||||
return it->second;
|
||||
@ -818,7 +818,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, IPVersion ip
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
throw InterfaceNotFoundException(name);
|
||||
throw InterfaceNotFoundException(rName);
|
||||
}
|
||||
|
||||
|
||||
@ -864,10 +864,10 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly)
|
||||
NetworkInterface::Map::const_iterator end = m.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
int index = it->second.index();
|
||||
std::string name = it->second.name();
|
||||
std::string displayName = it->second.displayName();
|
||||
std::string adapterName = it->second.adapterName();
|
||||
int interfaceIndex = it->second.index();
|
||||
std::string interfaceName = it->second.name();
|
||||
std::string interfaceDisplayName = it->second.displayName();
|
||||
std::string interfaceAdapterName = it->second.adapterName();
|
||||
NetworkInterface::MACAddress mac = it->second.macAddress();
|
||||
|
||||
typedef NetworkInterface::AddressList List;
|
||||
@ -881,12 +881,12 @@ NetworkInterface::List NetworkInterface::list(bool ipOnly, bool upOnly)
|
||||
NetworkInterface ni;
|
||||
if (mask.isWildcard())
|
||||
{
|
||||
ni = NetworkInterface(name, displayName, adapterName, addr, index, &mac);
|
||||
ni = NetworkInterface(interfaceName, interfaceDisplayName, interfaceAdapterName, addr, interfaceIndex, &mac);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPAddress broadcast = ipIt->get<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;
|
||||
@ -984,7 +984,7 @@ NetworkInterface::Type fromNative(DWORD type)
|
||||
}
|
||||
|
||||
|
||||
IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback)
|
||||
IPAddress subnetMaskForInterface(const std::string& rName, bool isLoopback)
|
||||
{
|
||||
if (isLoopback)
|
||||
{
|
||||
@ -994,7 +994,7 @@ IPAddress subnetMaskForInterface(const std::string& name, bool isLoopback)
|
||||
{
|
||||
#if !defined(_WIN32_WCE)
|
||||
std::string subKey("SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters\\Interfaces\\");
|
||||
subKey += name;
|
||||
subKey += rName;
|
||||
std::string netmask;
|
||||
HKEY hKey;
|
||||
#if defined(POCO_WIN32_UTF8) && !defined(POCO_NO_WSTRING)
|
||||
@ -1081,9 +1081,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
poco_assert (NO_ERROR == dwRetVal);
|
||||
for (; pAddress; pAddress = pAddress->Next)
|
||||
{
|
||||
IPAddress address;
|
||||
IPAddress subnetMask;
|
||||
IPAddress broadcastAddress;
|
||||
IPAddress ipAddress;
|
||||
IPAddress ipSubnetMask;
|
||||
IPAddress ipBroadcastAddress;
|
||||
unsigned ifIndex = 0;
|
||||
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
@ -1138,26 +1138,26 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
#endif
|
||||
if (ifIndex == 0) continue;
|
||||
|
||||
std::string name;
|
||||
std::string displayName;
|
||||
std::string adapterName(pAddress->AdapterName);
|
||||
std::string interfaceName;
|
||||
std::string interfaceDisplayName;
|
||||
std::string interfaceAdapterName(pAddress->AdapterName);
|
||||
#ifdef POCO_WIN32_UTF8
|
||||
Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, name);
|
||||
Poco::UnicodeConverter::toUTF8(pAddress->Description, displayName);
|
||||
Poco::UnicodeConverter::toUTF8(pAddress->FriendlyName, interfaceName);
|
||||
Poco::UnicodeConverter::toUTF8(pAddress->Description, interfaceDisplayName);
|
||||
#else
|
||||
char nameBuffer[1024];
|
||||
int rc = WideCharToMultiByte(CP_ACP, 0, pAddress->FriendlyName, -1, nameBuffer, sizeof(nameBuffer), NULL, NULL);
|
||||
if (rc) name = nameBuffer;
|
||||
if (rc) interfaceName = nameBuffer;
|
||||
char displayNameBuffer[1024];
|
||||
rc = WideCharToMultiByte(CP_ACP, 0, pAddress->Description, -1, displayNameBuffer, sizeof(displayNameBuffer), NULL, NULL);
|
||||
if (rc) displayName = displayNameBuffer;
|
||||
if (rc) interfaceDisplayName = displayNameBuffer;
|
||||
#endif
|
||||
|
||||
bool isUp = (pAddress->OperStatus == IfOperStatusUp);
|
||||
bool isIP = (0 != pAddress->FirstUnicastAddress);
|
||||
if (((ipOnly && isIP) || !ipOnly) && ((upOnly && isUp) || !upOnly))
|
||||
{
|
||||
NetworkInterface ni(name, displayName, adapterName, ifIndex);
|
||||
NetworkInterface ni(interfaceName, interfaceDisplayName, interfaceAdapterName, ifIndex);
|
||||
// Create interface even if it has an empty list of addresses; also, set
|
||||
// physical attributes which are protocol independent (name, media type,
|
||||
// MAC address, MTU, operational status, etc).
|
||||
@ -1184,7 +1184,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
pUniAddr;
|
||||
pUniAddr = pUniAddr->Next)
|
||||
{
|
||||
address = IPAddress(pUniAddr->Address);
|
||||
ipAddress = IPAddress(pUniAddr->Address);
|
||||
ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family;
|
||||
switch (family)
|
||||
{
|
||||
@ -1201,67 +1201,67 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
#if defined(_WIN32_WCE)
|
||||
#if _WIN32_WCE >= 0x0800
|
||||
prefixLength = pUniAddr->OnLinkPrefixLength;
|
||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
|
||||
ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress);
|
||||
#else
|
||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
|
||||
ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
|
||||
#endif
|
||||
// if previous call did not do it, make last-ditch attempt for prefix and broadcast
|
||||
if (prefixLength == 0 && pAddress->FirstPrefix)
|
||||
prefixLength = pAddress->FirstPrefix->PrefixLength;
|
||||
poco_assert (prefixLength <= 32);
|
||||
if (broadcastAddress.isWildcard())
|
||||
if (ipBroadcastAddress.isWildcard())
|
||||
{
|
||||
IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4);
|
||||
IPAddress host(mask & address);
|
||||
broadcastAddress = host | ~mask;
|
||||
IPAddress host(mask & ipAddress);
|
||||
ipBroadcastAddress = host | ~mask;
|
||||
}
|
||||
#elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
|
||||
#if (_WIN32_WINNT >= 0x0600) // Vista and newer
|
||||
if (osvi.dwMajorVersion >= 6)
|
||||
{
|
||||
prefixLength = pUniAddr->OnLinkPrefixLength;
|
||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
|
||||
ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
|
||||
ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
|
||||
}
|
||||
#else
|
||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
|
||||
ipBroadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, ipAddress, &prefixLength);
|
||||
#endif
|
||||
poco_assert (prefixLength <= 32);
|
||||
if (broadcastAddress.isWildcard())
|
||||
if (ipBroadcastAddress.isWildcard())
|
||||
{
|
||||
IPAddress mask(static_cast<unsigned>(prefixLength), IPAddress::IPv4);
|
||||
IPAddress host(mask & address);
|
||||
broadcastAddress = host | ~mask;
|
||||
IPAddress host(mask & ipAddress);
|
||||
ipBroadcastAddress = host | ~mask;
|
||||
}
|
||||
#endif // (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100)
|
||||
if (prefixLength)
|
||||
{
|
||||
subnetMask = IPAddress(static_cast<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
|
||||
{
|
||||
address = IPAddress(&reinterpret_cast<struct sockaddr_in*>(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr));
|
||||
subnetMask = subnetMaskForInterface(name, address.isLoopback());
|
||||
if (!address.isLoopback())
|
||||
ipAddress = IPAddress(&reinterpret_cast<struct sockaddr_in*>(pUniAddr->Address.lpSockaddr)->sin_addr, sizeof(in_addr));
|
||||
ipSubnetMask = subnetMaskForInterface(interfaceName, ipAddress.isLoopback());
|
||||
if (!ipAddress.isLoopback())
|
||||
{
|
||||
broadcastAddress = address;
|
||||
broadcastAddress.mask(subnetMask, IPAddress::broadcast());
|
||||
ipBroadcastAddress = ipAddress;
|
||||
ipBroadcastAddress.mask(ipSubnetMask, IPAddress::broadcast());
|
||||
}
|
||||
}
|
||||
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
|
||||
ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
ifIt->second.addAddress(address);
|
||||
ifIt->second.addAddress(ipAddress);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
case AF_INET6:
|
||||
ifIt->second.addAddress(address);
|
||||
ifIt->second.addAddress(ipAddress);
|
||||
break;
|
||||
#endif
|
||||
} // switch family
|
||||
@ -1408,7 +1408,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
{
|
||||
if (!currIface->ifa_addr) continue;
|
||||
|
||||
IPAddress address, subnetMask, broadcastAddress;
|
||||
IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress;
|
||||
unsigned family = currIface->ifa_addr->sa_family;
|
||||
switch (family)
|
||||
{
|
||||
@ -1432,17 +1432,17 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
|
||||
ifIt = result.insert(Map::value_type(ifIndex, intf)).first;
|
||||
|
||||
address = IPAddress(*(currIface->ifa_addr));
|
||||
ipAddress = IPAddress(*(currIface->ifa_addr));
|
||||
|
||||
if (( currIface->ifa_flags & IFF_LOOPBACK ) == 0 && currIface->ifa_netmask)
|
||||
subnetMask = IPAddress(*(currIface->ifa_netmask));
|
||||
ipSubnetMask = IPAddress(*(currIface->ifa_netmask));
|
||||
|
||||
if (currIface->ifa_flags & IFF_BROADCAST && currIface->ifa_broadaddr)
|
||||
broadcastAddress = IPAddress(*(currIface->ifa_broadaddr));
|
||||
ipBroadcastAddress = IPAddress(*(currIface->ifa_broadaddr));
|
||||
else if (currIface->ifa_flags & IFF_POINTOPOINT && currIface->ifa_dstaddr)
|
||||
broadcastAddress = IPAddress(*(currIface->ifa_dstaddr));
|
||||
ipBroadcastAddress = IPAddress(*(currIface->ifa_dstaddr));
|
||||
else
|
||||
broadcastAddress = IPAddress();
|
||||
ipBroadcastAddress = IPAddress();
|
||||
break;
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
case AF_INET6:
|
||||
@ -1453,10 +1453,10 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
|
||||
ifIt = result.insert(Map::value_type(ifIndex, intf)).first;
|
||||
|
||||
address = IPAddress(&reinterpret_cast<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);
|
||||
subnetMask = IPAddress(*(currIface->ifa_netmask));
|
||||
broadcastAddress = IPAddress();
|
||||
ipSubnetMask = IPAddress(*(currIface->ifa_netmask));
|
||||
ipBroadcastAddress = IPAddress();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -1472,7 +1472,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
if ((upOnly && intf.isUp()) || !upOnly)
|
||||
{
|
||||
if ((ifIt = result.find(ifIndex)) != result.end())
|
||||
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
|
||||
ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1582,7 +1582,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
{
|
||||
if (!iface->ifa_addr) continue;
|
||||
|
||||
IPAddress address, subnetMask, broadcastAddress;
|
||||
IPAddress ipAddress, ipSubnetMask, ipBroadcastAddress;
|
||||
unsigned family = iface->ifa_addr->sa_family;
|
||||
switch (family)
|
||||
{
|
||||
@ -1607,15 +1607,15 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
|
||||
ifIt = result.insert(Map::value_type(ifIndex, intf)).first;
|
||||
|
||||
address = IPAddress(*(iface->ifa_addr));
|
||||
subnetMask = IPAddress(*(iface->ifa_netmask));
|
||||
ipAddress = IPAddress(*(iface->ifa_addr));
|
||||
ipSubnetMask = IPAddress(*(iface->ifa_netmask));
|
||||
|
||||
if (iface->ifa_flags & IFF_BROADCAST && iface->ifa_broadaddr)
|
||||
broadcastAddress = IPAddress(*(iface->ifa_broadaddr));
|
||||
ipBroadcastAddress = IPAddress(*(iface->ifa_broadaddr));
|
||||
else if (iface->ifa_flags & IFF_POINTOPOINT && iface->ifa_dstaddr)
|
||||
broadcastAddress = IPAddress(*(iface->ifa_dstaddr));
|
||||
ipBroadcastAddress = IPAddress(*(iface->ifa_dstaddr));
|
||||
else
|
||||
broadcastAddress = IPAddress();
|
||||
ipBroadcastAddress = IPAddress();
|
||||
|
||||
break;
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
@ -1628,9 +1628,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
if ((ifIt == result.end()) && ((upOnly && intf.isUp()) || !upOnly))
|
||||
result.insert(Map::value_type(ifIndex, intf));
|
||||
|
||||
address = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex);
|
||||
subnetMask = IPAddress(*(iface->ifa_netmask));
|
||||
broadcastAddress = IPAddress();
|
||||
ipAddress = IPAddress(&reinterpret_cast<const struct sockaddr_in6*>(iface->ifa_addr)->sin6_addr, sizeof(struct in6_addr), ifIndex);
|
||||
ipSubnetMask = IPAddress(*(iface->ifa_netmask));
|
||||
ipBroadcastAddress = IPAddress();
|
||||
|
||||
break;
|
||||
#endif
|
||||
@ -1644,11 +1644,11 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
intf = NetworkInterface(std::string(iface->ifa_name), address, subnetMask, broadcastAddress, ifIndex);
|
||||
intf = NetworkInterface(std::string(iface->ifa_name), ipAddress, ipSubnetMask, ipBroadcastAddress, ifIndex);
|
||||
if ((upOnly && intf.isUp()) || !upOnly)
|
||||
{
|
||||
if ((ifIt = result.find(ifIndex)) != result.end())
|
||||
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
|
||||
ifIt->second.addAddress(ipAddress, ipSubnetMask, ipBroadcastAddress);
|
||||
}
|
||||
}
|
||||
} // for interface
|
||||
|
@ -30,8 +30,8 @@ PartSource::PartSource():
|
||||
}
|
||||
|
||||
|
||||
PartSource::PartSource(const std::string& mediaType):
|
||||
_mediaType(mediaType)
|
||||
PartSource::PartSource(const std::string& rMediaType):
|
||||
_mediaType(rMediaType)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace Net {
|
||||
//
|
||||
|
||||
|
||||
PartStore::PartStore(const std::string& mediaType): PartSource(mediaType)
|
||||
PartStore::PartStore(const std::string& rMediaType): PartSource(rMediaType)
|
||||
{
|
||||
}
|
||||
|
||||
@ -44,9 +44,9 @@ PartStore::~PartStore()
|
||||
//
|
||||
|
||||
|
||||
FilePartStore::FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename):
|
||||
PartStore(mediaType),
|
||||
_filename(filename),
|
||||
FilePartStore::FilePartStore(const std::string& content, const std::string& rMediaType, const std::string& rFilename):
|
||||
PartStore(rMediaType),
|
||||
_filename(rFilename),
|
||||
_path(TemporaryFile::tempName()),
|
||||
_fstr(_path)
|
||||
{
|
||||
|
@ -38,10 +38,10 @@ RawSocket::RawSocket(SocketAddress::Family family, int proto):
|
||||
}
|
||||
|
||||
|
||||
RawSocket::RawSocket(const SocketAddress& address, bool reuseAddress):
|
||||
Socket(new RawSocketImpl(address.family()))
|
||||
RawSocket::RawSocket(const SocketAddress& rAddress, bool reuseAddress):
|
||||
Socket(new RawSocketImpl(rAddress.family()))
|
||||
{
|
||||
bind(address, reuseAddress);
|
||||
bind(rAddress, reuseAddress);
|
||||
}
|
||||
|
||||
|
||||
@ -74,15 +74,15 @@ RawSocket& RawSocket::operator = (const Socket& socket)
|
||||
}
|
||||
|
||||
|
||||
void RawSocket::connect(const SocketAddress& address)
|
||||
void RawSocket::connect(const SocketAddress& rAddress)
|
||||
{
|
||||
impl()->connect(address);
|
||||
impl()->connect(rAddress);
|
||||
}
|
||||
|
||||
|
||||
void RawSocket::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void RawSocket::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
impl()->bind(address, reuseAddress);
|
||||
impl()->bind(rAddress, reuseAddress);
|
||||
}
|
||||
|
||||
|
||||
@ -98,15 +98,15 @@ int RawSocket::receiveBytes(void* buffer, int length, int flags)
|
||||
}
|
||||
|
||||
|
||||
int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& address, int flags)
|
||||
int RawSocket::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
return impl()->sendTo(buffer, length, address, flags);
|
||||
return impl()->sendTo(buffer, length, rAddress, flags);
|
||||
}
|
||||
|
||||
|
||||
int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& address, int flags)
|
||||
int RawSocket::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
return impl()->receiveFrom(buffer, length, address, flags);
|
||||
return impl()->receiveFrom(buffer, length, rAddress, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,8 +44,8 @@ RawSocketImpl::RawSocketImpl(SocketAddress::Family family, int proto)
|
||||
}
|
||||
|
||||
|
||||
RawSocketImpl::RawSocketImpl(poco_socket_t sockfd):
|
||||
SocketImpl(sockfd)
|
||||
RawSocketImpl::RawSocketImpl(poco_socket_t socketfd):
|
||||
SocketImpl(socketfd)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,15 +43,15 @@ namespace Net {
|
||||
class MessageNotification: public Poco::Notification
|
||||
{
|
||||
public:
|
||||
MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& sourceAddress):
|
||||
MessageNotification(const char* buffer, std::size_t length, const Poco::Net::SocketAddress& rSourceAddress):
|
||||
_message(buffer, length),
|
||||
_sourceAddress(sourceAddress)
|
||||
_sourceAddress(rSourceAddress)
|
||||
{
|
||||
}
|
||||
|
||||
MessageNotification(const std::string& message, const Poco::Net::SocketAddress& sourceAddress):
|
||||
_message(message),
|
||||
_sourceAddress(sourceAddress)
|
||||
MessageNotification(const std::string& rMessage, const Poco::Net::SocketAddress& rSourceAddress):
|
||||
_message(rMessage),
|
||||
_sourceAddress(rSourceAddress)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
SMTPClientSession::SMTPClientSession(const StreamSocket& socket):
|
||||
_socket(socket),
|
||||
SMTPClientSession::SMTPClientSession(const StreamSocket& rSocket):
|
||||
_socket(rSocket),
|
||||
_isOpen(false)
|
||||
{
|
||||
}
|
||||
@ -346,8 +346,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient
|
||||
for (Recipients::const_iterator it = pRecipients->begin(); it != pRecipients->end(); ++it)
|
||||
{
|
||||
recipient << '<' << *it << '>';
|
||||
int status = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status);
|
||||
int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
|
||||
recipient.str("");
|
||||
}
|
||||
}
|
||||
@ -356,8 +356,8 @@ void SMTPClientSession::sendCommands(const MailMessage& message, const Recipient
|
||||
for (MailMessage::Recipients::const_iterator it = message.recipients().begin(); it != message.recipients().end(); ++it)
|
||||
{
|
||||
recipient << '<' << it->getAddress() << '>';
|
||||
int status = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status);
|
||||
int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
|
||||
recipient.str("");
|
||||
}
|
||||
}
|
||||
@ -393,8 +393,8 @@ void SMTPClientSession::sendAddresses(const std::string& from, const Recipients&
|
||||
{
|
||||
|
||||
recipient << '<' << *it << '>';
|
||||
int status = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(status)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, status);
|
||||
int commandStatus = sendCommand("RCPT TO:", recipient.str(), response);
|
||||
if (!isPositiveCompletion(commandStatus)) throw SMTPException(std::string("Recipient rejected: ") + recipient.str(), response, commandStatus);
|
||||
recipient.str("");
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,9 @@ ServerSocket::ServerSocket(const Socket& socket): Socket(socket)
|
||||
}
|
||||
|
||||
|
||||
ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(new ServerSocketImpl)
|
||||
ServerSocket::ServerSocket(const SocketAddress& rAddress, int backlog): Socket(new ServerSocketImpl)
|
||||
{
|
||||
impl()->bind(address, true);
|
||||
impl()->bind(rAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ ServerSocket::ServerSocket(const SocketAddress& address, int backlog): Socket(ne
|
||||
ServerSocket::ServerSocket(Poco::UInt16 port, int backlog): Socket(new ServerSocketImpl)
|
||||
{
|
||||
IPAddress wildcardAddr;
|
||||
SocketAddress address(wildcardAddr, port);
|
||||
impl()->bind(address, true);
|
||||
SocketAddress socketAddress(wildcardAddr, port);
|
||||
impl()->bind(socketAddress, true);
|
||||
impl()->listen(backlog);
|
||||
}
|
||||
|
||||
@ -74,23 +74,23 @@ ServerSocket& ServerSocket::operator = (const Socket& socket)
|
||||
}
|
||||
|
||||
|
||||
void ServerSocket::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void ServerSocket::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
impl()->bind(address, reuseAddress);
|
||||
impl()->bind(rAddress, reuseAddress);
|
||||
}
|
||||
|
||||
|
||||
void ServerSocket::bind(Poco::UInt16 port, bool reuseAddress)
|
||||
{
|
||||
IPAddress wildcardAddr;
|
||||
SocketAddress address(wildcardAddr, port);
|
||||
impl()->bind(address, reuseAddress);
|
||||
SocketAddress socketAddress(wildcardAddr, port);
|
||||
impl()->bind(socketAddress, reuseAddress);
|
||||
}
|
||||
|
||||
|
||||
void ServerSocket::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only)
|
||||
void ServerSocket::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only)
|
||||
{
|
||||
impl()->bind6(address, reuseAddress, ipV6Only);
|
||||
impl()->bind6(rAddress, reuseAddress, ipV6Only);
|
||||
}
|
||||
|
||||
|
||||
@ -98,8 +98,8 @@ void ServerSocket::bind6(Poco::UInt16 port, bool reuseAddress, bool ipV6Only)
|
||||
{
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
IPAddress wildcardAddr(IPAddress::IPv6);
|
||||
SocketAddress address(wildcardAddr, port);
|
||||
impl()->bind6(address, reuseAddress, ipV6Only);
|
||||
SocketAddress socketAddress(wildcardAddr, port);
|
||||
impl()->bind6(socketAddress, reuseAddress, ipV6Only);
|
||||
#else
|
||||
throw Poco::NotImplementedException("No IPv6 support available");
|
||||
#endif // POCO_HAVE_IPv6
|
||||
|
@ -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));
|
||||
#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));
|
||||
#endif
|
||||
#if defined(POCO_OS_FAMILY_UNIX)
|
||||
else if (length > 0 && length <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX)
|
||||
else if (addressLength > 0 && addressLength <= sizeof(struct sockaddr_un) && sockAddr->sa_family == AF_UNIX)
|
||||
newLocal(reinterpret_cast<const sockaddr_un*>(sockAddr));
|
||||
#endif
|
||||
else throw Poco::InvalidArgumentException("Invalid address length or family passed to SocketAddress()");
|
||||
@ -281,8 +281,8 @@ void SocketAddress::init(const std::string& hostAndPort)
|
||||
{
|
||||
poco_assert (!hostAndPort.empty());
|
||||
|
||||
std::string host;
|
||||
std::string port;
|
||||
std::string socketHost;
|
||||
std::string socketPort;
|
||||
std::string::const_iterator it = hostAndPort.begin();
|
||||
std::string::const_iterator end = hostAndPort.end();
|
||||
|
||||
@ -296,30 +296,30 @@ void SocketAddress::init(const std::string& hostAndPort)
|
||||
if (*it == '[')
|
||||
{
|
||||
++it;
|
||||
while (it != end && *it != ']') host += *it++;
|
||||
while (it != end && *it != ']') socketHost += *it++;
|
||||
if (it == end) throw InvalidArgumentException("Malformed IPv6 address");
|
||||
++it;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (it != end && *it != ':') host += *it++;
|
||||
while (it != end && *it != ':') socketHost += *it++;
|
||||
}
|
||||
if (it != end && *it == ':')
|
||||
{
|
||||
++it;
|
||||
while (it != end) port += *it++;
|
||||
while (it != end) socketPort += *it++;
|
||||
}
|
||||
else throw InvalidArgumentException("Missing port number");
|
||||
init(host, resolveService(port));
|
||||
init(socketHost, resolveService(socketPort));
|
||||
}
|
||||
|
||||
|
||||
Poco::UInt16 SocketAddress::resolveService(const std::string& service)
|
||||
{
|
||||
unsigned port;
|
||||
if (NumberParser::tryParseUnsigned(service, port) && port <= 0xFFFF)
|
||||
unsigned socketPort;
|
||||
if (NumberParser::tryParseUnsigned(service, socketPort) && socketPort <= 0xFFFF)
|
||||
{
|
||||
return (UInt16) port;
|
||||
return (UInt16) socketPort;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,19 +53,19 @@ IPv4SocketAddressImpl::IPv4SocketAddressImpl()
|
||||
}
|
||||
|
||||
|
||||
IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* addr)
|
||||
IPv4SocketAddressImpl::IPv4SocketAddressImpl(const struct sockaddr_in* pAddr)
|
||||
{
|
||||
std::memcpy(&_addr, addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, pAddr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* addr, UInt16 port)
|
||||
IPv4SocketAddressImpl::IPv4SocketAddressImpl(const void* pAddr, UInt16 socketPort)
|
||||
{
|
||||
std::memset(&_addr, 0, sizeof(_addr));
|
||||
_addr.sin_family = AF_INET;
|
||||
poco_set_sin_len(&_addr);
|
||||
std::memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr));
|
||||
_addr.sin_port = port;
|
||||
std::memcpy(&_addr.sin_addr, pAddr, sizeof(_addr.sin_addr));
|
||||
_addr.sin_port = socketPort;
|
||||
}
|
||||
|
||||
|
||||
@ -87,29 +87,29 @@ std::string IPv4SocketAddressImpl::toString() const
|
||||
//
|
||||
|
||||
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* addr)
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const struct sockaddr_in6* pAddr)
|
||||
{
|
||||
std::memcpy(&_addr, addr, sizeof(_addr));
|
||||
std::memcpy(&_addr, pAddr, sizeof(_addr));
|
||||
}
|
||||
|
||||
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port)
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort)
|
||||
{
|
||||
std::memset(&_addr, 0, sizeof(_addr));
|
||||
_addr.sin6_family = AF_INET6;
|
||||
poco_set_sin6_len(&_addr);
|
||||
std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr));
|
||||
_addr.sin6_port = port;
|
||||
std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr));
|
||||
_addr.sin6_port = socketPort;
|
||||
}
|
||||
|
||||
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* addr, UInt16 port, UInt32 scope)
|
||||
IPv6SocketAddressImpl::IPv6SocketAddressImpl(const void* pAddr, UInt16 socketPort, UInt32 scope)
|
||||
{
|
||||
std::memset(&_addr, 0, sizeof(_addr));
|
||||
_addr.sin6_family = AF_INET6;
|
||||
poco_set_sin6_len(&_addr);
|
||||
std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr));
|
||||
_addr.sin6_port = port;
|
||||
std::memcpy(&_addr.sin6_addr, pAddr, sizeof(_addr.sin6_addr));
|
||||
_addr.sin6_port = socketPort;
|
||||
_addr.sin6_scope_id = scope;
|
||||
}
|
||||
|
||||
@ -137,19 +137,19 @@ std::string IPv6SocketAddressImpl::toString() const
|
||||
//
|
||||
|
||||
|
||||
LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* addr)
|
||||
LocalSocketAddressImpl::LocalSocketAddressImpl(const struct sockaddr_un* pAddr)
|
||||
{
|
||||
_pAddr = new sockaddr_un;
|
||||
std::memcpy(_pAddr, addr, sizeof(struct sockaddr_un));
|
||||
std::memcpy(_pAddr, pAddr, sizeof(struct sockaddr_un));
|
||||
}
|
||||
|
||||
|
||||
LocalSocketAddressImpl::LocalSocketAddressImpl(const char* path)
|
||||
LocalSocketAddressImpl::LocalSocketAddressImpl(const char* pPath)
|
||||
{
|
||||
_pAddr = new sockaddr_un;
|
||||
poco_set_sun_len(_pAddr, std::strlen(path) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1);
|
||||
poco_set_sun_len(_pAddr, std::strlen(pPath) + sizeof(struct sockaddr_un) - sizeof(_pAddr->sun_path) + 1);
|
||||
_pAddr->sun_family = AF_UNIX;
|
||||
std::strcpy(_pAddr->sun_path, path);
|
||||
std::strcpy(_pAddr->sun_path, pPath);
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,8 +73,8 @@ SocketImpl::SocketImpl():
|
||||
}
|
||||
|
||||
|
||||
SocketImpl::SocketImpl(poco_socket_t sockfd):
|
||||
_sockfd(sockfd),
|
||||
SocketImpl::SocketImpl(poco_socket_t socketfd):
|
||||
_sockfd(socketfd),
|
||||
_blocking(true),
|
||||
_isBrokenTimeout(checkIsBrokenTimeout())
|
||||
{
|
||||
@ -110,51 +110,51 @@ SocketImpl* SocketImpl::acceptConnection(SocketAddress& clientAddr)
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::connect(const SocketAddress& address)
|
||||
void SocketImpl::connect(const SocketAddress& rAddress)
|
||||
{
|
||||
if (_sockfd == POCO_INVALID_SOCKET)
|
||||
{
|
||||
init(address.af());
|
||||
init(rAddress.af());
|
||||
}
|
||||
int rc;
|
||||
do
|
||||
{
|
||||
#if defined(POCO_VXWORKS)
|
||||
rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length());
|
||||
rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
|
||||
#else
|
||||
rc = ::connect(_sockfd, address.addr(), address.length());
|
||||
rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
|
||||
#endif
|
||||
}
|
||||
while (rc != 0 && lastError() == POCO_EINTR);
|
||||
if (rc != 0)
|
||||
{
|
||||
int err = lastError();
|
||||
error(err, address.toString());
|
||||
error(err, rAddress.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout)
|
||||
void SocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout)
|
||||
{
|
||||
if (_sockfd == POCO_INVALID_SOCKET)
|
||||
{
|
||||
init(address.af());
|
||||
init(rAddress.af());
|
||||
}
|
||||
setBlocking(false);
|
||||
try
|
||||
{
|
||||
#if defined(POCO_VXWORKS)
|
||||
int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length());
|
||||
int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
|
||||
#else
|
||||
int rc = ::connect(_sockfd, address.addr(), address.length());
|
||||
int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
|
||||
#endif
|
||||
if (rc != 0)
|
||||
{
|
||||
int err = lastError();
|
||||
if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK)
|
||||
error(err, address.toString());
|
||||
error(err, rAddress.toString());
|
||||
if (!poll(timeout, SELECT_READ | SELECT_WRITE | SELECT_ERROR))
|
||||
throw Poco::TimeoutException("connect timed out", address.toString());
|
||||
throw Poco::TimeoutException("connect timed out", rAddress.toString());
|
||||
err = socketError();
|
||||
if (err != 0) error(err);
|
||||
}
|
||||
@ -168,32 +168,32 @@ void SocketImpl::connect(const SocketAddress& address, const Poco::Timespan& tim
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::connectNB(const SocketAddress& address)
|
||||
void SocketImpl::connectNB(const SocketAddress& rAddress)
|
||||
{
|
||||
if (_sockfd == POCO_INVALID_SOCKET)
|
||||
{
|
||||
init(address.af());
|
||||
init(rAddress.af());
|
||||
}
|
||||
setBlocking(false);
|
||||
#if defined(POCO_VXWORKS)
|
||||
int rc = ::connect(_sockfd, (sockaddr*) address.addr(), address.length());
|
||||
int rc = ::connect(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
|
||||
#else
|
||||
int rc = ::connect(_sockfd, address.addr(), address.length());
|
||||
int rc = ::connect(_sockfd, rAddress.addr(), rAddress.length());
|
||||
#endif
|
||||
if (rc != 0)
|
||||
{
|
||||
int err = lastError();
|
||||
if (err != POCO_EINPROGRESS && err != POCO_EWOULDBLOCK)
|
||||
error(err, address.toString());
|
||||
error(err, rAddress.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void SocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
if (_sockfd == POCO_INVALID_SOCKET)
|
||||
{
|
||||
init(address.af());
|
||||
init(rAddress.af());
|
||||
}
|
||||
if (reuseAddress)
|
||||
{
|
||||
@ -201,23 +201,23 @@ void SocketImpl::bind(const SocketAddress& address, bool reuseAddress)
|
||||
setReusePort(true);
|
||||
}
|
||||
#if defined(POCO_VXWORKS)
|
||||
int rc = ::bind(_sockfd, (sockaddr*) address.addr(), address.length());
|
||||
int rc = ::bind(_sockfd, (sockaddr*) rAddress.addr(), rAddress.length());
|
||||
#else
|
||||
int rc = ::bind(_sockfd, address.addr(), address.length());
|
||||
int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length());
|
||||
#endif
|
||||
if (rc != 0) error(address.toString());
|
||||
if (rc != 0) error(rAddress.toString());
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only)
|
||||
void SocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only)
|
||||
{
|
||||
#if defined(POCO_HAVE_IPv6)
|
||||
if (address.family() != SocketAddress::IPv6)
|
||||
if (rAddress.family() != SocketAddress::IPv6)
|
||||
throw Poco::InvalidArgumentException("SocketAddress must be an IPv6 address");
|
||||
|
||||
if (_sockfd == POCO_INVALID_SOCKET)
|
||||
{
|
||||
init(address.af());
|
||||
init(rAddress.af());
|
||||
}
|
||||
#ifdef IPV6_V6ONLY
|
||||
setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0);
|
||||
@ -229,8 +229,8 @@ void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV
|
||||
setReuseAddress(true);
|
||||
setReusePort(true);
|
||||
}
|
||||
int rc = ::bind(_sockfd, address.addr(), address.length());
|
||||
if (rc != 0) error(address.toString());
|
||||
int rc = ::bind(_sockfd, rAddress.addr(), rAddress.length());
|
||||
if (rc != 0) error(rAddress.toString());
|
||||
#else
|
||||
throw Poco::NotImplementedException("No IPv6 support available");
|
||||
#endif
|
||||
@ -338,16 +338,16 @@ int SocketImpl::receiveBytes(void* buffer, int length, int flags)
|
||||
}
|
||||
|
||||
|
||||
int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags)
|
||||
int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
int rc;
|
||||
do
|
||||
{
|
||||
if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
|
||||
#if defined(POCO_VXWORKS)
|
||||
rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) address.addr(), address.length());
|
||||
rc = ::sendto(_sockfd, (char*) buffer, length, flags, (sockaddr*) rAddress.addr(), rAddress.length());
|
||||
#else
|
||||
rc = ::sendto(_sockfd, reinterpret_cast<const char*>(buffer), length, flags, address.addr(), address.length());
|
||||
rc = ::sendto(_sockfd, reinterpret_cast<const char*>(buffer), length, flags, rAddress.addr(), rAddress.length());
|
||||
#endif
|
||||
}
|
||||
while (_blocking && rc < 0 && lastError() == POCO_EINTR);
|
||||
@ -356,7 +356,7 @@ int SocketImpl::sendTo(const void* buffer, int length, const SocketAddress& addr
|
||||
}
|
||||
|
||||
|
||||
int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags)
|
||||
int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
if (_isBrokenTimeout)
|
||||
{
|
||||
@ -379,7 +379,7 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, in
|
||||
while (_blocking && rc < 0 && lastError() == POCO_EINTR);
|
||||
if (rc >= 0)
|
||||
{
|
||||
address = SocketAddress(pSA, saLen);
|
||||
rAddress = SocketAddress(pSA, saLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -420,8 +420,8 @@ bool SocketImpl::secure() const
|
||||
|
||||
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
{
|
||||
poco_socket_t sockfd = _sockfd;
|
||||
if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
|
||||
poco_socket_t socketfd = _sockfd;
|
||||
if (socketfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
|
||||
|
||||
#if defined(POCO_HAVE_FD_EPOLL)
|
||||
|
||||
@ -443,7 +443,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
if (mode & SELECT_ERROR)
|
||||
evin.events |= EPOLLERR;
|
||||
|
||||
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sockfd, &evin) < 0)
|
||||
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, socketfd, &evin) < 0)
|
||||
{
|
||||
char buf[1024];
|
||||
strerror_r(errno, buf, sizeof(buf));
|
||||
@ -516,15 +516,15 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
FD_ZERO(&fdExcept);
|
||||
if (mode & SELECT_READ)
|
||||
{
|
||||
FD_SET(sockfd, &fdRead);
|
||||
FD_SET(socketfd, &fdRead);
|
||||
}
|
||||
if (mode & SELECT_WRITE)
|
||||
{
|
||||
FD_SET(sockfd, &fdWrite);
|
||||
FD_SET(socketfd, &fdWrite);
|
||||
}
|
||||
if (mode & SELECT_ERROR)
|
||||
{
|
||||
FD_SET(sockfd, &fdExcept);
|
||||
FD_SET(socketfd, &fdExcept);
|
||||
}
|
||||
Poco::Timespan remainingTime(timeout);
|
||||
int errorCode = POCO_ENOERR;
|
||||
@ -535,7 +535,7 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
tv.tv_sec = (long) remainingTime.totalSeconds();
|
||||
tv.tv_usec = (long) remainingTime.useconds();
|
||||
Poco::Timestamp start;
|
||||
rc = ::select(int(sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv);
|
||||
rc = ::select(int(socketfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv);
|
||||
if (rc < 0 && (errorCode = lastError()) == POCO_EINTR)
|
||||
{
|
||||
Poco::Timestamp end;
|
||||
|
@ -32,9 +32,9 @@ SocketNotification::~SocketNotification()
|
||||
}
|
||||
|
||||
|
||||
void SocketNotification::setSocket(const Socket& socket)
|
||||
void SocketNotification::setSocket(const Socket& rSocket)
|
||||
{
|
||||
_socket = socket;
|
||||
_socket = rSocket;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,8 +66,8 @@ int SocketStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
|
||||
//
|
||||
|
||||
|
||||
SocketIOS::SocketIOS(const Socket& socket):
|
||||
_buf(socket)
|
||||
SocketIOS::SocketIOS(const Socket& rSocket):
|
||||
_buf(rSocket)
|
||||
{
|
||||
poco_ios_init(&_buf);
|
||||
}
|
||||
@ -109,8 +109,8 @@ StreamSocket SocketIOS::socket() const
|
||||
//
|
||||
|
||||
|
||||
SocketOutputStream::SocketOutputStream(const Socket& socket):
|
||||
SocketIOS(socket),
|
||||
SocketOutputStream::SocketOutputStream(const Socket& rSocket):
|
||||
SocketIOS(rSocket),
|
||||
std::ostream(&_buf)
|
||||
{
|
||||
}
|
||||
@ -126,8 +126,8 @@ SocketOutputStream::~SocketOutputStream()
|
||||
//
|
||||
|
||||
|
||||
SocketInputStream::SocketInputStream(const Socket& socket):
|
||||
SocketIOS(socket),
|
||||
SocketInputStream::SocketInputStream(const Socket& rSocket):
|
||||
SocketIOS(rSocket),
|
||||
std::istream(&_buf)
|
||||
{
|
||||
}
|
||||
@ -143,8 +143,8 @@ SocketInputStream::~SocketInputStream()
|
||||
//
|
||||
|
||||
|
||||
SocketStream::SocketStream(const Socket& socket):
|
||||
SocketIOS(socket),
|
||||
SocketStream::SocketStream(const Socket& rSocket):
|
||||
SocketIOS(rSocket),
|
||||
std::iostream(&_buf)
|
||||
{
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,17 +28,17 @@ StringPartSource::StringPartSource(const std::string& str):
|
||||
}
|
||||
|
||||
|
||||
StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType):
|
||||
PartSource(mediaType),
|
||||
StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType):
|
||||
PartSource(rMediaType),
|
||||
_istr(str)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
StringPartSource::StringPartSource(const std::string& str, const std::string& mediaType, const std::string& filename):
|
||||
PartSource(mediaType),
|
||||
StringPartSource::StringPartSource(const std::string& str, const std::string& rMediaType, const std::string& rFilename):
|
||||
PartSource(rMediaType),
|
||||
_istr(str),
|
||||
_filename(filename)
|
||||
_filename(rFilename)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,9 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 port
|
||||
}
|
||||
|
||||
|
||||
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams):
|
||||
_socket(socket),
|
||||
_thread(threadName(socket)),
|
||||
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& rSocket, TCPServerParams::Ptr pParams):
|
||||
_socket(rSocket),
|
||||
_thread(threadName(rSocket)),
|
||||
_stopped(true)
|
||||
{
|
||||
Poco::ThreadPool& pool = Poco::ThreadPool::defaultPool();
|
||||
@ -61,10 +61,10 @@ TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocke
|
||||
}
|
||||
|
||||
|
||||
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams):
|
||||
_socket(socket),
|
||||
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& rSocket, TCPServerParams::Ptr pParams):
|
||||
_socket(rSocket),
|
||||
_pDispatcher(new TCPServerDispatcher(pFactory, threadPool, pParams)),
|
||||
_thread(threadName(socket)),
|
||||
_thread(threadName(rSocket)),
|
||||
_stopped(true)
|
||||
{
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
TCPServerConnection::TCPServerConnection(const StreamSocket& socket):
|
||||
_socket(socket)
|
||||
TCPServerConnection::TCPServerConnection(const StreamSocket& rSocket):
|
||||
_socket(rSocket)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ namespace Net {
|
||||
class TCPConnectionNotification: public Notification
|
||||
{
|
||||
public:
|
||||
TCPConnectionNotification(const StreamSocket& socket):
|
||||
_socket(socket)
|
||||
TCPConnectionNotification(const StreamSocket& rSocket):
|
||||
_socket(rSocket)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload):
|
||||
WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool isMustMaskPayload):
|
||||
StreamSocketImpl(pStreamSocketImpl->sockfd()),
|
||||
_pStreamSocketImpl(pStreamSocketImpl),
|
||||
_frameFlags(0),
|
||||
_mustMaskPayload(mustMaskPayload)
|
||||
_mustMaskPayload(isMustMaskPayload)
|
||||
{
|
||||
poco_check_ptr(pStreamSocketImpl);
|
||||
_pStreamSocketImpl->duplicate();
|
||||
@ -232,31 +232,31 @@ SocketImpl* WebSocketImpl::acceptConnection(SocketAddress& clientAddr)
|
||||
}
|
||||
|
||||
|
||||
void WebSocketImpl::connect(const SocketAddress& address)
|
||||
void WebSocketImpl::connect(const SocketAddress& rAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
void WebSocketImpl::connect(const SocketAddress& address, const Poco::Timespan& timeout)
|
||||
void WebSocketImpl::connect(const SocketAddress& rAddress, const Poco::Timespan& timeout)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connect() a WebSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
void WebSocketImpl::connectNB(const SocketAddress& address)
|
||||
void WebSocketImpl::connectNB(const SocketAddress& rAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot connectNB() a WebSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
void WebSocketImpl::bind(const SocketAddress& address, bool reuseAddress)
|
||||
void WebSocketImpl::bind(const SocketAddress& rAddress, bool reuseAddress)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot bind() a WebSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
void WebSocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV6Only)
|
||||
void WebSocketImpl::bind6(const SocketAddress& rAddress, bool reuseAddress, bool ipV6Only)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot bind6() a WebSocketImpl");
|
||||
}
|
||||
@ -293,13 +293,13 @@ void WebSocketImpl::shutdown()
|
||||
}
|
||||
|
||||
|
||||
int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& address, int flags)
|
||||
int WebSocketImpl::sendTo(const void* buffer, int length, const SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot sendTo() on a WebSocketImpl");
|
||||
}
|
||||
|
||||
|
||||
int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, int flags)
|
||||
int WebSocketImpl::receiveFrom(void* buffer, int length, SocketAddress& rAddress, int flags)
|
||||
{
|
||||
throw Poco::InvalidAccessException("Cannot receiveFrom() on a WebSocketImpl");
|
||||
}
|
||||
|
@ -551,6 +551,23 @@
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
|
||||
</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>
|
||||
<Globals/>
|
||||
</VisualStudioProject>
|
||||
|
@ -316,6 +316,8 @@
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
@ -328,6 +330,8 @@
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -316,6 +316,8 @@
|
||||
<ClInclude Include="src\NetSSLTestSuite.h"/>
|
||||
<ClInclude Include="src\TCPServerTest.h"/>
|
||||
<ClInclude Include="src\TCPServerTestSuite.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
@ -328,6 +330,8 @@
|
||||
<ClCompile Include="src\TCPServerTest.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\WinCEDriver.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -321,6 +321,8 @@
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
@ -333,6 +335,8 @@
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -321,6 +321,8 @@
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
@ -333,6 +335,8 @@
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -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">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="debug_shared|Win32">
|
||||
@ -32,7 +32,7 @@
|
||||
<RootNamespace>TestSuite</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</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">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
@ -63,27 +63,27 @@
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
||||
<ImportGroup Label="ExtensionSettings"/>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<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 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 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 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 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 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>
|
||||
<PropertyGroup Label="UserMacros"/>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName>
|
||||
@ -136,7 +136,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -167,9 +167,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -196,7 +196,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -227,9 +227,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -256,7 +256,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -287,9 +287,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -304,28 +304,32 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTest.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\HTTPSTestServer.h"/>
|
||||
<ClInclude Include="src\NetSSLTestSuite.h"/>
|
||||
<ClInclude Include="src\TCPServerTest.h"/>
|
||||
<ClInclude Include="src\TCPServerTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h" />
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h" />
|
||||
<ClInclude Include="src\HTTPSServerTest.h" />
|
||||
<ClInclude Include="src\HTTPSServerTestSuite.h" />
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h" />
|
||||
<ClInclude Include="src\HTTPSTestServer.h" />
|
||||
<ClInclude Include="src\NetSSLTestSuite.h" />
|
||||
<ClInclude Include="src\TCPServerTest.h" />
|
||||
<ClInclude Include="src\TCPServerTestSuite.h" />
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Driver.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSServerTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTest.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\Driver.cpp" />
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp" />
|
||||
<ClCompile Include="src\HTTPSServerTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSServerTestSuite.cpp" />
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp" />
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp" />
|
||||
<ClCompile Include="src\TCPServerTest.cpp" />
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp" />
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
</Project>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
@ -52,6 +52,9 @@
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{40e36c0c-5808-4c87-aa2e-04c0ffa6f35e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Websocket">
|
||||
<UniqueIdentifier>{9243a946-e87f-42f5-adba-efbb4823f93c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\HTTPSTestServer.h">
|
||||
@ -81,6 +84,12 @@
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h">
|
||||
<Filter>HTTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>Websocket</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTestSuite.h">
|
||||
<Filter>Websocket</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp">
|
||||
@ -113,5 +122,11 @@
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
|
||||
<Filter>HTTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTest.cpp">
|
||||
<Filter>Websocket</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>Websocket</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -313,6 +313,8 @@
|
||||
<ClInclude Include="src\NetSSLTestSuite.h"/>
|
||||
<ClInclude Include="src\TCPServerTest.h"/>
|
||||
<ClInclude Include="src\TCPServerTestSuite.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Driver.cpp"/>
|
||||
@ -325,6 +327,8 @@
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTest.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -532,6 +532,23 @@
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
|
||||
</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>
|
||||
<Globals/>
|
||||
</VisualStudioProject>
|
||||
|
@ -321,6 +321,8 @@
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
@ -333,6 +335,8 @@
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -321,6 +321,8 @@
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
@ -333,6 +335,8 @@
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -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">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="debug_shared|x64">
|
||||
@ -32,7 +32,7 @@
|
||||
<RootNamespace>TestSuite</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</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">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
@ -63,27 +63,27 @@
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
||||
<ImportGroup Label="ExtensionSettings"/>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<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 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 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 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 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 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>
|
||||
<PropertyGroup Label="UserMacros"/>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>12.0.30501.0</_ProjectFileVersion>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|x64'">TestSuited</TargetName>
|
||||
@ -136,7 +136,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -167,9 +167,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -196,7 +196,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -227,9 +227,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -256,7 +256,7 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
@ -287,9 +287,9 @@
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader/>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat/>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -304,28 +304,32 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h"/>
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTest.h"/>
|
||||
<ClInclude Include="src\HTTPSServerTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h"/>
|
||||
<ClInclude Include="src\HTTPSTestServer.h"/>
|
||||
<ClInclude Include="src\NetSSLTestSuite.h"/>
|
||||
<ClInclude Include="src\TCPServerTest.h"/>
|
||||
<ClInclude Include="src\TCPServerTestSuite.h"/>
|
||||
<ClInclude Include="src\HTTPSClientSessionTest.h" />
|
||||
<ClInclude Include="src\HTTPSClientTestSuite.h" />
|
||||
<ClInclude Include="src\HTTPSServerTest.h" />
|
||||
<ClInclude Include="src\HTTPSServerTestSuite.h" />
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h" />
|
||||
<ClInclude Include="src\HTTPSTestServer.h" />
|
||||
<ClInclude Include="src\NetSSLTestSuite.h" />
|
||||
<ClInclude Include="src\TCPServerTest.h" />
|
||||
<ClInclude Include="src\TCPServerTestSuite.h" />
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Driver.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSServerTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp"/>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp"/>
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTest.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\Driver.cpp" />
|
||||
<ClCompile Include="src\HTTPSClientSessionTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSClientTestSuite.cpp" />
|
||||
<ClCompile Include="src\HTTPSServerTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSServerTestSuite.cpp" />
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp" />
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp" />
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp" />
|
||||
<ClCompile Include="src\TCPServerTest.cpp" />
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp" />
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
</Project>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
@ -52,6 +52,9 @@
|
||||
<Filter Include="HTTPSClient\Source Files">
|
||||
<UniqueIdentifier>{363ebde9-9367-44b7-aa1b-dcb421bb759c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="WebSocket">
|
||||
<UniqueIdentifier>{14c12fc4-d7e0-4311-a59e-f499f1993c3b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\HTTPSTestServer.h">
|
||||
@ -81,6 +84,12 @@
|
||||
<ClInclude Include="src\HTTPSStreamFactoryTest.h">
|
||||
<Filter>HTTPSClient\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTest.h">
|
||||
<Filter>WebSocket</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\WebSocketTestSuite.h">
|
||||
<Filter>WebSocket</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\HTTPSTestServer.cpp">
|
||||
@ -113,5 +122,11 @@
|
||||
<ClCompile Include="src\HTTPSStreamFactoryTest.cpp">
|
||||
<Filter>HTTPSClient\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTest.cpp">
|
||||
<Filter>WebSocket</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp">
|
||||
<Filter>WebSocket</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -313,6 +313,8 @@
|
||||
<ClInclude Include="src\NetSSLTestSuite.h"/>
|
||||
<ClInclude Include="src\TCPServerTest.h"/>
|
||||
<ClInclude Include="src\TCPServerTestSuite.h"/>
|
||||
<ClInclude Include="src\WebSocketTest.h" />
|
||||
<ClInclude Include="src\WebSocketTestSuite.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Driver.cpp"/>
|
||||
@ -325,6 +327,8 @@
|
||||
<ClCompile Include="src\NetSSLTestSuite.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTest.cpp"/>
|
||||
<ClCompile Include="src\TCPServerTestSuite.cpp"/>
|
||||
<ClCompile Include="src\WebSocketTest.cpp" />
|
||||
<ClCompile Include="src\WebSocketTestSuite.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets"/>
|
||||
|
@ -532,6 +532,23 @@
|
||||
RelativePath=".\src\HTTPSStreamFactoryTest.cpp"/>
|
||||
</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>
|
||||
<Globals/>
|
||||
</VisualStudioProject>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "HTTPSClientTestSuite.h"
|
||||
#include "TCPServerTestSuite.h"
|
||||
#include "HTTPSServerTestSuite.h"
|
||||
#include "WebSocketTestSuite.h"
|
||||
|
||||
|
||||
CppUnit::Test* NetSSLTestSuite::suite()
|
||||
@ -24,6 +25,7 @@ CppUnit::Test* NetSSLTestSuite::suite()
|
||||
pSuite->addTest(HTTPSClientTestSuite::suite());
|
||||
pSuite->addTest(TCPServerTestSuite::suite());
|
||||
pSuite->addTest(HTTPSServerTestSuite::suite());
|
||||
pSuite->addTest(WebSocketTestSuite::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
231
NetSSL_Win/testsuite/src/WebSocketTest.cpp
Normal file
231
NetSSL_Win/testsuite/src/WebSocketTest.cpp
Normal 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;
|
||||
}
|
41
NetSSL_Win/testsuite/src/WebSocketTest.h
Normal file
41
NetSSL_Win/testsuite/src/WebSocketTest.h
Normal 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
|
24
NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp
Normal file
24
NetSSL_Win/testsuite/src/WebSocketTestSuite.cpp
Normal 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;
|
||||
}
|
29
NetSSL_Win/testsuite/src/WebSocketTestSuite.h
Normal file
29
NetSSL_Win/testsuite/src/WebSocketTestSuite.h
Normal 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
|
@ -1,10 +1,3 @@
|
||||
//
|
||||
// TimeHandler.cpp
|
||||
//
|
||||
// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54.
|
||||
//
|
||||
|
||||
|
||||
#include "TimeHandler.h"
|
||||
#include "Poco/Net/HTTPServerRequest.h"
|
||||
#include "Poco/Net/HTTPServerResponse.h"
|
||||
@ -28,7 +21,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net
|
||||
responseStream << "\n";
|
||||
responseStream << "\n";
|
||||
responseStream << "";
|
||||
#line 6 "/ws/poco-1.3/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp"
|
||||
#line 6 "/cygdrive/z/git/poco/PageCompiler/samples/HTTPTimeServer/src/TimeHandler.cpsp"
|
||||
|
||||
Poco::DateTime now;
|
||||
std::string dt(Poco::DateTimeFormatter::format(now, "%W, %e %b %y %H:%M:%S %Z"));
|
||||
@ -40,7 +33,7 @@ void TimeHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net
|
||||
responseStream << "</head>\n";
|
||||
responseStream << "<body>\n";
|
||||
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 << "</p>\n";
|
||||
responseStream << "</body>\n";
|
||||
|
@ -1,10 +1,3 @@
|
||||
//
|
||||
// TimeHandler.h
|
||||
//
|
||||
// This file has been generated from TimeHandler.cpsp on 2010-01-28 08:49:54.
|
||||
//
|
||||
|
||||
|
||||
#ifndef TimeHandler_INCLUDED
|
||||
#define TimeHandler_INCLUDED
|
||||
|
||||
|
@ -54,9 +54,9 @@ public:
|
||||
/// A key-value pair, used as event argument.
|
||||
{
|
||||
public:
|
||||
KeyValue(const std::string& key, std::string& value):
|
||||
_key(key),
|
||||
_value(value)
|
||||
KeyValue(const std::string& rKey, std::string& rValue):
|
||||
_key(rKey),
|
||||
_value(rValue)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -471,9 +471,9 @@ inline const Poco::Timestamp& Application::startTime() const
|
||||
inline Poco::Timespan Application::uptime() const
|
||||
{
|
||||
Poco::Timestamp now;
|
||||
Poco::Timespan uptime = now - _startTime;
|
||||
Poco::Timespan ret = now - _startTime;
|
||||
|
||||
return uptime;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -423,11 +423,11 @@ std::string AbstractConfiguration::internalExpand(const std::string& value) cons
|
||||
}
|
||||
|
||||
|
||||
std::string AbstractConfiguration::uncheckedExpand(const std::string& value) const
|
||||
std::string AbstractConfiguration::uncheckedExpand(const std::string& rValue) const
|
||||
{
|
||||
std::string result;
|
||||
std::string::const_iterator it = value.begin();
|
||||
std::string::const_iterator end = value.end();
|
||||
std::string::const_iterator it = rValue.begin();
|
||||
std::string::const_iterator end = rValue.end();
|
||||
while (it != end)
|
||||
{
|
||||
if (*it == '$')
|
||||
|
@ -78,7 +78,7 @@ Application::Application():
|
||||
}
|
||||
|
||||
|
||||
Application::Application(int argc, char* argv[]):
|
||||
Application::Application(int argc, char* pArgv[]):
|
||||
_pConfig(new LayeredConfiguration),
|
||||
_initialized(false),
|
||||
_unixOptions(true),
|
||||
@ -87,7 +87,7 @@ Application::Application(int argc, char* argv[]):
|
||||
_loadedConfigs(0)
|
||||
{
|
||||
setup();
|
||||
init(argc, argv);
|
||||
init(argc, pArgv);
|
||||
}
|
||||
|
||||
|
||||
@ -131,9 +131,9 @@ void Application::addSubsystem(Subsystem* pSubsystem)
|
||||
}
|
||||
|
||||
|
||||
void Application::init(int argc, char* argv[])
|
||||
void Application::init(int argc, char* pArgv[])
|
||||
{
|
||||
setArgs(argc, argv);
|
||||
setArgs(argc, pArgv);
|
||||
init();
|
||||
}
|
||||
|
||||
@ -363,15 +363,15 @@ int Application::main(const ArgVec& args)
|
||||
}
|
||||
|
||||
|
||||
void Application::setArgs(int argc, char* argv[])
|
||||
void Application::setArgs(int argc, char* pArgv[])
|
||||
{
|
||||
_command = argv[0];
|
||||
_command = pArgv[0];
|
||||
_pConfig->setInt("application.argc", argc);
|
||||
_unprocessedArgs.reserve(argc);
|
||||
std::string argvKey = "application.argv[";
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
std::string arg(argv[i]);
|
||||
std::string arg(pArgv[i]);
|
||||
_pConfig->setString(argvKey + NumberFormatter::format(i) + "]", arg);
|
||||
_unprocessedArgs.push_back(arg);
|
||||
}
|
||||
@ -403,13 +403,13 @@ void Application::processOptions()
|
||||
ArgVec::iterator it = _unprocessedArgs.begin();
|
||||
while (it != _unprocessedArgs.end() && !_stopOptionsProcessing)
|
||||
{
|
||||
std::string name;
|
||||
std::string argName;
|
||||
std::string value;
|
||||
if (processor.process(*it, name, value))
|
||||
if (processor.process(*it, argName, value))
|
||||
{
|
||||
if (!name.empty()) // "--" option to end options processing or deferred argument
|
||||
if (!argName.empty()) // "--" option to end options processing or deferred argument
|
||||
{
|
||||
handleOption(name, value);
|
||||
handleOption(argName, value);
|
||||
}
|
||||
it = _unprocessedArgs.erase(it);
|
||||
}
|
||||
@ -536,18 +536,18 @@ bool Application::findAppConfigFile(const Path& basePath, const std::string& app
|
||||
}
|
||||
|
||||
|
||||
void Application::defineOptions(OptionSet& options)
|
||||
void Application::defineOptions(OptionSet& rOptions)
|
||||
{
|
||||
for (SubsystemVec::iterator it = _subsystems.begin(); it != _subsystems.end(); ++it)
|
||||
{
|
||||
(*it)->defineOptions(options);
|
||||
(*it)->defineOptions(rOptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Application::handleOption(const std::string& name, const std::string& value)
|
||||
void Application::handleOption(const std::string& rName, const std::string& value)
|
||||
{
|
||||
const Option& option = _options.getOption(name);
|
||||
const Option& option = _options.getOption(rName);
|
||||
if (option.validator())
|
||||
{
|
||||
option.validator()->validate(option, value);
|
||||
@ -560,14 +560,14 @@ void Application::handleOption(const std::string& name, const std::string& value
|
||||
}
|
||||
if (option.callback())
|
||||
{
|
||||
option.callback()->invoke(name, value);
|
||||
option.callback()->invoke(rName, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Application::setLogger(Logger& logger)
|
||||
void Application::setLogger(Logger& rLogger)
|
||||
{
|
||||
_pLogger = &logger;
|
||||
_pLogger = &rLogger;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ void IniFileConfiguration::setRaw(const std::string& key, const std::string& val
|
||||
|
||||
void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
std::set<std::string> keySet;
|
||||
std::string prefix = key;
|
||||
if (!prefix.empty()) prefix += '.';
|
||||
std::string::size_type psize = prefix.size();
|
||||
@ -114,10 +114,10 @@ void IniFileConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
subKey = it->first.substr(psize);
|
||||
else
|
||||
subKey = it->first.substr(psize, end - psize);
|
||||
if (keys.find(subKey) == keys.end())
|
||||
if (keySet.find(subKey) == keySet.end())
|
||||
{
|
||||
range.push_back(subKey);
|
||||
keys.insert(subKey);
|
||||
keySet.insert(subKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,4 +189,4 @@ void IniFileConfiguration::parseLine(std::istream& istr)
|
||||
} } // namespace Poco::Util
|
||||
|
||||
|
||||
#endif // POCO_UTIL_NO_INIFILECONFIGURATION
|
||||
#endif // POCO_UTIL_NO_INIFILECONFIGURATION
|
||||
|
@ -167,7 +167,7 @@ JSON::Object::Ptr JSONConfiguration::findStart(const std::string& key, std::stri
|
||||
parentArray->add(newArray);
|
||||
}
|
||||
|
||||
for(int i = 0; i <= *it - 1; ++i)
|
||||
for(int j = 0; j <= *it - 1; ++j)
|
||||
{
|
||||
Poco::DynamicAny nullValue;
|
||||
newArray->add(nullValue);
|
||||
|
@ -140,17 +140,17 @@ void LayeredConfiguration::setRaw(const std::string& key, const std::string& val
|
||||
|
||||
void LayeredConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
std::set<std::string> keySet;
|
||||
for (ConfigList::const_iterator itc = _configs.begin(); itc != _configs.end(); ++itc)
|
||||
{
|
||||
Keys partRange;
|
||||
itc->pConfig->enumerate(key, partRange);
|
||||
for (Keys::const_iterator itr = partRange.begin(); itr != partRange.end(); ++itr)
|
||||
{
|
||||
if (keys.find(*itr) == keys.end())
|
||||
if (keySet.find(*itr) == keySet.end())
|
||||
{
|
||||
range.push_back(*itr);
|
||||
keys.insert(*itr);
|
||||
keySet.insert(*itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void MapConfiguration::setRaw(const std::string& key, const std::string& value)
|
||||
|
||||
void MapConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
std::set<std::string> keySet;
|
||||
std::string prefix = key;
|
||||
if (!prefix.empty()) prefix += '.';
|
||||
std::string::size_type psize = prefix.size();
|
||||
@ -67,15 +67,15 @@ void MapConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
if (it->first.compare(0, psize, prefix) == 0)
|
||||
{
|
||||
std::string subKey;
|
||||
std::string::size_type end = it->first.find('.', psize);
|
||||
if (end == std::string::npos)
|
||||
std::string::size_type pos = it->first.find('.', psize);
|
||||
if (pos == std::string::npos)
|
||||
subKey = it->first.substr(psize);
|
||||
else
|
||||
subKey = it->first.substr(psize, end - psize);
|
||||
if (keys.find(subKey) == keys.end())
|
||||
subKey = it->first.substr(psize, pos - psize);
|
||||
if (keySet.find(subKey) == keySet.end())
|
||||
{
|
||||
range.push_back(subKey);
|
||||
keys.insert(subKey);
|
||||
keySet.insert(subKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ Option::Option(const Option& option):
|
||||
}
|
||||
|
||||
|
||||
Option::Option(const std::string& fullName, const std::string& shortName):
|
||||
_shortName(shortName),
|
||||
_fullName(fullName),
|
||||
Option::Option(const std::string& rFullName, const std::string& rShortName):
|
||||
_shortName(rShortName),
|
||||
_fullName(rFullName),
|
||||
_required(false),
|
||||
_repeatable(false),
|
||||
_argRequired(false),
|
||||
@ -73,11 +73,11 @@ Option::Option(const std::string& fullName, const std::string& shortName):
|
||||
}
|
||||
|
||||
|
||||
Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required):
|
||||
_shortName(shortName),
|
||||
_fullName(fullName),
|
||||
_description(description),
|
||||
_required(required),
|
||||
Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired):
|
||||
_shortName(rShortName),
|
||||
_fullName(rFullName),
|
||||
_description(rDescription),
|
||||
_required(isRequired),
|
||||
_repeatable(false),
|
||||
_argRequired(false),
|
||||
_pValidator(0),
|
||||
@ -87,11 +87,11 @@ Option::Option(const std::string& fullName, const std::string& shortName, const
|
||||
}
|
||||
|
||||
|
||||
Option::Option(const std::string& fullName, const std::string& shortName, const std::string& description, bool required, const std::string& argName, bool argRequired):
|
||||
_shortName(shortName),
|
||||
_fullName(fullName),
|
||||
_description(description),
|
||||
_required(required),
|
||||
Option::Option(const std::string& rFullName, const std::string& rShortName, const std::string& rDescription, bool isRequired, const std::string& argName, bool argRequired):
|
||||
_shortName(rShortName),
|
||||
_fullName(rFullName),
|
||||
_description(rDescription),
|
||||
_required(isRequired),
|
||||
_repeatable(false),
|
||||
_argName(argName),
|
||||
_argRequired(argRequired),
|
||||
@ -173,10 +173,10 @@ Option& Option::repeatable(bool flag)
|
||||
}
|
||||
|
||||
|
||||
Option& Option::argument(const std::string& name, bool required)
|
||||
Option& Option::argument(const std::string& name, bool isRequired)
|
||||
{
|
||||
_argName = name;
|
||||
_argRequired = required;
|
||||
_argRequired = isRequired;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -189,9 +189,9 @@ Option& Option::noArgument()
|
||||
}
|
||||
|
||||
|
||||
Option& Option::group(const std::string& group)
|
||||
Option& Option::group(const std::string& rGroup)
|
||||
{
|
||||
_group = group;
|
||||
_group = rGroup;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -610,16 +610,16 @@ void ServerApplication::waitForTerminationRequest()
|
||||
}
|
||||
|
||||
|
||||
int ServerApplication::run(int argc, char** argv)
|
||||
int ServerApplication::run(int argc, char** pArgv)
|
||||
{
|
||||
bool runAsDaemon = isDaemon(argc, argv);
|
||||
bool runAsDaemon = isDaemon(argc, pArgv);
|
||||
if (runAsDaemon)
|
||||
{
|
||||
beDaemon();
|
||||
}
|
||||
try
|
||||
{
|
||||
init(argc, argv);
|
||||
init(argc, pArgv);
|
||||
if (runAsDaemon)
|
||||
{
|
||||
int rc = chdir("/");
|
||||
@ -668,12 +668,12 @@ int ServerApplication::run(const std::vector<std::string>& args)
|
||||
}
|
||||
|
||||
|
||||
bool ServerApplication::isDaemon(int argc, char** argv)
|
||||
bool ServerApplication::isDaemon(int argc, char** pArgv)
|
||||
{
|
||||
std::string option("--daemon");
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (option == argv[i])
|
||||
if (option == pArgv[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -708,17 +708,17 @@ void ServerApplication::beDaemon()
|
||||
}
|
||||
|
||||
|
||||
void ServerApplication::defineOptions(OptionSet& options)
|
||||
void ServerApplication::defineOptions(OptionSet& rOptions)
|
||||
{
|
||||
Application::defineOptions(options);
|
||||
Application::defineOptions(rOptions);
|
||||
|
||||
options.addOption(
|
||||
rOptions.addOption(
|
||||
Option("daemon", "", "Run application as a daemon.")
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
.callback(OptionCallback<ServerApplication>(this, &ServerApplication::handleDaemon)));
|
||||
|
||||
options.addOption(
|
||||
rOptions.addOption(
|
||||
Option("pidfile", "", "Write the process ID of the application to given file.")
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
@ -727,13 +727,13 @@ void ServerApplication::defineOptions(OptionSet& options)
|
||||
}
|
||||
|
||||
|
||||
void ServerApplication::handleDaemon(const std::string& name, const std::string& value)
|
||||
void ServerApplication::handleDaemon(const std::string& rName, const std::string& Value)
|
||||
{
|
||||
config().setBool("application.runAsDaemon", true);
|
||||
}
|
||||
|
||||
|
||||
void ServerApplication::handlePidFile(const std::string& name, const std::string& value)
|
||||
void ServerApplication::handlePidFile(const std::string& rName, const std::string& value)
|
||||
{
|
||||
std::ofstream ostr(value.c_str());
|
||||
if (ostr.good())
|
||||
|
@ -30,8 +30,8 @@ namespace Util {
|
||||
class TimerNotification: public Poco::Notification
|
||||
{
|
||||
public:
|
||||
TimerNotification(Poco::TimedNotificationQueue& queue):
|
||||
_queue(queue)
|
||||
TimerNotification(Poco::TimedNotificationQueue& rQueue):
|
||||
_queue(rQueue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -54,8 +54,8 @@ private:
|
||||
class StopNotification: public TimerNotification
|
||||
{
|
||||
public:
|
||||
StopNotification(Poco::TimedNotificationQueue& queue):
|
||||
TimerNotification(queue)
|
||||
StopNotification(Poco::TimedNotificationQueue& rQueue):
|
||||
TimerNotification(rQueue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ public:
|
||||
class CancelNotification: public TimerNotification
|
||||
{
|
||||
public:
|
||||
CancelNotification(Poco::TimedNotificationQueue& queue):
|
||||
TimerNotification(queue)
|
||||
CancelNotification(Poco::TimedNotificationQueue& rQueue):
|
||||
TimerNotification(rQueue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -103,8 +103,8 @@ private:
|
||||
class TaskNotification: public TimerNotification
|
||||
{
|
||||
public:
|
||||
TaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask):
|
||||
TimerNotification(queue),
|
||||
TaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask):
|
||||
TimerNotification(rQueue),
|
||||
_pTask(pTask)
|
||||
{
|
||||
}
|
||||
@ -151,8 +151,8 @@ private:
|
||||
class PeriodicTaskNotification: public TaskNotification
|
||||
{
|
||||
public:
|
||||
PeriodicTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval):
|
||||
TaskNotification(queue, pTask),
|
||||
PeriodicTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval):
|
||||
TaskNotification(rQueue, pTask),
|
||||
_interval(interval)
|
||||
{
|
||||
}
|
||||
@ -185,8 +185,8 @@ private:
|
||||
class FixedRateTaskNotification: public TaskNotification
|
||||
{
|
||||
public:
|
||||
FixedRateTaskNotification(Poco::TimedNotificationQueue& queue, TimerTask::Ptr pTask, long interval, Poco::Clock clock):
|
||||
TaskNotification(queue, pTask),
|
||||
FixedRateTaskNotification(Poco::TimedNotificationQueue& rQueue, TimerTask::Ptr pTask, long interval, Poco::Clock clock):
|
||||
TaskNotification(rQueue, pTask),
|
||||
_interval(interval),
|
||||
_nextExecution(clock)
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
{
|
||||
using Poco::NumberFormatter;
|
||||
|
||||
std::multiset<std::string> keys;
|
||||
std::multiset<std::string> keySet;
|
||||
const Poco::XML::Node* pNode = findNode(key);
|
||||
if (pNode)
|
||||
{
|
||||
@ -270,12 +270,12 @@ void XMLConfiguration::enumerate(const std::string& key, Keys& range) const
|
||||
if (pChild->nodeType() == Poco::XML::Node::ELEMENT_NODE)
|
||||
{
|
||||
const std::string& nodeName = pChild->nodeName();
|
||||
int n = (int) keys.count(nodeName);
|
||||
int n = (int) keySet.count(nodeName);
|
||||
if (n)
|
||||
range.push_back(nodeName + "[" + NumberFormatter::format(n) + "]");
|
||||
else
|
||||
range.push_back(nodeName);
|
||||
keys.insert(nodeName);
|
||||
keySet.insert(nodeName);
|
||||
}
|
||||
pChild = pChild->nextSibling();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user