summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qabstractsocket.h
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@collabora.com>2011-10-23 20:04:52 +0200
committerSergio Ahumada <sergio.ahumada@nokia.com>2011-10-31 20:25:12 +0100
commit03f852cb47d508d98aa90f501e9b7f4214e8ad8b (patch)
tree1df4fbdc4076205a306d9c3d89d68510e5ad035a /src/network/socket/qabstractsocket.h
parent3aa81c55e2f42389341feb77b1d9840e6c9b61a2 (diff)
Move support for socket binding from QUdpSocket upstream to QAbstractSocket.
This should be API-compatible with Qt 4, but is not ABI-compatible, due to removing the enum from QUdpSocket. Task-number: QTBUG-121 Change-Id: I967968c6cb6f96d3ab1d6300eadd5bde6154b300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/socket/qabstractsocket.h')
-rw-r--r--src/network/socket/qabstractsocket.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h
index b757092915..ee910e3b33 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -115,10 +115,20 @@ public:
MulticastTtlOption, // IP_MULTICAST_TTL
MulticastLoopbackOption // IP_MULTICAST_LOOPBACK
};
+ enum BindFlag {
+ DefaultForPlatform = 0x0,
+ ShareAddress = 0x1,
+ DontShareAddress = 0x2,
+ ReuseAddressHint = 0x4
+ };
+ Q_DECLARE_FLAGS(BindMode, BindFlag)
QAbstractSocket(SocketType socketType, QObject *parent);
virtual ~QAbstractSocket();
+ bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform);
+ bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform);
+
// ### Qt 5: Make connectToHost() and disconnectFromHost() virtual.
void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
@@ -214,6 +224,9 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_forceDisconnect())
};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSocket::BindMode)
+
#ifndef QT_NO_DEBUG_STREAM
Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketError);
Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketState);