sP2P c++ STL *nix API  1.2
NAT traversal and peer-to-peer networking API providing all utilities needed to build peer-to-peer application straigth out of box
 All Classes Functions Variables Typedefs Enumerations Enumerator
sp2plib::VNManager Class Reference

Used to send commands and receive results from virtual network index server More...

#include <VNManager.h>

Inherited by sp2plib::ConnectionManager::VNManagerInstancier.

Public Member Functions

 ~VNManager ()
 Destructor.
 
VUser SaveUser (VUser &user,::std::string user_password="")
 Saves virtual user object in sP2P index storage
 
VNetwork SaveNetwork (VNetwork &network)
 Creates/Updates Virtal network object in sP2P index storage
 
VObject SaveObject (VObject &obj)
 Creates/Updates Virtal object in sP2P index storage
 
void DeleteUser (Guid userToDeleteUID)
 Deletes virtual user object form sP2P index storage
 
void DeleteNetwork (Guid networkToDeleteUID)
 Deletes virtual network object form sP2P index storage
 
void DeleteObject (Guid objectToDeleteUID)
 Deletes virtual object form sP2P index storage
 
long QueryUsersCount (::std::string QueryCommandText)
 Returns count of virtal user objects in sP2P index storage matched by query
 
long QueryNetworksCount (::std::string QueryCommandText)
 Returns count of virtal networks objects in sP2P index storage matched by query
 
long QueryObjectsCount (::std::string QueryCommandText)
 Returns count of virtal objects in sP2P index storage matched by query
 
void QueryUsers (::std::list< VUser > *result_list,::std::string QueryCommandText, int skip=0, int limit=0,::std::string ascOrderBy="",::std::string descOrderBy="")
 Quieries virtual user objects in sP2P index storage
 
void QueryNetworks (::std::list< VNetwork > *result_list,::std::string QueryCommandText, int skip=0, int limit=0,::std::string ascOrderBy="",::std::string descOrderBy="")
 Quieries virtual network objects in sP2P index storage
 
void QueryObjects (::std::list< VObject > *result_list,::std::string QueryCommandText, int skip=0, int limit=0,::std::string ascOrderBy="",::std::string descOrderBy="")
 Quieries virtual objects in sP2P index storage
 
void ChangeUserPassword (Guid userUID,::std::string old_password,::std::string new_password)
 Changes virtual user object password
 
void JoinUserToNetwork (Guid userUID, Guid networkUID)
 Joins virtual user object to virtual network object
 
void UnJoinUserFromNetwork (Guid userUID, Guid networkUID)
 Un-Joins virtual user object from virtual network object
 
VUser AuthenticateUser (::std::string Username,::std::string Password)
 Returns virtual user object having exact username and password
 
VUser LogOffUser (::std::string Username)
 Updates VUser object properties on index server to indicate user is no more loged in
 

Static Public Member Functions

::std::string IndexHandleFromGuid (Guid UID)
 Converts GUID to index handle string that can be used for index quieries as id : ObjectId("indexhandle")
 

Protected Member Functions

 VNManager (Peer *localPeer, IPEndPoint IndexServerEP, int IndexIdentifikator)
 Initializes new instance of VNManager class
 

Protected Attributes

Peer_localPeer
 
IPEndPoint _IndexServerEP
 
int _IndexIdentifikator
 

Detailed Description

Used to send commands and receive results from virtual network index server

Constructor & Destructor Documentation

sp2plib::VNManager::VNManager ( Peer localPeer,
IPEndPoint  IndexServerEP,
int  IndexIdentifikator 
)
protected

Initializes new instance of VNManager class

Parameters
localPeerPeer representing local host
IndexServerEPIndex server ip endpoint
sp2plib::VNManager::~VNManager ( )

Destructor.

Member Function Documentation

VUser sp2plib::VNManager::AuthenticateUser ( ::std::string  Username,
::std::string  Password 
)

Returns virtual user object having exact username and password

Parameters
UsernameUsername of user to return
PasswordPasswor of user to return
Returns
Virtual user having exact username/password, or it throws exception if not found
void sp2plib::VNManager::ChangeUserPassword ( Guid  userUID,
::std::string  old_password,
::std::string  new_password 
)

Changes virtual user object password

Parameters
userUIDUID of virtual user object to change password
old_passwordOld passworrd, this can be also magic value: (requesterPeerUID.ToString() + ApplicationUID.ToString() + userUID.ToString()).ToLower()
new_passwordNew password
void sp2plib::VNManager::DeleteNetwork ( Guid  networkToDeleteUID)

Deletes virtual network object form sP2P index storage

Parameters
networkToDeleteUIDUID of virtual network to delete
void sp2plib::VNManager::DeleteObject ( Guid  objectToDeleteUID)

Deletes virtual object form sP2P index storage

Parameters
objectToDeleteUIDUID of virtual object to delete
void sp2plib::VNManager::DeleteUser ( Guid  userToDeleteUID)

Deletes virtual user object form sP2P index storage

Parameters
userToDeleteUIDUID of virtual user object to delete
::std::string sp2plib::VNManager::IndexHandleFromGuid ( Guid  UID)
static

Converts GUID to index handle string that can be used for index quieries as id : ObjectId("indexhandle")

Parameters
UIDGUID to convet to index handle string
Returns
Index handle as string
void sp2plib::VNManager::JoinUserToNetwork ( Guid  userUID,
Guid  networkUID 
)

Joins virtual user object to virtual network object

Parameters
userUIDUID of user to join
networkUIDUID of network to join to
VUser sp2plib::VNManager::LogOffUser ( ::std::string  Username)

Updates VUser object properties on index server to indicate user is no more loged in

Parameters
UsernameUsername of user to log of
Returns
Fresh copy of loged of vuser, or it throws exception if not found
void sp2plib::VNManager::QueryNetworks ( ::std::list< VNetwork > *  result_list,
::std::string  QueryCommandText,
int  skip = 0,
int  limit = 0,
::std::string  ascOrderBy = "",
::std::string  descOrderBy = "" 
)

Quieries virtual network objects in sP2P index storage

Parameters
result_listList to fill with returned objects
QueryCommandTextNoSQL query
skipNumber of object to skip
limitMaximal number of object to return
ascOrderByComma separated of field names to sort by result ascending
descOrderByComma separated of field names to sort by result descending
Returns
If succesfull list of virtual netrowk object, otherwise exception is thrown
long sp2plib::VNManager::QueryNetworksCount ( ::std::string  QueryCommandText)

Returns count of virtal networks objects in sP2P index storage matched by query

Parameters
QueryCommandTextNoSQL Query
Returns
If succesfull retruns objects count , otherwise throwse exception
void sp2plib::VNManager::QueryObjects ( ::std::list< VObject > *  result_list,
::std::string  QueryCommandText,
int  skip = 0,
int  limit = 0,
::std::string  ascOrderBy = "",
::std::string  descOrderBy = "" 
)

Quieries virtual objects in sP2P index storage

Parameters
result_listList to fill with returned objects
QueryCommandTextNoSQL query
skipNumber of object to skip
limitMaximal number of object to return
ascOrderByComma separated of field names to sort by result ascending
descOrderByComma separated of field names to sort by result descending
Returns
If succesfull list of virtual netrowk object, otherwise exception is thrown
long sp2plib::VNManager::QueryObjectsCount ( ::std::string  QueryCommandText)

Returns count of virtal objects in sP2P index storage matched by query

Parameters
QueryCommandTextNoSQL Query
Returns
If succesfull retruns objects count , otherwise throwse exception
void sp2plib::VNManager::QueryUsers ( ::std::list< VUser > *  result_list,
::std::string  QueryCommandText,
int  skip = 0,
int  limit = 0,
::std::string  ascOrderBy = "",
::std::string  descOrderBy = "" 
)

Quieries virtual user objects in sP2P index storage

Parameters
result_listList to fill with returned objects
QueryCommandTextNoSQL query
skipNumber of object to skip
limitMaximal number of object to return
ascOrderByComma separated of field names to sort by result ascending
descOrderByComma separated of field names to sort by result descending
Returns
If succesfull list of virtual user object, otherwise exception is thrown
long sp2plib::VNManager::QueryUsersCount ( ::std::string  QueryCommandText)

Returns count of virtal user objects in sP2P index storage matched by query

Parameters
QueryCommandTextNoSQL Query
Returns
If succesfull retruns objects count , otherwise throwse exception
VNetwork sp2plib::VNManager::SaveNetwork ( VNetwork network)

Creates/Updates Virtal network object in sP2P index storage

Parameters
networkVirtual network object
Returns
If succesfull returns updated object otherwise it throws exception
VObject sp2plib::VNManager::SaveObject ( VObject obj)

Creates/Updates Virtal object in sP2P index storage

Parameters
objVirtual object
Returns
If succesfull returns updated object otherwise it throws exception
VUser sp2plib::VNManager::SaveUser ( VUser user,
::std::string  user_password = "" 
)

Saves virtual user object in sP2P index storage

Parameters
uservirtual user object
user_passworduser password
Returns
Saved virtual user object
void sp2plib::VNManager::UnJoinUserFromNetwork ( Guid  userUID,
Guid  networkUID 
)

Un-Joins virtual user object from virtual network object

Parameters
userUIDUID of user to un-join
networkUIDUID of network to un-join from

The documentation for this class was generated from the following file: