#include <TrackerResponseParser.h> [code]
This class provides raw tracker responses parsing. Only static parsing function can be called because this class doesn't provide instance creation.
Raw response data (structure) must comply for suit to this specification: http://wiki.theory.org/BitTorrentSpecification#Tracker_Response .
See parseAndLoadTrackerResponse() for more details about parsing.
Definition at line 48 of file TrackerResponseParser.h.
Static Public Member Functions | |
| static bool | parseAndLoadTrackerResponse (const QByteArray &rawTrackerResponseData, TrackerResponse &trackerResponse) |
| Parses rawTrackerResponseData into the trackerResponse object. | |
Private Member Functions | |
| TrackerResponseParser () | |
| ~TrackerResponseParser () | |
| TrackerResponseParser (const TrackerResponseParser &) | |
| TrackerResponseParser & | operator= (const TrackerResponseParser &) |
Static Private Member Functions | |
| static bool | loadAllResponseData (const QByteArray &rawData, TrackerResponse &response) |
| Parses and loads all tracker response data from rawData to response. | |
| static bool | loadFailureReason (const BDictionary *bData, TrackerResponse &response) |
| Loads 'failure reason' value from bData into response. | |
| static bool | loadWarningMessage (const BDictionary *bData, TrackerResponse &response) |
| Loads 'warning message' value from bData into response. | |
| static bool | loadInterval (const BDictionary *bData, TrackerResponse &response) |
| Loads 'interval' value from bData into response. | |
| static bool | loadMinInterval (const BDictionary *bData, TrackerResponse &response) |
| Loads 'min interval' value from bData into response. | |
| static bool | loadTrackerId (const BDictionary *bData, TrackerResponse &response) |
| Loads 'tracker id' value from bData into response. | |
| static bool | loadComplete (const BDictionary *bData, TrackerResponse &response) |
| Loads 'complete' value from bData into response. | |
| static bool | loadIncomplete (const BDictionary *bData, TrackerResponse &response) |
| Loads 'incomplete' value from bData into response. | |
| static bool | loadPeers (const BDictionary *bData, TrackerResponse &response) |
| Loads 'peers' value from bData into response. | |
| static bool | loadPeersBinaryModel (const BString *bPeers, TrackerResponse::PeerInfoList &peerInfoList) |
| Loads 'peers' value from bPeers into peerInfoList (binary model). | |
| static PeerInfo | parseRawPeerInfo (const QByteArray &rawPeerInfo) |
| static bool | loadPeersDictionaryModel (const BList *bPeers, TrackerResponse::PeerInfoList &peerInfoList) |
| Loads 'peers' value from bPeers into peerInfoList (dictionary model). | |
| static bool | loadPeerInfo (const BDictionary *bPeerInfo, PeerInfo &peerInfo) |
| Loads complete peer info from bPeerInfo into peerInfo. | |
| static bool | loadPeerInfoPeerId (const BDictionary *bPeerInfo, PeerInfo::PeerId &peerId) |
| Loads 'peer id' value from bPeerInfo into peerId. | |
| static bool | loadPeerInfoHostAddress (const BDictionary *bPeerInfo, QByteArray &hostAddress) |
| Loads 'ip' value from bPeerInfo into hostAddress. | |
| static bool | loadPeerInfoPort (const BDictionary *bPeerInfo, quint16 &port) |
| Loads 'port' value from bPeerInfo into port. | |
| static bool | isValidInterval (qint64 interval) |
| Interval (interval) validity test. | |
| static bool | isValidNumberOfPeers (qint64 numOfPeers) |
| Number of peers (numOfPeers) validity test. | |
| static bool | isValidPeerId (const QByteArray &peerId) |
| Peer ID (peerId) validity test. | |
| static bool | isValidPort (qint64 port) |
| Port (port) validity test. | |
Static Private Attributes | |
| static const char * | FailureReasonKeyName = "failure reason" |
| static const char * | WarningMessageKeyName = "warning message" |
| static const char * | IntervalKeyName = "interval" |
| static const char * | MinIntervalKeyName = "min interval" |
| static const char * | TrackerIdKeyName = "tracker id" |
| static const char * | CompleteKeyName = "complete" |
| static const char * | IncompleteKeyName = "incomplete" |
| static const char * | PeersKeyName = "peers" |
| static const char * | PeersPeerIdKeyName = "peer id" |
| static const char * | PeersIpKeyName = "ip" |
| static const char * | PeersPortKeyName = "port" |
| static const int | OnePeerStringSizeBinaryModel = 6 |
|
|
|
|
|
|
|
|
|
|
|
Interval (interval) validity test.
Definition at line 409 of file TrackerResponseParser.cpp. |
|
|
Number of peers (numOfPeers) validity test.
Definition at line 421 of file TrackerResponseParser.cpp. |
|
|
Peer ID (peerId) validity test.
Definition at line 431 of file TrackerResponseParser.cpp. |
|
|
Port (port) validity test.
Definition at line 441 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Parses and loads all tracker response data from rawData to response.
Definition at line 78 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'complete' value from bData into response.
Definition at line 209 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'failure reason' value from bData into response.
Definition at line 132 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'incomplete' value from bData into response.
Definition at line 225 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'interval' value from bData into response.
Definition at line 162 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'min interval' value from bData into response.
Definition at line 178 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads complete peer info from bPeerInfo into peerInfo.
Definition at line 331 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'ip' value from bPeerInfo into hostAddress.
Definition at line 372 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'peer id' value from bPeerInfo into peerId.
Definition at line 356 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'port' value from bPeerInfo into port.
Definition at line 387 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'peers' value from bData into response.
Definition at line 241 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'peers' value from bPeers into peerInfoList (binary model).
Definition at line 268 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'peers' value from bPeers into peerInfoList (dictionary model).
Definition at line 287 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'tracker id' value from bData into response.
Definition at line 194 of file TrackerResponseParser.cpp. |
|
||||||||||||
|
Loads 'warning message' value from bData into response.
Definition at line 147 of file TrackerResponseParser.cpp. |
|
|
|
|
||||||||||||
|
Parses rawTrackerResponseData into the trackerResponse object.
If the 'failure reason' field value is non-empty and there are NO other data, only failureReason() member function can be then called on the trackerResponse (other member function will return default values). If the 'failure reason' field value is non-empty and there are also other data as well, trackerResponse will be left unchanged (it counts as an error during parsing). If an exception gets thrown indirectly by the function, then no side effects will be produced on the environment. Thus, the function meets the strong guarantee of exception safety. Definition at line 58 of file TrackerResponseParser.cpp. |
|
|
Definition at line 310 of file TrackerResponseParser.cpp. |
|
|
Definition at line 99 of file TrackerResponseParser.h. |
|
|
Definition at line 94 of file TrackerResponseParser.h. |
|
|
Definition at line 100 of file TrackerResponseParser.h. |
|
|
Definition at line 96 of file TrackerResponseParser.h. |
|
|
Definition at line 97 of file TrackerResponseParser.h. |
|
|
Definition at line 105 of file TrackerResponseParser.h. |
|
|
Definition at line 103 of file TrackerResponseParser.h. |
|
|
Definition at line 101 of file TrackerResponseParser.h. |
|
|
Definition at line 102 of file TrackerResponseParser.h. |
|
|
Definition at line 104 of file TrackerResponseParser.h. |
|
|
Definition at line 98 of file TrackerResponseParser.h. |
|
|
Definition at line 95 of file TrackerResponseParser.h. |