Community driven twister-core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

#ifndef TWISTER_H
#define TWISTER_H
#include "util.h"
#include "key.h"
#include <boost/thread.hpp>
#define LIBTORRENT_PORT_OFFSET 1000
#define USERPOST_FLAG_RT 0x01
#define USERPOST_FLAG_DM 0x02
#define BLOCK_AGE_TO_EXPIRE_DHT_ENTRY (2016) // about 2 weeks
#define BLOCK_AGE_TO_EXPIRE_DHT_POSTS (4320*2) // about 2 months
class twister
{
public:
twister();
};
void startSessionTorrent(boost::thread_group& threadGroup);
void stopSessionTorrent();
bool getUserPubKey(std::string const &strUsername, CPubKey &pubkey);
std::string createSignature(std::string const &strMessage, CKeyID &keyID);
std::string createSignature(std::string const &strMessage, std::string const &strUsername);
bool verifySignature(std::string const &strMessage, std::string const &strUsername, std::string const &strSign);
bool acceptSignedPost(char const *data, int data_size, std::string username, int seq, std::string &errmsg, boost::uint32_t *flags);
bool validatePostNumberForUser(std::string const &username, int k);
bool usernameExists(std::string const &username);
void receivedSpamMessage(std::string const &message, std::string const &user);
int getBestHeight();
bool shouldDhtResourceExpire(std::string resource, bool multi, int height);
#endif // TWISTER_H