first commit

This commit is contained in:
2024-07-08 15:54:04 +05:30
commit f4709c97ab
17 changed files with 2691 additions and 0 deletions

57
include/BProtocol.hpp Normal file
View 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