12 inline Socket::Ptr::Ptr (nullptr_t)
15 inline Socket::Ptr::Ptr (
const shared_ptr<_IRep>& rep)
19 inline Socket::Ptr::Ptr (shared_ptr<_IRep>&& rep)
23 inline Socket::Ptr& Socket::Ptr::operator= (Ptr&& s)
noexcept
25 fRep_ = move (s.fRep_);
28 inline Socket::Ptr& Socket::Ptr::operator= (
const Ptr& s)
33 inline void Socket::Ptr::reset () noexcept
37 inline shared_ptr<Socket::_IRep> Socket::Ptr::_GetSharedRep ()
const
42 inline Socket::_IRep& Socket::Ptr::_ref ()
const
47 inline const Socket::_IRep& Socket::Ptr::_cref ()
const
55 return _cref ().GetNativeSocket ();
57 inline optional<IO::Network::SocketAddress> Socket::Ptr::GetLocalAddress ()
const
60 return _cref ().GetLocalAddress ();
65 return _cref ().GetAddressFamily ();
67 inline void Socket::Ptr::Shutdown (ShutdownTarget shutdownTarget)
70 if (fRep_ !=
nullptr) {
71 _ref ().Shutdown (shutdownTarget);
74 inline void Socket::Ptr::Close ()
const
78 if (fRep_ !=
nullptr) {
82 template <
typename RESULT_TYPE>
83 inline RESULT_TYPE Socket::Ptr::getsockopt (
int level,
int optname)
const
87 socklen_t roptlen =
sizeof (r);
88 _cref ().getsockopt (level, optname, &r, &roptlen);
91 template <
typename ARG_TYPE>
92 inline void Socket::Ptr::setsockopt (
int level,
int optname, ARG_TYPE arg)
const
95 socklen_t optvallen =
sizeof (arg);
96 _ref ().setsockopt (level, optname, &arg, optvallen);
98 inline bool Socket::Ptr::operator== (
const Ptr& rhs)
const
100 Debug::AssertExternallySynchronizedMutex::ReadContext declareContext{_fThisAssertExternallySynchronized};
101 Debug::AssertExternallySynchronizedMutex::ReadContext declareContext2{rhs._fThisAssertExternallySynchronized};
102 return _GetSharedRep () == rhs._GetSharedRep ();
104 inline strong_ordering Socket::Ptr::operator<=> (
const Ptr& rhs)
const
106 Debug::AssertExternallySynchronizedMutex::ReadContext declareContext{_fThisAssertExternallySynchronized};
107 Debug::AssertExternallySynchronizedMutex::ReadContext declareContext2{rhs._fThisAssertExternallySynchronized};
108 return Common::StdCompat::compare_three_way{}(_GetSharedRep (), rhs._GetSharedRep ());
111#if qStroika_Foundation_Common_Platform_Windows
117 template <
typename INT_TYPE>
118 inline INT_TYPE ThrowWSASystemErrorIfSOCKET_ERROR (INT_TYPE returnCode)
119 requires (is_signed_v<INT_TYPE>)
121 if (returnCode == SOCKET_ERROR) {
122 Execution::ThrowSystemErrNo (::WSAGetLastError ());
127 inline IO::Network::Socket::PlatformNativeHandle ThrowWSASystemErrorIfSOCKET_ERROR (IO::Network::Socket::PlatformNativeHandle returnCode)
130 if (returnCode == INVALID_SOCKET) {
131 Execution::ThrowSystemErrNo (::WSAGetLastError ());
#define RequireNotNull(p)
shared_lock< const AssertExternallySynchronizedMutex > ReadContext
Instantiate AssertExternallySynchronizedMutex::ReadContext to designate an area of code where protect...
FamilyType
Socket address family - also sometimes referred to as domain (argument to ::socket calls it domain)