diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-03-10 15:01:21 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-08-22 22:26:23 +0000 |
commit | 89efa7333db4b5877cb58b16e511b690fe43507c (patch) | |
tree | 29867495b54a94beeef49b92a01348a140e059b3 /src/network/socket/qnativesocketengine_p.h | |
parent | 53251e23cf3f82950c5de1c2208d9f376b5bb5f0 (diff) |
QAbstractSocketEngine: introduce QIpPacketHeader for datagrams
This commit changes the readDatagram() and writeDatagram() virtual
functions to take a QIpPacketHeader as meta data, instead of a
QHostAddress/quint16 pair. As previously, the header is an "out"
parameter for readDatagram() and an "in" parameter for writeDatagram().
The header pointer in readDatagram() is allowed to be null if the
PacketHeaderOptions indicates WantNone. Otherwise, it must not be null.
The extra options parameter is introduced because we may not always want
all the metadata upon reception. For sending, we know what to include or
not based on what's set in the incoming header parameter.
QIpPacketHeader splits sender and destination because we'll be able to
return both on datagram reception.
Change-Id: Iee8cbc07c4434ce9b560ffff13ca4213255008c7
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/socket/qnativesocketengine_p.h')
-rw-r--r-- | src/network/socket/qnativesocketengine_p.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 653309302c..fb36ce6204 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -133,10 +133,9 @@ public: qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; - qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0, - quint16 *port = 0) Q_DECL_OVERRIDE; - qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr, - quint16 port) Q_DECL_OVERRIDE; + qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0, + PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE; + qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE; bool hasPendingDatagrams() const Q_DECL_OVERRIDE; qint64 pendingDatagramSize() const Q_DECL_OVERRIDE; @@ -242,10 +241,9 @@ public: bool nativeHasPendingDatagrams() const; qint64 nativePendingDatagramSize() const; - qint64 nativeReceiveDatagram(char *data, qint64 maxLength, - QHostAddress *address, quint16 *port); - qint64 nativeSendDatagram(const char *data, qint64 length, - const QHostAddress &host, quint16 port); + qint64 nativeReceiveDatagram(char *data, qint64 maxLength, QIpPacketHeader *header, + QAbstractSocketEngine::PacketHeaderOptions options); + qint64 nativeSendDatagram(const char *data, qint64 length, const QIpPacketHeader &header); qint64 nativeRead(char *data, qint64 maxLength); qint64 nativeWrite(const char *data, qint64 length); int nativeSelect(int timeout, bool selectForRead) const; |