WinRT: Added socket engine implementation
Added basic functionality to socket for WinRT. Even though not all auto tests pass yet, this patch can be seen as a foundation for upcoming work in this area. Reading from and writing to TCP socket works and one can listen for tcp connections. Change-Id: Id4c25ba1c7187ed92b6368c785c4f62837faded7 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
This commit is contained in:
parent
315b6a6a84
commit
553c6416bb
File diff suppressed because it is too large
Load Diff
@ -138,6 +138,70 @@ class QNativeSocketEnginePrivate : public QAbstractSocketEnginePrivate
|
||||
public:
|
||||
QNativeSocketEnginePrivate();
|
||||
~QNativeSocketEnginePrivate();
|
||||
|
||||
qintptr socketDescriptor;
|
||||
|
||||
bool notifyOnRead, notifyOnWrite, notifyOnException;
|
||||
bool closingDown;
|
||||
|
||||
enum ErrorString {
|
||||
NonBlockingInitFailedErrorString,
|
||||
BroadcastingInitFailedErrorString,
|
||||
NoIpV6ErrorString,
|
||||
RemoteHostClosedErrorString,
|
||||
TimeOutErrorString,
|
||||
ResourceErrorString,
|
||||
OperationUnsupportedErrorString,
|
||||
ProtocolUnsupportedErrorString,
|
||||
InvalidSocketErrorString,
|
||||
HostUnreachableErrorString,
|
||||
NetworkUnreachableErrorString,
|
||||
AccessErrorString,
|
||||
ConnectionTimeOutErrorString,
|
||||
ConnectionRefusedErrorString,
|
||||
AddressInuseErrorString,
|
||||
AddressNotAvailableErrorString,
|
||||
AddressProtectedErrorString,
|
||||
DatagramTooLargeErrorString,
|
||||
SendDatagramErrorString,
|
||||
ReceiveDatagramErrorString,
|
||||
WriteErrorString,
|
||||
ReadErrorString,
|
||||
PortInuseErrorString,
|
||||
NotSocketErrorString,
|
||||
InvalidProxyTypeString,
|
||||
TemporaryErrorString,
|
||||
|
||||
UnknownSocketErrorString = -1
|
||||
};
|
||||
|
||||
void setError(QAbstractSocket::SocketError error, ErrorString errorString) const;
|
||||
|
||||
// native functions
|
||||
int option(QNativeSocketEngine::SocketOption option) const;
|
||||
bool setOption(QNativeSocketEngine::SocketOption option, int value);
|
||||
|
||||
bool createNewSocket(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol &protocol);
|
||||
|
||||
bool checkProxy(const QHostAddress &address);
|
||||
bool fetchConnectionParameters();
|
||||
private:
|
||||
union {
|
||||
ABI::Windows::Networking::Sockets::IStreamSocket *tcp;
|
||||
ABI::Windows::Networking::Sockets::IDatagramSocket *udp;
|
||||
};
|
||||
Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocketListener> tcpListener;
|
||||
Microsoft::WRL::ComPtr<ABI::Windows::Storage::Streams::IBuffer> inputBuffer;
|
||||
QList<ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *> pendingDatagrams;
|
||||
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> pendingConnections;
|
||||
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> currentConnections;
|
||||
|
||||
HRESULT handleNewDatagram(ABI::Windows::Networking::Sockets::IDatagramSocket *socket,
|
||||
ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *args);
|
||||
HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener,
|
||||
ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args);
|
||||
static HRESULT interruptEventDispatcher(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus);
|
||||
static HRESULT handleReadyRead(ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32> *asyncInfo, ABI::Windows::Foundation::AsyncStatus);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -48,7 +48,11 @@
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include <QtNetwork/QTcpServer>
|
||||
#include <QtNetwork/QTcpSocket>
|
||||
#ifndef Q_OS_WINRT
|
||||
#include <private/qnativesocketengine_p.h>
|
||||
#else
|
||||
#include <private/qnativesocketengine_winrt_p.h>
|
||||
#endif
|
||||
#define NATIVESOCKETENGINE QNativeSocketEngine
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <private/qnet_unix_p.h>
|
||||
|
Loading…
Reference in New Issue
Block a user