summaryrefslogtreecommitdiff
path: root/src/net/SocketDescriptor.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-08-20 16:06:58 +0200
committerMax Kellermann <max@musicpd.org>2018-08-20 16:06:58 +0200
commit50c733796540d7a9c1a06a055f26f0023e31ad85 (patch)
tree0ae41df2e612ae8da8cde9b945e94dff93b9081e /src/net/SocketDescriptor.hxx
parentb5c569cd30f8a657b543356e0b563f86b23ab832 (diff)
net/SocketDescriptor: add GetType(), IsStream()
Diffstat (limited to 'src/net/SocketDescriptor.hxx')
-rw-r--r--src/net/SocketDescriptor.hxx14
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;