summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qlocalserver.cpp
diff options
context:
space:
mode:
authorAndrew Stanley-Jones <andrew.stanley-jones@nokia.com>2012-02-06 18:36:06 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-10 03:02:07 +0100
commit49b53061550c15ce3b9cc38ee5e82e970f75d5ea (patch)
tree8b6ea732d514b0220d11062d256351145d8837cb /src/network/socket/qlocalserver.cpp
parent8522cb5c97e092d83484768152704f7d9a69901d (diff)
Add socketOptions flags to QLocalServer
QLocalServer had no way to set socket options that more complicated servers require. The first set of options allow setting of access control on the sockets. Change-Id: If4268c66462fc2e6cf1e70b1d5f56c76d2c69228 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/network/socket/qlocalserver.cpp')
-rw-r--r--src/network/socket/qlocalserver.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index b3fe4ac448..97f5920171 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -82,6 +82,27 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QLocalServer::SocketOption
+
+ This enum describes the possible options that can be used to create the
+ socket. This changes the access permissions on platforms (Linux, Windows)
+ that support access permissions on the socket. Both GroupAccess and OtherAccess
+ may vary slightly in meanings depending on the platform.
+
+ \value UserAccess
+ Access is restricted to the same user as the process that created the socket.
+ \value GroupAccess
+ Access is restricted to the same group but not the user that created the socket on Linux.
+ \value OtherAccess
+ Access is available to everyone but the user and group that created the socket on Linux.
+ \value WorldAccess
+ No access restrictions.
+
+ \sa SocketOptions
+*/
+
+
+/*!
Create a new local socket server with the given \a parent.
\sa listen()
@@ -109,6 +130,48 @@ QLocalServer::~QLocalServer()
}
/*!
+ \property QLocalServer::socketOptions
+ \since 5.0
+
+ The setSocketOptions method controls how the socket operates.
+ For example the socket may restrict access to what user ids can
+ connect to the socket.
+
+ These options must be set before listen() is called.
+
+ In some cases, such as with Unix domain sockets on Linux, the
+ access to the socket will be determined by file system permissions,
+ and are created based on the umask. Setting the access flags will
+ overide this and will restrict or permit access as specified.
+
+ Other Unix-based operating systems, such as Mac OS X, do not
+ honor file permissions for Unix domain sockets and by default
+ have WorldAccess and these permission flags will have no effect.
+
+ By default none of the flags are set, access permissions
+ are the platform default.
+
+ \sa listen()
+*/
+void QLocalServer::setSocketOptions(SocketOptions options)
+{
+ Q_D(QLocalServer);
+
+ d->socketOptions = options;
+}
+
+/*!
+ Returns the socket options set on the socket.
+
+ \sa setSocketOptions()
+ */
+QLocalServer::SocketOptions QLocalServer::socketOptions() const
+{
+ Q_D(const QLocalServer);
+ return d->socketOptions;
+}
+
+/*!
Stop listening for incoming connections. Existing connections are not
effected, but any new connections will be refused.