i2pd/ClientContext.h

63 lines
1.7 KiB
C
Raw Normal View History

2014-10-16 04:52:17 +04:00
#ifndef CLIENT_CONTEXT_H__
#define CLIENT_CONTEXT_H__
#include <mutex>
#include "Destination.h"
#include "HTTPProxy.h"
#include "SOCKS.h"
#include "I2PTunnel.h"
#include "SAM.h"
2014-12-02 18:34:02 +03:00
#include "BOB.h"
2014-10-24 23:22:36 +04:00
#include "AddressBook.h"
2014-10-16 04:52:17 +04:00
namespace i2p
{
namespace client
{
class ClientContext
{
public:
ClientContext ();
~ClientContext ();
2014-10-16 04:52:17 +04:00
void Start ();
void Stop ();
ClientDestination * GetSharedLocalDestination () const { return m_SharedLocalDestination; };
ClientDestination * CreateNewLocalDestination (bool isPublic = false, i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_DSA_SHA1,
const std::map<std::string, std::string> * params = nullptr); // transient
ClientDestination * CreateNewLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true,
const std::map<std::string, std::string> * params = nullptr);
void DeleteLocalDestination (ClientDestination * destination);
ClientDestination * FindLocalDestination (const i2p::data::IdentHash& destination) const;
ClientDestination * LoadLocalDestination (const std::string& filename, bool isPublic);
2014-10-16 04:52:17 +04:00
2014-10-24 23:22:36 +04:00
AddressBook& GetAddressBook () { return m_AddressBook; };
2014-10-16 04:52:17 +04:00
private:
std::mutex m_DestinationsMutex;
std::map<i2p::data::IdentHash, ClientDestination *> m_Destinations;
ClientDestination * m_SharedLocalDestination;
2014-10-16 04:52:17 +04:00
2014-10-24 23:22:36 +04:00
AddressBook m_AddressBook;
i2p::proxy::HTTPProxy * m_HttpProxy;
i2p::proxy::SOCKSProxy * m_SocksProxy;
I2PClientTunnel * m_IrcTunnel;
I2PServerTunnel * m_ServerTunnel;
SAMBridge * m_SamBridge;
2014-12-02 18:34:02 +03:00
BOBCommandChannel * m_BOBCommandChannel;
2014-10-16 04:52:17 +04:00
public:
// for HTTP
const decltype(m_Destinations)& GetDestinations () const { return m_Destinations; };
};
extern ClientContext context;
}
}
#endif