X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fsocket.cpp;h=2378207048c9a9a91395eca79227ea6088c5a56b;hb=3840d5d193327059b84406ee6b0ba263f5ef2401;hp=5af2b4f507e34de1a3527e1c9b99b5693441eae7;hpb=debe1004676d5431e571d9c4361072661dcc88c4;p=libs%2Fnet.git diff --git a/source/net/socket.cpp b/source/net/socket.cpp index 5af2b4f..2378207 100644 --- a/source/net/socket.cpp +++ b/source/net/socket.cpp @@ -1,5 +1,6 @@ #ifndef WIN32 #include +#include #include #include #endif @@ -128,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(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(optval), optlen); + return setsockopt(handle, level, optname, reinterpret_cast(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(optval), optlen); + return getsockopt(handle, level, optname, reinterpret_cast(optval), optlen); #else - return getsockopt(priv->handle, level, optname, optval, optlen); + return getsockopt(handle, level, optname, optval, optlen); #endif }