Public Types | |
| typedef boost::shared_ptr< PeerID > | SharedPtr |
Public Member Functions | |
| PeerID () | |
| Ctor. | |
| PeerID (const std::string &a_str) | |
| PeerID (const std::string &a_id, const std::string &a_domain) | |
| virtual | ~PeerID () |
| Dtor. | |
| const std::string & | getID () const |
| Returns the ID part of the Peer. | |
| const std::string & | getDomain () const |
| Returns the Domain part of the Peer. | |
| const std::string & | getDomainName () const |
| Returns the Domain Name part of the Peer. | |
| const std::string & | getNickName () const |
| Returns the Nickname part of the Peer. | |
| void | setPrivateAddress (const Poco::Net::SocketAddress &a_address) |
| Sets the Private IP associated with the Peer. | |
| const Poco::Net::SocketAddress & | getPrivateAddress () const |
| Gets the Private IP associated with the Peer. | |
| std::string | toString () const |
| Returns the string representation of the PeerID. | |
| bool | isValid () const |
| Returns whether the given TonidoID is valid. | |
| size_t | getSize () |
| Returns the size of the PeerID written to memory. | |
| PeerID & | operator= (const PeerID &a_peer) |
| operators | |
| bool | operator== (const PeerID &a_peer) const |
| bool | operator!= (const PeerID &a_peer) const |
| bool | operator< (const PeerID &a_peer) const |
| bool | operator<= (const PeerID &a_peer) const |
| bool | operator> (const PeerID &a_peer) const |
| bool | operator>= (const PeerID &a_peer) const |
Represents a Peer ID.
A Peer is represented as
ID@Domain
This information allows not only to identify a peer, but also to identify where the Peer is registered.
The domain is a resolvable address to which the Peer has registerd as a Lookup client.
E.g. s1.tonido.com:24465 (or s1.tonido.com)
machinename:5676
192.168.0.12.4563
Note that the domain is in the form of Host:Port. If Port is left out, the port is assumed to be 24465. (Tonido domain server default port)
The ID is a string and can be as follows:
E.g.
randomjoe
joe~3232-3232-323232-32323 (of the form of joe~UUID)
In most cases, all peers will be running from our managed Domain. (say lp1.codelathe.com).But they need not be. Anyone can run a server on their private domain. It allows them full control. But it also allows anyone else to contact the peers connected to that domain. This is like a standard web protocol URI like for ftp, mail etc.
This is decentralized and allows all Domains to work without needing all Domain servers to tell each other about each of them. Instead we let the internet DNS do this job.
Any other approach needs all peers to talk to a single (maybe load balanced) server peer for lookup and it complex in terms of implementation and scalability.
| Tonido::Data::PeerID::PeerID | ( | ) |
Ctor.
Details if needed
| virtual Tonido::Data::PeerID::~PeerID | ( | ) | [virtual] |
Dtor.
Details if needed
| const std::string& Tonido::Data::PeerID::getDomain | ( | ) | const |
Returns the Domain part of the Peer.
| const std::string& Tonido::Data::PeerID::getDomainName | ( | ) | const |
Returns the Domain Name part of the Peer.
| const std::string& Tonido::Data::PeerID::getID | ( | ) | const |
Returns the ID part of the Peer.
| const std::string& Tonido::Data::PeerID::getNickName | ( | ) | const |
Returns the Nickname part of the Peer.
| const Poco::Net::SocketAddress& Tonido::Data::PeerID::getPrivateAddress | ( | ) | const |
Gets the Private IP associated with the Peer.
| size_t Tonido::Data::PeerID::getSize | ( | ) |
Returns the size of the PeerID written to memory.
| bool Tonido::Data::PeerID::isValid | ( | ) | const |
Returns whether the given TonidoID is valid.
| void Tonido::Data::PeerID::setPrivateAddress | ( | const Poco::Net::SocketAddress & | a_address | ) |
Sets the Private IP associated with the Peer.
| [in] | a_address | private ip to set |
| std::string Tonido::Data::PeerID::toString | ( | ) | const |
Returns the string representation of the PeerID.