]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/socket.cpp
Hide the set_option and get_option functions in socket_private.h
[libs/net.git] / source / net / socket.cpp
index 75919777e6cb0c256d3a9dea1bf0ded6bd3587b4..2378207048c9a9a91395eca79227ea6088c5a56b 100644 (file)
@@ -129,30 +129,31 @@ void Socket::set_timeout(const Time::TimeDelta &timeout)
 {
 #ifndef WIN32
        timeval tv = Time::rawtime_to_timeval(timeout.raw());
-       set_option(SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(timeval));
-       set_option(SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(timeval));
+       priv->set_option(SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(timeval));
+       priv->set_option(SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(timeval));
 #else
        DWORD msecs = static_cast<DWORD>(timeout/Time::msec);
-       set_option(SOL_SOCKET, SO_RCVTIMEO, &msecs, sizeof(DWORD));
-       set_option(SOL_SOCKET, SO_SNDTIMEO, &msecs, sizeof(DWORD));
+       priv->set_option(SOL_SOCKET, SO_RCVTIMEO, &msecs, sizeof(DWORD));
+       priv->set_option(SOL_SOCKET, SO_SNDTIMEO, &msecs, sizeof(DWORD));
 #endif
 }
 
-int Socket::set_option(int level, int optname, const void *optval, socklen_t optlen)
+
+int Socket::Private::set_option(int level, int optname, const void *optval, socklen_t optlen)
 {
 #ifdef WIN32
-       return setsockopt(priv->handle, level, optname, reinterpret_cast<const char *>(optval), optlen);
+       return setsockopt(handle, level, optname, reinterpret_cast<const char *>(optval), optlen);
 #else
-       return setsockopt(priv->handle, level, optname, optval, optlen);
+       return setsockopt(handle, level, optname, optval, optlen);
 #endif
 }
 
-int Socket::get_option(int level, int optname, void *optval, socklen_t *optlen) const
+int Socket::Private::get_option(int level, int optname, void *optval, socklen_t *optlen)
 {
 #ifdef WIN32
-       return getsockopt(priv->handle, level, optname, reinterpret_cast<char *>(optval), optlen);
+       return getsockopt(handle, level, optname, reinterpret_cast<char *>(optval), optlen);
 #else
-       return getsockopt(priv->handle, level, optname, optval, optlen);
+       return getsockopt(handle, level, optname, optval, optlen);
 #endif
 }