summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-05-07 14:06:55 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2010-09-01 12:24:40 (GMT)
commit47d66c7855b9c315db29c82f4306de1864384ff7 (patch)
tree2c9bdb3348154b3ff9191f96f8bbb0fef588b591 /src/network/socket
parent44862c25999736155e904c36dbcd84bcd2dad63c (diff)
downloadQt-47d66c7855b9c315db29c82f4306de1864384ff7.zip
Qt-47d66c7855b9c315db29c82f4306de1864384ff7.tar.gz
Qt-47d66c7855b9c315db29c82f4306de1864384ff7.tar.bz2
Remove support for single-source multi-cast
It's not supported everywhere, so remove it for now until the need to re-add it arises.
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qabstractsocketengine_p.h2
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qhttpsocketengine_p.h2
-rw-r--r--src/network/socket/qnativesocketengine.cpp6
-rw-r--r--src/network/socket/qnativesocketengine_p.h4
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp69
-rw-r--r--src/network/socket/qsocks5socketengine.cpp6
-rw-r--r--src/network/socket/qsocks5socketengine_p.h2
-rw-r--r--src/network/socket/qudpsocket.cpp10
-rw-r--r--src/network/socket/qudpsocket.h2
10 files changed, 25 insertions, 80 deletions
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h
index 9a2a7c3..0632891 100644
--- a/src/network/socket/qabstractsocketengine_p.h
+++ b/src/network/socket/qabstractsocketengine_p.h
@@ -121,10 +121,8 @@ public:
#ifndef QT_NO_UDPSOCKET
virtual bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface) = 0;
virtual bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface) = 0;
virtual qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index c7e5b95..e467df8 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -240,7 +240,6 @@ qint64 QHttpSocketEngine::write(const char *data, qint64 len)
#ifndef QT_NO_UDPSOCKET
bool QHttpSocketEngine::joinMulticastGroup(const QHostAddress &,
- const QHostAddress &,
const QNetworkInterface &)
{
setError(QAbstractSocket::UnsupportedSocketOperationError,
@@ -249,7 +248,6 @@ bool QHttpSocketEngine::joinMulticastGroup(const QHostAddress &,
}
bool QHttpSocketEngine::leaveMulticastGroup(const QHostAddress &,
- const QHostAddress &,
const QNetworkInterface &)
{
setError(QAbstractSocket::UnsupportedSocketOperationError,
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index 18add3c..1a6b4f6 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -103,10 +103,8 @@ public:
#ifndef QT_NO_UDPSOCKET
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index d4092b6..ae2cad2 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -650,28 +650,26 @@ int QNativeSocketEngine::accept()
\since 4.8
*/
bool QNativeSocketEngine::joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::joinMulticastGroup(), false);
Q_CHECK_STATE(QNativeSocketEngine::joinMulticastGroup(), QAbstractSocket::BoundState, false);
Q_CHECK_TYPE(QNativeSocketEngine::joinMulticastGroup(), QAbstractSocket::UdpSocket, false);
- return d->nativeJoinMulticastGroup(groupAddress, sourceAddress, interface);
+ return d->nativeJoinMulticastGroup(groupAddress, interface);
}
/*!
\since 4.8
*/
bool QNativeSocketEngine::leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::leaveMulticastGroup(), false);
Q_CHECK_STATE(QNativeSocketEngine::leaveMulticastGroup(), QAbstractSocket::BoundState, false);
Q_CHECK_TYPE(QNativeSocketEngine::leaveMulticastGroup(), QAbstractSocket::UdpSocket, false);
- return d->nativeLeaveMulticastGroup(groupAddress, sourceAddress, interface);
+ return d->nativeLeaveMulticastGroup(groupAddress, interface);
}
/*!
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index 7ec1166..e44aa2e 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -124,10 +124,8 @@ public:
void close();
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
qint64 bytesAvailable() const;
@@ -245,10 +243,8 @@ public:
bool nativeListen(int backlog);
int nativeAccept();
bool nativeJoinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
bool nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
qint64 nativeBytesAvailable() const;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 4fa4a55..8416ed2 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -586,79 +586,50 @@ int QNativeSocketEnginePrivate::nativeAccept()
return acceptedDescriptor;
}
-#if !defined(IP_ADD_SOURCE_MEMBERSHIP)
-# define QT_NO_MULTICAST_SSM
-# define IP_ADD_SOURCE_MEMBERSHIP -1
-# define IP_DROP_SOURCE_MEMBERSHIP -1
-#endif
static bool doMulticast(QNativeSocketEnginePrivate *d,
- int howAsm6,
- int howAsm4,
- int howSsm4,
+ int how6,
+ int how4,
const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
- Q_UNUSED(howSsm4);
-
int sockOpt = 0;
void *sockArg;
int sockArgSize;
- ip_mreq asm4;
-#ifndef QT_NO_MULTICAST_SSM
- ip_mreq_source ssm4;
-#endif
+ ip_mreq mreq4;
#ifndef QT_NO_IPV6
- ipv6_mreq asm6;
+ ipv6_mreq mreq6;
if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) {
- sockOpt = howAsm6;
- sockArg = &asm6;
- sockArgSize = sizeof(asm6);
- memset(&asm6, 0, sizeof(asm6));
+ sockOpt = how6;
+ sockArg = &mreq6;
+ sockArgSize = sizeof(mreq6);
+ memset(&mreq6, 0, sizeof(mreq6));
Q_IPV6ADDR ip6 = groupAddress.toIPv6Address();
- memcpy(&asm6.ipv6mr_multiaddr, &ip6, sizeof(ip6));
- Q_UNUSED(sourceAddress); // ### not possible to specify a single source when using IPv6?
- asm6.ipv6mr_interface = interface.index();
+ memcpy(&mreq6.ipv6mr_multiaddr, &ip6, sizeof(ip6));
+ mreq6.ipv6mr_interface = interface.index();
} else
#endif
if (groupAddress.protocol() == QAbstractSocket::IPv4Protocol) {
- if (sourceAddress != QHostAddress::Any) {
-#ifndef QT_NO_MULTICAST_SSM
- sockOpt = howSsm4;
- sockArg = &ssm4;
- sockArgSize = sizeof(ssm4);
- memset(&ssm4, 0, sizeof(ssm4));
- ssm4.imr_multiaddr.s_addr = htonl(groupAddress.toIPv4Address());
- ssm4.imr_sourceaddr.s_addr = htonl(sourceAddress.toIPv4Address());
-#else
- // system doesn't support SSM
- d->setError(QAbstractSocket::UnsupportedSocketOperationError,
- QNativeSocketEnginePrivate::OperationUnsupportedErrorString);
- return false;
-#endif
- } else {
- sockOpt = howAsm4;
- sockArg = &asm4;
- sockArgSize = sizeof(asm4);
- memset(&asm4, 0, sizeof(asm4));
- asm4.imr_multiaddr.s_addr = htonl(groupAddress.toIPv4Address());
- }
+ sockOpt = how4;
+ sockArg = &mreq4;
+ sockArgSize = sizeof(mreq4);
+ memset(&mreq4, 0, sizeof(mreq4));
+ mreq4.imr_multiaddr.s_addr = htonl(groupAddress.toIPv4Address());
if (interface.isValid()) {
QList<QNetworkAddressEntry> addressEntries = interface.addressEntries();
if (!addressEntries.isEmpty()) {
QHostAddress firstIP = addressEntries.first().ip();
- asm4.imr_interface.s_addr = htonl(firstIP.toIPv4Address());
+ mreq4.imr_interface.s_addr = htonl(firstIP.toIPv4Address());
} else {
d->setError(QAbstractSocket::NetworkError,
QNativeSocketEnginePrivate::NetworkUnreachableErrorString);
return false;
}
} else {
- asm4.imr_interface.s_addr = INADDR_ANY;
+ mreq4.imr_interface.s_addr = INADDR_ANY;
}
} else {
// unreachable
@@ -685,7 +656,6 @@ static bool doMulticast(QNativeSocketEnginePrivate *d,
}
bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
return doMulticast(this,
@@ -695,14 +665,11 @@ bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &gr
0,
#endif
IP_ADD_MEMBERSHIP,
- IP_ADD_SOURCE_MEMBERSHIP,
groupAddress,
- sourceAddress,
interface);
}
bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
return doMulticast(this,
@@ -712,9 +679,7 @@ bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &g
0,
#endif
IP_DROP_MEMBERSHIP,
- IP_DROP_SOURCE_MEMBERSHIP,
groupAddress,
- sourceAddress,
interface);
}
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 3da00ed..dcaf561 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1545,8 +1545,7 @@ qint64 QSocks5SocketEngine::write(const char *data, qint64 len)
#ifndef QT_NO_UDPSOCKET
bool QSocks5SocketEngine::joinMulticastGroup(const QHostAddress &,
- const QHostAddress &,
- const QNetworkInterface &)
+ const QNetworkInterface &)
{
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Operation on socket is not supported"));
@@ -1554,8 +1553,7 @@ bool QSocks5SocketEngine::joinMulticastGroup(const QHostAddress &,
}
bool QSocks5SocketEngine::leaveMulticastGroup(const QHostAddress &,
- const QHostAddress &,
- const QNetworkInterface &)
+ const QNetworkInterface &)
{
setError(QAbstractSocket::UnsupportedSocketOperationError,
QLatin1String("Operation on socket is not supported"));
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index fcfa4ff..298595a 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -93,10 +93,8 @@ public:
#ifndef QT_NO_UDPSOCKET
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index 880cb2b..84657b4 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -334,7 +334,7 @@ bool QUdpSocket::bind(quint16 port, BindMode mode)
*/
bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress, MulticastMode mode)
{
- return joinMulticastGroup(groupAddress, QHostAddress::Any, QNetworkInterface(), mode);
+ return joinMulticastGroup(groupAddress, QNetworkInterface(), mode);
}
/*!
@@ -342,7 +342,6 @@ bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress, MulticastM
\overload
*/
bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface,
MulticastMode mode)
{
@@ -350,7 +349,7 @@ bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress,
QT_CHECK_BOUND("QUdpSocket::joinMulticastGroup()", false);
d->socketEngine->setOption(QAbstractSocketEngine::MulticastLoopback,
(mode & MulticastLoopback) ? 1 : 0);
- return d->socketEngine->joinMulticastGroup(groupAddress, sourceAddress, interface);
+ return d->socketEngine->joinMulticastGroup(groupAddress, interface);
}
/*!
@@ -358,7 +357,7 @@ bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress,
*/
bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress)
{
- return leaveMulticastGroup(groupAddress, QHostAddress::Any, QNetworkInterface());
+ return leaveMulticastGroup(groupAddress, QNetworkInterface());
}
/*!
@@ -366,11 +365,10 @@ bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress)
\overload
*/
bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface)
{
QT_CHECK_BOUND("QUdpSocket::leaveMulticastGroup()", false);
- return d_func()->socketEngine->leaveMulticastGroup(groupAddress, sourceAddress, interface);
+ return d_func()->socketEngine->leaveMulticastGroup(groupAddress, interface);
}
/*!
diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h
index 8cb6dc3..ff80712 100644
--- a/src/network/socket/qudpsocket.h
+++ b/src/network/socket/qudpsocket.h
@@ -86,12 +86,10 @@ public:
bool joinMulticastGroup(const QHostAddress &groupAddress,
MulticastMode mode = DefaultMulticastFlagForPlatform);
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface,
MulticastMode mode = DefaultMulticastFlagForPlatform);
bool leaveMulticastGroup(const QHostAddress &groupAddress);
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QHostAddress &sourceAddress,
const QNetworkInterface &interface);
bool hasPendingDatagrams() const;