summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL/Util.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2008-04-15 22:59:13 -0700
committerMark Spruiell <mes@zeroc.com>2008-04-15 22:59:13 -0700
commita5e873a44d51c1b572d008c2f748e63ad54b9c7a (patch)
tree5ce41f40aa6add0a7985bf6c6485221081aa245f /cpp/src/IceSSL/Util.cpp
parentminor fixes to CHANGES/RELEASE_NOTES (diff)
downloadice-a5e873a44d51c1b572d008c2f748e63ad54b9c7a.tar.bz2
ice-a5e873a44d51c1b572d008c2f748e63ad54b9c7a.tar.xz
ice-a5e873a44d51c1b572d008c2f748e63ad54b9c7a.zip
bug 3008 - IceSSL cleanup
Diffstat (limited to 'cpp/src/IceSSL/Util.cpp')
-rw-r--r--cpp/src/IceSSL/Util.cpp131
1 files changed, 0 insertions, 131 deletions
diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp
index dbf9d31b0ab..3abd92dcee4 100644
--- a/cpp/src/IceSSL/Util.cpp
+++ b/cpp/src/IceSSL/Util.cpp
@@ -272,137 +272,6 @@ IceSSL::DHParams::get(int keyLength)
#endif
-static bool
-selectReadWrite(SOCKET fd, bool read, int timeout)
-{
-#ifdef _WIN32
- fd_set rFdSet, wFdSet;
- FD_ZERO(&rFdSet);
- FD_ZERO(&wFdSet);
- if(read)
- {
- FD_SET(fd, &rFdSet);
- }
- else
- {
- FD_SET(fd, &wFdSet);
- }
-#else
- struct pollfd pollfd[1];
- pollfd[0].fd = fd;
- pollfd[0].events = read ? POLLIN : POLLOUT;
-#endif
-
-repeatSelect:
- int ret;
-#ifdef _WIN32
- if(timeout >= 0)
- {
- struct timeval tv;
- tv.tv_sec = timeout / 1000;
- tv.tv_usec = (timeout - tv.tv_sec * 1000) * 1000;
- ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, &tv);
- }
- else
- {
- ret = ::select(static_cast<int>(fd) + 1, &rFdSet, &wFdSet, 0, 0);
- }
-#else
- ret = ::poll(pollfd, 1, timeout);
-#endif
-
- if(ret == 0)
- {
- return false; // Timeout.
- }
- else if(ret == SOCKET_ERROR)
- {
- if(IceInternal::interrupted())
- {
- goto repeatSelect;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = IceInternal::getSocketErrno();
- throw ex;
- }
-
- return true;
-}
-
-bool
-IceSSL::selectRead(SOCKET fd, int timeout)
-{
- return selectReadWrite(fd, true, timeout);
-}
-
-bool
-IceSSL::selectWrite(SOCKET fd, int timeout)
-{
- return selectReadWrite(fd, false, timeout);
-}
-
-bool
-IceSSL::splitString(const string& str, const string& delim, bool handleQuotes, vector<string>& result)
-{
- string::size_type pos = str.find_first_not_of(delim + " \t");
- if(pos == string::npos)
- {
- return true;
- }
-
- string::value_type quoteChar = 0;
- while(pos != string::npos)
- {
- if(handleQuotes && (str[pos] == '"' || str[pos] == '\''))
- {
- quoteChar = str[pos];
- ++pos;
- }
-
- string val;
- while(pos < str.size())
- {
- if((!handleQuotes || !quoteChar) && delim.find(str[pos]) != string::npos)
- {
- break;
- }
- if(handleQuotes)
- {
- if(str[pos] == '\\')
- {
- if(pos + 1 < str.size() && str[pos + 1] == quoteChar)
- {
- ++pos;
- }
- }
- else if(str[pos] == quoteChar)
- {
- quoteChar = 0;
- ++pos;
- continue;
- }
- }
- val.push_back(str[pos]);
- ++pos;
- }
-
- if(!val.empty())
- {
- result.push_back(val);
- }
-
- pos = str.find_first_not_of(delim, pos);
- }
-
- if(quoteChar) // Mismatched quote.
- {
- return false;
- }
-
- return true;
-}
-
bool
IceSSL::checkPath(string& path, const string& defaultDir, bool dir)
{