Public Types | Public Member Functions
Tonido::Data::PeerID Class Reference

Represents a Peer ID. More...

List of all members.

Public Types

typedef boost::shared_ptr< PeerIDSharedPtr

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.
PeerIDoperator= (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

Detailed Description

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.


Constructor & Destructor Documentation

Tonido::Data::PeerID::PeerID ( )

Ctor.

Details if needed

virtual Tonido::Data::PeerID::~PeerID ( ) [virtual]

Dtor.

Details if needed


Member Function Documentation

const std::string& Tonido::Data::PeerID::getDomain ( ) const

Returns the Domain part of the Peer.

Returns:
the domain part of the peer
const std::string& Tonido::Data::PeerID::getDomainName ( ) const

Returns the Domain Name part of the Peer.

Returns:
the domain name part of the peer
const std::string& Tonido::Data::PeerID::getID ( ) const

Returns the ID part of the Peer.

Returns:
the id part of the peer
const std::string& Tonido::Data::PeerID::getNickName ( ) const

Returns the Nickname part of the Peer.

Returns:
the nickname part of the peer
const Poco::Net::SocketAddress& Tonido::Data::PeerID::getPrivateAddress ( ) const

Gets the Private IP associated with the Peer.

Returns:
the private ip of the peer
size_t Tonido::Data::PeerID::getSize ( )

Returns the size of the PeerID written to memory.

Returns:
the size of the peer written to memory
bool Tonido::Data::PeerID::isValid ( ) const

Returns whether the given TonidoID is valid.

Returns:
true if the peer id is valid, false otherwise
PeerID & Tonido::Data::PeerID::operator= ( const PeerID a_peer)

operators

Useful operators

void Tonido::Data::PeerID::setPrivateAddress ( const Poco::Net::SocketAddress &  a_address)

Sets the Private IP associated with the Peer.

Parameters:
[in]a_addressprivate ip to set
std::string Tonido::Data::PeerID::toString ( ) const

Returns the string representation of the PeerID.

Returns:
the string representation of the peer

Generated on Wed Oct 12 2011 21:46:53. © CodeLathe LLC 2007-2011. All Rights Reserved.