diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-20 16:06:58 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-20 16:06:58 +0200 |
commit | 50c733796540d7a9c1a06a055f26f0023e31ad85 (patch) | |
tree | 0ae41df2e612ae8da8cde9b945e94dff93b9081e /src/net/SocketDescriptor.hxx | |
parent | b5c569cd30f8a657b543356e0b563f86b23ab832 (diff) |
net/SocketDescriptor: add GetType(), IsStream()
Diffstat (limited to 'src/net/SocketDescriptor.hxx')
-rw-r--r-- | src/net/SocketDescriptor.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/net/SocketDescriptor.hxx b/src/net/SocketDescriptor.hxx index ae00a6c16..33bde8c79 100644 --- a/src/net/SocketDescriptor.hxx +++ b/src/net/SocketDescriptor.hxx @@ -82,6 +82,20 @@ public: using FileDescriptor::IsValid; using FileDescriptor::IsSocket; #endif + + /** + * Determine the socket type, i.e. SOCK_STREAM, SOCK_DGRAM or + * SOCK_SEQPACKET. Returns -1 on error. + */ + gcc_pure + int GetType() const noexcept; + + /** + * Is this a stream socket? + */ + gcc_pure + bool IsStream() const noexcept; + using FileDescriptor::Get; using FileDescriptor::Set; using FileDescriptor::Steal; |