i2pd/libi2pd/api.h

46 lines
1.7 KiB
C
Raw Permalink Normal View History

/*
* Copyright (c) 2013-2020, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
* See full license text in LICENSE file at top of project tree
*/
2014-11-17 20:37:40 +03:00
#ifndef API_H__
#define API_H__
2014-11-23 19:33:58 +03:00
#include <memory>
#include <iostream>
2014-11-18 01:00:30 +03:00
#include "Identity.h"
2014-11-18 17:33:58 +03:00
#include "Destination.h"
#include "Streaming.h"
2014-11-18 01:00:30 +03:00
2014-11-17 20:37:40 +03:00
namespace i2p
{
namespace api
{
2018-01-06 06:48:51 +03:00
// initialization start and stop
2014-11-18 17:33:58 +03:00
void InitI2P (int argc, char* argv[], const char * appName);
2016-01-01 00:02:10 +03:00
void TerminateI2P ();
2016-02-04 20:36:58 +03: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 22:42:45 +03:00
void StopI2P ();
2015-11-03 17:15:49 +03:00
void RunPeerTest (); // should be called after UPnP
2018-01-06 06:48:51 +03:00
2014-11-18 17:33:58 +03:00
// destinations
2015-11-03 17:15:49 +03:00
std::shared_ptr<i2p::client::ClientDestination> CreateLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true,
2018-01-06 06:48:51 +03: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 21:28:37 +03:00
const std::map<std::string, std::string> * params = nullptr); // transient destinations usually not published
2015-11-03 17:15:49 +03:00
void DestroyLocalDestination (std::shared_ptr<i2p::client::ClientDestination> dest);
2014-11-18 17:33:58 +03:00
// streams
2015-11-03 17:15:49 +03: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 19:33:58 +03:00
void DestroyStream (std::shared_ptr<i2p::stream::Stream> stream);
2014-11-17 20:37:40 +03:00
}
}
#endif