#include <TorrentParser.h> [code]
This class provides Torrent files parsing.
Torrent file structure must comply for suit to these specifications: http://wiki.theory.org/BitTorrentSpecification#Metainfo_File_Structure .
Optional tracker announce list must comply for suit to these specifications: http://home.elp.rr.com/tur/multitracker-spec.txt (this is an extention to the official specification, which is also backwards compatible).
Optional field 'private' must comply for suit to these specifications: http://www.azureuswiki.com/index.php/Secure_Torrents (this field is used in practice but it is not part of the official specification).
Definition at line 61 of file TorrentParser.h.
Static Public Member Functions | |
| static bool | parseAndLoadTorrent (const QByteArray &rawTorrentData, Torrent &torrent) |
| Parses rawTorrentData into the torrent object. | |
Private Member Functions | |
| TorrentParser () | |
| ~TorrentParser () | |
| TorrentParser (const TorrentParser &) | |
| TorrentParser & | operator= (const TorrentParser &) |
Static Private Member Functions | |
| static bool | loadAllTorrentData (const QByteArray &rawData, Torrent &torrent) |
| Parses and loads torrent data from rawData into torrent. | |
| static bool | loadTorrentBasicData (const BDictionary *bBasicData, Torrent &torrent) |
| Loads basic torrent data from bBasicData into torrent. | |
| static bool | loadTorrentFilesInfo (const BDictionary *bInfo, Torrent &torrent) |
| Loads info about files and their properties from bInfo into torrent. | |
| static bool | getAndLoadAnnounce (const BDictionary *bBasicData, Torrent &torrent) |
| Loads the tracker announce URL from bBasicData into torrent. | |
| static bool | getAndLoadAnnounceList (const BDictionary *bBasicData, Torrent &torrent) |
| Loads the list of announce URLs from bBasicData into torrent. | |
| static bool | getAndLoadCreationDate (const BDictionary *bBasicData, Torrent &torrent) |
| Loads the creation date of the torrent from bBasicData into torrent. | |
| static bool | getAndLoadComment (const BDictionary *bBasicData, Torrent &torrent) |
| Loads the torrent comment from bBasicData into torrent. | |
| static bool | getAndLoadCreatedBy (const BDictionary *bBasicData, Torrent &torrent) |
| Loads the torrent creator name/version from bBasicData into torrent. | |
| static bool | getAndLoadPieceLength (const BDictionary *bInfo, Torrent &torrent) |
| Loads the number of bytes in each piece from bInfo into torrent. | |
| static bool | getAndLoadPieces (const BDictionary *bInfo, Torrent &torrent) |
| Loads the list of all hash values from bInfo into torrent. | |
| static bool | getAndLoadPrivate (const BDictionary *bInfo, Torrent &torrent) |
| Loads the private flag from bInfo into torrent. | |
| static bool | getAndLoadSingleModeFileInfo (const BDictionary *bInfo, Torrent &torrent) |
| Loads single file mode information from bInfo into torrent. | |
| static bool | getAndLoadMultipleModeFileInfo (const BDictionary *bInfo, Torrent &torrent) |
| Loads multiple file mode information from bInfo into torrent. | |
| static bool | getAndLoadDirectoryName (const BDictionary *bFileInfo, QString &directoryName) |
| Loads the directory name from bFileInfo into directoryName. | |
| static bool | getAndLoadFileName (const BDictionary *bFileInfo, QString &fileName) |
| Loads the file name from bFileInfo into fileName. | |
| static bool | getAndLoadFilePath (const BDictionary *bFileInfo, QString &filePath) |
| Loads the file path from bFileInfo into filePath. | |
| static bool | getAndLoadFileLength (const BDictionary *bFileInfo, Torrent::FileInfo &fileInfo) |
| Loads the file length from bFileInfo into fileInfo. | |
| static bool | getAndLoadFileChecksum (const BDictionary *bFileInfo, Torrent::FileInfo &fileInfo) |
| Loads the file checksum from bFileInfo into fileInfo. | |
| static bool | getAndLoadFileInfoList (const BList *bFileInfoList, Torrent::FileInfoList &fileInfoList) |
| Loads the file info list from bFileInfoList into fileInfoList. | |
| static bool | getAndLoadFileInfo (const BDictionary *bFileInfo, Torrent::FileInfo &fileInfo) |
| Loads file information from bFileInfo into fileInfo. | |
| static bool | isValidAnnounceUrl (const Uri &announceUrl) |
| Announce URL (announceUrl) validity test. | |
| static bool | isValidCreationDate (int creationDate) |
| Creation date (creationDate) validity test. | |
| static bool | isValidPieceLength (int pieceLength) |
| Piece length (pieceLength) validity test. | |
| static bool | isValidPieces (const QByteArray &pieces) |
| Pieces (pieces) validity test. | |
| static bool | isValidPrivate (int privateFlag) |
| Private flag (privateFlag) validity test. | |
| static bool | isValidFileLength (qint64 fileLength) |
| File length (fileLength) validity test. | |
| static bool | isValidFileChecksum (const QByteArray &fileChecksum) |
| File checksum (fileChecksum) validity test. | |
| static bool | convertBTierToTier (const BList *bTier, QList< Uri > &tier) |
| Converts bTier containing announce-list tier into tier. | |
| static bool | convertPiecesToPieceList (const QByteArray &pieces, Torrent::PieceList &pieceList) |
| Converts selected pieces into pieceList. | |
| static bool | convertBFilePathToFilePath (const BList *bFilePath, const QString &delimiter, QString &filePath) |
| Converts bFilePath containing file path into filePath. | |
| static bool | convertPrivateFlagToBool (int privateFlag) |
| Returns converted privateFlag into bool. | |
| static void | appendDirectoryName (const QString &directoryName, const QString &delimiter, Torrent::FileInfoList &fileInfoList) |
| Appends directoryName before each file path in fileInfoList. | |
Static Private Attributes | |
| static const char * | InfoKeyName = "info" |
| static const char * | AnnounceKeyName = "announce" |
| static const char * | AnnounceListKeyName = "announce-list" |
| static const char * | CreationDateKeyName = "creation date" |
| static const char * | CommentKeyName = "comments" |
| static const char * | CreatedByKeyName = "created by" |
| static const char * | PieceLengthKeyName = "piece length" |
| static const char * | PiecesKeyName = "pieces" |
| static const char * | PrivateKeyName = "private" |
| static const char * | FileNameKeyName = "name" |
| static const char * | FileLengthKeyName = "length" |
| static const char * | ChecksumKeyName = "md5sum" |
| static const char * | FilesKeyName = "files" |
| static const char * | PathKeyName = "path" |
| static const char * | DirectoryDelimiter = "/" |
| Directory delimiter (like "/"). | |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
Appends directoryName before each file path in fileInfoList. Each file path will then have the following format: directoryName delimiter originalFilePath If there is no file info in the fileInfoList it will do nothing. Definition at line 734 of file TorrentParser.cpp. |
|
||||||||||||||||
|
Converts bFilePath containing file path into filePath. Returns true if the conversion went ok, false otherwise (filePath will be left unchanged). filePath will be in the following format: dir1 delimiter dir2 delimiter ... delimiter fileName If bFilePath has no elements before the conversion it returns true. Definition at line 688 of file TorrentParser.cpp. |
|
||||||||||||
|
Converts bTier containing announce-list tier into tier. Returns true if the conversion went ok, false otherwise (tier will be left unchanged). Definition at line 629 of file TorrentParser.cpp. |
|
||||||||||||
|
Converts selected pieces into pieceList. Returns true if the conversion went ok, false otherwise (and pieceList will be left unchanged). Definition at line 661 of file TorrentParser.cpp. |
|
|
Returns converted privateFlag into bool.
Definition at line 721 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the tracker announce URL from bBasicData into torrent. Returns true if the announce was loaded successfully, false otherwise. Definition at line 151 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the list of announce URLs from bBasicData into torrent. Returns true if the announce list was loaded successfully, false otherwise. This piece of information is only optional. Definition at line 173 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the torrent comment from bBasicData into torrent. Returns true if the comment was loaded successfully, false otherwise. This piece of information is only optional. Definition at line 241 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the torrent creator name/version from bBasicData into torrent. Returns true if the name/version was loaded successfully, false otherwise. This piece of information is only optional. Definition at line 259 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the creation date of the torrent from bBasicData into torrent. Returns true if the creation date was loaded successfully, false otherwise. This piece of information is only optional.
Definition at line 221 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the directory name from bFileInfo into directoryName. Returns true if the directory name was loaded successfully, false otherwise.
Definition at line 406 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the file checksum from bFileInfo into fileInfo. Returns true if the the file checksum was loaded successfully, false otherwise. This piece of information is only optional.
Definition at line 482 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads file information from bFileInfo into fileInfo. Returns true if the file information was loaded successfully, false otherwise. Definition at line 530 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the file info list from bFileInfoList into fileInfoList. Returns true if the the file info list was loaded successfully, false otherwise. Definition at line 502 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the file length from bFileInfo into fileInfo. Returns true if the the file length was loaded successfully, false otherwise.
Definition at line 460 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the file name from bFileInfo into fileName. Returns true if the the file name was loaded successfully, false otherwise.
Definition at line 421 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the file path from bFileInfo into filePath. Returns true if the the file path was loaded successfully, false otherwise. Definition at line 439 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads multiple file mode information from bInfo into torrent. Returns true if the file information was loaded successfully, false otherwise. Definition at line 374 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the number of bytes in each piece from bInfo into torrent. Returns true if the number of bytes in each piece was loaded successfully, false otherwise.
Definition at line 279 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the list of all hash values from bInfo into torrent. Returns true if the list was loaded successfully, false otherwise.
Definition at line 300 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads the private flag from bInfo into torrent. Returns true if the private flag was loaded successfully, false otherwise. This piece of information is only optional.
Definition at line 325 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads single file mode information from bInfo into torrent. Returns true if the file information was loaded successfully, false otherwise. Definition at line 346 of file TorrentParser.cpp. |
|
|
Announce URL (announceUrl) validity test. Returns true if the selected announceUrl value is valid, false otherwise. An URL is considered valid if it contains the scheme and authority URI components at minimum. Definition at line 557 of file TorrentParser.cpp. |
|
|
Creation date (creationDate) validity test. Returns true if the selected creationDate value is valid, false otherwise. Definition at line 567 of file TorrentParser.cpp. |
|
|
File checksum (fileChecksum) validity test. Returns true if the selected fileChecksum value is valid, false otherwise. Definition at line 618 of file TorrentParser.cpp. |
|
|
File length (fileLength) validity test. Returns true if the selected fileLength value is valid, false otherwise. Definition at line 608 of file TorrentParser.cpp. |
|
|
Piece length (pieceLength) validity test. Returns true if the selected pieceLength value is valid, false otherwise. Definition at line 577 of file TorrentParser.cpp. |
|
|
Pieces (pieces) validity test. Returns true if the selected pieces value is valid, false otherwise. Definition at line 587 of file TorrentParser.cpp. |
|
|
Private flag (privateFlag) validity test. Returns true if the selected privateFlag value is valid, false otherwise. Definition at line 598 of file TorrentParser.cpp. |
|
||||||||||||
|
Parses and loads torrent data from rawData into torrent. Returns true if parsing went ok, false otherwise. Definition at line 60 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads basic torrent data from bBasicData into torrent. Returns true if parsing went ok, false otherwise. Definition at line 96 of file TorrentParser.cpp. |
|
||||||||||||
|
Loads info about files and their properties from bInfo into torrent. Returns true if parsing went ok, false otherwise. Definition at line 119 of file TorrentParser.cpp. |
|
|
|
|
||||||||||||
|
Parses rawTorrentData into the torrent object.
Definition at line 43 of file TorrentParser.cpp. |
|
|
Definition at line 134 of file TorrentParser.h. |
|
|
Definition at line 135 of file TorrentParser.h. |
|
|
Definition at line 144 of file TorrentParser.h. |
|
|
Definition at line 137 of file TorrentParser.h. |
|
|
Definition at line 138 of file TorrentParser.h. |
|
|
Definition at line 136 of file TorrentParser.h. |
|
|
Directory delimiter (like "/").
Definition at line 148 of file TorrentParser.h. |
|
|
Definition at line 143 of file TorrentParser.h. |
|
|
Definition at line 142 of file TorrentParser.h. |
|
|
Definition at line 145 of file TorrentParser.h. |
|
|
Definition at line 133 of file TorrentParser.h. |
|
|
Definition at line 146 of file TorrentParser.h. |
|
|
Definition at line 139 of file TorrentParser.h. |
|
|
Definition at line 140 of file TorrentParser.h. |
|
|
Definition at line 141 of file TorrentParser.h. |