Gnutella::Packets::Query Class Reference
#include <Query.h> [code]
Inherits Gnutella::Packets::Packet.
Inheritance diagram for Gnutella::Packets::Query:
[legend]Collaboration diagram for Gnutella::Packets::Query:
[legend]List of all members.
Detailed Description
Encapsulates the
Query Gnutella packet.
The table below presents the data fields stored in a query's payload and how they can be accessed using the Query interface. For a detailed documentation of all basic Gnutella packets and the usage of all their fileds please refer to The Annotated Gnutella Protocol Specification v0.4.
| Byte Offset | Field Name | getFunction | setFunction |
| 0..1 | Minimum Speed | N/A | N/A |
| 2..N | Search Criteria String | N/A | N/A |
| N+1 | NUL (0x00) Terminator | N/A | N/A |
| N+2..L-1 | Optional Query Data | N/A | N/A |
- Todo:
- Implement the query data extension.
Definition at line 53 of file Query.h.
Member Typedef Documentation
Constructor & Destructor Documentation
| Query::Query |
( |
const QByteArray & |
rawHeader, |
|
|
const QByteArray & |
rawPayload |
|
) |
|
|
|
|
Creates a Query object from the raw bytes in rawHeader and rawPayload.
Definition at line 38 of file Query.cpp. |
| Query::Query |
( |
const QString & |
searchCriteria = QString(), |
|
|
quint16 |
minimumSpeed = 0 |
|
) |
|
|
Member Function Documentation
| static const Query& Gnutella::Packets::Query::castFrom |
( |
const Packet & |
packet |
) |
[inline, static] |
|
| static Query& Gnutella::Packets::Query::castFrom |
( |
Packet & |
packet |
) |
[inline, static] |
|
| Query* Gnutella::Packets::Query::copy |
( |
|
) |
const [inline, virtual] |
|
| quint16 Query::minimumSpeed |
( |
|
) |
const |
|
| QString Gnutella::Packets::Query::name |
( |
|
) |
const [inline, virtual] |
|
| bool Query::prepareReadPayload |
( |
const QByteArray & |
rawPayload |
) |
[protected, virtual] |
|
|
|
Verifies the structure of the rawPayload.
Verifies if the rawPayload can be correctly parsed by readPayload(). The function just goes over the whole rawPayload and checks if the structure of the payload is correct. Some data may be gathered and stored to ease the work of readPayload(). For example, the size of the query hit data field can only be calculated with knowledge of the payloadLength, which is not available in the QDataStream object passed to readPayload(). The size of this field is read here and stored for use later in readPayload().
Implements Gnutella::Packets::Packet.
Definition at line 56 of file Query.cpp. |
| int Query::prepareWritePayload |
( |
|
) |
const [protected, virtual] |
|
| void Query::readPayload |
( |
QDataStream & |
stream |
) |
[protected, virtual] |
|
|
|
Reads the payload fields from the stream. The structure of the data in the stream is already verified by verifyPayload().
Implements Gnutella::Packets::Packet.
Definition at line 82 of file Query.cpp. |
| QString Query::searchCriteria |
( |
|
) |
const |
|
| void Query::setMinimumSpeed |
( |
const quint16 & |
minimumSpeed |
) |
|
|
| void Query::setSearchCriteria |
( |
const QString & |
searchCriteria |
) |
|
|
| void Query::writePayload |
( |
QDataStream & |
stream |
) |
const [protected, virtual] |
|
Member Data Documentation
The documentation for this class was generated from the following files: