mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-10 03:49:51 -05:00
rsPeers add few JSON API calls
This commit is contained in:
parent
cfe95a57a0
commit
7a1375ff6f
@ -510,11 +510,55 @@ public:
|
|||||||
virtual bool setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port) = 0;
|
virtual bool setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port) = 0;
|
||||||
virtual bool isHiddenNode(const RsPeerId &id) = 0;
|
virtual bool isHiddenNode(const RsPeerId &id) = 0;
|
||||||
|
|
||||||
virtual bool addPeerLocator(const RsPeerId &ssl_id, const RsUrl& locator) = 0;
|
/**
|
||||||
virtual bool setLocalAddress(const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;
|
* @brief Add URL locator for given peer
|
||||||
virtual bool setExtAddress( const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;
|
* @jsonapi{development}
|
||||||
virtual bool setDynDNS(const RsPeerId &id, const std::string &addr) = 0;
|
* @param[in] sslId SSL id of the peer, own id is accepted too
|
||||||
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
|
* @param[in] locator peer url locator
|
||||||
|
* @return false if error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
virtual bool addPeerLocator(const RsPeerId& sslId, const RsUrl& locator) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set local IPv4 address for the given peer
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] sslId SSL id of the peer, own id is accepted too
|
||||||
|
* @param[in] addr string representation of the local IPv4 address
|
||||||
|
* @param[in] port local listening port
|
||||||
|
* @return false if error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
virtual bool setLocalAddress(
|
||||||
|
const RsPeerId& sslId, const std::string& addr, uint16_t port ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set external IPv4 address for given peer
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] sslId SSL id of the peer, own id is accepted too
|
||||||
|
* @param[in] addr string representation of the external IPv4 address
|
||||||
|
* @param[in] port external listening port
|
||||||
|
* @return false if error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
virtual bool setExtAddress(
|
||||||
|
const RsPeerId& sslId, const std::string &addr, uint16_t port ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set (dynamical) domain name associated to the given peer
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] sslId SSL id of the peer, own id is accepted too
|
||||||
|
* @param[in] addr domain name string representation
|
||||||
|
* @return false if error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
virtual bool setDynDNS(const RsPeerId& sslId, const std::string& addr) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set network mode of the given peer
|
||||||
|
* @jsonapi{development}
|
||||||
|
* @param[in] sslId SSL id of the peer, own id is accepted too
|
||||||
|
* @param[in] netMode one of RS_NETMODE_*
|
||||||
|
* @return false if error occurred, true otherwise
|
||||||
|
*/
|
||||||
|
virtual bool setNetworkMode(const RsPeerId &sslId, uint32_t netMode) = 0;
|
||||||
|
|
||||||
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
||||||
|
|
||||||
virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "rsurl.h"
|
#include "rsurl.h"
|
||||||
|
#include "serialiser/rstypeserializer.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -254,6 +255,14 @@ RsUrl& RsUrl::setFragment(const std::string& fragment)
|
|||||||
return decoded.str();
|
return decoded.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsUrl::serial_process( RsGenericSerializer::SerializeJob j,
|
||||||
|
RsGenericSerializer::SerializeContext& ctx )
|
||||||
|
{
|
||||||
|
std::string urlString = toString();
|
||||||
|
RS_SERIAL_PROCESS(urlString);
|
||||||
|
fromString(urlString);
|
||||||
|
}
|
||||||
|
|
||||||
/*static*/ const std::string RsUrl::schemeSeparator("://");
|
/*static*/ const std::string RsUrl::schemeSeparator("://");
|
||||||
/*static*/ const std::string RsUrl::ipv6WrapOpen("[");
|
/*static*/ const std::string RsUrl::ipv6WrapOpen("[");
|
||||||
/*static*/ const std::string RsUrl::ipv6Separator(":");
|
/*static*/ const std::string RsUrl::ipv6Separator(":");
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "serialiser/rsserializable.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Very simplistic and minimal URL helper class for RetroShare, after looking
|
* Very simplistic and minimal URL helper class for RetroShare, after looking
|
||||||
* for a small and self-contained C/C++ URL parsing and manipulation library,
|
* for a small and self-contained C/C++ URL parsing and manipulation library,
|
||||||
@ -31,7 +33,7 @@
|
|||||||
* Anyway this should support most common URLs of the form
|
* Anyway this should support most common URLs of the form
|
||||||
* scheme://host[:port][/path][?query][#fragment]
|
* scheme://host[:port][/path][?query][#fragment]
|
||||||
*/
|
*/
|
||||||
struct RsUrl
|
struct RsUrl : RsSerializable
|
||||||
{
|
{
|
||||||
RsUrl();
|
RsUrl();
|
||||||
RsUrl(const std::string& urlStr);
|
RsUrl(const std::string& urlStr);
|
||||||
@ -78,6 +80,10 @@ struct RsUrl
|
|||||||
inline bool operator!=(const RsUrl& rhs) const
|
inline bool operator!=(const RsUrl& rhs) const
|
||||||
{ return toString() != rhs.toString(); }
|
{ return toString() != rhs.toString(); }
|
||||||
|
|
||||||
|
/// @see RsSerializable
|
||||||
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,
|
||||||
|
RsGenericSerializer::SerializeContext& ctx);
|
||||||
|
|
||||||
static const std::string schemeSeparator;
|
static const std::string schemeSeparator;
|
||||||
static const std::string ipv6WrapOpen;
|
static const std::string ipv6WrapOpen;
|
||||||
static const std::string ipv6Separator;
|
static const std::string ipv6Separator;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user