api.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef API_H__
  2. #define API_H__
  3. #include <memory>
  4. #include <iostream>
  5. #include "Identity.h"
  6. #include "Destination.h"
  7. #include "Streaming.h"
  8. namespace i2p
  9. {
  10. namespace api
  11. {
  12. // initialization start and stop
  13. void InitI2P (int argc, char* argv[], const char * appName);
  14. void TerminateI2P ();
  15. void StartI2P (std::shared_ptr<std::ostream> logStream = nullptr);
  16. // write system log to logStream, if not specified to <appName>.log in application's folder
  17. void StopI2P ();
  18. void RunPeerTest (); // should be called after UPnP
  19. // destinations
  20. std::shared_ptr<i2p::client::ClientDestination> CreateLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true,
  21. const std::map<std::string, std::string> * params = nullptr);
  22. std::shared_ptr<i2p::client::ClientDestination> CreateLocalDestination (bool isPublic = false, i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256,
  23. const std::map<std::string, std::string> * params = nullptr); // transient destinations usually not published
  24. void DestroyLocalDestination (std::shared_ptr<i2p::client::ClientDestination> dest);
  25. // streams
  26. void RequestLeaseSet (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::data::IdentHash& remote);
  27. std::shared_ptr<i2p::stream::Stream> CreateStream (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::data::IdentHash& remote);
  28. void AcceptStream (std::shared_ptr<i2p::client::ClientDestination> dest, const i2p::stream::StreamingDestination::Acceptor& acceptor);
  29. void DestroyStream (std::shared_ptr<i2p::stream::Stream> stream);
  30. }
  31. }
  32. #endif