twister-core/src/twister.h

43 lines
1.3 KiB
C
Raw Normal View History

#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
2013-10-27 22:54:47 -02:00
#define BLOCK_AGE_TO_EXPIRE_DHT_POSTS (4320*2) // about 2 months
class twister
{
public:
twister();
};
void startSessionTorrent(boost::thread_group& threadGroup);
2013-08-02 00:43:04 -03:00
void stopSessionTorrent();
bool getUserPubKey(std::string const &strUsername, CPubKey &pubkey, int maxHeight = -1);
std::string createSignature(std::string const &strMessage, CKeyID &keyID);
2013-08-04 18:26:45 -03:00
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, int maxHeight = -1);
bool acceptSignedPost(char const *data, int data_size, std::string username, int seq, std::string &errmsg, boost::uint32_t *flags);
2013-08-18 21:05:23 -03:00
bool validatePostNumberForUser(std::string const &username, int k);
bool usernameExists(std::string const &username);
2013-08-18 20:33:54 -03:00
2013-10-01 08:57:51 -03:00
void receivedSpamMessage(std::string const &message, std::string const &user);
2013-08-04 16:16:36 -03:00
int getBestHeight();
bool shouldDhtResourceExpire(std::string resource, bool multi, int height);
2013-12-31 09:46:19 -02:00
int getDhtNodes(boost::int64_t *dht_global_nodes = NULL);
#endif // TWISTER_H