summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-03-30 16:06:07 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-04-05 10:22:36 (GMT)
commitcd907ff4656c8819f5aa19979ea6da25fc5947e6 (patch)
treee8c85b9247fdaab14dbcd263b991e5bfa3b4c6cb /src
parent989ca02a932cf7c90e8d29c18dd72415e46afb81 (diff)
downloadQt-cd907ff4656c8819f5aa19979ea6da25fc5947e6.zip
Qt-cd907ff4656c8819f5aa19979ea6da25fc5947e6.tar.gz
Qt-cd907ff4656c8819f5aa19979ea6da25fc5947e6.tar.bz2
Fix multicast group membership
Although symbian's multicast support is incomplete, this is enough to pass the QUdpSocket test case. (no IGMP/MLD support in the OS) Reviewed-by: Markus Goetz
Diffstat (limited to 'src')
-rw-r--r--src/network/socket/qsymbiansocketengine.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp
index af755a9..52f6b68 100644
--- a/src/network/socket/qsymbiansocketengine.cpp
+++ b/src/network/socket/qsymbiansocketengine.cpp
@@ -1198,22 +1198,32 @@ bool QSymbianSocketEnginePrivate::multicastGroupMembershipHelper(const QHostAddr
const QNetworkInterface &iface,
TUint operation)
{
- //TODO - untested
+#if defined (QNATIVESOCKETENGINE_DEBUG)
+ qDebug() << "QSymbianSocketEnginePrivate::multicastGroupMembershipHelper" << groupAddress << iface << operation;
+#endif
//translate address
TPckgBuf<TIp6Mreq> option;
- Q_IPV6ADDR ip6 = groupAddress.toIPv6Address();
- memcpy(option().iAddr.u.iAddr8, ip6.c, 16);
- //translate interface
- //TODO - can we just use iface.index() ?
- TPckgBuf<TSoInetIfQuery> query;
- query().iName = qt_QString2TPtrC(iface.name());
- TInt err = nativeSocket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, query);
- if (err == KErrNone)
- option().iInterface = query().iIndex;
- else
- option().iInterface = 0;
+ if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) {
+ Q_IPV6ADDR ip6 = groupAddress.toIPv6Address();
+ memcpy(option().iAddr.u.iAddr8, ip6.c, 16);
+ } else {
+ TInetAddr wrapped;
+ wrapped.SetAddress(groupAddress.toIPv4Address());
+ wrapped.ConvertToV4Mapped();
+ option().iAddr = wrapped.Ip6Address();
+ }
+ option().iInterface = iface.index();
//join or leave group
- return (KErrNone == nativeSocket.SetOpt(operation, KSolInetIp, option));
+ TInt err = nativeSocket.SetOpt(operation, KSolInetIp, option);
+#if defined (QNATIVESOCKETENGINE_DEBUG)
+ qDebug() << "address" << qt_prettyDebug((const char *)(option().iAddr.u.iAddr8), 16, 16);
+ qDebug() << "interface" << option().iInterface;
+ qDebug() << "error" << err;
+#endif
+ if (err) {
+ setError(err);
+ }
+ return (KErrNone == err);
}
QNetworkInterface QSymbianSocketEngine::multicastInterface() const