mirror of
https://github.com/Hizenberg469/btClient.git
synced 2026-04-19 17:52:24 +03:00
first commit
This commit is contained in:
57
include/BProtocol.hpp
Normal file
57
include/BProtocol.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef __B_PROTOCOL
|
||||
#define __B_PROTOCOL
|
||||
|
||||
#include "torrent_structure.hpp"
|
||||
#include <Torrent.hpp>
|
||||
|
||||
|
||||
/*************************B_Protocol literals*********************/
|
||||
|
||||
|
||||
|
||||
#define DictionaryStart 'd'
|
||||
#define DictionaryEnd 'e'
|
||||
#define ListStart 'l'
|
||||
#define ListEnd 'e'
|
||||
#define NumberStart 'i'
|
||||
#define NumberEnd 'e'
|
||||
#define ByteArrayDivider ':'
|
||||
|
||||
|
||||
/*************************B_Protocol literals*********************/
|
||||
|
||||
|
||||
/*************************Decode Functions Implementation*************************/
|
||||
|
||||
/*Implemented*/
|
||||
long long _read_file(const std::string& torrentFile, char*& raw_data);
|
||||
|
||||
/*Implemented*/
|
||||
bNode* b_decode(char*& raw_data, long long &size);
|
||||
|
||||
/*Implemented*/
|
||||
long long int integer_decode(char*& raw_data, long long int &size);
|
||||
|
||||
/*Implemented*/
|
||||
std::string string_decode(char*& raw_data, long long int& size);
|
||||
|
||||
|
||||
|
||||
/*************************Decode Functions Implementation*************************/
|
||||
|
||||
|
||||
/*************************Encode Functions Implementation*************************/
|
||||
|
||||
|
||||
/* Always decrease the return size of e_data by 1, after processing*/
|
||||
int b_encode(bNode* tFile, char*& e_data, long long& size);
|
||||
|
||||
|
||||
|
||||
/*************************Encode Functions Implementation*************************/
|
||||
|
||||
|
||||
|
||||
//void TorrentInfoDump(bNode* res, TorrentInfo* &torrentInfo);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user