summaryrefslogtreecommitdiffstats
path: root/include/raul/Socket.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-07 19:31:25 +0100
committerDavid Robillard <d@drobilla.net>2021-01-07 19:31:25 +0100
commit7cc90d01f3cd0c9fe620e8dec17e89a91d2d8345 (patch)
tree68c594c96457f73e1498f296adfd5761d994c012 /include/raul/Socket.hpp
parentd1f6bd5a5828064b2cca487deff1065e33727fcf (diff)
downloadraul-7cc90d01f3cd0c9fe620e8dec17e89a91d2d8345.tar.gz
raul-7cc90d01f3cd0c9fe620e8dec17e89a91d2d8345.tar.bz2
raul-7cc90d01f3cd0c9fe620e8dec17e89a91d2d8345.zip
Clean up documentation comments
Diffstat (limited to 'include/raul/Socket.hpp')
-rw-r--r--include/raul/Socket.hpp63
1 files changed, 39 insertions, 24 deletions
diff --git a/include/raul/Socket.hpp b/include/raul/Socket.hpp
index 55d2f70..6a2883c 100644
--- a/include/raul/Socket.hpp
+++ b/include/raul/Socket.hpp
@@ -31,16 +31,20 @@
namespace raul {
-/** A safe and simple interface for UNIX or TCP sockets. */
+/**
+ A safe and simple interface for UNIX or TCP sockets.
+
+ @ingroup raul
+*/
class Socket : public raul::Noncopyable
{
public:
enum class Type { UNIX, TCP };
- /** Create a new unbound/unconnected socket of a given type. */
+ /// Create a new unbound/unconnected socket of a given type
explicit Socket(Type t);
- /** Wrap an existing open socket. */
+ /// Wrap an existing open socket
Socket(Type t,
std::string uri,
struct sockaddr* addr,
@@ -55,41 +59,52 @@ public:
~Socket();
- /** Bind a server socket to an address.
- * @param uri Address URI, e.g. unix:///tmp/foo, or tcp://hostname:1234.
- * Use "*" as hostname to listen on all interfaces.
- * @return True on success.
- */
+ /**
+ Bind a server socket to an address.
+
+ @param uri Address URI, e.g. unix:///tmp/foo, or tcp://hostname:1234.
+ Use "*" as hostname to listen on all interfaces.
+
+ @return True on success.
+ */
bool bind(const std::string& uri);
- /** Connect a client socket to a server address.
- * @param uri Address URI, e.g. unix:///tmp/foo or tcp://somehost:1234
- * @return True on success.
- */
+ /**
+ Connect a client socket to a server address.
+
+ @param uri Address URI, e.g. unix:///tmp/foo or tcp://somehost:1234
+ @return True on success.
+ */
bool connect(const std::string& uri);
- /** Mark server socket as passive to listen for incoming connections.
- * @return True on success.
- */
+ /**
+ Mark server socket as passive to listen for incoming connections.
+
+ @return True on success.
+ */
bool listen();
- /** Accept a connection.
- * @return An new open socket for the connection.
- */
+ /**
+ Accept a connection.
+
+ @return An new open socket for the connection.
+ */
std::shared_ptr<Socket> accept();
- /** Return the file descriptor for the socket. */
+ /// Return the file descriptor for the socket
int fd() const { return _sock; }
const std::string& uri() const { return _uri; }
- /** Close the socket. */
+ /// Close the socket
void close();
- /** Shut down the socket.
- * This terminates any connections associated with the sockets, and will
- * (unlike close()) cause a poll on the socket to return.
- */
+ /**
+ Shut down the socket.
+
+ This terminates any connections associated with the socket, and will
+ (unlike close()) cause a poll on the socket to return.
+ */
void shutdown();
private: