i2pd/libi2pd/api.h

39 lines
1.6 KiB
C
Raw Normal View History

2014-11-17 17:37:40 +00:00
#ifndef API_H__
#define API_H__
2014-11-23 16:33:58 +00:00
#include <memory>
#include <iostream>
2014-11-17 22:00:30 +00:00
#include "Identity.h"
2014-11-18 14:33:58 +00:00
#include "Destination.h"
#include "Streaming.h"
2014-11-17 22:00:30 +00:00
2014-11-17 17:37:40 +00:00
namespace i2p
{
namespace api
{
2018-01-06 03:48:51 +00:00
// initialization start and stop
2014-11-18 14:33:58 +00:00
void InitI2P (int argc, char* argv[], const char * appName);
2015-12-31 21:02:10 +00:00
void TerminateI2P ();
2016-02-04 17:36:58 +00:00
void StartI2P (std::shared_ptr<std::ostream> logStream = nullptr);
// write system log to logStream, if not specified to <appName>.log in application's folder
2014-11-17 19:42:45 +00:00
void StopI2P ();
2015-11-03 14:15:49 +00:00
void RunPeerTest (); // should be called after UPnP
2018-01-06 03:48:51 +00:00
2014-11-18 14:33:58 +00:00
// destinations
2015-11-03 14:15:49 +00:00
std::shared_ptr<i2p::client::ClientDestination> CreateLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true,
2018-01-06 03:48:51 +00:00
const std::map<std::string, std::string> * params = nullptr);
std::shared_ptr<i2p::client::ClientDestination> CreateLocalDestination (bool isPublic = false, i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256,
2014-12-11 18:28:37 +00:00
const std::map<std::string, std::string> * params = nullptr); // transient destinations usually not published
2015-11-03 14:15:49 +00:00
void DestroyLocalDestination (std::shared_ptr<i2p::client::ClientDestination> dest);
2014-11-18 14:33:58 +00:00
// streams
2015-11-03 14:15:49 +00:00
void RequestLeaseSet (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::data::IdentHash& remote);
std::shared_ptr<i2p::stream::Stream> CreateStream (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::data::IdentHash& remote);
void AcceptStream (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::stream::StreamingDestination::Acceptor& acceptor);
2014-11-23 16:33:58 +00:00
void DestroyStream (std::shared_ptr<i2p::stream::Stream> stream);
2014-11-17 17:37:40 +00:00
}
}
#endif