Class containing routines for parsing protocol messages. Methods are mainly called from network connection instances and this class will forward the parsed protocol entities to datamodel.
More...
#include <protocol_message_parser.h>
|
bool | parseNodeGreetingV1 (const QByteArray &aSingleNodeGreeting, const Connection &aConnection) |
|
bool | parseMultipleNodeGreetingsV1 (const QByteArray &aGoodFood, const Connection &aConnection) |
|
bool | uintFromPosition (const QByteArray &aGoodFood, const int aPos, quint32 *aResult) const |
|
bool | hashFromPosition (const QByteArray &aGoodFood, const int aPos, Hash *aResultHash) const |
|
bool | parseRequestForObjectsAroundHash (const QByteArray &aNodeRefRequest, const Connection &aConnection) |
|
bool | parseContentPublishedOrSent (const unsigned char aProtocolItemType, const QByteArray &aPublishedContent, const Connection &aConnection) |
|
bool | parsePrivMsgPublishedOrSent (const unsigned char aProtocolItemType, const QByteArray &aPublishedContent, const Connection &aConnection) |
|
bool | parseProfileCommentPublishedOrSent (const unsigned char aProtocolItemType, const QByteArray &aPublishedContent, const Connection &aConnection) |
|
bool | parseAdsClassifiedAtHash (const QByteArray &aQueryBytes, const Connection &aConnection) |
|
bool | parseListOfAdsClassifiedAtHash (const QByteArray &aQueryBytes, const Connection &aConnection) |
|
bool | parseSearchRequest (const QByteArray &aQueryBytes, Connection &aConnection) |
|
bool | parseSearchResults (const QByteArray &aQueryBytes, const Connection &aConnection) |
|
bool | parseVoiceCall (const QByteArray &aQueryBytes, const Connection &aConnection) |
|
bool | parseCallRtData (const QByteArray &aQueryBytes, const Connection &aConnection) |
|
Class containing routines for parsing protocol messages. Methods are mainly called from network connection instances and this class will forward the parsed protocol entities to datamodel.
bool ProtocolMessageParser::hashFromPosition |
( |
const QByteArray & |
aGoodFood, |
|
|
const int |
aPos, |
|
|
Hash * |
aResultHash |
|
) |
| const |
|
private |
utility method: extract hash from bytearray.
- Parameters
-
aGoodFood | is the bytearray from which to extract |
aPos | is the position where integer is expected to be found |
aResultHash | is the hash that will have its value set from contents of aGoodFood |
- Returns
- true if success
bool ProtocolMessageParser::parseAdsClassifiedAtHash |
( |
const QByteArray & |
aQueryBytes, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
method for parsing request that requests for classified ads whose classification matches given hash
- Parameters
-
aQueryBytes | contains the query |
aConnection | is the requester |
bool ProtocolMessageParser::parseCallRtData |
( |
const QByteArray & |
aQueryBytes, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing voice call data. This parses actual data stream like audio, not call control data.
- Parameters
-
aQueryBytes | serialized call data |
aConnection | is connection of the node whose operator made a statement. |
- Returns
- true if things went all right.
bool ProtocolMessageParser::parseContentPublishedOrSent |
( |
const unsigned char |
aProtocolItemType, |
|
|
const QByteArray & |
aPublishedContent, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing published content. Content-type is given as parameter ; single method as the structure is anyway same, handling is different..
This method is also used to parse content sent ; it differs from published content so, that it has no bangpath but otherwise the format is the same.
bool ProtocolMessageParser::parseListOfAdsClassifiedAtHash |
( |
const QByteArray & |
aQueryBytes, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing list of headers of classified ads. In practice this parses the protocol message sent with id KListOfAdsClassifiedAtHash.
bool ProtocolMessageParser::parseMessage |
( |
const QByteArray & |
aGoodFood, |
|
|
Connection & |
aConnection |
|
) |
| |
the open mouth
- Parameters
-
- Returns
- false if such a fatal error that peer needs to be disconnected
bool ProtocolMessageParser::parseMultipleNodeGreetingsV1 |
( |
const QByteArray & |
aGoodFood, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Peer number of hello messages
- Parameters
-
aGoodFood | at least one node greeting |
aConnection | the orignating connection |
bool ProtocolMessageParser::parseNodeGreetingV1 |
( |
const QByteArray & |
aSingleNodeGreeting, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
bool ProtocolMessageParser::parsePrivMsgPublishedOrSent |
( |
const unsigned char |
aProtocolItemType, |
|
|
const QByteArray & |
aPublishedContent, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing published private message. Does about same work as parseContentPublishedOrSent but structure of private messages is somewhat different.
bool ProtocolMessageParser::parseProfileCommentPublishedOrSent |
( |
const unsigned char |
aProtocolItemType, |
|
|
const QByteArray & |
aPublishedContent, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing published profile comments. Does about same work as parseContentPublishedOrSent but structure of profile commentss is somewhat different.
bool ProtocolMessageParser::parseRequestForObjectsAroundHash |
( |
const QByteArray & |
aNodeRefRequest, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing request to send one or more objects specified by a hash.
bool ProtocolMessageParser::parseSearchRequest |
( |
const QByteArray & |
aQueryBytes, |
|
|
Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing a search request from remote node. If parse is successful, this method will also ask searchmodel to perform the search and place possible results immediately into send-queue of aConnection so search works slightly differently compared to rest of the network requests
- Parameters
-
aQueryBytes | serialized query-description |
aConnection | is connection of the node who sent the request |
- Returns
- true if things went all right.
bool ProtocolMessageParser::parseSearchResults |
( |
const QByteArray & |
aQueryBytes, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing a search result from remote node. In this case this node made a search request and this is reply (containing list of objects matching the query).
- Parameters
-
aQueryBytes | serialized query-description |
aConnection | is connection of the node who sent the request |
- Returns
- true if things went all right.
bool ProtocolMessageParser::parseVoiceCall |
( |
const QByteArray & |
aQueryBytes, |
|
|
const Connection & |
aConnection |
|
) |
| |
|
private |
Method for parsing voice call status data. This parses call status, not call realtime (audio) data.
- Parameters
-
aQueryBytes | serialized call-status data |
aConnection | is connection of the node who sent the request |
- Returns
- true if things went all right.
bool ProtocolMessageParser::uintFromPosition |
( |
const QByteArray & |
aGoodFood, |
|
|
const int |
aPos, |
|
|
quint32 * |
aResult |
|
) |
| const |
|
private |
utility method: extract integer from bytearray. integer will be returned in host byte order e.g.
- Parameters
-
aGoodFood | is the bytearray from which to extract |
aPos | is the position where integer is expected to be found |
aResult | is the quint32 where result will be written e.g. this is the output variable |
- Returns
- true if reading succeeded
The documentation for this class was generated from the following file: